From 5dfa1a0feb5bee4a6e8b028b6a7aacc64ce50529 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sun, 20 Jan 2019 23:33:47 +0800 Subject: [PATCH 001/813] Update 20150513 XML vs JSON.md --- sources/talk/20150513 XML vs JSON.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index 4bd15ea2fa..a190deb462 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -4,31 +4,38 @@ [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (XML vs JSON) -[#]: via: (https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#xml-advantages) +[#]: via: (https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html) [#]: author: (TOM STRASSNER tomstrassner@gmail.com) XML vs JSON ====== -### Introduction +### 简介 Introduction XML and JSON are the two most common formats for data interchange in the Web today. XML was created by the W3C in 1996, and JSON was publicly specified by Douglas Crockford in 2002. Although their purposes are not identical, they are frequently used to accomplish the same task, which is data interchange. Both have well-documented open standards on the Web ([RFC 7159][1], [RFC 4825][2]), and both are human and machine-readable. Neither one is absolutely superior to the other, as each is better suited for different use cases. +在今天,XML 和 JSON 是互联网上最常用的两种数据交换格式。XML 格式由 W3C 于 1996 年提出。JSON 格式由 Douglas Crockford 于 2020 年提出。虽然制作这两种格式的目的不同,但它们都是数据交换中常用的格式。这两种格式的文档都很完善([RFC 7159][1], [RFC 4825][2]),且都同时具有人类可读性human-readable机器可读性machine-readable。这两种格式并没有哪一个比另一个更强,只是各自适用的领域不用。(LCTT译注:W3C 是[互联网联盟](https://www.w3.org/),制定了各种 Web 相关的标准,如 HTML、CSS 等。Douglas Crockford 除了制定了 JSON 格式,还致力于改进 JavaScript,开发了 JavaScript 相关工具 [JSLint](http://jslint.com/) 和 [JSMin](http://www.crockford.com/javascript/jsmin.html)。) -### XML Advantages +### XML 的优点 Advantages There are several advantages that XML has over JSON. One of the biggest differences between the two is that in XML you can put metadata into the tags in the form of attributes. With JSON, the programmer could accomplish the same goal that metadata achieves by making the entity an object and adding the attributes as members of the object. However, the way XML does it may often be preferable, given the slightly misleading nature of turning something into an object that is not one in the client program. For example, if your C++ program sends an int via JSON and needs metadata to be sent along with it, you would have to make it an object, with one name/value pair for the actual value of the int, and more name/value pairs for each attribute. The program that receives the JSON would read it as an object, when in fact it is not one. While this is a viable solution, it defies one of JSON’s key advantages: “JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] +XML 与 JSON 相比有很多优点。二者间最大的不同在于使用 XML 时可以通过在标签中添加属性这一简单的方法来存储元数据metadata。而使用 JSON 时需要创建一个对象,把元数据当作对象的成员来存储。虽然二者都能达到存储元数据的目的,但在这一情况下通常选择 XML,因为 JSON 的表达形式会让客户端程序误以为要将数据转换成一个对象。举个例子,如果你的 C++ 程序需要使用 JSON 格式发送一个附带元数据的整型数据,需要创建一个对象,用对象中的一个名称/值对name/value pair来记录整型数据的值,再为每一个附带的属性添加一个名称/值对。接收到这个 JSON 的程序在读取后很可能把它当成一个对象,可事实并不是这样。虽然这是使用 JSON 传递元数据的一种变通方法,但他违背了 JSON 的核心优势:“JSON 的结构与常规的程序语言中的结构相对应,而无需修改。JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] Although I will argue later that this can also be a drawback of XML, its mechanism to resolve name conflicts, prefixes, gives it power that JSON does not have. With prefixes, the programmer has the ability to name two different kinds of entities the same thing.[1] This would be advantageous in situations where the different entities should have the same name in the client program, perhaps if they are used in entirely different scopes. +虽然我后面会说这也是 XML 的一个缺点,但 XML 中处理命名冲突、前缀prefix的机制赋予了它 JSON 所不具备的能力。程序员们使用前缀可以给两个不同的实体使用同一名称。[1]当不同的实体在客户端中使用的名称相同时,这一特性会非常有用。 Another advantage of XML is that most browsers render it in a highly readable and organized way. The tree structure of XML lends itself well to this formatting, and allows for browsers to let users to naturally collapse individual tree elements. This feature would be particularly useful in debugging. +XML 的另一个优势在于大多数的浏览器可以把它以具有高可读性和强组织性的方式highly readable and organized way展现给用户。XML 的树形结构让它易于结构化,浏览器也让用户可以自行展开或折叠树中的元素,这简直就是调试的福音。 One of the most significant advantages that XML has over JSON is its ability to communicate mixed content, i.e. strings that contain structured markup. In order to handle this with XML, the programmer need only put the marked-up text within a child tag of the parent in which it belongs. Similar to the metadata situation, since JSON only contains data, there is no such simple way to indicate markup. It would again require storing metadata as data, which could be considered an abuse of the format. +XML 对比 JSON 有一个很重要的能力就是它可以混合多种内容mixed content。例如在 XML 中处理包含结构化标记的字符串时,程序员们只要把带有标记的文本放在一个标签内就可以了。而且和元数据的处理类似,由于 JSON 只包含数据,没有用于指明标签的简单方式。虽然这里还可以使用处理元数据的解决方法,但这总有点误用格式之嫌。 -### JSON Advantages +### JSON 的优点 Advantages JSON has several advantages as well. One of the most obvious of these is that JSON is significantly less verbose than XML, because XML necessitates opening and closing tags (or in some cases less verbose self-closing tags), and JSON uses name/value pairs, concisely delineated by “{“ and “}” for objects, “[“ and “]” for arrays, “,” to separate pairs, and “:” to separate name from value. Even when zipped (using gzip), JSON is still smaller and it takes less time to zip it.[6] As determined by Sumaray and Makki as well as Nurseitov, Paulson, Reynolds, and Izurieta in their experimental findings, JSON outperforms XML in a number of ways. First, naturally following from its conciseness, JSON files that contain the same information as their XML counterparts are almost always significantly smaller, which leads to faster transmission and processing. Second, difference in size aside, both groups found that JSON was serialized and deserialized drastically faster than XML.[3][4] Third, the latter study determined that JSON processing outdoes XML in CPU resource utilization. They found that JSON used less total resources, more user CPU, and less system CPU. The experiment used RedHat machines, and RedHat claims that higher user CPU usage is preferable.[3] Unsurprisingly, the Sumaray and Makki study determined that JSON performance is superior to XML on mobile devices too.[4] This makes sense, given that JSON uses less resources, and mobile devices are less powerful than desktop machines. +JSON 自身也有很多优点。其最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要标签的打开和关闭,而 JSON 使用名称/值对,使用简单的“{”和“}”来标记对象,“\[”和“\]”来标记数组,“,”来表示数据的分隔,“:”表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[6]正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这就意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究[3][4]表明使用 JSON 序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理会使用更多的 CPU 资源。他们发现 JSON 在总体上使用的资源更少,但在用户空间消耗更多的 CPU 资源,同时系统空间消耗更少的 CPU 资源。这一实验是在 RedHat 的设备上进行的,RedHat 更倾向于在用户空间消耗更多的 CPU 资源。[3]不出意外,Sumaray 和 Makki 的研究里还说明了在移动设备上 JSON 的性能也优于 XML。[4]这说得通,因为 JSON 在整体上消耗的资源更少,而且移动设备也没有台式机那么强劲。 Yet another advantage that JSON has over XML is that its representation of objects and arrays allows for direct mapping onto the corresponding data structures in the host language, such as objects, records, structs, dictionaries, hash tables, keyed lists, and associative arrays for objects, and arrays, vectors, lists, and sequences for arrays.[2] Although it is perfectly possible to represent these structures in XML, it is only as a function of the parsing, and it takes more code to serialize and deserialize properly. It also would not always be obvious to the reader of arbitrary XML what tags represent an object and what tags represent an array, especially because nested tags can just as easily be structured markup instead. The curly braces and brackets of JSON definitively show the structure of the data. However, this advantage does come with the caveat explained above, that the JSON can inaccurately represent the data if the need arises to send metadata. +JSON 的另一个优点在于其对对象和数组的描述允许宿主语言host language直接将它映射到对应数据结构上,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有对象组成的数组,以及数组array向量vector列表list等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,因为 XML 标准缺乏对象、数组的标签的明确定义,尤其是潜逃的标签可以简单的使用结构化的标记替代时。 Although XML supports namespaces and prefixes, JSON’s handling of name collisions is less verbose than prefixes, and arguably feels more natural with the program using it; in JSON, each object is its own namespace, so names may be repeated as long as they are in different scopes. This may be preferable, as in most programming languages members of different objects can have the same name, because they are distinguished by the names of the objects to which they belong. @@ -92,7 +99,7 @@ The given trends indicate that JSON will continue to dominate the Web, and XML u -------------------------------------------------------------------------------- -via: https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#xml-advantages +via: https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html 作者:[TOM STRASSNER][a] 选题:[lujun9972][b] From aed80c703306d023a95dba4b2eee89f7595d8f9f Mon Sep 17 00:00:00 2001 From: wwhio Date: Wed, 23 Jan 2019 23:49:49 +0800 Subject: [PATCH 002/813] Update 20150513 XML vs JSON.md --- sources/talk/20150513 XML vs JSON.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index a190deb462..b9a21827bc 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -35,28 +35,37 @@ JSON has several advantages as well. One of the most obvious of these is that JS JSON 自身也有很多优点。其最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要标签的打开和关闭,而 JSON 使用名称/值对,使用简单的“{”和“}”来标记对象,“\[”和“\]”来标记数组,“,”来表示数据的分隔,“:”表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[6]正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这就意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究[3][4]表明使用 JSON 序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理会使用更多的 CPU 资源。他们发现 JSON 在总体上使用的资源更少,但在用户空间消耗更多的 CPU 资源,同时系统空间消耗更少的 CPU 资源。这一实验是在 RedHat 的设备上进行的,RedHat 更倾向于在用户空间消耗更多的 CPU 资源。[3]不出意外,Sumaray 和 Makki 的研究里还说明了在移动设备上 JSON 的性能也优于 XML。[4]这说得通,因为 JSON 在整体上消耗的资源更少,而且移动设备也没有台式机那么强劲。 Yet another advantage that JSON has over XML is that its representation of objects and arrays allows for direct mapping onto the corresponding data structures in the host language, such as objects, records, structs, dictionaries, hash tables, keyed lists, and associative arrays for objects, and arrays, vectors, lists, and sequences for arrays.[2] Although it is perfectly possible to represent these structures in XML, it is only as a function of the parsing, and it takes more code to serialize and deserialize properly. It also would not always be obvious to the reader of arbitrary XML what tags represent an object and what tags represent an array, especially because nested tags can just as easily be structured markup instead. The curly braces and brackets of JSON definitively show the structure of the data. However, this advantage does come with the caveat explained above, that the JSON can inaccurately represent the data if the need arises to send metadata. -JSON 的另一个优点在于其对对象和数组的描述允许宿主语言host language直接将它映射到对应数据结构上,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有对象组成的数组,以及数组array向量vector列表list等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,因为 XML 标准缺乏对象、数组的标签的明确定义,尤其是潜逃的标签可以简单的使用结构化的标记替代时。 +JSON 的另一个优点在于其对对象和数组的描述允许宿主语言host language直接将它映射到对应数据结构上,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有对象组成的数组,以及数组array向量vector列表list等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,因为 XML 标准缺乏对象、数组的标签的明确定义,尤其是潜逃的标签可以简单的使用结构化的标记替代时。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也符合前文中的警告,在包含元数据时 JSON 的表示不如 XML 精确。 Although XML supports namespaces and prefixes, JSON’s handling of name collisions is less verbose than prefixes, and arguably feels more natural with the program using it; in JSON, each object is its own namespace, so names may be repeated as long as they are in different scopes. This may be preferable, as in most programming languages members of different objects can have the same name, because they are distinguished by the names of the objects to which they belong. +虽然 XML 支持命名空间namespace前缀prefix,但这不代表 JSON 没有处理命名冲突的能力。比起 XML 的前缀,它处理命名冲突的方式更简洁,在程序中的处理也更自然。在 JSON 里,每一个对象都在它自己的命名空间中,因此不同对象内的元素可以随意的重复。因为在大多数编程语言中,不同的对象中的成员可以包含相同的名字,所以 JSON 根据对象名称进行区分的规则在处理时更加自然。 Perhaps the most significant advantage that JSON has over XML is that JSON is a subset of JavaScript, so code to parse and package it fits very naturally into JavaScript code. This seems highly beneficial for JavaScript programs, but does not directly benefit any programs that use languages other than JavaScript. However, this drawback has been largely overcome, as currently the JSON website lists over 175 tools for 64 different programming languages that exist to integrate JSON processing. While I cannot speak to the quality of most of these tools, it is clear that the developer community has embraced JSON and has made it simple to use in many different platforms. +也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都继承了 JSON 处理功能。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 -### Purposes + +### 目标 Simply put, XML’s purpose is document markup. This is decidedly not a purpose of JSON, so XML should be used whenever this is what needs to be done. It accomplishes this purpose by giving semantic meaning to text through its tree-like structure and ability to represent mixed content. Data structures can be represented in XML, but that is not its purpose. +简单地说,XML 的目标是完成一种文档标记。这和 JSON 的目标想去甚远,所以只要用得到 XML 的地方就尽管用。它使用树形的结构和包含语义的文本来表达混合内容以达成这一目标。XML 可以表示数据的结构,但这并不是它的初衷。 JSON’s purpose is structured data interchange. It serves this purpose by directly representing objects, arrays, numbers, strings, and booleans. Its purpose is distinctly not document markup. As described above, JSON does not have a natural way to represent mixed content. +JSON 的目标是完成一种结构化的数据交换。它直接使用对象、数组、数字、字符串、布尔值这些元素来达成这一目标。这完全不同于文档标记语言。正如上面说的那样,JSON 本身不存在表示混合内容的方法。 -### Software +### 软件 The following major public APIs uses XML only: Amazon Product Advertising API. +这些主流的开放 API 仅提供 XML:亚马逊产品广告 APIAmazon Product Advertising API。 The following major APIs use JSON only: Facebook Graph API, Google Maps API, Twitter API, AccuWeather API, Pinterest API, Reddit API, Foursquare API. +这些主流 API 仅提供 JSON:脸书图 APIFacebook Graph API谷歌地图 APIGoogle Maps API推特 APITwitter API,AccuWeather API,Pinterest API,Reddit API,Foursquare API。 The following major APIs use both XML and JSON: Google Cloud Storage, Linkedin API, Flickr API +这些主流 API 同时提供 XML 和 JSON:谷歌云存储Google Cloud Storage领英 APILinkedin API,Flickr API。 Of the top 10 most popular APIs according to Programmable Web[9], along with a couple more popular ones, only one supports XML and not JSON. Several support both, and several support only JSON. Among developer APIs for modern and popular websites, JSON clearly seems to be preferred. This also indicates that more app developers that use these APIs prefer JSON. This is likely a result of its reputation as the faster and leaner of the two. Furthermore, most of these APIs communicate data rather than documents, so JSON would be more appropriate. For example, Facebook is mainly concerned with communicating data about users and posts, Google Maps deals in coordinates and information about entities on their maps, and AccuWeather just sends weather data. Overall, it is impossible to say whether JSON or XML is currently used more in APIs, but the trend is certainly swinging towards JSON.[10][11] + The following major desktop software uses XML only: Microsoft Word, Apache OpenOffice, LibreOffice. It makes sense for software that is mainly concerned with document creation, manipulation, and storage to use XML rather than JSON. Also, all three of these programs support mixed content, which JSON does not do well. For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. From ca782053dfc50cc2b08d9ad339e1cc8bad482ac3 Mon Sep 17 00:00:00 2001 From: wwhio Date: Fri, 25 Jan 2019 20:39:29 +0800 Subject: [PATCH 003/813] Update 20150513 XML vs JSON.md --- sources/talk/20150513 XML vs JSON.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index b9a21827bc..2b5f10e5d8 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -43,7 +43,6 @@ Although XML supports namespaces and prefixes, JSON’s handling of name collisi Perhaps the most significant advantage that JSON has over XML is that JSON is a subset of JavaScript, so code to parse and package it fits very naturally into JavaScript code. This seems highly beneficial for JavaScript programs, but does not directly benefit any programs that use languages other than JavaScript. However, this drawback has been largely overcome, as currently the JSON website lists over 175 tools for 64 different programming languages that exist to integrate JSON processing. While I cannot speak to the quality of most of these tools, it is clear that the developer community has embraced JSON and has made it simple to use in many different platforms. 也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都继承了 JSON 处理功能。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 - ### 目标 Simply put, XML’s purpose is document markup. This is decidedly not a purpose of JSON, so XML should be used whenever this is what needs to be done. It accomplishes this purpose by giving semantic meaning to text through its tree-like structure and ability to represent mixed content. Data structures can be represented in XML, but that is not its purpose. @@ -64,11 +63,13 @@ The following major APIs use both XML and JSON: Google Cloud Storage, Linkedin A 这些主流 API 同时提供 XML 和 JSON:谷歌云存储Google Cloud Storage领英 APILinkedin API,Flickr API。 Of the top 10 most popular APIs according to Programmable Web[9], along with a couple more popular ones, only one supports XML and not JSON. Several support both, and several support only JSON. Among developer APIs for modern and popular websites, JSON clearly seems to be preferred. This also indicates that more app developers that use these APIs prefer JSON. This is likely a result of its reputation as the faster and leaner of the two. Furthermore, most of these APIs communicate data rather than documents, so JSON would be more appropriate. For example, Facebook is mainly concerned with communicating data about users and posts, Google Maps deals in coordinates and information about entities on their maps, and AccuWeather just sends weather data. Overall, it is impossible to say whether JSON or XML is currently used more in APIs, but the trend is certainly swinging towards JSON.[10][11] - +根据可编程网络Programmable Web[9]的数据,最流行的 10 个 API 中只有一个是仅提供 XML 且不支持 JSON 的。其他的要么同时支持 XML 和 JSON,要么只支持 JSON。这表明了大多数应用开发者都更倾向于使用支持 JSON 的 API,原因大概是因为 JSON 的处理更快的良好口碑和与 XML 相比相对轻量。此外,大多数 API 只是传递数据而非文档,所以 JSON 更加合适。例如 Facebook 的重点在于用户的交流与帖子,谷歌地图则主要处理坐标和地图信息,AccuWeather 就只传递天气数据。总之,虽然不能说天气 API 在使用时究竟是 JSON 用的多还是 XML 用的多,但是趋势明确偏向了 JSON。[10][11] The following major desktop software uses XML only: Microsoft Word, Apache OpenOffice, LibreOffice. +这些主流的桌面软件仍然只是用 XML:Microsoft Word,Apache OpenOffice,LibraOffice。 It makes sense for software that is mainly concerned with document creation, manipulation, and storage to use XML rather than JSON. Also, all three of these programs support mixed content, which JSON does not do well. For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. +因为这些软件需要考虑引用、格式、存储等等,所以比起 JSON,XML 优势更大。另外,这三款程序都支持混合内容,而 JSON 在这一点上做得并不如 XML 好。 For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. The following major databases support XML: IBM DB2, Microsoft SQL Server, Oracle Database, PostgresSQL, BaseX, eXistDB, MarkLogic, MySQL. From 06cc442e581ad7588b8c7168bdd99f9179a2ced5 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sun, 27 Jan 2019 17:42:50 +0800 Subject: [PATCH 004/813] Update 20150513 XML vs JSON.md --- sources/talk/20150513 XML vs JSON.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index 2b5f10e5d8..aa7b9be486 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -10,12 +10,12 @@ XML vs JSON ====== -### 简介 Introduction +### 简介 XML and JSON are the two most common formats for data interchange in the Web today. XML was created by the W3C in 1996, and JSON was publicly specified by Douglas Crockford in 2002. Although their purposes are not identical, they are frequently used to accomplish the same task, which is data interchange. Both have well-documented open standards on the Web ([RFC 7159][1], [RFC 4825][2]), and both are human and machine-readable. Neither one is absolutely superior to the other, as each is better suited for different use cases. 在今天,XML 和 JSON 是互联网上最常用的两种数据交换格式。XML 格式由 W3C 于 1996 年提出。JSON 格式由 Douglas Crockford 于 2020 年提出。虽然制作这两种格式的目的不同,但它们都是数据交换中常用的格式。这两种格式的文档都很完善([RFC 7159][1], [RFC 4825][2]),且都同时具有人类可读性human-readable机器可读性machine-readable。这两种格式并没有哪一个比另一个更强,只是各自适用的领域不用。(LCTT译注:W3C 是[互联网联盟](https://www.w3.org/),制定了各种 Web 相关的标准,如 HTML、CSS 等。Douglas Crockford 除了制定了 JSON 格式,还致力于改进 JavaScript,开发了 JavaScript 相关工具 [JSLint](http://jslint.com/) 和 [JSMin](http://www.crockford.com/javascript/jsmin.html)。) -### XML 的优点 Advantages +### XML 的优点 There are several advantages that XML has over JSON. One of the biggest differences between the two is that in XML you can put metadata into the tags in the form of attributes. With JSON, the programmer could accomplish the same goal that metadata achieves by making the entity an object and adding the attributes as members of the object. However, the way XML does it may often be preferable, given the slightly misleading nature of turning something into an object that is not one in the client program. For example, if your C++ program sends an int via JSON and needs metadata to be sent along with it, you would have to make it an object, with one name/value pair for the actual value of the int, and more name/value pairs for each attribute. The program that receives the JSON would read it as an object, when in fact it is not one. While this is a viable solution, it defies one of JSON’s key advantages: “JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] XML 与 JSON 相比有很多优点。二者间最大的不同在于使用 XML 时可以通过在标签中添加属性这一简单的方法来存储元数据metadata。而使用 JSON 时需要创建一个对象,把元数据当作对象的成员来存储。虽然二者都能达到存储元数据的目的,但在这一情况下通常选择 XML,因为 JSON 的表达形式会让客户端程序误以为要将数据转换成一个对象。举个例子,如果你的 C++ 程序需要使用 JSON 格式发送一个附带元数据的整型数据,需要创建一个对象,用对象中的一个名称/值对name/value pair来记录整型数据的值,再为每一个附带的属性添加一个名称/值对。接收到这个 JSON 的程序在读取后很可能把它当成一个对象,可事实并不是这样。虽然这是使用 JSON 传递元数据的一种变通方法,但他违背了 JSON 的核心优势:“JSON 的结构与常规的程序语言中的结构相对应,而无需修改。JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] @@ -29,13 +29,13 @@ XML 的另一个优势在于大多数的浏览器可以把它以具有高 One of the most significant advantages that XML has over JSON is its ability to communicate mixed content, i.e. strings that contain structured markup. In order to handle this with XML, the programmer need only put the marked-up text within a child tag of the parent in which it belongs. Similar to the metadata situation, since JSON only contains data, there is no such simple way to indicate markup. It would again require storing metadata as data, which could be considered an abuse of the format. XML 对比 JSON 有一个很重要的能力就是它可以混合多种内容mixed content。例如在 XML 中处理包含结构化标记的字符串时,程序员们只要把带有标记的文本放在一个标签内就可以了。而且和元数据的处理类似,由于 JSON 只包含数据,没有用于指明标签的简单方式。虽然这里还可以使用处理元数据的解决方法,但这总有点误用格式之嫌。 -### JSON 的优点 Advantages +### JSON 的优点 JSON has several advantages as well. One of the most obvious of these is that JSON is significantly less verbose than XML, because XML necessitates opening and closing tags (or in some cases less verbose self-closing tags), and JSON uses name/value pairs, concisely delineated by “{“ and “}” for objects, “[“ and “]” for arrays, “,” to separate pairs, and “:” to separate name from value. Even when zipped (using gzip), JSON is still smaller and it takes less time to zip it.[6] As determined by Sumaray and Makki as well as Nurseitov, Paulson, Reynolds, and Izurieta in their experimental findings, JSON outperforms XML in a number of ways. First, naturally following from its conciseness, JSON files that contain the same information as their XML counterparts are almost always significantly smaller, which leads to faster transmission and processing. Second, difference in size aside, both groups found that JSON was serialized and deserialized drastically faster than XML.[3][4] Third, the latter study determined that JSON processing outdoes XML in CPU resource utilization. They found that JSON used less total resources, more user CPU, and less system CPU. The experiment used RedHat machines, and RedHat claims that higher user CPU usage is preferable.[3] Unsurprisingly, the Sumaray and Makki study determined that JSON performance is superior to XML on mobile devices too.[4] This makes sense, given that JSON uses less resources, and mobile devices are less powerful than desktop machines. JSON 自身也有很多优点。其最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要标签的打开和关闭,而 JSON 使用名称/值对,使用简单的“{”和“}”来标记对象,“\[”和“\]”来标记数组,“,”来表示数据的分隔,“:”表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[6]正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这就意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究[3][4]表明使用 JSON 序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理会使用更多的 CPU 资源。他们发现 JSON 在总体上使用的资源更少,但在用户空间消耗更多的 CPU 资源,同时系统空间消耗更少的 CPU 资源。这一实验是在 RedHat 的设备上进行的,RedHat 更倾向于在用户空间消耗更多的 CPU 资源。[3]不出意外,Sumaray 和 Makki 的研究里还说明了在移动设备上 JSON 的性能也优于 XML。[4]这说得通,因为 JSON 在整体上消耗的资源更少,而且移动设备也没有台式机那么强劲。 Yet another advantage that JSON has over XML is that its representation of objects and arrays allows for direct mapping onto the corresponding data structures in the host language, such as objects, records, structs, dictionaries, hash tables, keyed lists, and associative arrays for objects, and arrays, vectors, lists, and sequences for arrays.[2] Although it is perfectly possible to represent these structures in XML, it is only as a function of the parsing, and it takes more code to serialize and deserialize properly. It also would not always be obvious to the reader of arbitrary XML what tags represent an object and what tags represent an array, especially because nested tags can just as easily be structured markup instead. The curly braces and brackets of JSON definitively show the structure of the data. However, this advantage does come with the caveat explained above, that the JSON can inaccurately represent the data if the need arises to send metadata. -JSON 的另一个优点在于其对对象和数组的描述允许宿主语言host language直接将它映射到对应数据结构上,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有对象组成的数组,以及数组array向量vector列表list等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,因为 XML 标准缺乏对象、数组的标签的明确定义,尤其是潜逃的标签可以简单的使用结构化的标记替代时。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也符合前文中的警告,在包含元数据时 JSON 的表示不如 XML 精确。 +JSON 的另一个优点在于其对对象和数组的描述允许宿主语言host language直接将它映射到对应数据结构上,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有对象组成的数组,以及数组array向量vector列表list等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,因为 XML 标准缺乏对象、数组的标签的明确定义,尤其是嵌套的标签可以简单的使用结构化的标记替代时。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也符合前文中的警告,在包含元数据时 JSON 的表示不如 XML 精确。 Although XML supports namespaces and prefixes, JSON’s handling of name collisions is less verbose than prefixes, and arguably feels more natural with the program using it; in JSON, each object is its own namespace, so names may be repeated as long as they are in different scopes. This may be preferable, as in most programming languages members of different objects can have the same name, because they are distinguished by the names of the objects to which they belong. 虽然 XML 支持命名空间namespace前缀prefix,但这不代表 JSON 没有处理命名冲突的能力。比起 XML 的前缀,它处理命名冲突的方式更简洁,在程序中的处理也更自然。在 JSON 里,每一个对象都在它自己的命名空间中,因此不同对象内的元素可以随意的重复。因为在大多数编程语言中,不同的对象中的成员可以包含相同的名字,所以 JSON 根据对象名称进行区分的规则在处理时更加自然。 @@ -43,7 +43,7 @@ Although XML supports namespaces and prefixes, JSON’s handling of name collisi Perhaps the most significant advantage that JSON has over XML is that JSON is a subset of JavaScript, so code to parse and package it fits very naturally into JavaScript code. This seems highly beneficial for JavaScript programs, but does not directly benefit any programs that use languages other than JavaScript. However, this drawback has been largely overcome, as currently the JSON website lists over 175 tools for 64 different programming languages that exist to integrate JSON processing. While I cannot speak to the quality of most of these tools, it is clear that the developer community has embraced JSON and has made it simple to use in many different platforms. 也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都继承了 JSON 处理功能。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 -### 目标 +### 二者的动机 Simply put, XML’s purpose is document markup. This is decidedly not a purpose of JSON, so XML should be used whenever this is what needs to be done. It accomplishes this purpose by giving semantic meaning to text through its tree-like structure and ability to represent mixed content. Data structures can be represented in XML, but that is not its purpose. 简单地说,XML 的目标是完成一种文档标记。这和 JSON 的目标想去甚远,所以只要用得到 XML 的地方就尽管用。它使用树形的结构和包含语义的文本来表达混合内容以达成这一目标。XML 可以表示数据的结构,但这并不是它的初衷。 @@ -69,25 +69,32 @@ The following major desktop software uses XML only: Microsoft Word, Apache OpenO 这些主流的桌面软件仍然只是用 XML:Microsoft Word,Apache OpenOffice,LibraOffice。 It makes sense for software that is mainly concerned with document creation, manipulation, and storage to use XML rather than JSON. Also, all three of these programs support mixed content, which JSON does not do well. For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. -因为这些软件需要考虑引用、格式、存储等等,所以比起 JSON,XML 优势更大。另外,这三款程序都支持混合内容,而 JSON 在这一点上做得并不如 XML 好。 For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. +因为这些软件需要考虑引用、格式、存储等等,所以比起 JSON,XML 优势更大。另外,这三款程序都支持混合内容,而 JSON 在这一点上做得并不如 XML 好。举例说明,当用户使用 Microsoft Word 编辑一篇论文时,用户需要使用不同的文字字形、文字大小、文字颜色、页边距、段落格式等,而 XML 结构化的组织形式与标签属性生来就是为了表达这些信息的。 The following major databases support XML: IBM DB2, Microsoft SQL Server, Oracle Database, PostgresSQL, BaseX, eXistDB, MarkLogic, MySQL. +这些主流的数据库支持 XML:IBM DB2,Microsoft SQL Server,Oracle Database,PostgresSQL,BaseX,eXistDB,MarkLogic,MySQL。 The following major databases support JSON: MongoDB, CouchDB, eXistDB, Elastisearch, BaseX, MarkLogic, OrientDB, Oracle Database, PostgresSQL, Riak. +这些是支持 JSON 的主流数据库:MongoDB,CouchDB,eXistDB,Elastisearch,BaseX,MarkLogic,OrientDB,Oracle Database,PostgresSQL,Riak。 For a long time, SQL and the relational database model dominated the market. Corporate giants like Oracle and Microsoft have always marketed such databases. However, in the last decade, there has been a major rise in popularity of NoSQL databases. As this has coincided with the rise of JSON, most NoSQL databases support JSON, and some, such as MongoDB, CouchDB, and Riak use JSON to store their data. These databases have two important qualities that make them better suited for modern websites: they are generally more scalable than relational SQL databases, and they are designed to the core to run in the Web.[10] Since JSON is more lightweight and a subset of JavaScript, it suits NoSQL databases well, and helps facilitate these two qualities. In addition, many older databases have added support for JSON, such as Oracle Database and PostgresSQL. Conversion between XML and JSON is a hassle, so naturally, as more developers use JSON for their apps, more database companies have incentive to support it.[7] +在很长一段时间里,SQL 和关系型数据库统治着整个数据库市场。像甲骨文Oracle微软Microsoft这样的软件巨头都提供这类数据库,然而近几年 NoSQL 数据库正逐步受到开发者的青睐。也许是正巧碰上了 JSON 的普及,大多数 NoSQL 数据库都支持 JSON,甚至像 MongoDB、CouchDB 和 Riak 这样的数据库使用 JSON 来存储数据。这些数据库有两个重要的品质是它们适用于现代网站:一是它们与关系型数据库相比更容易扩展more scalable;二是它们设计的目标 web 运行所需的核心组件。由于 JSON 更加轻量,又是 JavaScript 的子集,所以很适合 NoSQL 数据库,并且让这两个品质更容易实现。此外,许多旧的关系型数据库增加了 JSON 支持,例如 Oracle Database 和 PostgresSql。由于 XML 与 JSON 间的转换比较麻烦,所以大多数开发者会直接在他们的应用里使用 JSON,因此开发数据库的公司才有支持 JSON 的理由。(LCTT译注:NoSQL是对不同于传统的关系数据库的数据库管理系统的统称。[参考来源](https://zh.wikipedia.org/wiki/NoSQL)) -### Future +### 未来 One of the most heavily anticipated changes in the Internet is the “Internet of Things”, i.e. the addition to the Internet of non-computer devices such as watches, thermostats, televisions, refrigerators, etc. This movement is well underway, and is expected to explode in the near future, as predictions for the number of devices in the Internet of Things in 2020 range from about 26 billion to 200 billion.[12][13][13] Almost all of these devices are smaller and less powerful than laptop and desktop computers. Many of them only run embedded systems. Thus, when they have the need to exchange data with other entities in the Web, the lighter and faster JSON would naturally be preferable to XML.[10] Also, with the recent rapid rise of JSON use in the Web relative to XML, new devices may benefit more from speaking JSON. This highlights an example of Metcalf’s Law; whether XML or JSON or something entirely new becomes the most popular format in the Web, newly added devices and all existing devices will benefit much more if the newly added devices speak the most popular language. +对互联网的变革中,最让人期待的便是物联网Internet of Things。这会给互联网带来大量的非计算机设备,例如手表、温度计、电视、冰箱等等。这一势头的发展良好,预期将在不久的将来迎来爆发式的增长。据估计,到 2020 年时会有 260 亿 到 2000 亿的物联网设备被接入互联网。[12][13] 几乎所有的物联网设备都是小型设备,此外比笔记本或者台式电脑的性能要弱很多。大多数都是嵌入式系统。因此,当他们需要与 web 上的系统交换数据时,更轻量,更快速的 JSON 自然比 XML 更受青睐。[10] 受益于 JSON 在 web 上的快速普及,与 XML 相比,这些新的物联网设备更有可能从使用 JSON 中受益。这是一个典型的梅特卡夫定律的实例,无论是 XML 还是 JSON,抑或是什么其他全新的格式,现存的设备和新的设备都会从支持最广泛使用的格式中受益。 With the creation and recent rapid increase in popularity of Node.js, a server-side JavaScript framework, along with NoSQL databases like MongoDB, full-stack JavaScript development has become a reality. This bodes well for the future of JSON, as with these new apps, JSON is spoken at every level of the stack, which generally makes the apps very fast and lightweight. This is a desirable trait for any app, so this trend towards full-stack JavaScript is not likely to die out anytime soon.[10] +Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。This bodes well for the future of JSON, as with these new apps, JSON is spoken at every level of the stack, which generally makes the apps very fast and lightweight. This is a desirable trait for any app, so this trend towards full-stack JavaScript is not likely to die out anytime soon.[10] Another existing trend in the world of app development is toward REST and away from SOAP.[11][15][16] Both XML and JSON can be used with REST, but SOAP exclusively uses XML. + The given trends indicate that JSON will continue to dominate the Web, and XML use will continue to decrease. This should not be overblown, however, because XML is still very heavily used in the Web, and it is the only option for apps that use SOAP. Given the widespread migration from SOAP to REST, the rise of NoSQL databases and full-stack JavaScript, and the far superior performance of JSON, I believe that JSON will soon be much more widely used than XML in the Web. There seem to be very few applications where XML is the better choice. -### References + +### 参考链接 1. [XML Tutorial](http://www.w3schools.com/xml/default.asp) 2. [Introducing JSON](http://www.json.org/) From 516a5d32d4d29a4015f79cd0b7fdac98cea5ac1b Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 31 Jan 2019 09:42:41 +0800 Subject: [PATCH 005/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180507=20Modula?= =?UTF-8?q?rity=20in=20Fedora=2028=20Server=20Edition=20sources/tech/20180?= =?UTF-8?q?507=20Modularity=20in=20Fedora=2028=20Server=20Edition.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Modularity in Fedora 28 Server Edition.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20180507 Modularity in Fedora 28 Server Edition.md diff --git a/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md b/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md new file mode 100644 index 0000000000..0b5fb0415b --- /dev/null +++ b/sources/tech/20180507 Modularity in Fedora 28 Server Edition.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Modularity in Fedora 28 Server Edition) +[#]: via: (https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-816x345.jpg) +[#]: author: (Stephen Gallagher https://fedoramagazine.org/author/sgallagh/) + +Modularity in Fedora 28 Server Edition +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-816x345.jpg) + +### What is Modularity? + +A classic conundrum that all open-source distributions have faced is the “too fast/too slow” problem. Users install an operating system in order to enable the use of their applications. A comprehensive distribution like Fedora has an advantage and a disadvantage to the large amount of available software. While the package the user wants may be available, it might not be available in the version needed. Here’s how Modularity can help solve that problem. + +Fedora sometimes moves too fast for some users. Its rapid release cycle and desire to carry the latest stable software can result in breaking compatibility with applications. If a user can’t run a web application because Fedora upgraded a web framework to an incompatible version, it can be very frustrating. The classic answer to the “too fast” problem has been “Fedora should have an LTS release.” However, this approach only solves half the problem and makes the flip side of this conundrum worse. + +There are also times when Fedora moves too slowly for some of its users. For example, a Fedora release may be poorly-timed alongside the release of other desirable software. Once a Fedora release is declared stable, packagers must abide by the [Stable Updates Policy][1] and not introduce incompatible changes into the system. + +Fedora Modularity addresses both sides of this problem. Fedora will still ship a standard release under its traditional policy. However, it will also ship a set of modules that define alternative versions of popular software. Those in the “too fast” camp still have the benefit of Fedora’s newer kernel and other general platform enhancements. In addition, they still have access to older frameworks or toolchains that support their applications. + +In addition, those users who like to live closer to the edge can access newer software than was available at release time. + +### What is Modularity not? + +Modularity is not a drop-in replacement for [Software Collections][2]. These two technologies try to solve many of the same problems, but have distinct differences. + +Software Collections install different versions of packages in parallel on the system. However, their downside is that each installation exists in its own namespaced portion of the filesystem. Furthermore, each application that relies on them needs to be told where to find them. + +With Modularity, only one version of a package exists on the system, but the user can choose which one. The advantage is that this version lives in a standard location on the system. The package requires no special changes to applications that rely on it. Feedback from user studies shows most users don’t actually rely on parallel installation. Containerization and virtualization solve that problem. + +### Why not just use containers? + +This is another common question. Why would a user want modules when they could just use containers? The answer is, someone still has to maintain the software in the containers. Modules provide pre-packaged content for those containers that users don’t need to maintain, update and patch on their own. This is how Fedora takes the traditional value of a distribution and moves it into the new, containerized world. + +Here’s an example of how Modularity solves problems for users of Node.js and Review Board. + +### Node.js + +Many readers may be familiar with Node.js, a popular server-side JavaScript runtime. Node.js has an even/odd release policy. Its community supports even-numbered releases (6.x, 8.x, 10.x, etc.) for around 30 months. Meanwhile, they support odd-numbered releases that are essentially developer previews for 9 months. + +Due to this cycle, Fedora carried only the most recent even-numbered version of Node.js in its stable repositories. It avoided the odd-numbered versions entirely since their lifecycle was shorter than Fedora, and generally not aligned with a Fedora release. This didn’t sit well with some Fedora users, who wanted access to the latest and greatest enhancements. + +Thanks to Modularity, Fedora 28 shipped with not just one, but three versions of Node.js to satisfy both developers and stable deployments. Fedora 28’s traditional repository shipped with Node.js 8.x. This version was the most recent long-term stable version at release time. The Modular repositories (available by default on Fedora 28 Server edition) also made the older Node.js 6.x release and the newer Node.js 9.x development release available. + +Additionally, Node.js released 10.x upstream just days after Fedora 28\. In the past, users who wanted to deploy that version had to wait until Fedora 29, or use sources from outside Fedora. However, thanks again to Modularity, Node.js 10.x is already [available][3] in the Modular Updates-Testing repository for Fedora 28. + +### Review Board + +Review Board is a popular Django application for performing code reviews. Fedora included Review Board from Fedora 13 all the way until Fedora 21\. At that point, Fedora moved to Django 1.7\. Review Board was unable to keep up, due to backwards-incompatible changes in Django’s database support. It remained alive in EPEL for RHEL/CentOS 7, simply because those releases had fortunately frozen on Django 1.6\. Nevertheless, its time in Fedora was apparently over. + +However, with the advent of Modularity, Fedora could again ship the older Django as a non-default module stream. As a result, Review Board has been restored to Fedora as a module. Fedora carries both supported releases from upstream: 2.5.x and 3.0.x. + +### Putting the pieces together + +Fedora has always provided users with a wide range of software to use. Fedora Modularity now provides them with deeper choices for which versions of the software they need. The next few years will be very exciting for Fedora, as developers and users start putting together their software in new and exciting (or old and exciting) ways. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/wp-content/uploads/2018/05/f28-server-modularity-816x345.jpg + +作者:[Stephen Gallagher][a] +选题:[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/sgallagh/ +[b]: https://github.com/lujun9972 +[1]: https://fedoraproject.org/wiki/Updates_Policy#Stable_Releases +[2]: https://www.softwarecollections.org +[3]: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2018-2b0846cb86 From d1a8ac85714cd93e2423a1f982d1e7fcf3cead86 Mon Sep 17 00:00:00 2001 From: wwhio Date: Thu, 31 Jan 2019 23:39:18 +0800 Subject: [PATCH 006/813] Update 20150513 XML vs JSON.md --- sources/talk/20150513 XML vs JSON.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index aa7b9be486..386d7404c2 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -86,12 +86,13 @@ One of the most heavily anticipated changes in the Internet is the “Internet o 对互联网的变革中,最让人期待的便是物联网Internet of Things。这会给互联网带来大量的非计算机设备,例如手表、温度计、电视、冰箱等等。这一势头的发展良好,预期将在不久的将来迎来爆发式的增长。据估计,到 2020 年时会有 260 亿 到 2000 亿的物联网设备被接入互联网。[12][13] 几乎所有的物联网设备都是小型设备,此外比笔记本或者台式电脑的性能要弱很多。大多数都是嵌入式系统。因此,当他们需要与 web 上的系统交换数据时,更轻量,更快速的 JSON 自然比 XML 更受青睐。[10] 受益于 JSON 在 web 上的快速普及,与 XML 相比,这些新的物联网设备更有可能从使用 JSON 中受益。这是一个典型的梅特卡夫定律的实例,无论是 XML 还是 JSON,抑或是什么其他全新的格式,现存的设备和新的设备都会从支持最广泛使用的格式中受益。 With the creation and recent rapid increase in popularity of Node.js, a server-side JavaScript framework, along with NoSQL databases like MongoDB, full-stack JavaScript development has become a reality. This bodes well for the future of JSON, as with these new apps, JSON is spoken at every level of the stack, which generally makes the apps very fast and lightweight. This is a desirable trait for any app, so this trend towards full-stack JavaScript is not likely to die out anytime soon.[10] -Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。This bodes well for the future of JSON, as with these new apps, JSON is spoken at every level of the stack, which generally makes the apps very fast and lightweight. This is a desirable trait for any app, so this trend towards full-stack JavaScript is not likely to die out anytime soon.[10] +Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。这些发展预示着 JSON 光明的未来,这些软件让 JSON 运用在全栈开发的每一个环节中,使应用更加轻量,响应更快。这也是任何应用的追求之一,所以,全栈使用 JavaScript 的趋势在不久的将来都不会消退。[10] Another existing trend in the world of app development is toward REST and away from SOAP.[11][15][16] Both XML and JSON can be used with REST, but SOAP exclusively uses XML. - +此外,另一个应用开发的趋势是从 SOAP 转向 REST。[11][15][16] XML 和 JSON 都可以用于 REST,可 SOAP 只能使用 XML。 The given trends indicate that JSON will continue to dominate the Web, and XML use will continue to decrease. This should not be overblown, however, because XML is still very heavily used in the Web, and it is the only option for apps that use SOAP. Given the widespread migration from SOAP to REST, the rise of NoSQL databases and full-stack JavaScript, and the far superior performance of JSON, I believe that JSON will soon be much more widely used than XML in the Web. There seem to be very few applications where XML is the better choice. +从这些事实中可以推断,JSON 会发展将统一 Web 的信息交换格式,XML 的使用率将继续降低。虽然不应该把 JSON 吹过头了,因为 XML 在 Web 中的使用依旧很广,而且它还是 SOAP 的唯一选择,可考虑到 SOAP 到 REST 的迁移,NoSQL 数据库和全栈 JavaScript 的兴起,JSON 的卓越性能,我相信 JSON 很快就会在 Web 开发中超过 XML。至于其他领域,把 XML 作为更好的选择的情况似乎并不多。 ### 参考链接 From c6711a05f27bcfb2e6a8a0d3ab1a3faf542755c5 Mon Sep 17 00:00:00 2001 From: acyanbird <2534930703@qq.com> Date: Mon, 4 Feb 2019 21:27:52 +0800 Subject: [PATCH 007/813] =?UTF-8?q?20180809=20Two=20Years=20With=20Emacs?= =?UTF-8?q?=20as=20a=20CEO=20(and=20now=20CTO).md=20=E6=A0=A1=E5=AF=B9?= =?UTF-8?q?=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Years With Emacs as a CEO (and now CTO).md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md index b25721a59b..76cdf9aeea 100644 --- a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (oneforalone) -[#]: reviewer: ( ) +[#]: reviewer: (acyanbird) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Two Years With Emacs as a CEO (and now CTO)) @@ -10,57 +10,57 @@ 作为 CEO 使用 Emacs 的两年经验之谈(现任 CTO) ====== -两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经转为 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑 Emacs 是一次很不错的尝试,但我不太清楚具体该怎么实现。在网上,那篇博客也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的还是不错的。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变形,或者说我会因白色的背景而近视。在这里我可以很肯定的回答 —— 完全没有这回事,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从在家得到的想法变成强大的产品,并有一大批忠实的顾客,我觉得 Emacs 可以让你从复杂的事务中解脱出来。我现在还在用白色的背景。 +两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经是 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑使用 Emacs 是一次令我振奋的尝试,但我不太清楚这次行动会造成什么反响。在网上,那篇博客的评论也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的是一个蛮有意思的题材。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变形,或者说我会因白色的背景而近视。在这里我可以很高兴地回答,到目前为止并没有出现什么特别糟糕的后果,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从在家得到的想法变成强大的产品,并有一大批忠实的顾客。在做这种真正复杂之事的时候,Emacs 可以给你带来安慰。还有,我现在仍然在用白色的背景。 -近段时间那篇博客又被翻出来了,并发到了 [HackerNews][4] 上。我收到了大量的跟帖者问我现在怎么样了,所以我写这篇博客来回应他们。在本文中,我还将重点讨论为什么 Emacs 和函数式编程有很高的相关性,以及我们是怎样使用 Emacs 来开发我们的产品 —— Fugue,一个使用函数式编程的自动化的云计算平台。由于我收到了很多反馈,比较有用的是一些细节的详细程度和有关背景色的注解,因此这篇博客比较长,而我确实也需要费点精力来解释我的想法,但这篇文章的主要内容还是反映了我担任 CEO 时处理的事务。而我想在之后更频繁地用 Emacs 写代码,所以需要提前做一些准备。一如既往,本文因人而异,后果自负。 +近段时间那篇博客又被翻出来了,并发到了 [HackerNews][4] 上。我收到了大量的跟帖者问我现在使用状况如何,所以我写了这篇博客来回应他们。在本文中,我还将重点讨论为什么 Emacs 和函数式编程有很高的关联性,以及我们是怎样使用 Emacs 来开发我们的产品 —— Fugue,一个使用函数式编程的自动化的云计算平台的。由于我收到了很多反馈,他们表示博客里的众多细节和评论很有用,因此这篇博客比较长,而我确实也需要费点精力来解释我如此作为时的想法,但这篇文章的主要内容还是反映了我担任 CEO 时处理的事务。而我想在之后更频繁地用 Emacs 写代码,所以需要提前做一些准备。一如既往,本文因人而异,后果自负。 ### 意外之喜 -我大部分时间都在不断得处理公司内外沟通。交流是解决问题的唯一方法,但也是反思及思考困难或是复杂问题的敌人。对我来说,作为创业公司的 CEO,最需要的是有时间专注工作而不别打扰。一旦开始投入时间来学习一些命令,Emacs 就很适合这种情况。其他的应用弹出提示,但是配置好了的 Emacs 就可以完全的忽略掉,无论是视觉上还是精神上。除非你想修改,否则的话他不会变,而且没有比空白屏幕和漂亮的字体更干净的界面了。在我不断被打扰的情况下,这种简洁让我能够专注于我在想什么,而不是电脑。好的程序能够默默地对电脑的进行访问。 +我大部分时间都在不断得处理公司内外沟通。交流是解决问题的唯一方法,但也是反思及思考困难或是复杂问题的敌人。对我来说,作为创业公司的 CEO,最需要的是能专注工作而不被打扰的时间。一旦你决定投入时间来学习一些有用的命令,Emacs 就能帮助创造这种不被打扰的可贵环境。其他的应用会弹出提示,但是一个配置好了的 Emacs 可以被你完全的忽略掉 —— 无论是视觉上还是精神上。除非你想修改,否则的话他不会改变,况且没有比空白屏幕和漂亮的字体更干净的界面了。不断被打扰是我的日常,因此这种简洁让我能够专注于我在想的事情,而不是电脑本身。好的程序能够默默地操纵电脑,并且不会夺取你的注意力。 -一些人指出,原来的帖子既是对现代图形界面的批判,也是对 Emacs 的赞许。我既不赞同,也不否认。现代的接口,特别是那些以应用程序为中心的方法(相对于以内容为中心的方法),既不是以用户为中心的,也不是面向进程的。Emacs 避免了这种错误,这也是我如此喜欢它的部分原因,而它也带来了其他优点。Emacs 是进入计算机本身的入口,这打开了一扇新世界的大门。它的核心是发现和创造属于自己的道路,对我来说这就是创造的定义。现代电脑的悲哀之处在于,它很大程度上是由带有闪亮界面的黑盒组成的,这些黑盒提供的是瞬间的满足感,而不是真正的满足感。这让我们变成了消费者,而不是技术的创造者。我不在乎你是谁或者你的背景是什么;你可以理解你的电脑,你可以用它做东西。它很有趣,令人满意,而且不是你想的那么难学! +一些人指出,我原来的博客既是对现代图形界面的批判,也是对 Emacs 的赞许。我既不赞同,也不否认。现代的接口,特别是那些以应用程序为中心的方法(相对于以内容为中心的方法),既不是以用户为中心的,也不是面向进程的。Emacs 避免了这种错误,这也是我如此喜欢它的部分原因,而它也带来了其他优点。Emacs 是带领你体会计算机魅力的传送门,一个值得跳下去的兔子洞(校对注:爱丽丝梦游仙境里的兔子洞,跳进去会有新世界)。它的核心是发现和创造属于自己的道路,对我来说这就是创造本身了。现代电脑的悲哀之处在于,它很大程度上是由带有闪亮界面的黑盒组成的,这些黑盒提供的是瞬间的喜悦,而不是真正的满足感。这让我们变成了消费者,而不是技术的创造者。我不在乎你是谁或者你的背景是什么;你可以理解你的电脑,你可以用它创造事物。它很有趣,能令人满意,而且不是你想的那么难学! -我们常常低估了环境对我们心理的影响。Emacs 给人一种平静和自由的感觉,而不是紧迫感、烦恼或兴奋——后者是思想和沉思的敌人。我喜欢那些持久的,不碍事的东西,当我花时间去关注它们的时候,它们会给我带来真知灼见。Emacs 满足我的所有这些标准。我每天都使用 Emacs 来创建内容,我也很高兴我很少考虑它。Emacs 确实有一个学习曲线,但不会比学自行车更陡,而且一旦你完成了它,你会得到相应的回报,你就不必再去想它了,它赋予你一种其他工具所没有的自由感。这是一个优雅的工具,来自一个更加文明的时代。我很高兴我们步入了另一个计算机时代,而 Emacs 也将越来越受欢迎。 +我们常常低估了环境对我们心理的影响。Emacs 给人一种平静和自由的感觉,而不是紧迫感、烦恼或兴奋 —— 后者是思想和沉思的敌人。我喜欢那些持久的,不碍事的东西,当我花时间去关注它们的时候,它们会给我带来真知灼见。Emacs 满足我的所有这些标准。我每天都使用 Emacs 来创建内容,我也很高兴我很少考虑它。Emacs 确实有一个学习曲线,但不会比学自行车的学习曲线来的更陡,而且一旦你完成了它,你会得到相应的回报,而且不必再去想它了。它赋予你一种其他工具所没有的自由感。这是一个优雅的工具,来自一个更加文明的时代。我很高兴我们步入了另一个文明的计算机时代,我相信 Emacs 也将越来越受欢迎。 ### 放弃用 Emacs 规划日程及处理待办事项 -在原来的文章中,我花了一些时间介绍如何使用 Org 模式来规划日程。我放弃了使用 Org 模式来处理待办事项之类的,因为我每天都有很多会要开,很多电话要打, 而我也不能让其他人来适应我选的工具,我也没有时间将事务转换或是自动移动到 Org 上 。我们主要是用 Mac shop,使用谷歌日历等,原生的 Mac OS/iOS 工具可以很好的进行协作。我还有支比较旧的笔用来在会议中做笔记,因为我发现在会议中使用笔记本电脑或者说键盘很不礼貌,而且这也限制了我的聆听和思考。因此,我基本上放弃了用 Org 帮我规划日程或安排生活的想法。当然,Org 模式对其他的方面也很有用,它是我编写文档的首选,包括本文。换句话说,我与其作者背道而驰,但它在这方面做得很好。我也希望有一天也有人这么说我们在 Fugue 的工作。 +在原来的文章中,我花了一些时间介绍如何使用 Org 模式来规划日程。不过现在我放弃了使用 Org 模式来处理待办事项一类的事物,因为我每天都有很多会要开,很多电话要打, 我也不能让其他人来适应我选的工具,而且也没有时间将事务转换或是自动移动到 Org 上。我们主要使用 Mac shop,谷歌日历,原生的 Mac OS/iOS 工具可以很好的进行团队协作。我还有支旧笔用来在会议中做笔记,因为我发现在会议中使用笔记本电脑或者说键盘记录很不礼貌,而且这也限制了我的聆听和思考。因此,我基本上放弃了用 Org 帮我规划日程或安排生活。当然,Org 模式对其他的方面也很有用,它是我编写文档的首选,包括本文。换句话说,我使用它的方式与其作者的想法背道而驰,但它的确做得很好。我也希望有一天也有人如此评价并使用我们的 Fugue。 -### Emacs 在 Fugue 已经扩散 +### Emacs 已经在 Fugue 中扩散 -我在上篇博客就有说,你可能会喜欢 Emacs,也可能不会。因此,当 Fugue 的文档组将 Emacs 作为标准工具时,我是有点担心的,因为我觉得他们可能是受了我的影响。几年后,我确信他们做出了个正确的选择。那个组长是一个很聪明的程序员,但是那两个编写文档的人却没有怎么接触过技术。我想,如果这是一个经理强加错误工具的案例,我就会得到投诉并去解决,因为 Fugue 有反威权文化,大家不怕惹麻烦,包括我在内。之前的组长去年辞职了,但[文档组][5]现在有了一个灵活的集成的 CI/CD 工具链。并且文档组的人已经成为了 Emacs 的忠实用户。Emacs 有一条学习曲线,但即使很陡,也不会那么陡,翻过后对生产力和总体幸福感都有益。这也提醒我们,学文科的人在技术方面和程序员一样聪明,一样能干,也许不应该那么倾向于技术而产生派别歧视。 +我在上篇博客就有说,你可能会喜欢 Emacs,也可能不会。因此,当 Fugue 的文档组将 Emacs 作为标准工具时,我是有点担心的,因为我觉得他们可能是受了我的影响才做出这种选择。不过在几年后,我确信他们做出了正确的选择。文档组的组长是一个很聪明的程序员,但是另外两个编写文档的人却没有怎么接触过技术。我想,如果这是一个经理强迫员工使用错误工具的案例,我就会被投诉并去解决,因为 Fugue 有反威权文化,大家不怕惹麻烦。之前的组长在去年辞职了,但[文档组][5]现在有了一个灵活的集成的 CI/CD 工具链,并且文档组的人已经成为了 Emacs 的忠实用户。Emacs 有一条学习曲线,但即使在最陡的时候,也不至于多么困难,并且翻过顶峰后,对生产力和总体幸福感都得到了提升。这也提醒我们,学文科的人在技术方面和程序员一样聪明,一样能干,也许不那么容易受到技术崇拜与类别隔阂产生的影响。 -### 我的手腕得益于我的决定 +### 我的手腕感激我的决定 -上世纪80年代中期以来,我每天花12个小时左右在电脑前工作,这给我的手腕(以及后背)造成了很大的损伤,在此我强烈安利 Tag Capisco 的椅子。Emacs 和人机工程学键盘的结合让手腕的 [RSI][10](Repetitive Strain Injury/Repetitive Motion Syndrome) 问题消失了,我已经一年多没有想过这种问题了。在那之前,我的手腕每天都会疼,尤其是右手,如果你也遇到这种问题,你就知道这很让人分心和担心。有几个人问过键盘和鼠标的问题,如果你感兴趣的话,我现在用的是[这款键盘][6]。虽然在过去的几年里我主要使用的是真正符合人体工程学的键盘。我已经换成现在的键盘有几个星期了,而且我爱死它了。键帽的形状很神奇,因为你不用看就能知道自己在哪里,而拇指键设计的很合理,尤其是对于 Emacs, Control和Meta是你的固定伙伴。不要再用小指做高度重复的任务了! +上世纪80年代中期以来,我每天花12个小时左右在电脑前工作,这给我的手腕(以及后背)造成了很大的损伤,因此我强烈安利 Tag Capisco 的椅子。Emacs 和人机工程学键盘的结合让手腕的 [RSI][10](Repetitive Strain Injury/Repetitive Motion Syndrome) 问题消失了,我已经一年多没有想过这种问题了。在那之前,我的手腕每天都会疼,尤其是右手。如果你也有这种问题,你就知道这疼痛很让人分心和忧虑。有几个人问过关于选购键盘和鼠标的问题,如果你也对此有兴趣,那么在过去的几年里,我主要使用的是真正符合人体工程学的键盘,不过我现在用的是[这款键盘][6]。我已经换成现在的键盘有几个星期,而且我爱死它了。键帽的形状很神奇,因为你不用看就能知道自己的手指放在哪里。而拇指键也设计的十分合理,尤其是对于 Emacs 用户而言。Control 和 Meta 是你的固定伙伴,不要再用小指做高度重复的任务了! -我使用鼠标的次数比使用 Office 和 IDE 时要少得多,这对我有很大帮助,但我还是会用鼠标。我一直在使用外观相当过时,但功能和人体工程学明显优越的轨迹球,这是名副其实的。 +我使用鼠标的次数比使用 Office 和 IDE 时要少得多,这对我的工作效率有很大帮助。但我还是需要一个鼠标。我一直在使用外观相当过时,但功能和人体工程学非常优秀的高级轨迹球。 -撇开具体的工具不谈,最重要的一点是,事实证明,一个很棒的键盘,再加上避免使用鼠标,在减少身体的磨损方面很有效。Emacs 是这方面的核心,因为我不需要在菜单上滑动鼠标来完成任务,而且导航键就在我的手指下面。我肯定,手离开标准打字姿势会给我的肌腱造成很大的压力。这因人而异,我也不是医生。 +撇开具体的工具不谈,事实证明,一个很棒的键盘,再加上避免使用鼠标,在减少身体的磨损方面很有效。Emacs 是达成这方面的核心,因为我不需要在菜单上滑动鼠标来完成任务,而且导航键就在我的手指下面。我现在十分肯定,我的手离开标准打字姿势会给我的肌腱造成很大的压力。不过这也因人而异,我不是医生不好下定论。 -### 还没完成大部分配置…… +### 我并没有做太多配置…… -有人说我会在界面配置上花很多的时间。我想验证下他们说的对不对,所以我留意了下。我不仅让配置基本上不受影响,关注这个问题还让我意识到我使用的其他工具是多么的耗费我的精力和时间。Emacs 是我用过的维护成本最低的软件。Mac OS 和 Windows 一直要求我更新它,但在我我看来,这远没有 Adobe 套件和 Office 的更新的困恼那么大。我只是偶尔更新 Emacs,但也没什么变化,所以对我来说,它基本上是一个接近于零成本的操作,我高兴什么时候跟新就什么时候更新。 +有人说我会在界面配置上花很多的时间。我想验证下他们说的对不对,所以我特别留意了下。我不仅让配置基本上不受影响,关注这个问题还让我意识到,我使用的其他工具是多么的耗费我的精力和时间。Emacs 是我用过的维护成本最低的软件。Mac OS 和 Windows 一直要求我更新它,但在我看来,这远没有 Adobe 套件和 Office 的更新给我带来的困恼那么大。我只是偶尔更新 Emacs,但对我来说它也没什么变化。所以从我的个人观点而言,更新基本上是一个接近于零成本的操作,我高兴什么时候更新就什么时候更新。 -有一点然你们失望了,因为许多人想知道我为跟上 Emacs 社区的更新及其输出所做的事情,但是在过去的两年中,我只在配置中添加了一些内容。我认为也是成功的,因为 Emacs 只是一个工具,而不是我的爱好。也就是说,如果你想和我分享,我很乐意听到新的东西。 +有一点然你们失望了,因为许多人想知道我为跟上 Emacs 社区的更新及其输出所做的事情,但是在过去的两年中,我只在配置中添加了少部分内容。我认为也是一种成功,因为 Emacs 只是一个工具,而不是我的爱好。但即便如此,如果你想和我分享关于 Emacs 的新鲜事物,我很乐意聆听。 ### 期望实现控制云端 -我们在 Fugue 有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,我们会开发一个云自动化和管理工具,它利用函数式编程为用户提供与云的 api 交互的良好体验。它做的不止这些,但它也做了。fugue 模式很酷的原因有很多。它有一个不断报告云基础设备状态的缓冲区,而由于我经常修改这些设备,所以我可以快速看到编码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于云工作负载的 top 模式。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 +Fugue 用户中有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,我们会开发一个云自动化和管理工具,它利用函数式编程为用户提供与云的 API 交互的良好体验。但它做的不止这些。fugue 模式很酷的原因有很多,它有一个不断报告云基础设备状态的缓冲区,由于我经常修改这些设备,所以我可以快速看到编码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于为云工作负载设计的 top 工具。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 ![fugue-mode-edited.gif][8] ### 模式及监听 -我添加了一些模式和集成插件,但并不是真正用于 CEO 工作。我喜欢在周末时写写 Haskell 和 Scheme,所以我添加了 haskell 模式和 geiser。Emacs 对具有 REPL 的语言很友好,因为你可以在不同的窗口中运行不同的模式,包括 REPL 和 shell。Geiser 和 Scheme 很配,要是你还没有这样做过,那么用 SICP 工作也不失为一种乐趣,在这个有很多土鳖编程的例子的时代,这可能是一种启发。安装 MIT Scheme 和 geiser,你就会感觉有点像 lore 的符号环境。 +我添加了一些模式和集成插件,但并不是真正用于 CEO 工作。我喜欢在周末时写写 Haskell 和 Scheme 娱乐,所以我添加了 haskell 模式和 geiser。Emacs 对具有 REPL 的语言很友好,因为你可以在不同的窗口中运行不同的模式,包括 REPL 和 shell,Geiser 和 Scheme 很配。要是你还没有用过 Scheme,那么阅读《计算机程序的构造和解释》SICP也不失为一种乐趣,在这个有很多货物崇拜编程(校对注:是一种计算机程序设计中的反模式,其特征为不明就里地、仪式性地使用代码或程序架构)例子的时代,阅读此书或许可以启发你。安装 MIT Scheme 和 geiser,你就会感觉有点像 lore 的符号环境。 -这就引出了我在 15 年的文章中没有提到的另一个话题:屏幕管理。我喜欢使用用竖屏来写作,我在家里和我的主要办公室都有这个配置。对于编程或混合使用,我喜欢 fuguer 提供的新的超宽显示器。对于宽屏,我更喜欢将屏幕分成三列,中间是主编辑缓冲区,左边是水平分隔的 shell 和 fugue 模式缓冲区,右边是文档缓冲区或另一个或两个编辑缓冲区。这个很简单,首先按 'Ctl-x 3' 两次,然后使用 'Ctl-x =' 使窗口的宽度相等。这将提供三个相等的列,你也可以使用 'Ctl-x 2' 进行水平分割。以下是我的截图。 +这就引出了我在 2015 年的文章中没有提到的另一个话题:屏幕管理。我喜欢使用单独一个带肖像模式显示器来写作,我在家里和我的主要办公室都有这个配置。对于编程或混合使用,我喜欢我们提供给 Fugue 使用者们的,新型超宽显示器。对于它来说,我更喜欢将屏幕分成三列,中间是主编辑缓冲区,左边是水平分隔的 shell 和 fugue 模式缓冲区,右边是文档缓冲区或另一个或两个编辑缓冲区。这个很简单,首先按 'Ctl-x 3' 两次,然后使用 'Ctl-x =' 使窗口的宽度相等。这将提供三个相等的列,你也可以使用 'Ctl-x 2' 对分割之后的窗口再次进行水平分割。以下是我的截图。 ![Emacs Screen Shot][9] ### 最后一篇 CEO/Emacs 文章…… -首先,我现在是 Fugue 的 CTO,其次我也想要写一些其他方面的博客,而我现在刚好有时间。我还打算写些更深入的东西,比如说函数式编程、基础结构类型安全,以及我们即将推出一些的新功能,还有一些关于 Fugue 在云上可以做什么。 +首先,我现在是 Fugue 的 CTO 而并非 CEO,其次我之前一直想要写一些其他方面的博客,而我现在刚好有时间。我还打算写些更深入的东西,比如说函数式编程、基础结构类型安全,以及我们即将推出一些 Fugue 的新功能,关于 Fugue 在云上可以做什么的博客。 -------------------------------------------------------------------------------- @@ -68,8 +68,8 @@ via: https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html 作者:[Josh Stella][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/oneforalone) -校对:[校对者ID](https://github.com/校对者ID) +译者:[oneforalone](https://github.com/oneforalone) +校对:[acyanbird](https://github.com/acyanbird) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a9ffef38822bbf41971019d254092f50d10cbe89 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Feb 2019 10:42:01 +0800 Subject: [PATCH 008/813] PRF:20180809 Two Years With Emacs as a CEO (and now CTO).md PART --- ...Years With Emacs as a CEO (and now CTO).md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md index 76cdf9aeea..32d3807290 100644 --- a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (oneforalone) -[#]: reviewer: (acyanbird) +[#]: reviewer: (acyanbird wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Two Years With Emacs as a CEO (and now CTO)) @@ -10,43 +10,43 @@ 作为 CEO 使用 Emacs 的两年经验之谈(现任 CTO) ====== -两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经是 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑使用 Emacs 是一次令我振奋的尝试,但我不太清楚这次行动会造成什么反响。在网上,那篇博客的评论也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的是一个蛮有意思的题材。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变形,或者说我会因白色的背景而近视。在这里我可以很高兴地回答,到目前为止并没有出现什么特别糟糕的后果,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从在家得到的想法变成强大的产品,并有一大批忠实的顾客。在做这种真正复杂之事的时候,Emacs 可以给你带来安慰。还有,我现在仍然在用白色的背景。 +两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经是 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑使用 Emacs 是一次令我振奋的尝试,但我不太清楚这次行动会造成什么反响。在网上,那篇博客的评论也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的是一个蛮有意思的题材。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变成鸡爪,或者说我会因白色的背景而近视。在这里我可以很高兴地回答,到目前为止并没有出现什么特别糟糕的后果,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从一个在我家后院的灵感变成强大的产品,并有一大批忠实的顾客,我发现在做这种真正复杂之事的时候,Emacs 可以给你带来安慰。还有,我现在仍然在用白色的背景。 -近段时间那篇博客又被翻出来了,并发到了 [HackerNews][4] 上。我收到了大量的跟帖者问我现在使用状况如何,所以我写了这篇博客来回应他们。在本文中,我还将重点讨论为什么 Emacs 和函数式编程有很高的关联性,以及我们是怎样使用 Emacs 来开发我们的产品 —— Fugue,一个使用函数式编程的自动化的云计算平台的。由于我收到了很多反馈,他们表示博客里的众多细节和评论很有用,因此这篇博客比较长,而我确实也需要费点精力来解释我如此作为时的想法,但这篇文章的主要内容还是反映了我担任 CEO 时处理的事务。而我想在之后更频繁地用 Emacs 写代码,所以需要提前做一些准备。一如既往,本文因人而异,后果自负。 +近段时间那篇博客又被翻出来了,并发到了 [HackerNews][4] 上。我收到了大量的跟帖者问我现在使用状况如何,所以我写了这篇博客来回应他们。在本文中,我还将重点讨论为什么 Emacs 和函数式编程有很高的关联性,以及我们是怎样使用 Emacs 来开发我们的产品 —— Fugue,一个使用函数式编程的自动化的云计算平台的。由于我收到了很多反馈,其众多细节和评论很有用,因此这篇博客比较长,而我确实也需要费点精力来解释我如此作为时的想法,但这篇文章的主要内容还是反映了我担任 CEO 时处理的事务。而我想在之后更频繁地用 Emacs 写代码,所以需要提前做一些准备。一如既往,本文因人而异,后果自负。 ### 意外之喜 -我大部分时间都在不断得处理公司内外沟通。交流是解决问题的唯一方法,但也是反思及思考困难或是复杂问题的敌人。对我来说,作为创业公司的 CEO,最需要的是能专注工作而不被打扰的时间。一旦你决定投入时间来学习一些有用的命令,Emacs 就能帮助创造这种不被打扰的可贵环境。其他的应用会弹出提示,但是一个配置好了的 Emacs 可以被你完全的忽略掉 —— 无论是视觉上还是精神上。除非你想修改,否则的话他不会改变,况且没有比空白屏幕和漂亮的字体更干净的界面了。不断被打扰是我的日常,因此这种简洁让我能够专注于我在想的事情,而不是电脑本身。好的程序能够默默地操纵电脑,并且不会夺取你的注意力。 +我大部分时间都在不断的处理公司内外沟通。交流是解决问题的唯一方法,但也是反思及思考困难或复杂问题的敌人。对我来说,作为创业公司的 CEO,最需要的是能专注工作而不被打扰的时间。一旦你决定投入时间来学习一些有用的命令,Emacs 就能帮助创造这种不被打扰的可贵环境。其他的应用会弹出提示,但是一个配置好了的 Emacs 可以完全不影响你 —— 无论是视觉上还是精神上。除非你想,否则的话它不会改变,况且没有比空白屏幕和漂亮的字体更干净的界面了。不断被打扰是我的日常状况,因此这种简洁让我能够专注于我在想的事情,而不是电脑本身。好的程序能够默默地操纵电脑,并且不会夺取你的注意力。 -一些人指出,我原来的博客既是对现代图形界面的批判,也是对 Emacs 的赞许。我既不赞同,也不否认。现代的接口,特别是那些以应用程序为中心的方法(相对于以内容为中心的方法),既不是以用户为中心的,也不是面向进程的。Emacs 避免了这种错误,这也是我如此喜欢它的部分原因,而它也带来了其他优点。Emacs 是带领你体会计算机魅力的传送门,一个值得跳下去的兔子洞(校对注:爱丽丝梦游仙境里的兔子洞,跳进去会有新世界)。它的核心是发现和创造属于自己的道路,对我来说这就是创造本身了。现代电脑的悲哀之处在于,它很大程度上是由带有闪亮界面的黑盒组成的,这些黑盒提供的是瞬间的喜悦,而不是真正的满足感。这让我们变成了消费者,而不是技术的创造者。我不在乎你是谁或者你的背景是什么;你可以理解你的电脑,你可以用它创造事物。它很有趣,能令人满意,而且不是你想的那么难学! +一些人指出,我原来的博客有太多对现代图形界面的批判和对 Emacs 的赞许。我既不赞同,也不否认。现代的界面,特别是那些以应用程序为中心的方法(相对于以内容为中心的方法),既不是以用户为中心的,也不是面向任务的。Emacs 避免了这种错误,这也是我如此喜欢它的部分原因,而它也带来了其他优点。Emacs 是带领你体会计算机魅力的传送门,一个值得跳下去的兔子洞(LCTT 译注:爱丽丝梦游仙境里的兔子洞,跳进去会有新世界)。它的核心是发现和创造属于自己的道路,对我来说这本身就是创造了。现代计算的悲哀之处在于,它很大程度上是由带有闪亮界面的黑盒组成的,这些黑盒提供的是瞬间的喜悦,而不是真正的满足感。这让我们变成了消费者,而不是技术的创造者。无论你是谁或者你的背景是什么;你都可以理解你的电脑,你可以用它创造事物。它很有趣,能令人满意,而且不是你想的那么难学! -我们常常低估了环境对我们心理的影响。Emacs 给人一种平静和自由的感觉,而不是紧迫感、烦恼或兴奋 —— 后者是思想和沉思的敌人。我喜欢那些持久的,不碍事的东西,当我花时间去关注它们的时候,它们会给我带来真知灼见。Emacs 满足我的所有这些标准。我每天都使用 Emacs 来创建内容,我也很高兴我很少考虑它。Emacs 确实有一个学习曲线,但不会比学自行车的学习曲线来的更陡,而且一旦你完成了它,你会得到相应的回报,而且不必再去想它了。它赋予你一种其他工具所没有的自由感。这是一个优雅的工具,来自一个更加文明的时代。我很高兴我们步入了另一个文明的计算机时代,我相信 Emacs 也将越来越受欢迎。 +我们常常低估了环境对我们心理的影响。Emacs 给人一种平静和自由的感觉,而不是紧迫感、烦恼或兴奋 —— 后者是思考和沉思的敌人。我喜欢那些持久的、不碍事的东西,当我花时间去关注它们的时候,它们会给我带来真知灼见。Emacs 满足我的所有这些标准。我每天都使用 Emacs 来工作,我也很高兴我很少需要注意到它。Emacs 确实有一个学习曲线,但不会比学自行车的学习曲线来的更陡,而且一旦你掌握了它,你会得到相应的回报,而且不必再去想它了。它赋予你一种其他工具所没有的自由感。这是一个优雅的工具,来自一个更加文明的计算时代。我很高兴我们步入了另一个文明的计算时代,我相信 Emacs 也将越来越受欢迎。 -### 放弃用 Emacs 规划日程及处理待办事项 +### 弃用 Org 模式处理日程和待办事项 -在原来的文章中,我花了一些时间介绍如何使用 Org 模式来规划日程。不过现在我放弃了使用 Org 模式来处理待办事项一类的事物,因为我每天都有很多会要开,很多电话要打, 我也不能让其他人来适应我选的工具,而且也没有时间将事务转换或是自动移动到 Org 上。我们主要使用 Mac shop,谷歌日历,原生的 Mac OS/iOS 工具可以很好的进行团队协作。我还有支旧笔用来在会议中做笔记,因为我发现在会议中使用笔记本电脑或者说键盘记录很不礼貌,而且这也限制了我的聆听和思考。因此,我基本上放弃了用 Org 帮我规划日程或安排生活。当然,Org 模式对其他的方面也很有用,它是我编写文档的首选,包括本文。换句话说,我使用它的方式与其作者的想法背道而驰,但它的确做得很好。我也希望有一天也有人如此评价并使用我们的 Fugue。 +在原来的文章中,我花了一些时间介绍如何使用 Org 模式来规划日程。不过现在我放弃了使用 Org 模式来处理待办事项一类的事物,因为我每天都有很多会议要开,很多电话要打,我也不能让其他人来适应我选的工具,而且也没有时间将事务转换或是自动移动到 Org 上。我们主要是 Mac 一族,使用谷歌日历等工具,而且原生的 Mac OS/iOS 工具可以很好的进行团队协作。我还有支老钢笔用来在会议中做笔记,因为我发现在会议中使用笔记本电脑或者说键盘记录很不礼貌,而且这也限制了我的聆听和思考。因此,我基本上放弃了用 Org 模式帮我规划日程或安排生活。当然,Org 模式对其他的方面也很有用,它是我编写文档的首选,包括本文。换句话说,我使用它的方式与其作者的想法背道而驰,但它的确做得很好。我也希望有一天也有人如此评价并使用我们的 Fugue。 -### Emacs 已经在 Fugue 中扩散 +### Emacs 已经在 Fugue 公司中扩散 -我在上篇博客就有说,你可能会喜欢 Emacs,也可能不会。因此,当 Fugue 的文档组将 Emacs 作为标准工具时,我是有点担心的,因为我觉得他们可能是受了我的影响才做出这种选择。不过在几年后,我确信他们做出了正确的选择。文档组的组长是一个很聪明的程序员,但是另外两个编写文档的人却没有怎么接触过技术。我想,如果这是一个经理强迫员工使用错误工具的案例,我就会被投诉并去解决,因为 Fugue 有反威权文化,大家不怕惹麻烦。之前的组长在去年辞职了,但[文档组][5]现在有了一个灵活的集成的 CI/CD 工具链,并且文档组的人已经成为了 Emacs 的忠实用户。Emacs 有一条学习曲线,但即使在最陡的时候,也不至于多么困难,并且翻过顶峰后,对生产力和总体幸福感都得到了提升。这也提醒我们,学文科的人在技术方面和程序员一样聪明,一样能干,也许不那么容易受到技术崇拜与类别隔阂产生的影响。 +我在上篇博客就有说,你可能会喜欢 Emacs,也可能不会。因此,当 Fugue 的文档组将 Emacs 作为标准工具时,我是有点担心的,因为我觉得他们可能是受了我的影响才做出这种选择。不过在两年后,我确信他们做出了正确的选择。文档组的组长是一个很聪明的程序员,但是另外两个编写文档的人却没有怎么接触过技术。我想,如果这是一个经理强迫员工使用错误工具的案例,我就会收到投诉要去解决它,因为 Fugue 有反威权文化,大家不怕挑战任何事和任何人。之前的组长在去年辞职了,但[文档组][5]现在有了一个灵活的集成的 CI/CD 工具链,并且文档组的人已经成为了 Emacs 的忠实用户。Emacs 有一条学习曲线,但即使在最陡的时候,也不至于多么困难,并且翻过顶峰后,对生产力和总体幸福感都得到了提升。这也提醒我们,学文科的人在技术方面和程序员一样聪明,一样能干,也许不那么容易受到技术崇拜与习俗产生的影响。 ### 我的手腕感激我的决定 -上世纪80年代中期以来,我每天花12个小时左右在电脑前工作,这给我的手腕(以及后背)造成了很大的损伤,因此我强烈安利 Tag Capisco 的椅子。Emacs 和人机工程学键盘的结合让手腕的 [RSI][10](Repetitive Strain Injury/Repetitive Motion Syndrome) 问题消失了,我已经一年多没有想过这种问题了。在那之前,我的手腕每天都会疼,尤其是右手。如果你也有这种问题,你就知道这疼痛很让人分心和忧虑。有几个人问过关于选购键盘和鼠标的问题,如果你也对此有兴趣,那么在过去的几年里,我主要使用的是真正符合人体工程学的键盘,不过我现在用的是[这款键盘][6]。我已经换成现在的键盘有几个星期,而且我爱死它了。键帽的形状很神奇,因为你不用看就能知道自己的手指放在哪里。而拇指键也设计的十分合理,尤其是对于 Emacs 用户而言。Control 和 Meta 是你的固定伙伴,不要再用小指做高度重复的任务了! +上世纪 80 年代中期以来,我每天花 12 个小时左右在电脑前工作,这给我的手腕(以及后背)造成了很大的损伤(因此我强烈安利 Tag Capisco 的椅子)。Emacs 和人机工程学键盘的结合让手腕的 [RSI][10](重复性压迫损伤Repetitive Strain Injury)问题消失了,我已经一年多没有想过这种问题了。在那之前,我的手腕每天都会疼,尤其是右手。如果你也有这种问题,你就知道这疼痛很让人分心和忧虑。有几个人问过关于选购键盘和鼠标的问题,如果你也对此有兴趣,那么在过去两年里,我主要使用的是 Truly Ergonomic 键盘,不过我现在用的是[这款键盘][6]。我已经换成现在的键盘有几个星期,而且我爱死它了。大写键的形状很神奇,因为你不用看就能知道它在哪里。而人体工学的拇指键也设计的十分合理,尤其是对于 Emacs 用户而言,Control 和 Meta 是你的坚实伴侣,不要再需要用小指做高度重复的任务了! -我使用鼠标的次数比使用 Office 和 IDE 时要少得多,这对我的工作效率有很大帮助。但我还是需要一个鼠标。我一直在使用外观相当过时,但功能和人体工程学非常优秀的高级轨迹球。 +我使用鼠标的次数比使用 Office 和 IDE 时要少得多,这对我的工作效率有很大帮助,但我还是需要一个鼠标。我一直在使用外观相当过时,但功能和人体工程学非常优秀的 Clearly Superior 轨迹球,恰如其名。 -撇开具体的工具不谈,事实证明,一个很棒的键盘,再加上避免使用鼠标,在减少身体的磨损方面很有效。Emacs 是达成这方面的核心,因为我不需要在菜单上滑动鼠标来完成任务,而且导航键就在我的手指下面。我现在十分肯定,我的手离开标准打字姿势会给我的肌腱造成很大的压力。不过这也因人而异,我不是医生不好下定论。 +撇开具体的工具不谈,事实证明,一个很棒的键盘,再加上避免使用鼠标,在减少身体的磨损方面很有效。Emacs 是达成这方面的核心,因为我不需要在菜单上滑动鼠标来完成任务,而且导航键就在我的手指下面。我现在十分肯定,我的手离开标准打字位置会给我的肌腱造成很大的压力。不过这也因人而异,我不是医生不好下定论。 ### 我并没有做太多配置…… -有人说我会在界面配置上花很多的时间。我想验证下他们说的对不对,所以我特别留意了下。我不仅让配置基本上不受影响,关注这个问题还让我意识到,我使用的其他工具是多么的耗费我的精力和时间。Emacs 是我用过的维护成本最低的软件。Mac OS 和 Windows 一直要求我更新它,但在我看来,这远没有 Adobe 套件和 Office 的更新给我带来的困恼那么大。我只是偶尔更新 Emacs,但对我来说它也没什么变化。所以从我的个人观点而言,更新基本上是一个接近于零成本的操作,我高兴什么时候更新就什么时候更新。 +有人说我会在界面配置上耗费很多的时间。我想验证下他们说的对不对,所以我特别留意了下。我不仅在很多程度上不用配置,关注这个问题还让我意识到,我使用的其他工具是多么的耗费我的精力和时间。Emacs 是我用过的维护成本最低的软件。Mac OS 和 Windows 一直要求我更新它,但在我看来,这远没有 Adobe 套件和 Office 的更新给我带来的困扰那么大。我只是偶尔更新 Emacs,但对我来说它也没什么变化,所以从我的个人观点而言,更新基本上是一个接近于零成本的操作,我高兴什么时候更新就什么时候更新。 -有一点然你们失望了,因为许多人想知道我为跟上 Emacs 社区的更新及其输出所做的事情,但是在过去的两年中,我只在配置中添加了少部分内容。我认为也是一种成功,因为 Emacs 只是一个工具,而不是我的爱好。但即便如此,如果你想和我分享关于 Emacs 的新鲜事物,我很乐意聆听。 +有一点让你们失望了,因为许多人想知道我为跟上重新打造的 Emacs 社区的更新做了些什么,但是在过去的两年中,我只在配置中添加了少部分内容。我认为这也是一种成功,因为 Emacs 只是一个工具,而不是我的爱好。但即便如此,如果你想和我分享关于 Emacs 的新鲜事物,我很乐意聆听。 ### 期望实现控制云端 -Fugue 用户中有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,我们会开发一个云自动化和管理工具,它利用函数式编程为用户提供与云的 API 交互的良好体验。但它做的不止这些。fugue 模式很酷的原因有很多,它有一个不断报告云基础设备状态的缓冲区,由于我经常修改这些设备,所以我可以快速看到编码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于为云工作负载设计的 top 工具。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 +Fugue 的用户中有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,我们会开发一个云自动化和管理工具,它利用函数式编程为用户提供与云的 API 交互的良好体验。但它做的不止这些。fugue 模式很酷的原因有很多,它有一个不断报告云基础设备状态的缓冲区,由于我经常修改这些设备,所以我可以快速看到编码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于为云工作负载设计的 top 工具。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 ![fugue-mode-edited.gif][8] @@ -69,13 +69,13 @@ via: https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html 作者:[Josh Stella][a] 选题:[lujun9972][b] 译者:[oneforalone](https://github.com/oneforalone) -校对:[acyanbird](https://github.com/acyanbird) +校对:[acyanbird](https://github.com/acyanbird), [wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.fugue.co/blog/author/josh-stella [b]: https://github.com/lujun9972 -[1]: https://blog.fugue.co/2015-11-11-guide-to-emacs.html +[1]: https://linux.cn/article-10401-1.html [2]: https://www.reddit.com/r/emacs/comments/7efpkt/a_ceos_guide_to_emacs/ [3]: https://news.ycombinator.com/item?id=10642088 [4]: https://news.ycombinator.com/item?id=15753150 From 772228414675d1f8cc5593e49e5980e65dbc39c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Feb 2019 14:02:53 +0800 Subject: [PATCH 009/813] PRF:20180809 Two Years With Emacs as a CEO (and now CTO).md @oneforalone @acyanbird --- ... Two Years With Emacs as a CEO (and now CTO).md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md index 32d3807290..4ec428b5e6 100644 --- a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ b/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -44,23 +44,23 @@ 有一点让你们失望了,因为许多人想知道我为跟上重新打造的 Emacs 社区的更新做了些什么,但是在过去的两年中,我只在配置中添加了少部分内容。我认为这也是一种成功,因为 Emacs 只是一个工具,而不是我的爱好。但即便如此,如果你想和我分享关于 Emacs 的新鲜事物,我很乐意聆听。 -### 期望实现控制云端 +### 期望实现云端控制 -Fugue 的用户中有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,我们会开发一个云自动化和管理工具,它利用函数式编程为用户提供与云的 API 交互的良好体验。但它做的不止这些。fugue 模式很酷的原因有很多,它有一个不断报告云基础设备状态的缓冲区,由于我经常修改这些设备,所以我可以快速看到编码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于为云工作负载设计的 top 工具。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 +在我们 Fugue 公司有很多 Emacs 的粉丝,所以我们有一段时间在用 [Ludwing 模式][7]。Ludwig 模式是我们用于自动化云基础设施和服务的声明式、功能性的 DSL。最近,Alex Schoof 利用在飞机上和晚上的时间来构建 fugue 模式,它在 Fugue CLI 上充当 Emacs 控制台。要是你不熟悉 Fugue,这是我们开发的一个云自动化和治理工具,它利用函数式编程为用户提供与云的 API 交互的良好体验。但它做的不止这些。fugue 模式很酷的原因有很多,它有一个不断报告云基础设施状态的缓冲区,由于我经常修改这些基础设施,这样我就可以快速看到代码的效果。Fugue 将云工作负载当成进程处理,fugue 模式非常类似于为云工作负载设计的 `top` 工具。它还允许我执行一些操作,比如创建新的设备或删除过期的东西,而且也不需要太多输入。Fugue 模式只是个雏形,但它非常方便,而我现在也经常使用它。 ![fugue-mode-edited.gif][8] -### 模式及监听 +### 模式及监控 -我添加了一些模式和集成插件,但并不是真正用于 CEO 工作。我喜欢在周末时写写 Haskell 和 Scheme 娱乐,所以我添加了 haskell 模式和 geiser。Emacs 对具有 REPL 的语言很友好,因为你可以在不同的窗口中运行不同的模式,包括 REPL 和 shell,Geiser 和 Scheme 很配。要是你还没有用过 Scheme,那么阅读《计算机程序的构造和解释》SICP也不失为一种乐趣,在这个有很多货物崇拜编程(校对注:是一种计算机程序设计中的反模式,其特征为不明就里地、仪式性地使用代码或程序架构)例子的时代,阅读此书或许可以启发你。安装 MIT Scheme 和 geiser,你就会感觉有点像 lore 的符号环境。 +我添加了一些模式和集成插件,但并不是真正用于工作或 CEO 职能。我喜欢在周末时写写 Haskell 和 Scheme 娱乐,所以我添加了 haskell 模式和 geiser。Emacs 很适合拥有 REPL 的语言,因为你可以在不同的窗口中运行不同的模式,包括 REPL 和 shell。geiser 和 Scheme 很配,要是你还没有用过 Scheme,那么阅读《计算机程序的构造和解释》(SICP)也不失为一种乐趣,在这个有很多货物崇拜编程(LCTT 译注:是一种计算机程序设计中的反模式,其特征为不明就里地、仪式性地使用代码或程序架构)例子的时代,阅读此书或许可以启发你。安装 MIT Scheme 和 geiser,你就会感觉有点像 lore 的符号环境。 -这就引出了我在 2015 年的文章中没有提到的另一个话题:屏幕管理。我喜欢使用单独一个带肖像模式显示器来写作,我在家里和我的主要办公室都有这个配置。对于编程或混合使用,我喜欢我们提供给 Fugue 使用者们的,新型超宽显示器。对于它来说,我更喜欢将屏幕分成三列,中间是主编辑缓冲区,左边是水平分隔的 shell 和 fugue 模式缓冲区,右边是文档缓冲区或另一个或两个编辑缓冲区。这个很简单,首先按 'Ctl-x 3' 两次,然后使用 'Ctl-x =' 使窗口的宽度相等。这将提供三个相等的列,你也可以使用 'Ctl-x 2' 对分割之后的窗口再次进行水平分割。以下是我的截图。 +这就引出了我在 2015 年的文章中没有提到的另一个话题:屏幕管理。我喜欢使用单独一个纵向模式的显示器来写作,我在家里和我的主要办公室都有这个配置。对于编程或混合使用,我喜欢我们提供给所有 Fugue 人的新型超宽显示器。对于它来说,我更喜欢将屏幕分成三列,中间是主编辑缓冲区,左边是水平分隔的 shell 和 fugue 模式缓冲区,右边是文档缓冲区或另外一、两个编辑缓冲区。这个很简单,首先按 `Ctl-x 3` 两次,然后使用 `Ctl-x =` 使窗口的宽度相等。这将提供三个相等的列,你也可以使用 `Ctl-x 2` 对分割之后的窗口再次进行水平分割。以下是我的截图。 ![Emacs Screen Shot][9] -### 最后一篇 CEO/Emacs 文章…… +### 这将是最后一篇 CEO/Emacs 文章 -首先,我现在是 Fugue 的 CTO 而并非 CEO,其次我之前一直想要写一些其他方面的博客,而我现在刚好有时间。我还打算写些更深入的东西,比如说函数式编程、基础结构类型安全,以及我们即将推出一些 Fugue 的新功能,关于 Fugue 在云上可以做什么的博客。 +首先是因为我现在是 Fugue 的 CTO 而并非 CEO,其次是我有好多要写的博客主题,而我现在刚好有时间。我还打算写些更深入的东西,比如说函数式编程、基础设施即代码的类型安全,以及我们即将推出的一些 Fugue 的新功能、关于 Fugue 在云上可以做什么的博文等等。 -------------------------------------------------------------------------------- From 796bc2a7b13ddcd39a5895c3f94875f6918fddb3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Feb 2019 14:15:41 +0800 Subject: [PATCH 010/813] PUB:20180809 Two Years With Emacs as a CEO (and now CTO).md @oneforalone @acyanbird https://linux.cn/article-10510-1.html --- .../20180809 Two Years With Emacs as a CEO (and now CTO).md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20180809 Two Years With Emacs as a CEO (and now CTO).md (99%) diff --git a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/published/20180809 Two Years With Emacs as a CEO (and now CTO).md similarity index 99% rename from translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md rename to published/20180809 Two Years With Emacs as a CEO (and now CTO).md index 4ec428b5e6..f82d75b2f6 100644 --- a/translated/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md +++ b/published/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (oneforalone) [#]: reviewer: (acyanbird wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10510-1.html) [#]: subject: (Two Years With Emacs as a CEO (and now CTO)) [#]: via: (https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html) [#]: author: (Josh Stella https://www.fugue.co/blog/author/josh-stella) -作为 CEO 使用 Emacs 的两年经验之谈(现任 CTO) +作为 CEO 使用 Emacs 的两年经验之谈 ====== 两年前,我写了一篇[博客][1],并取得了一些反响。这让我有点受宠若惊。那篇博客写的是我准备将 Emacs 作为我的主办公软件,当时我还是 CEO,现在已经是 CTO 了。现在回想起来,我发现我之前不是做程序员就是做软件架构师,而且那时我也喜欢用 Emacs 写代码。重新考虑使用 Emacs 是一次令我振奋的尝试,但我不太清楚这次行动会造成什么反响。在网上,那篇博客的评论也是褒贬不一,但是还是有数万的阅读量,所以总的来说,我写的是一个蛮有意思的题材。在 [Reddit][2] 和 [HackerNews][3] 上有些令人哭笑不得的回复,说我的手会变成鸡爪,或者说我会因白色的背景而近视。在这里我可以很高兴地回答,到目前为止并没有出现什么特别糟糕的后果,相反,我的手腕还因此变得更灵活了。还有一些人担心,说使用 Emacs 会耗费一个 CEO 的精力。把 Fugue 从一个在我家后院的灵感变成强大的产品,并有一大批忠实的顾客,我发现在做这种真正复杂之事的时候,Emacs 可以给你带来安慰。还有,我现在仍然在用白色的背景。 From 73a1d8869fce697f9bf6137e1eceab564ffc5f78 Mon Sep 17 00:00:00 2001 From: wwhio Date: Tue, 5 Feb 2019 21:40:52 +0800 Subject: [PATCH 011/813] Update 20150513 XML vs JSON.md --- sources/talk/20150513 XML vs JSON.md | 55 ++++++++-------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md index 386d7404c2..01bef8bec7 100644 --- a/sources/talk/20150513 XML vs JSON.md +++ b/sources/talk/20150513 XML vs JSON.md @@ -12,87 +12,64 @@ XML vs JSON ### 简介 -XML and JSON are the two most common formats for data interchange in the Web today. XML was created by the W3C in 1996, and JSON was publicly specified by Douglas Crockford in 2002. Although their purposes are not identical, they are frequently used to accomplish the same task, which is data interchange. Both have well-documented open standards on the Web ([RFC 7159][1], [RFC 4825][2]), and both are human and machine-readable. Neither one is absolutely superior to the other, as each is better suited for different use cases. -在今天,XML 和 JSON 是互联网上最常用的两种数据交换格式。XML 格式由 W3C 于 1996 年提出。JSON 格式由 Douglas Crockford 于 2020 年提出。虽然制作这两种格式的目的不同,但它们都是数据交换中常用的格式。这两种格式的文档都很完善([RFC 7159][1], [RFC 4825][2]),且都同时具有人类可读性human-readable机器可读性machine-readable。这两种格式并没有哪一个比另一个更强,只是各自适用的领域不用。(LCTT译注:W3C 是[互联网联盟](https://www.w3.org/),制定了各种 Web 相关的标准,如 HTML、CSS 等。Douglas Crockford 除了制定了 JSON 格式,还致力于改进 JavaScript,开发了 JavaScript 相关工具 [JSLint](http://jslint.com/) 和 [JSMin](http://www.crockford.com/javascript/jsmin.html)。) +XML 和 JSON 是现今互联网中最常用的两种数据交换格式。XML 格式由 W3C 于 1996 年提出。JSON 格式由 Douglas Crockford 于 2020 年提出。虽然这两种格式的设计目标并不相同,但它们常常用于数据交换中。XML 和 JSON 的文档都很完善([RFC 7159][1], [RFC 4825][2]),且都同时具有人类可读性human-readable机器可读性machine-readable。这两种格式并没有哪一个比另一个更强,只是各自适用的领域不用。(LCTT译注:W3C 是[互联网联盟](https://www.w3.org/),制定了各种 Web 相关的标准,如 HTML、CSS 等。Douglas Crockford 除了制定了 JSON 格式,还致力于改进 JavaScript,开发了 JavaScript 相关工具 [JSLint](http://jslint.com/) 和 [JSMin](http://www.crockford.com/javascript/jsmin.html)。) ### XML 的优点 -There are several advantages that XML has over JSON. One of the biggest differences between the two is that in XML you can put metadata into the tags in the form of attributes. With JSON, the programmer could accomplish the same goal that metadata achieves by making the entity an object and adding the attributes as members of the object. However, the way XML does it may often be preferable, given the slightly misleading nature of turning something into an object that is not one in the client program. For example, if your C++ program sends an int via JSON and needs metadata to be sent along with it, you would have to make it an object, with one name/value pair for the actual value of the int, and more name/value pairs for each attribute. The program that receives the JSON would read it as an object, when in fact it is not one. While this is a viable solution, it defies one of JSON’s key advantages: “JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] -XML 与 JSON 相比有很多优点。二者间最大的不同在于使用 XML 时可以通过在标签中添加属性这一简单的方法来存储元数据metadata。而使用 JSON 时需要创建一个对象,把元数据当作对象的成员来存储。虽然二者都能达到存储元数据的目的,但在这一情况下通常选择 XML,因为 JSON 的表达形式会让客户端程序误以为要将数据转换成一个对象。举个例子,如果你的 C++ 程序需要使用 JSON 格式发送一个附带元数据的整型数据,需要创建一个对象,用对象中的一个名称/值对name/value pair来记录整型数据的值,再为每一个附带的属性添加一个名称/值对。接收到这个 JSON 的程序在读取后很可能把它当成一个对象,可事实并不是这样。虽然这是使用 JSON 传递元数据的一种变通方法,但他违背了 JSON 的核心优势:“JSON 的结构与常规的程序语言中的结构相对应,而无需修改。JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] +XML 与 JSON 相比有很多优点。二者间最大的不同在于 XML 可以通过在标签中添加属性这一简单的方法来存储元数据metadata。而使用 JSON 时需要创建一个对象,把元数据当作对象的成员来存储。虽然二者都能达到存储元数据的目的,但在这一情况下 XML 往往是更好的选择,因为 JSON 的表达形式会让客户端程序开发人员误以为要将数据转换成一个对象。举个例子,如果你的 C++ 程序需要使用 JSON 格式发送一个附带元数据的整型数据,需要创建一个对象,用对象中的一个名称/值对name/value pair来记录整型数据的值,再为每一个附带的属性添加一个名称/值对。接收到这个 JSON 的程序在读取后很可能把它当成一个对象,可事实并不是这样。虽然这是使用 JSON 传递元数据的一种变通方法,但他违背了 JSON 的核心理念:“JSON 的结构与常规的程序语言中的结构相对应,而无需修改。JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] -Although I will argue later that this can also be a drawback of XML, its mechanism to resolve name conflicts, prefixes, gives it power that JSON does not have. With prefixes, the programmer has the ability to name two different kinds of entities the same thing.[1] This would be advantageous in situations where the different entities should have the same name in the client program, perhaps if they are used in entirely different scopes. -虽然我后面会说这也是 XML 的一个缺点,但 XML 中处理命名冲突、前缀prefix的机制赋予了它 JSON 所不具备的能力。程序员们使用前缀可以给两个不同的实体使用同一名称。[1]当不同的实体在客户端中使用的名称相同时,这一特性会非常有用。 +虽然稍后我会说这也是 XML 的一个缺点,但 XML 中对命名冲突、前缀prefix的处理机制赋予了它 JSON 所不具备的能力。程序员们可以通过前缀来把统一名称给予两个不同的实体。[1]当不同的实体在客户端中使用的名称相同时,这一特性会非常有用。 -Another advantage of XML is that most browsers render it in a highly readable and organized way. The tree structure of XML lends itself well to this formatting, and allows for browsers to let users to naturally collapse individual tree elements. This feature would be particularly useful in debugging. XML 的另一个优势在于大多数的浏览器可以把它以具有高可读性和强组织性的方式highly readable and organized way展现给用户。XML 的树形结构让它易于结构化,浏览器也让用户可以自行展开或折叠树中的元素,这简直就是调试的福音。 -One of the most significant advantages that XML has over JSON is its ability to communicate mixed content, i.e. strings that contain structured markup. In order to handle this with XML, the programmer need only put the marked-up text within a child tag of the parent in which it belongs. Similar to the metadata situation, since JSON only contains data, there is no such simple way to indicate markup. It would again require storing metadata as data, which could be considered an abuse of the format. -XML 对比 JSON 有一个很重要的能力就是它可以混合多种内容mixed content。例如在 XML 中处理包含结构化标记的字符串时,程序员们只要把带有标记的文本放在一个标签内就可以了。而且和元数据的处理类似,由于 JSON 只包含数据,没有用于指明标签的简单方式。虽然这里还可以使用处理元数据的解决方法,但这总有点误用格式之嫌。 +XML 对比 JSON 有一个很重要的优势就是它可以记录混合内容mixed content。例如在 XML 中处理包含结构化标记的字符串时,程序员们只要把带有标记的文本放在一个标签内就可以了。可因为 JSON 只包含数据,没有用于指明标签的简单方式,虽然可以使用处理元数据的解决方法,但这总有点滥用之嫌。 ### JSON 的优点 -JSON has several advantages as well. One of the most obvious of these is that JSON is significantly less verbose than XML, because XML necessitates opening and closing tags (or in some cases less verbose self-closing tags), and JSON uses name/value pairs, concisely delineated by “{“ and “}” for objects, “[“ and “]” for arrays, “,” to separate pairs, and “:” to separate name from value. Even when zipped (using gzip), JSON is still smaller and it takes less time to zip it.[6] As determined by Sumaray and Makki as well as Nurseitov, Paulson, Reynolds, and Izurieta in their experimental findings, JSON outperforms XML in a number of ways. First, naturally following from its conciseness, JSON files that contain the same information as their XML counterparts are almost always significantly smaller, which leads to faster transmission and processing. Second, difference in size aside, both groups found that JSON was serialized and deserialized drastically faster than XML.[3][4] Third, the latter study determined that JSON processing outdoes XML in CPU resource utilization. They found that JSON used less total resources, more user CPU, and less system CPU. The experiment used RedHat machines, and RedHat claims that higher user CPU usage is preferable.[3] Unsurprisingly, the Sumaray and Makki study determined that JSON performance is superior to XML on mobile devices too.[4] This makes sense, given that JSON uses less resources, and mobile devices are less powerful than desktop machines. -JSON 自身也有很多优点。其最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要标签的打开和关闭,而 JSON 使用名称/值对,使用简单的“{”和“}”来标记对象,“\[”和“\]”来标记数组,“,”来表示数据的分隔,“:”表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[6]正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这就意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究[3][4]表明使用 JSON 序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理会使用更多的 CPU 资源。他们发现 JSON 在总体上使用的资源更少,但在用户空间消耗更多的 CPU 资源,同时系统空间消耗更少的 CPU 资源。这一实验是在 RedHat 的设备上进行的,RedHat 更倾向于在用户空间消耗更多的 CPU 资源。[3]不出意外,Sumaray 和 Makki 的研究里还说明了在移动设备上 JSON 的性能也优于 XML。[4]这说得通,因为 JSON 在整体上消耗的资源更少,而且移动设备也没有台式机那么强劲。 +JSON 自身也有很多优点。其中最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要标签的打开和关闭,而 JSON 使用名称/值对表示数据,使用简单的“{”和“}”来标记对象,“\[”和“\]”来标记数组,“,”来表示数据的分隔,“:”表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[6]正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究[3][4]表明使用 JSON 执行序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理在 CPU 资源的使用上也优于 XML。研究人员发现 JSON 在总体上使用的资源更少,其中更多的 CPU 资源消耗在用户空间,系统空间消耗的 CPU 资源较少。这一实验是在 RedHat 的设备上进行的,RedHat 表示更倾向于在用户空间使用 CPU 资源。[3]不出意外,Sumaray 和 Makki 在研究里还说明了在移动设备上 JSON 的性能也优于 XML。[4]这很直接,因为 JSON 消耗的资源更少,移动设备的性能也更弱。 -Yet another advantage that JSON has over XML is that its representation of objects and arrays allows for direct mapping onto the corresponding data structures in the host language, such as objects, records, structs, dictionaries, hash tables, keyed lists, and associative arrays for objects, and arrays, vectors, lists, and sequences for arrays.[2] Although it is perfectly possible to represent these structures in XML, it is only as a function of the parsing, and it takes more code to serialize and deserialize properly. It also would not always be obvious to the reader of arbitrary XML what tags represent an object and what tags represent an array, especially because nested tags can just as easily be structured markup instead. The curly braces and brackets of JSON definitively show the structure of the data. However, this advantage does come with the caveat explained above, that the JSON can inaccurately represent the data if the need arises to send metadata. -JSON 的另一个优点在于其对对象和数组的描述允许宿主语言host language直接将它映射到对应数据结构上,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有对象组成的数组,以及数组array向量vector列表list等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,因为 XML 标准缺乏对象、数组的标签的明确定义,尤其是嵌套的标签可以简单的使用结构化的标记替代时。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也符合前文中的警告,在包含元数据时 JSON 的表示不如 XML 精确。 +JSON 的另一个优点在于其对对象和数组的表述和宿主语言host language中的数据结构相对应,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有数组array向量vector列表list,以及对象组成的数组等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但往往需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,XML 标准缺乏对象、数组的标签的明确定义。当结构化的标记可以替代嵌套的标签时,JSON 的优势极为突出。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也包含前文中的问题,在表示元数据时 JSON 不如 XML 准确。 -Although XML supports namespaces and prefixes, JSON’s handling of name collisions is less verbose than prefixes, and arguably feels more natural with the program using it; in JSON, each object is its own namespace, so names may be repeated as long as they are in different scopes. This may be preferable, as in most programming languages members of different objects can have the same name, because they are distinguished by the names of the objects to which they belong. -虽然 XML 支持命名空间namespace前缀prefix,但这不代表 JSON 没有处理命名冲突的能力。比起 XML 的前缀,它处理命名冲突的方式更简洁,在程序中的处理也更自然。在 JSON 里,每一个对象都在它自己的命名空间中,因此不同对象内的元素可以随意的重复。因为在大多数编程语言中,不同的对象中的成员可以包含相同的名字,所以 JSON 根据对象名称进行区分的规则在处理时更加自然。 +虽然 XML 支持命名空间namespace前缀prefix,但这不代表 JSON 没有处理命名冲突的能力。比起 XML 的前缀,它处理命名冲突的方式更简洁,在程序中的处理也更自然。在 JSON 里,每一个对象都在它自己的命名空间中,因此不同对象内的元素名称可以随意重复。在大多数编程语言中,不同的对象中的成员可以包含相同的名字,所以 JSON 根据对象进行名称区分的规则在处理时更加自然。 -Perhaps the most significant advantage that JSON has over XML is that JSON is a subset of JavaScript, so code to parse and package it fits very naturally into JavaScript code. This seems highly beneficial for JavaScript programs, but does not directly benefit any programs that use languages other than JavaScript. However, this drawback has been largely overcome, as currently the JSON website lists over 175 tools for 64 different programming languages that exist to integrate JSON processing. While I cannot speak to the quality of most of these tools, it is clear that the developer community has embraced JSON and has made it simple to use in many different platforms. -也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都继承了 JSON 处理功能。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 +也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都实现了处理 JSON 所需的函数。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 ### 二者的动机 -Simply put, XML’s purpose is document markup. This is decidedly not a purpose of JSON, so XML should be used whenever this is what needs to be done. It accomplishes this purpose by giving semantic meaning to text through its tree-like structure and ability to represent mixed content. Data structures can be represented in XML, but that is not its purpose. -简单地说,XML 的目标是完成一种文档标记。这和 JSON 的目标想去甚远,所以只要用得到 XML 的地方就尽管用。它使用树形的结构和包含语义的文本来表达混合内容以达成这一目标。XML 可以表示数据的结构,但这并不是它的初衷。 +简单地说,XML 的目标是完成一种文档标记。这和 JSON 的目标想去甚远,所以只要用得到 XML 的地方就尽管用。它使用树形的结构和包含语义的文本来表达混合内容以实现这一目标。在 XML 中可以表示数据的结构,但这并不是它的长处。 JSON’s purpose is structured data interchange. It serves this purpose by directly representing objects, arrays, numbers, strings, and booleans. Its purpose is distinctly not document markup. As described above, JSON does not have a natural way to represent mixed content. -JSON 的目标是完成一种结构化的数据交换。它直接使用对象、数组、数字、字符串、布尔值这些元素来达成这一目标。这完全不同于文档标记语言。正如上面说的那样,JSON 本身不存在表示混合内容的方法。 +JSON 的目标是用于数据交换的一种结构化表示。它直接使用对象、数组、数字、字符串、布尔值这些元素来达成这一目标。这完全不同于文档标记语言。正如上面说的那样,JSON 没有原生支持混合内容mixed content的记录。 ### 软件 -The following major public APIs uses XML only: Amazon Product Advertising API. 这些主流的开放 API 仅提供 XML:亚马逊产品广告 APIAmazon Product Advertising API。 -The following major APIs use JSON only: Facebook Graph API, Google Maps API, Twitter API, AccuWeather API, Pinterest API, Reddit API, Foursquare API. 这些主流 API 仅提供 JSON:脸书图 APIFacebook Graph API谷歌地图 APIGoogle Maps API推特 APITwitter API,AccuWeather API,Pinterest API,Reddit API,Foursquare API。 -The following major APIs use both XML and JSON: Google Cloud Storage, Linkedin API, Flickr API 这些主流 API 同时提供 XML 和 JSON:谷歌云存储Google Cloud Storage领英 APILinkedin API,Flickr API。 -Of the top 10 most popular APIs according to Programmable Web[9], along with a couple more popular ones, only one supports XML and not JSON. Several support both, and several support only JSON. Among developer APIs for modern and popular websites, JSON clearly seems to be preferred. This also indicates that more app developers that use these APIs prefer JSON. This is likely a result of its reputation as the faster and leaner of the two. Furthermore, most of these APIs communicate data rather than documents, so JSON would be more appropriate. For example, Facebook is mainly concerned with communicating data about users and posts, Google Maps deals in coordinates and information about entities on their maps, and AccuWeather just sends weather data. Overall, it is impossible to say whether JSON or XML is currently used more in APIs, but the trend is certainly swinging towards JSON.[10][11] -根据可编程网络Programmable Web[9]的数据,最流行的 10 个 API 中只有一个是仅提供 XML 且不支持 JSON 的。其他的要么同时支持 XML 和 JSON,要么只支持 JSON。这表明了大多数应用开发者都更倾向于使用支持 JSON 的 API,原因大概是因为 JSON 的处理更快的良好口碑和与 XML 相比相对轻量。此外,大多数 API 只是传递数据而非文档,所以 JSON 更加合适。例如 Facebook 的重点在于用户的交流与帖子,谷歌地图则主要处理坐标和地图信息,AccuWeather 就只传递天气数据。总之,虽然不能说天气 API 在使用时究竟是 JSON 用的多还是 XML 用的多,但是趋势明确偏向了 JSON。[10][11] +根据可编程网络Programmable Web[9]的数据,最流行的 10 个 API 中只有一个是仅提供 XML 且不支持 JSON 的。其他的要么同时支持 XML 和 JSON,要么只支持 JSON。这表明了大多数应用开发者都更倾向于使用支持 JSON 的 API,原因大概是 JSON 更快的处理速度与良好口碑,加之与 XML 相比更加轻量。此外,大多数 API 只是传递数据而非文档,所以 JSON 更加合适。例如 Facebook 的重点在于用户的交流与帖子,谷歌地图则主要处理坐标和地图信息,AccuWeather 就只传递天气数据。总之,虽然不能说天气 API 在使用时究竟是 JSON 用的多还是 XML 用的多,但是趋势明确偏向了 JSON。[10][11] -The following major desktop software uses XML only: Microsoft Word, Apache OpenOffice, LibreOffice. 这些主流的桌面软件仍然只是用 XML:Microsoft Word,Apache OpenOffice,LibraOffice。 -It makes sense for software that is mainly concerned with document creation, manipulation, and storage to use XML rather than JSON. Also, all three of these programs support mixed content, which JSON does not do well. For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. 因为这些软件需要考虑引用、格式、存储等等,所以比起 JSON,XML 优势更大。另外,这三款程序都支持混合内容,而 JSON 在这一点上做得并不如 XML 好。举例说明,当用户使用 Microsoft Word 编辑一篇论文时,用户需要使用不同的文字字形、文字大小、文字颜色、页边距、段落格式等,而 XML 结构化的组织形式与标签属性生来就是为了表达这些信息的。 -The following major databases support XML: IBM DB2, Microsoft SQL Server, Oracle Database, PostgresSQL, BaseX, eXistDB, MarkLogic, MySQL. 这些主流的数据库支持 XML:IBM DB2,Microsoft SQL Server,Oracle Database,PostgresSQL,BaseX,eXistDB,MarkLogic,MySQL。 -The following major databases support JSON: MongoDB, CouchDB, eXistDB, Elastisearch, BaseX, MarkLogic, OrientDB, Oracle Database, PostgresSQL, Riak. 这些是支持 JSON 的主流数据库:MongoDB,CouchDB,eXistDB,Elastisearch,BaseX,MarkLogic,OrientDB,Oracle Database,PostgresSQL,Riak。 -For a long time, SQL and the relational database model dominated the market. Corporate giants like Oracle and Microsoft have always marketed such databases. However, in the last decade, there has been a major rise in popularity of NoSQL databases. As this has coincided with the rise of JSON, most NoSQL databases support JSON, and some, such as MongoDB, CouchDB, and Riak use JSON to store their data. These databases have two important qualities that make them better suited for modern websites: they are generally more scalable than relational SQL databases, and they are designed to the core to run in the Web.[10] Since JSON is more lightweight and a subset of JavaScript, it suits NoSQL databases well, and helps facilitate these two qualities. In addition, many older databases have added support for JSON, such as Oracle Database and PostgresSQL. Conversion between XML and JSON is a hassle, so naturally, as more developers use JSON for their apps, more database companies have incentive to support it.[7] -在很长一段时间里,SQL 和关系型数据库统治着整个数据库市场。像甲骨文Oracle微软Microsoft这样的软件巨头都提供这类数据库,然而近几年 NoSQL 数据库正逐步受到开发者的青睐。也许是正巧碰上了 JSON 的普及,大多数 NoSQL 数据库都支持 JSON,甚至像 MongoDB、CouchDB 和 Riak 这样的数据库使用 JSON 来存储数据。这些数据库有两个重要的品质是它们适用于现代网站:一是它们与关系型数据库相比更容易扩展more scalable;二是它们设计的目标 web 运行所需的核心组件。由于 JSON 更加轻量,又是 JavaScript 的子集,所以很适合 NoSQL 数据库,并且让这两个品质更容易实现。此外,许多旧的关系型数据库增加了 JSON 支持,例如 Oracle Database 和 PostgresSql。由于 XML 与 JSON 间的转换比较麻烦,所以大多数开发者会直接在他们的应用里使用 JSON,因此开发数据库的公司才有支持 JSON 的理由。(LCTT译注:NoSQL是对不同于传统的关系数据库的数据库管理系统的统称。[参考来源](https://zh.wikipedia.org/wiki/NoSQL)) +在很长一段时间里,SQL 和关系型数据库统治着整个数据库市场。像甲骨文Oracle微软Microsoft这样的软件巨头都提供这类数据库,然而近几年 NoSQL 数据库正逐步受到开发者的青睐。也许是正巧碰上了 JSON 的普及,大多数 NoSQL 数据库都支持 JSON,像 MongoDB、CouchDB 和 Riak 这样的数据库甚至使用 JSON 来存储数据。这些数据库有两个重要的特性是它们适用于现代网站:一是它们与关系型数据库相比更容易扩展more scalable;二是它们设计的目标就是 web 运行所需的核心组件。由于 JSON 更加轻量,又是 JavaScript 的子集,所以很适合 NoSQL 数据库,并且让这两个品质更容易实现。此外,许多旧的关系型数据库增加了 JSON 支持,例如 Oracle Database 和 PostgresSql。由于 XML 与 JSON 间的转换比较麻烦,所以大多数开发者会直接在他们的应用里使用 JSON,因此开发数据库的公司才有支持 JSON 的理由。(LCTT译注:NoSQL是对不同于传统的关系数据库的数据库管理系统的统称。[参考来源](https://zh.wikipedia.org/wiki/NoSQL)) ### 未来 -One of the most heavily anticipated changes in the Internet is the “Internet of Things”, i.e. the addition to the Internet of non-computer devices such as watches, thermostats, televisions, refrigerators, etc. This movement is well underway, and is expected to explode in the near future, as predictions for the number of devices in the Internet of Things in 2020 range from about 26 billion to 200 billion.[12][13][13] Almost all of these devices are smaller and less powerful than laptop and desktop computers. Many of them only run embedded systems. Thus, when they have the need to exchange data with other entities in the Web, the lighter and faster JSON would naturally be preferable to XML.[10] Also, with the recent rapid rise of JSON use in the Web relative to XML, new devices may benefit more from speaking JSON. This highlights an example of Metcalf’s Law; whether XML or JSON or something entirely new becomes the most popular format in the Web, newly added devices and all existing devices will benefit much more if the newly added devices speak the most popular language. -对互联网的变革中,最让人期待的便是物联网Internet of Things。这会给互联网带来大量的非计算机设备,例如手表、温度计、电视、冰箱等等。这一势头的发展良好,预期将在不久的将来迎来爆发式的增长。据估计,到 2020 年时会有 260 亿 到 2000 亿的物联网设备被接入互联网。[12][13] 几乎所有的物联网设备都是小型设备,此外比笔记本或者台式电脑的性能要弱很多。大多数都是嵌入式系统。因此,当他们需要与 web 上的系统交换数据时,更轻量,更快速的 JSON 自然比 XML 更受青睐。[10] 受益于 JSON 在 web 上的快速普及,与 XML 相比,这些新的物联网设备更有可能从使用 JSON 中受益。这是一个典型的梅特卡夫定律的实例,无论是 XML 还是 JSON,抑或是什么其他全新的格式,现存的设备和新的设备都会从支持最广泛使用的格式中受益。 +对互联网的种种变革中,最让人期待的便是物联网Internet of Things。这会给互联网带来大量计算机之外的设备,例如手表、温度计、电视、冰箱等等。这一势头的发展良好,预期在不久的将来迎来爆发式的增长。据估计,到 2020 年时会有 260 亿 到 2000 亿的物联网设备被接入互联网。[12][13] 几乎所有的物联网设备都是小型设备,因此性能比笔记本或台式电脑要弱很多,而且大多数都是嵌入式系统。因此,当他们需要与互联网上的系统交换数据时,更轻量,更快速的 JSON 自然比 XML 更受青睐。[10] 受益于 JSON 在 web 上的快速普及,与 XML 相比,这些新的物联网设备更有可能从使用 JSON 中受益。这是一个典型的梅特卡夫定律的例子,无论是 XML 还是 JSON,抑或是什么其他全新的格式,现存的设备和新的设备都会从支持最广泛使用的格式中受益。 -With the creation and recent rapid increase in popularity of Node.js, a server-side JavaScript framework, along with NoSQL databases like MongoDB, full-stack JavaScript development has become a reality. This bodes well for the future of JSON, as with these new apps, JSON is spoken at every level of the stack, which generally makes the apps very fast and lightweight. This is a desirable trait for any app, so this trend towards full-stack JavaScript is not likely to die out anytime soon.[10] -Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。这些发展预示着 JSON 光明的未来,这些软件让 JSON 运用在全栈开发的每一个环节中,使应用更加轻量,响应更快。这也是任何应用的追求之一,所以,全栈使用 JavaScript 的趋势在不久的将来都不会消退。[10] +Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。这些都预示着 JSON 光明的未来,这些软件的出现让 JSON 运用在全栈开发的每一个环节成为可能,这将使应用更加轻量,响应更快。这也是任何应用的追求之一,所以,全栈使用 JavaScript 的趋势在不久的未来都不会消退。[10] -Another existing trend in the world of app development is toward REST and away from SOAP.[11][15][16] Both XML and JSON can be used with REST, but SOAP exclusively uses XML. 此外,另一个应用开发的趋势是从 SOAP 转向 REST。[11][15][16] XML 和 JSON 都可以用于 REST,可 SOAP 只能使用 XML。 -The given trends indicate that JSON will continue to dominate the Web, and XML use will continue to decrease. This should not be overblown, however, because XML is still very heavily used in the Web, and it is the only option for apps that use SOAP. Given the widespread migration from SOAP to REST, the rise of NoSQL databases and full-stack JavaScript, and the far superior performance of JSON, I believe that JSON will soon be much more widely used than XML in the Web. There seem to be very few applications where XML is the better choice. -从这些事实中可以推断,JSON 会发展将统一 Web 的信息交换格式,XML 的使用率将继续降低。虽然不应该把 JSON 吹过头了,因为 XML 在 Web 中的使用依旧很广,而且它还是 SOAP 的唯一选择,可考虑到 SOAP 到 REST 的迁移,NoSQL 数据库和全栈 JavaScript 的兴起,JSON 的卓越性能,我相信 JSON 很快就会在 Web 开发中超过 XML。至于其他领域,把 XML 作为更好的选择的情况似乎并不多。 +从这些趋势中可以推断,JSON 的发展将统一 Web 的信息交换格式,XML 的使用率将继续降低。虽然不应该把 JSON 吹过头了,因为 XML 在 Web 中的使用依旧很广,而且它还是 SOAP 的唯一选择,可考虑到 SOAP 到 REST 的迁移,NoSQL 数据库和全栈 JavaScript 的兴起,JSON 卓越的性能,我相信 JSON 很快就会在 Web 开发中超过 XML。至于其他领域,XML 比 JSON 更好的情况并不多。 ### 参考链接 @@ -121,7 +98,7 @@ via: https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/Fi 作者:[TOM STRASSNER][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[wwhio](https://github.com/wwhio) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2cd55a34fdb34bb9a78fc1625c09b12348302f90 Mon Sep 17 00:00:00 2001 From: wwhio Date: Tue, 5 Feb 2019 21:45:57 +0800 Subject: [PATCH 012/813] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {sources => translated}/talk/20150513 XML vs JSON.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20150513 XML vs JSON.md (100%) diff --git a/sources/talk/20150513 XML vs JSON.md b/translated/talk/20150513 XML vs JSON.md similarity index 100% rename from sources/talk/20150513 XML vs JSON.md rename to translated/talk/20150513 XML vs JSON.md From 6599513772ea90c2db74aab069ec864b848fc863 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Feb 2019 22:18:25 +0800 Subject: [PATCH 013/813] PRF:20190126 Get started with Tint2, an open source taskbar for Linux.md @geekpi --- ...d with Tint2, an open source taskbar for Linux.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md index ef58de9fe5..544d674904 100644 --- a/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md +++ b/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -7,10 +7,10 @@ [#]: via: (https://opensource.com/article/19/1/productivity-tool-tint2) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 Tint2,一款 Linux 中的开源任务栏 +开始使用 Tint2 吧,一款 Linux 中的开源任务栏 ====== -Tint2 是我们在开源工具系列中的第 14 个工具,它将在 2019 年提高你的工作效率,能在任何窗口管理器中提供一致的用户体验。 +> Tint2 是我们在开源工具系列中的第 14 个工具,它将在 2019 年提高你的工作效率,能在任何窗口管理器中提供一致的用户体验。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_hardware_purple.png?itok=3NdVoYhl) @@ -20,7 +20,7 @@ Tint2 是我们在开源工具系列中的第 14 个工具,它将在 2019 年 ### Tint2 -让我提高工作效率的最佳方法之一是使用尽可能不让我分心的干净界面。作为 Linux 用户,这意味着使用一种最小的窗口管理器,如 [Openbox][1]、[i3][2] 或 [Awesome][3]。它们每种都有让我更有效率的自定义选项。但让我失望的一件事是,它们都没有一致的配置,所以我不得不经常重新调整我的窗口管理器。 +让我提高工作效率的最佳方法之一是使用尽可能不让我分心的干净界面。作为 Linux 用户,这意味着使用一种极简的窗口管理器,如 [Openbox][1]、[i3][2] 或 [Awesome][3]。它们每种都有让我更有效率的自定义选项。但让我失望的一件事是,它们都没有一致的配置,所以我不得不经常重新调整我的窗口管理器。 ![](https://opensource.com/sites/default/files/uploads/tint2-1.png) @@ -30,7 +30,7 @@ Tint2 是我们在开源工具系列中的第 14 个工具,它将在 2019 年 ![](https://opensource.com/sites/default/files/uploads/tint2-2.png) -启动配置工具能让你选择主题并自定义屏幕的顶部、底部和侧边栏。我建议从最接近你想要的主题开始,然后从那里进行自定义。 +启动该配置工具能让你选择主题并自定义屏幕的顶部、底部和侧边栏。我建议从最接近你想要的主题开始,然后从那里进行自定义。 ![](https://opensource.com/sites/default/files/uploads/tint2-3.png) @@ -47,7 +47,7 @@ via: https://opensource.com/article/19/1/productivity-tool-tint2 作者:[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/) 荣誉推出 @@ -56,4 +56,4 @@ via: https://opensource.com/article/19/1/productivity-tool-tint2 [1]: http://openbox.org/wiki/Main_Page [2]: https://i3wm.org/ [3]: https://awesomewm.org/ -[4]: https://gitlab.com/o9000/tint2 \ No newline at end of file +[4]: https://gitlab.com/o9000/tint2 From 4e4e7fae842ff9e86374a5736fef77b740d51c54 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Feb 2019 22:18:54 +0800 Subject: [PATCH 014/813] PRF:20190126 Get started with Tint2, an open source taskbar for Linux.md --- ... Get started with Tint2, an open source taskbar for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md index 544d674904..bcc0240972 100644 --- a/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md +++ b/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Tint2, an open source taskbar for Linux) From d55b4ea37cf76ceb904b746e1267b4480539c05f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Feb 2019 22:19:36 +0800 Subject: [PATCH 015/813] PUB:20190126 Get started with Tint2, an open source taskbar for Linux.md @geekpi https://linux.cn/article-10511-1.html --- ...et started with Tint2, an open source taskbar for Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190126 Get started with Tint2, an open source taskbar for Linux.md (97%) diff --git a/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md b/published/20190126 Get started with Tint2, an open source taskbar for Linux.md similarity index 97% rename from translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md rename to published/20190126 Get started with Tint2, an open source taskbar for Linux.md index bcc0240972..1efd095a38 100644 --- a/translated/tech/20190126 Get started with Tint2, an open source taskbar for Linux.md +++ b/published/20190126 Get started with Tint2, an open source taskbar for Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10511-1.html) [#]: subject: (Get started with Tint2, an open source taskbar for Linux) [#]: via: (https://opensource.com/article/19/1/productivity-tool-tint2) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From f08fb567fff0025ff82892082f23c869eb5d612c Mon Sep 17 00:00:00 2001 From: sndnvaps Date: Wed, 6 Feb 2019 00:13:52 +0800 Subject: [PATCH 016/813] Update 20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将其翻译成中文,首次翻译,可能会较多的问题。请多谅解。 --- ...Locally As Virtual File System In Linux.md | 103 +++++++++--------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md b/sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md index 3f804ffe9e..8fbde8ed43 100644 --- a/sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md +++ b/sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md @@ -1,23 +1,24 @@ -How To Mount Google Drive Locally As Virtual File System In Linux + +如何把Google Driver当做虚拟磁盘一样挂载到Linux操作系统 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/07/Google-Drive-720x340.png) -[**Google Drive**][1] is the one of the popular cloud storage provider on the planet. As of 2017, over 800 million users are actively using this service worldwide. Even though the number of users have dramatically increased, Google haven’t released a Google drive client for Linux yet. But it didn’t stop the Linux community. Every now and then, some developers had brought few google drive clients for Linux operating system. In this guide, we will see three unofficial google drive clients for Linux. Using these clients, you can mount Google drive locally as a virtual file system and access your drive files in your Linux box. Read on. +[**Google Drive**][1] 是全球比较受欢迎的云存储平台. 直到2017年, 全球有超过8亿的活跃用户在使用它。即使用户数在持续增长,但直到现在Google还是没有发布一款可以在Linux平台使用的客户端。但这难不倒Linux开源组织的大神。 不时,一些开发者已经把功能实现了。 下面我将会介绍三个用于Linux系统非官方开发的Google Driver客户端。使用这些客户端,你能把Google Driver像虚拟磁盘一样挂载到Linux系统。 请记好笔记了。 ### 1. Google-drive-ocamlfuse +**google-driver-ocamlfuse** 把Google Driver当做是一个FUSE类型的文件系统,是用OCam语言写的。FUSE到底是何物,用户态文件系统,此项目允许非管理员用户在用户空间开发文件系统。 **google-drive-ocamlfuse** 可以让你把Google Driver当做磁盘一样挂载到Linux系统。支持对文件和目录的读写操作,支持只读操作,支持多用户,支持拖拉文件,支持访问Google Driver的回收站,等操作。 -The **google-drive-ocamlfuse** is a FUSE filesystem for Google Drive, written in OCaml. For those wondering, FUSE, stands for **F** ilesystem in **Use** rspace, is a project that allows the users to create virtual file systems in user level. **google-drive-ocamlfuse** allows you to mount your Google Drive on Linux system. It features read/write access to ordinary files and folders, read-only access to Google docks, sheets, and slides, support for multiple google drive accounts, duplicate file handling, access to your drive trash directory, and more. -#### Installing google-drive-ocamlfuse +#### 安装 google-drive-ocamlfuse -google-drive-ocamlfuse is available in the [**AUR**][2], so you can install it using any AUR helper programs, for example [**Yay**][3]. +google-drive-ocamlfuse 能在Arch系统的[**AUR**][2]上直接找到, 所以这安装起来就比较简单了, 使用[**Yay**][3]命令直接安装。 ``` $ yay -S google-drive-ocamlfuse ``` -On Ubuntu: +在Ubuntu系统: ``` $ sudo add-apt-repository ppa:alessandro-strada/ppa $ sudo apt-get update @@ -25,7 +26,7 @@ $ sudo apt-get install google-drive-ocamlfuse ``` -To install latest beta version, do: +安装最新的测试版本: ``` $ sudo add-apt-repository ppa:alessandro-strada/google-drive-ocamlfuse-beta $ sudo apt-get update @@ -33,143 +34,140 @@ $ sudo apt-get install google-drive-ocamlfuse ``` -#### Usage +#### 使用方法 -Once installed, run the following command to launch **google-drive-ocamlfuse** utility from your Terminal: +安装完成后,直接在终端里面输入如下命令,就可以启动**google-drive-ocamlfuse**程序了: ``` $ google-drive-ocamlfuse ``` - -When you run this first time, the utility will open your web browser and ask your permission to authorize your google drive files. Once you gave authorization, all necessary config files and folders it needs to mount your google drive will be automatically created. +当你第一次运行命令,程序会直接打开你的浏览器并要求你确认是否对Google Driver的操作进行授权。当你确认授权后,授权信息和挂载Google Driver用到的目录都会自动进行创建的。 ![][5] -After successful authentication, you will see the following message in your Terminal. +当成功授权后,你会在终端里面看到如下的信息。 ``` Access token retrieved correctly. ``` - -You’re good to go now. Close the web browser and then create a mount point to mount your google drive files. +好了,我们可以进行下一步操作了。关闭浏览器并为我们的Google Driver创建一个挂载点吧。 ``` $ mkdir ~/mygoogledrive ``` - -Finally, mount your google drive using command: +最后操作,使用如下命令挂载Google Driver: ``` $ google-drive-ocamlfuse ~/mygoogledrive ``` -Congratulations! You can access access your files either from Terminal or file manager. +恭喜你了!你可以使用终端或文件管理器来访问Google Driver里面的文件了。 -From **Terminal** : +使用 **终端** : ``` $ ls ~/mygoogledrive ``` -From **File manager** : +使用 **文件管理器** : ![][6] -If you have more than one account, use **label** option to distinguish different accounts like below. +如何你有不止一个账户,可以使用**label**命令对其进行区分不同的账户,就像下面一样 ``` $ google-drive-ocamlfuse -label label [mountpoint] ``` -Once you’re done, unmount the FUSE flesystem using command: +当操作完成后,你可以使用如下的命令卸载Google Driver: ``` $ fusermount -u ~/mygoogledrive ``` -For more details, refer man pages. +获取更多信息,你可以命令用户操作手册。 ``` $ google-drive-ocamlfuse --help ``` -Also, do check the [**official wiki**][7] and the [**project GitHub repository**][8] for more details. +当然你也可以看看[**官方文档**][7]和[**Github项目**][8] 以获取更多内容。 ### 2. GCSF -**GCSF** is a FUSE filesystem based on Google Drive, written using **Rust** programming language. The name GCSF has come from the Romanian word “ **G** oogle **C** onduce **S** istem de **F** ișiere”, which means “Google Drive Filesystem” in English. Using GCSF, you can mount your Google drive as a local virtual file system and access the contents from the Terminal or file manager. You might wonder how it differ from other Google Drive FUSE projects, for example **google-drive-ocamlfuse**. The developer of GCSF replied to a similar [comment on Reddit][9] “GCSF tends to be faster in several cases (listing files recursively, reading large files from Drive). The caching strategy it uses also leads to very fast reads (x4-7 improvement compared to google-drive-ocamlfuse) for files that have been cached, at the cost of using more RAM“. +**GCSF** 是Google Driver基于FUSE的文件系统,使用**Rust**语言编写。GCSF主要是来源于罗马尼亚语中的“ **G** oogle **C** onduce **S** istem de **F** ișiere”,翻译成英文就是“Google Drive Filesystem”(即Google Drive 文件系统)使用GCSF,你可以把Google Driver当做虚拟磁盘一样挂载到Linux系统,可以通过终端和文件管理器对其进行操作。你肯定会很好奇,这到底于其它的Google Dirver FUSE项目有什么不同,就比如**google-drive-ocamlfuse**。就类型的问题,GCSF的开发者有如下的回复[comment on Reddit][9] “GCSF意在某些方面更快(循环列举文件,从Google Driver中读取大文件)。缓存策略也能让读取速度更快(x4-7 的修改更突显了与google-drive-ocamlfuse的差别)当文件被结存后,此为浪费更多的内在”。 -#### Installing GCSF +#### 安装 GCSF -GCSF is available in the [**AUR**][10], so the Arch Linux users can install it using any AUR helper, for example [**Yay**][3]. +GCSF 能在[**AUR**][10]上面找到, 对于Arch用户来说直接使用AUR助手来安装就行了,例如[**Yay**][3]. ``` $ yay -S gcsf-git ``` -For other distributions, do the following. +对于其它的发行版本,需要进行如下的操作来进行安装。 -Make sure you have installed Rust on your system. +首先,你得确认系统中是否安装了Rust语言。 -Make sure **pkg-config** and the **fuse** packages are installed. They are available in the default repositories of most Linux distributions. For example, on Ubuntu and derivatives, you can install them using command: +确保**pkg-config**和**fuse**软件包是否安装了。它们在绝大多数的Linux发行片的默认仓库中都能找到。例如,在Ubuntu及其衍生版本中,你可以使用如下的命令进行安装: ``` $ sudo apt-get install -y libfuse-dev pkg-config ``` -Once all dependencies installed, run the following command to install GCSF: +当所有的依赖软件安装完成后,你可以使用如下的命令来安装GCSF: ``` $ cargo install gcsf ``` -#### Usage +#### 使用方法 -First, we need to authorize our google drive. To do so, simply run: +首先,我们需要对Google Driver的操作进行授权,跟上面的一样方法,终端输入如下命令: ``` $ gcsf login ostechnix ``` -You must specify a session name. Replace **ostechnix** with your own session name. You will see an output something like below with an URL to authorize your google drive account. +你必须要指定一个会话名称。使用自己的会话名称来代**ostechnix**。你会看到像下图的提示信息和Google Driver账户的授权验证连接。 ![][11] -Just copy and navigate to the above URL from your browser and click **allow** to give permission to access your google drive contents. Once you gave the authentication you will see an output like below. +直接把授权验证信息复制出来,并用浏览器打开它,并点击最下面的**allow**来完成授权操作。当完成授权后,你的终端会显示如下的信息。 ``` Successfully logged in. Credentials saved to "/home/sk/.config/gcsf/ostechnix". ``` -GCSF will create a configuration file in **$XDG_CONFIG_HOME/gcsf/gcsf.toml** , which is usually defined as **$HOME/.config/gcsf/gcsf.toml**. Credentials are stored in the same directory. +GCSF会把配置保存文件在**$XDG_CONFIG_HOME/gcsf/gcsf.toml**,一般文件会保存在**$HOME/.config/gcsf/gcsf.toml**。授权信息也会保存在此目录当中。 -Next, create a directory to mount your google drive contents. +下一步,创建一个用来挂载Google Driver的目录。 ``` $ mkdir ~/mygoogledrive ``` -Then, edit **/etc/fuse.conf** file: +之后,修改**/etc/fuse.conf**文件: ``` $ sudo vi /etc/fuse.conf ``` -Uncomment the following line to allow non-root users to specify the allow_other or allow_root mount options. +注释掉以下的行,以允许非管理员进行挂载操作(内容像allow_other或allow_root) ``` user_allow_other ``` -Save and close the file. +保存并关闭文件。 -Finally, mount your google drive using command: +最后一步,挂载Google Driver命令如下的命令: ``` $ gcsf mount ~/mygoogledrive -s ostechnix ``` -Sample output: +简单的终端输入内容: ``` INFO gcsf > Creating and populating file system... INFO gcsf > File sytem created. @@ -180,7 +178,7 @@ INFO gcsf::gcsf::file_manager > Checking for changes and possibly applying them. ``` -Again, replace **ostechnix** with your session name. You can view the existing sessions using command: +重复一次,使用自己的会话名来更换**ostechnix**。你可以命令如下的命令来查看已经存在的会话: ``` $ gcsf list Sessions: @@ -188,19 +186,19 @@ Sessions: ``` -You can now access your google drive contents either from the Terminal or from File manager. +你现在可以使用终端和文件管理器对Google Driver进行操作了。. -From **Terminal** : +使用**终端** : ``` $ ls ~/mygoogledrive ``` -From **File manager** : +使用**文件管理器** : ![][12] -If you don’t know where your Google drive is mounted, use **df** or **mount** command as shown below. +如果你不知道自己把Google Driver挂载到哪个目录了,可以使用**df**或者**mount**命令,就像下面一样。 ``` $ df -h Filesystem Size Used Avail Use% Mounted on @@ -218,23 +216,22 @@ GCSF on /home/sk/mygoogledrive type fuse (rw,nosuid,nodev,relatime,user_id=1000, ``` -Once done, unmount the google drive using command: +当操作完成后,你可以使用如下命令来卸载Google Driver: ``` $ fusermount -u ~/mygoogledrive ``` -Check the [**GCSF GitHub repository**][13] for more details. +浏览[**GCSF GitHub项目**][13]以获取更多内容。 ### 3. Tuxdrive -**Tuxdrive** is yet another unofficial google drive client for Linux. We have written a detailed guide about Tuxdrive a while ago. Please check the following link. +**Tuxdrive**是其它的非官方Linux Google Driver客户端。我们之前有写过一篇关于Tuxdrive比较详细的使用方法。你可以找一找之前的文档。 -Of course, there were few other unofficial google drive clients available in the past, such as Grive2, Syncdrive. But it seems that they are discontinued now. I will keep updating this list when I come across any active google drive clients. +这当然,还有其它的非官方的Google Driver客户端在过去有出现过,例如Grive2, Syncdrive。但它们好像都已经停止开发了。我会对这个列表进行持续的跟进当有更受欢迎的Google Driver客户端出现。 -And, that’s all for now, folks. Hope this was useful. More good stuffs to come. Stay tuned! -Cheers! +谢谢你的阅读。 @@ -244,7 +241,7 @@ via: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/sndnvaps) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9b4057c39be679abfe342187130c4ce544f9a8a7 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Tue, 5 Feb 2019 10:45:16 -0600 Subject: [PATCH 017/813] Submit Translated Passage for Review tomjlw submitted translated passage for review --- .../20171215 Top 5 Linux Music Players.md | 98 ++++++++----------- 1 file changed, 42 insertions(+), 56 deletions(-) diff --git a/sources/tech/20171215 Top 5 Linux Music Players.md b/sources/tech/20171215 Top 5 Linux Music Players.md index a57ad29c52..ceeef6fe77 100644 --- a/sources/tech/20171215 Top 5 Linux Music Players.md +++ b/sources/tech/20171215 Top 5 Linux Music Players.md @@ -1,40 +1,29 @@ -tomjlw is translating -Top 5 Linux Music Players +Linux 上最好的五款音乐播放器 ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/live-music.jpg?itok=Ejbo4rf7_) ->Jack Wallen rounds up his five favorite Linux music players. Creative Commons Zero +>Jack Wallen 盘点他最爱的五款 Linux 音乐播放器。图片来源 Creative Commons Zero >Pixabay -No matter what you do, chances are you enjoy a bit of music playing in the background. Whether you're a coder, system administrator, or typical desktop user, enjoying good music might be at the top of your list of things you do on the desktop. And, with the holidays upon us, you might wind up with some gift cards that allow you to purchase some new music. If your music format of choice is of a digital nature (mine happens to be vinyl) and your platform is Linux, you're going to want a good GUI player to enjoy that music. +不管你做什么,你都有时会来一点背景音乐。不管你是码农,运维或是一个典型的电脑用户,享受美妙的音乐都可能是你在电脑上最想做的事情之一。同时随着即将到来的假期,你可能收到一些能让你买几首新歌的礼物卡。如果你所选的音乐是数字形式(我的恰好是唱片形式)而且你的平台是 Linux 的话,你会想要一个好的图形用户界面播放器来享受音乐。 -Fortunately, Linux has no lack of digital music players. In fact, there are quite a few, most of which are open source and available for free. Let's take a look at a few such players, to see which one might suit your needs. +幸运的是,Linux 不缺好的数字音乐播放器。事实上,Linux 上有不少播放器,大部分是开源并且可以免费获得的。让我们看看其中的几款,看哪个能满足你的需要。 ### Clementine -I wanted to start out with the player that has served as my default for years. [Clementine][1] offers probably the single best ratio of ease-of-use to flexibility you'll find in any player. Clementine is a fork of the new defunct [Amarok][2] music player, but isn't limited to Linux-only; Clementine is also available for Mac OS and Windows platforms. The feature set is seriously impressive and includes the likes of: +我想从当了我许多年默认选项的播放器开始。[Clementine][1] 可能在播放器中提供了最好的易用性与灵活性间的平衡。Clementine是新的停运的 [Amarok][2] 音乐播放器的复刻,但它不仅限于 Linux; Clementine 在 Mac OS 和 Windows 平台上也可以获得。它的一系列特性十分惊艳,包括: - * Built-in equalizer - - * Customizable interface (display current album cover as background -- Figure 1) - - * Play local music or from Spotify, Last.fm, and more - - * Sidebar for easy library navigation - - * Built-in audio transcoding (into MP3, OGG, Flac, and more) - - * Remote control using [Android app][3] - - * Handy search function - - * Tabbed playlists - - * Easy creation of regular and smart playlists - - * CUE sheet support - - * Tag support +* 內建的均衡器 +* 可定制的界面(将现在的专辑封面显示成背景——图一) +* 播放本地音乐或者从 Spotify, Last.fm 等播放音乐 +* 便于库导向的侧边栏 +* 內建的音频转码(转成 MP3,OGG,Flac等) +* 通过 [安卓应用][3] 远程控制 +* 便利的搜索功能 +* 分页的播放列表 +* 简单的规律性和智能化的播放列表创建 +* 支持音乐追踪表单 +* 支持标签 @@ -42,73 +31,70 @@ I wanted to start out with the player that has served as my default for years. [ ![Clementine][5] -Figure 1: The Clementine interface might be a bit old-school, but it's incredibly user-friendly and flexible. +图一:Clementine 界面可能有一点老派,但是它不可思议得灵活好用。 -[Used with permission][6] +[受许可使用][6] + +在所有我用过的音乐播放器中,Clementine 是目前为止功能最多也是最容易使用的。它同时也包含了你能在 Linux 音乐播放器中找到的最好的均衡器(有十个频带可以调)。尽管它的界面不够时髦,但它创建、操控播放列表的能力是无与伦比的。如果你的音乐集很大,同时你想完全控制你的音乐集的话,这就是你想要的播放器。 -Of all the music players I have used, Clementine is by far the most feature-rich and easy to use. It also includes one of the finest equalizers you'll find on a Linux music player (with 10 bands to adjust). Although it may not enjoy a very modern interface, it is absolutely unmatched for its ability to create and manipulate playlists. If your music collection is large, and you want total control over it, this is the player you want. - -Clementine can be found in the standard repositories and installed from either your distribution's software center or the command line. +Clementine 可以在标准仓库中找到。它可以从你的发行版的软件中心或通过命令行来安装。 ### Rhythmbox -[Rhythmbox][7] is the default player for the GNOME desktop, but it does function well on other desktops. The Rhythmbox interface is slightly more modern than Clementine and takes a minimal approach to design. That doesn't mean the app is bereft of features. Quite the opposite. Rhythmbox offers gapless playback, Soundcloud support, album cover display, audio scrobbling from Last.fm and Libre.fm, Jamendo support, podcast subscription (from [Apple iTunes][8]), web remote control, and more. +[Rhythmbox][7] 是 GNOME 桌面的默认播放器,但是它在其它桌面工作得也很好。Rhythmbox 的界面比 Clementine 的界面稍微时尚一点,它的设计遵循极简的理念。这并不意味着它缺乏特性,相反 Rhythmbox 提供无间隔回放,Soundcloud 支持,专辑封面显示,从 Last.fm 和 Libre.fm 导入音频,Jamendo 支持,播客订阅 (从 [Apple iTunes][8]),从网页远程控制等特性。 -One very nice feature found in Rhythmbox is plugin support, which allows you to enable features like DAAP Music Sharing, FM Radio, Cover art search, notifications, ReplayGain, Song Lyrics, and more. +在 Rhythmbox 中发现的一个很好的特性是插件支持,这使得你可以使用像 DAAP 音乐分享,FM 电台,封面艺术查找,通知,ReplayGain,歌词等特性。 -The Rhythmbox playlist feature isn't quite as powerful as that found in Clementine, but it still makes it fairly easy to organize your music into quick playlists for any mood. Although Rhythmbox does offer a slightly more modern interface than Clementine (Figure 2), it's not quite as flexible. +Rhythmbox 播放列表特性不像 Clementine 上的那么强大,但是将你的音乐整理进任何形式的快速播放列表还是很简单的。尽管 Rhythmbox 的界面(图二)比 Clementine 要时髦一点,但是它不像 Clementine 那样灵活。 ![Rhythmbox][10] -Figure 2: The Rhythmbox interface is simple and straightforward. +图二: Rhythmbox 界面简单直接。 -[Used with permission][6] +[受许可使用][6] ### VLC Media Player -For some, [VLC][11] cannot be beat for playing videos. However, VLC isn't limited to the playback of video. In fact, VLC does a great job of playing audio files. For [KDE Neon][12] users, VLC serves as your default for both music and video playback. Although VLC is one of the finest video players on the Linux market (it's my default), it does suffer from some minor limitations with audio--namely the lack of playlists and the inability to connect to remote directories on your network. But if you're looking for an incredibly simple and reliable means to play local files or network mms/rtsp streams VLC is a quality tool. - -VLC does include an equalizer (Figure 3), a compressor, and a spatializer as well as the ability to record from a capture device. +对于部分人来说,[VLC][11] 在视频播放方面是无懈可击的。然而 VLC 不仅限于视频播放。事实上,VLC在播放音频文件方面做得也很好。对于 [KDE Neon][12] 用户来说,VLC 既是音乐也是视频的默认播放器。 尽管 VLC 是 Linux 市场最好的视频播放器的之一(它是我的默认播放器),它在音频方面确实略有瑕疵——缺少播放列表以及不能够连接到你网络中的远程仓库。但如果你是在寻找一种播放本地文件或者网络 mms/rtsp 的简单可靠的方式,VLC是上佳之选。VLC 确实包括一个均衡器(图三),一个压缩器以及一个空间音响。它同样也能够从捕捉到的设备录音。 ![VLC][14] -Figure 3: The VLC equalizer in action. +图三: 运转中的 VLC 均衡器。 -[Used with permission][6] +[受许可使用][6] ### Audacious +如果你在寻找一个轻量级的音乐播放器,Audacious 完美地满足要求。这个音乐播放器相当的专一,但是它确实包括了一个均衡器和一小部分能够改善许多音频的声效(比如回声,消除默音,调节速度和音调,去除人声等——图四)。 -If you're looking for a lightweight music player, Audacious perfectly fits that bill. This particular music player is fairly single minded, but it does include an equalizer and a small selection of effects that will please many an audiophile (e.g., Echo, Silence removal, Speed and Pitch, Voice Removal, and more--Figure 4). - -![Audacious ][16] +![Audacious][16] -Figure 4: The Audacious EQ and plugins. +图四: Audacious 均衡器和插件。 -[Used with permission][6] +[受许可使用][6] -Audacious also includes a really handy alarm feature, that allows you to set an alarm that will start playing your currently selected track at a user-specified time and duration. +Audacious 也包括了一个十分简便的闹铃功能。它允许你设置一个能在用户选定的时间点和持续的时间段内播放选定乐段的闹铃。 ### Spotify -I must confess, I use spotify daily. I'm a subscriber and use it to find new music to purchase--which means I am constantly searching and discovering. Fortunately, there is a desktop client for Spotify (Figure 5) that can be easily installed using the [official Spotify Linux installation instructions][17]. Outside of listening to vinyl, I probably make use of Spotify more than any other music player. It also helps that I can seamlessly jump between the desktop client and the [Android app][18], so I never miss out on the music I enjoy. +我必须承认,我每天都用 Spotify。我是一个 Spotify 的订阅者并用它去发现、购买新的音乐——这意味着我在不停地探索发现。辛运的是,Spotify 有一个我能按照 [Spotify官方 Linux 平台安装指导][17] 轻松安装的桌面客户端。在桌面客户端与 [安卓应用][18] 间无缝转换对我来说也大有帮助,这样我就永远不会错过我喜欢的音乐了。 -![Spotify][20] +![Spotify][16] -Figure 5: The official Spotify client on Linux. +图五: Linux 上的 Spotify 官方客户端。 -[Used with permission][6] +[受许可使用][6] -The Spotify interface is very easy to use and, in fact, it beats the web player by leaps and bounds. Do not settle for the [Spotify Web Player][21] on Linux, as the desktop client makes it much easier to create and manage your playlists. If you're a Spotify power user, don't even bother with the built-in support for the streaming client in the other desktop apps--once you've used the Spotify Desktop Client, the other apps pale in comparison. +Spotify 界面十分易于使用,事实上它完胜网页端的播放器。不要在 Linux 上装 [Spotify 网页播放器][21] 因为桌面客户端在创建管理你的播放列表方面简便得多。如果你是 Spotify 重度用户,甚至没必要用其他桌面应用的內建流传输客户端支持——一旦你用过 Spotify 桌面客户端,其它应用就根本没可比性。 -### The choice is yours +### 选择在你 -Other options are available (check your desktop software center), but these five clients (in my opinion) are the best of the best. For me, the one-two punch of Clementine and Spotify gives me the best of all possible worlds. Try them out and see which one best meets your needs. +其它选择也是有的(查看你的桌面软件中心),但这五款客户端(在我看来)是最好的了。对我来说,Clementine 和 Spotify 的组合拳就已经让我美好得唱赞歌了。尝试它们看看哪个能更好地满足你的需要。 -Learn more about Linux through the free ["Introduction to Linux" ][22]course from The Linux Foundation and edX. +通过 edX 和 Linux Foundation 上免费的 ["Introduction to Linux" ][22] 课程学习更多有关 Linux 的知识。 -------------------------------------------------------------------------------- From 4acf604d8e7c326ea4ad6bae49beb357a1853358 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Tue, 5 Feb 2019 10:46:19 -0600 Subject: [PATCH 018/813] Rename sources/tech/20171215 Top 5 Linux Music Players.md to translated/tech/20171215 Top 5 Linux Music Players.md --- .../tech/20171215 Top 5 Linux Music Players.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20171215 Top 5 Linux Music Players.md (100%) diff --git a/sources/tech/20171215 Top 5 Linux Music Players.md b/translated/tech/20171215 Top 5 Linux Music Players.md similarity index 100% rename from sources/tech/20171215 Top 5 Linux Music Players.md rename to translated/tech/20171215 Top 5 Linux Music Players.md From 8f224cdcadd455c8cbad53935c57a161f89e1086 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 11:04:50 +0800 Subject: [PATCH 019/813] PRF:20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @HankChow --- ...abases- PostgreSQL, MariaDB, and SQLite.md | 80 ++++++------------- 1 file changed, 26 insertions(+), 54 deletions(-) diff --git a/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md b/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md index 6638fb8fb7..1939ec8a56 100644 --- a/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md +++ b/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Comparing 3 open source databases: PostgreSQL, MariaDB, and SQLite) @@ -9,78 +9,60 @@ 开源数据库 PostgreSQL、MariaDB 和 SQLite 的对比 ====== -> 要知道如何选择最适合你的需求的开源数据库。 + +> 了解如何选择最适合你的需求的开源数据库。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_container_block.png?itok=S8MbXEYw) -在现代企业的技术领域中,开源软件已经成为了一股不可忽视的重要力量。借助[开源运动open source movement][1]的东风,很多重大的技术已经得到了长足的发展。 +在现代的企业级技术领域中,开源软件已经成为了一股不可忽视的重要力量。借助[开源运动][1]open source movement的东风,涌现除了许多重大的技术突破。 -个中原因显而易见,尽管一些基于 Linux 的开源网络标准可能不如著名厂商的产品那么受欢迎,但是不同制造商的智能设备之间能够互相通信,开源技术功不可没。当然也有不少人认为开源应用比厂商提供的产品更加好,所以无论如何,使用开源数据库进行开发确实是相当有利的。 +个中原因显而易见,尽管一些基于 Linux 的开源网络标准可能不如专有厂商的那么受欢迎,但是不同制造商的智能设备之间能够互相通信,开源技术功不可没。当然也有不少人认为开源开发出来的应用比厂商提供的产品更加好,所以无论如何,使用开源数据库进行开发确实是相当有利的。 -和其它类型的应用软件一样,[不同的开源数据库管理系统之间在功能和特性上可能会存在着比较大的差异][2]。因此,如果要为整个团队选择一个开源数据库,那么应该重点考察数据库是否对用户友好、是否能够持续适应团队需求、是否能够提供足够安全的功能等方面的因素。 +和其它类型的应用软件一样,不同的开源数据库管理系统之间在功能和特性上可能会存在着比较大的差异。换言之,[不是所有的开源数据库都是平等的][2]。因此,如果要为整个组织选择一个开源数据库,那么应该重点考察数据库是否对用户友好、是否能够持续适应团队需求、是否能够提供足够安全的功能等方面的因素。 -出于这方面考虑,我们在这篇文章中对一些开源数据库进行了概述和对比。但也有可能略过了一些常用的数据库。需要提到的是,MongoDB 最近更改了它的许可证,因此它已经不是完全的开源产品了。从商业角度来看,这个决定是很有意义的,因为 MongoDB 已经成为了[约 27000 家公司][3]在数据库托管方面的实际解决方案,这也意味着 MongoDB 已经不再被视为真正的开源产品。 +出于这方面考虑,我们在这篇文章中对一些开源数据库进行了概述和优缺点对比。遗憾的是,我们必须忽略一些最常用的数据库。值得注意的是,MongoDB 最近更改了它的许可证,因此它已经不是真正的开源产品了。从商业角度来看,这个决定是很有意义的,因为 MongoDB 已经成为了数据库托管实际上的解决方案,[约 27000 家公司][3]在使用它,但这也意味着 MongoDB 已经不再被视为真正的开源产品。 -另外,在 MySQL 被 Oracle 收购之后,这个产品就已经不再具有开源性质了。MySQL 在过去相当长的一段时间里都是很多项目的首选数据库,因此它的案例也是摆在其它开源数据库面前的一个巨大挑战。 +另外,自从 MySQL 被 Oracle 收购之后,这个产品就已经不再具有开源性质了,MySQL 可以说是数十年来首选的开源数据库。然而,这为其它真正的开源数据库解决方案提供了挑战它的空间。 -下面讨论一下我们提到的三个开源数据库。 +下面是三个值得考虑的开源数据库。 ### PostgreSQL -[PostgreSQL][4] 可以说是开源数据库中的一个重要成员。无论是哪种规模的企业,PostgreSQL 可能都是它们的首选解决方案。Oracle 对 MySQL 的收购在当时来说可能具有一定的商业意义,但是随着云存储的日益壮大,[开发者对 MySQL 的依赖程度或许并不如以前那么大了][5]。 +没有 [PostgreSQL][4] 的开源数据库清单肯定是不完整的。PostgreSQL 一直都是各种规模企业的首选解决方案。Oracle 对 MySQL 的收购在当时来说可能具有一定的商业意义,但是随着云存储的日益壮大,[开发者对 MySQL 的依赖程度或许并不如以前那么大了][5]。 -尽管 PostgreSQL 不是一个最近几年才面世的新产品,但它却是借助了 [MySQL 衰落][6]的机会才逐渐成为最受欢迎的开源数据库之一。由于它和 MySQL 的工作方式非常相似,因此很多热衷于使用开源软件的开发者都纷纷转向 PostgreSQL。 +尽管 PostgreSQL 不是一个最近几年才面世的新产品,但它却是借助了 [MySQL 相对衰落][6]的机会才逐渐成为最受欢迎的开源数据库之一。由于它和 MySQL 的工作方式非常相似,因此很多热衷于使用开源软件的开发者都纷纷转向 PostgreSQL。 #### 优势 - * 目前 PostgreSQL 最显著的优点是它的算法效率高,因此它的性能就比其它的数据库也高一些。这一点在处理大型数据集的时候就可以很明显地体现出来了,否则在运算过程中 I/O 会成为瓶颈。 + * 目前 PostgreSQL 最显著的优点是它的核心算法的效率,这意味着它的性能优于许多宣称更先进数据库。这一点在处理大型数据集的时候就可以很明显地体现出来了,否则 I/O 处理会成为瓶颈。 * PostgreSQL 也是最灵活的开源数据库之一,使用 Python、Perl、Java、Ruby、C 或者 R 都能够很方便地调用数据库。 * 作为最常用的几个开源数据库之中,PostgreSQL 的社区支持是做得最好的。 - - - #### 劣势 - * 在数据量比较大的时候,PostgreSQL 的效率毋庸置疑是很高的,但对于数据量较小的情况,使用 PostgreSQL 就显得不如其它的一些工具轻量级了。 - + * 在数据量比较大的时候,PostgreSQL 的效率毋庸置疑是很高的,但对于数据量较小的情况,使用 PostgreSQL 就显得不如其它的一些工具快了。 * 尽管拥有一个很优秀的社区支持,但 PostgreSQL 的核心文档仍然需要作出改进。 - - * 如果你需要使用并行计算或者集群化等高级工具,就需要安装 PostgreSQL 的第三方插件。尽管官方有计划将这些功能逐步添加到主要版本当中,但可能会需要再等待好几年才能实现。 - - - + * 如果你需要使用并行计算或者集群化等高级工具,就需要安装 PostgreSQL 的第三方插件。尽管官方有计划将这些功能逐步添加到主要版本当中,但可能会需要再等待好几年才能出现在标准版本中。 ### MariaDB -[MariaDB][7] 是 MySQL 的真正开源发行版本(在 [GNU GPLv2][8] 下发布)。在 Oracle 收购 MySQL 之后,MySQL 的一些核心开发人员认为 Oracle 会破坏 MySQL 的开源理念,因此建立了 MariaDB 这个独立的分支。 +[MariaDB][7] 是 MySQL 的真正开源的发行版本(在 [GNU GPLv2][8] 下发布)。在 Oracle 收购 MySQL 之后,MySQL 的一些核心开发人员认为 Oracle 会破坏 MySQL 的开源理念,因此建立了 MariaDB 这个独立的分支。 -MariaDB 在开发过程中替换了 MySQL 的几个关键组件,但仍然尽可能地保持兼容 MySQL。MariaDB 使用了 Aria 作为存储引擎,这个存储引擎既可以作为事务式引擎,也可以作为非事务式引擎。在 MariaDB 独立出来之前,就[有一些人推测][10] Aria 会成为 MySQL 未来版本中的标准引擎。 +MariaDB 在开发过程中替换了 MySQL 的几个关键组件,但仍然尽可能地保持兼容 MySQL。MariaDB 使用了 Aria 作为存储引擎,这个存储引擎既可以作为事务式引擎,也可以作为非事务式引擎。在 MariaDB 分叉出来之前,就[有一些人推测][10] Aria 会成为 MySQL 未来版本中的标准引擎。 #### 优势 * 由于 MariaDB [频繁进行安全发布][11],很多用户选择使用 MariaDB 而不选择 MySQL。尽管这不一定代表 MariaDB 会比 MySQL 更加安全,但确实表明它的开发社区对安全性十分重视。 - - * 有一些人认为,MariaDB 的主要优点就是它在坚持开源的同时会与 MySQL 保持高度兼容,这就表示从 MySQL 向 MariaDB 的迁移会非常容易。 - + * 有一些人认为,MariaDB 的主要优点就是它在坚持开源的同时会与 MySQL 保持高度兼容,这就意味着从 MySQL 向 MariaDB 的迁移会非常容易。 * 也正是由于这种兼容性,MariaDB 也可以和其它常用于 MySQL 的语言配合使用,因此从 MySQL 迁移到 MariaDB 之后,学习和调试代码的时间成本会非常低。 - - * 你可以将 WordPress 和 MariaDB(而不是 MySQL)[配合使用][12]从而获得更好的性能和更丰富的功能。WordPress 是[最受欢迎的内容管理系统Content Management System][13](CMS),并且拥有活跃的开源开发者社区。各种第三方插件在 WordPress 和 MariaDB 配合使用时都能够正常工作。 - - - + * 你可以将 WordPress 和 MariaDB(而不是 MySQL)[配合使用][12]从而获得更好的性能和更丰富的功能。WordPress 是[最受欢迎的][13]内容管理系统Content Management System(CMS),占据了一半的互联网份额,并且拥有活跃的开源开发者社区。各种第三方插件在 WordPress 和 MariaDB 配合使用时都能够正常工作。 #### 劣势 * MariaDB 有时会变得比较臃肿,尤其是它的 IDX 日志文件在长期使用之后会变得非常大,最终导致性能下降。 - - * MariaDB 的缓存并没有期望中那么快,这可能会让人有所失望。 - + * 缓存是 MariaDB 的另一个工作领域,并没有期望中那么快,这可能会让人有所失望。 * 尽管 MariaDB 最初承诺兼容 MySQL,但目前 MariaDB 已经不是完全兼容 MySQL。如果要从 MySQL 迁移到 MariaDB,就需要额外做一些兼容工作。 - - - ### SQLite [SQLite][14] 可以说是世界上实现最多的数据库引擎,因为它被很多流行的 web 浏览器、操作系统和手机所采用。它最初是作为 MySQL 的轻量级分支所开发的。SQLite 和很多其它的数据库不同,它不采用客户端-服务端的引擎架构,而是将整个软件嵌入到每个实现当中。 @@ -90,30 +72,20 @@ MariaDB 在开发过程中替换了 MySQL 的几个关键组件,但仍然尽 #### 优势 * 如果你需要构建和实现一个小型数据库,SQLite [可能是最好的选择][15]。它小而灵活,不需要费工夫寻求各种变通方案,就可以在嵌入式系统中实现。 - - * SQLite 体积很小,因此速度也很快。其它的一些高级数据库可能会使用复杂的优化方式来提高效率,但不如SQLite 这样减小数据库大小更为直接。 - - * SQLite 被广泛采用也导致它可能是兼容性最高的数据库。如果你希望将应用程序集成到智能手机上,只要有第三方应用程序使用到了 SQLite,就能够正常运行数据库了。 - - - + * SQLite 体积很小,因此速度极快。其它的一些高级数据库可能会使用复杂的优化方式来提高效率,但SQLite 采用了一种更简单的方法:通过减小数据库及其处理软件的大小,以使处理的数据更少。 + * SQLite 被广泛采用也导致它可能是兼容性最高的数据库。如果你希望将应用程序集成到智能手机上,这一点尤为重要:只要是可以工作于广泛环境中的第三方应用程序,就可以原生运行于 iOS 上。 #### 劣势 - * SQLite 的轻量意味着它缺少了很多其它大型数据库的常见功能。例如数据加密就是[抵御网络攻击][16]的标准功能,而 SQLite 却没有内置这个功能。 - - * SQLite 的广泛流行和源码公开使它易于使用,但是也让它更容易遭受攻击。这是它最大的劣势。SQLite 经常被发现高位的漏洞,例如最近的 [Magellan][17]。 - + * SQLite 的体积小意味着它缺少了很多其它大型数据库的常见功能。例如数据加密就是[抵御黑客攻击][16]的标准功能,而 SQLite 却没有内置这个功能。 + * SQLite 的广泛流行和源码公开使它易于使用,但是也让它更容易遭受攻击。这是它最大的劣势。SQLite 经常被发现高危的漏洞,例如最近的 [Magellan][17]。 * 尽管 SQLite 单文件的方式拥有速度上的优势,但是要使用它实现多用户环境却比较困难。 - - - ### 哪个开源数据库才是最好的? -当然,对于开源数据库的选择还是取决于业务的需求以及系统的体量。对于小型数据库或者是使用量比较小的数据库,可以使用比较轻量级的解决方案,这样不仅可以加快实现的速度,而且由于系统的复杂程度不算太高,花在调试上的时间成本也不会太高。 +当然,对于开源数据库的选择还是取决于业务的需求,尤其是系统的体量。对于小型数据库或者是使用量比较小的数据库,可以使用比较轻量级的解决方案,这样不仅可以加快实现的速度,而且由于系统的复杂程度不算太高,花在调试上的时间成本也不会太高。 -而对于大型的系统,尤其是业务增长速度较快的业务,最好还是花时间使用更复杂的数据库(例如 PostgreSQL)。这是一个磨刀不误砍柴工的选择,能够让你不至于在后期再重新选择另一款数据库。 +而对于大型的系统,尤其是在成长性企业中,最好还是花时间使用更复杂的数据库(例如 PostgreSQL)。这是一个磨刀不误砍柴工的选择,能够让你不至于在后期再重新选择另一款数据库。 -------------------------------------------------------------------------------- @@ -122,7 +94,7 @@ via: https://opensource.com/article/19/1/open-source-databases 作者:[Sam Bocetta][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 f2f3148cb91a98251797f77a3b735bf56db576b8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 11:05:36 +0800 Subject: [PATCH 020/813] PUB:20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @HankChow https://linux.cn/article-10512-1.html --- ... open source databases- PostgreSQL, MariaDB, and SQLite.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md (99%) diff --git a/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md b/published/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md similarity index 99% rename from translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md rename to published/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md index 1939ec8a56..c47bb62e94 100644 --- a/translated/tech/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md +++ b/published/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10512-1.html) [#]: subject: (Comparing 3 open source databases: PostgreSQL, MariaDB, and SQLite) [#]: via: (https://opensource.com/article/19/1/open-source-databases) [#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) From 9b77815e9b9341b9160f00dc9ad6673a9da30e0d Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Tue, 5 Feb 2019 21:48:15 -0600 Subject: [PATCH 021/813] Apply for translating Apply for translating --- .../20180621 How to connect to a remote desktop from Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180621 How to connect to a remote desktop from Linux.md b/sources/tech/20180621 How to connect to a remote desktop from Linux.md index ced3b233dc..241d243b0b 100644 --- a/sources/tech/20180621 How to connect to a remote desktop from Linux.md +++ b/sources/tech/20180621 How to connect to a remote desktop from Linux.md @@ -1,3 +1,4 @@ +tomjlw is translating How to connect to a remote desktop from Linux ====== From 5aab75b6cfb822e5de7816027fd4944d6aaeedcb Mon Sep 17 00:00:00 2001 From: sndnvaps Date: Wed, 6 Feb 2019 15:51:11 +0800 Subject: [PATCH 022/813] =?UTF-8?q?=E6=8A=8A=E6=96=87=E7=AB=A0=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0Translated=E7=9B=AE=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=BF=AE=E6=94=B9=E7=9B=B8=E5=BA=94=E7=9A=84=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Locally As Virtual File System In Linux.md | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) rename {sources => translated}/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md (83%) diff --git a/sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md b/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md similarity index 83% rename from sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md rename to translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md index 8fbde8ed43..03b2c4a172 100644 --- a/sources/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md +++ b/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md @@ -7,7 +7,8 @@ [**Google Drive**][1] 是全球比较受欢迎的云存储平台. 直到2017年, 全球有超过8亿的活跃用户在使用它。即使用户数在持续增长,但直到现在Google还是没有发布一款可以在Linux平台使用的客户端。但这难不倒Linux开源组织的大神。 不时,一些开发者已经把功能实现了。 下面我将会介绍三个用于Linux系统非官方开发的Google Driver客户端。使用这些客户端,你能把Google Driver像虚拟磁盘一样挂载到Linux系统。 请记好笔记了。 ### 1. Google-drive-ocamlfuse -**google-driver-ocamlfuse** 把Google Driver当做是一个FUSE类型的文件系统,是用OCam语言写的。FUSE到底是何物,用户态文件系统,此项目允许非管理员用户在用户空间开发文件系统。 **google-drive-ocamlfuse** 可以让你把Google Driver当做磁盘一样挂载到Linux系统。支持对文件和目录的读写操作,支持只读操作,支持多用户,支持拖拉文件,支持访问Google Driver的回收站,等操作。 + +**google-driver-ocamlfuse**把Google Driver当做是一个FUSE类型的文件系统,是用OCam语言写的。FUSE到底是何物,用户态文件系统,此项目允许非管理员用户在用户空间开发文件系统。**google-drive-ocamlfuse**可以让你把Google Driver当做磁盘一样挂载到Linux系统。支持对文件和目录的读写操作,支持只读操作,支持多用户,支持拖拉文件,支持访问Google Driver的回收站,等操作。 #### 安装 google-drive-ocamlfuse @@ -55,7 +56,7 @@ Access token retrieved correctly. $ mkdir ~/mygoogledrive ``` -最后操作,使用如下命令挂载Google Driver: +最后操作,使用如下命令挂载Google Driver: ``` $ google-drive-ocamlfuse ~/mygoogledrive @@ -63,13 +64,13 @@ $ google-drive-ocamlfuse ~/mygoogledrive 恭喜你了!你可以使用终端或文件管理器来访问Google Driver里面的文件了。 -使用 **终端** : +使用**终端**: ``` $ ls ~/mygoogledrive ``` -使用 **文件管理器** : +使用**文件管理器**: ![][6] @@ -79,7 +80,7 @@ $ google-drive-ocamlfuse -label label [mountpoint] ``` -当操作完成后,你可以使用如下的命令卸载Google Driver: +当操作完成后,你可以使用如下的命令卸载Google Driver: ``` $ fusermount -u ~/mygoogledrive @@ -91,15 +92,15 @@ $ google-drive-ocamlfuse --help ``` -当然你也可以看看[**官方文档**][7]和[**Github项目**][8] 以获取更多内容。 +当然你也可以看看[**官方文档**][7]和[**Github项目**][8]以获取更多内容。 ### 2. GCSF -**GCSF** 是Google Driver基于FUSE的文件系统,使用**Rust**语言编写。GCSF主要是来源于罗马尼亚语中的“ **G** oogle **C** onduce **S** istem de **F** ișiere”,翻译成英文就是“Google Drive Filesystem”(即Google Drive 文件系统)使用GCSF,你可以把Google Driver当做虚拟磁盘一样挂载到Linux系统,可以通过终端和文件管理器对其进行操作。你肯定会很好奇,这到底于其它的Google Dirver FUSE项目有什么不同,就比如**google-drive-ocamlfuse**。就类型的问题,GCSF的开发者有如下的回复[comment on Reddit][9] “GCSF意在某些方面更快(循环列举文件,从Google Driver中读取大文件)。缓存策略也能让读取速度更快(x4-7 的修改更突显了与google-drive-ocamlfuse的差别)当文件被结存后,此为浪费更多的内在”。 +**GCSF** 是Google Driver基于FUSE的文件系统,使用**Rust**语言编写。GCSF主要是来源于罗马尼亚语中的“ **G** oogle **C** onduce **S** istem de **F** ișiere”,翻译成英文就是“Google Drive Filesystem”(即Google Drive 文件系统)使用GCSF,你可以把Google Driver当做虚拟磁盘一样挂载到Linux系统,可以通过终端和文件管理器对其进行操作。你肯定会很好奇,这到底于其它的Google Dirver FUSE项目有什么不同,就比如**google-drive-ocamlfuse**。就类型的问题,GCSF的开发者有如下的回复[在Reddit论坛上的评论][9] “GCSF意在某些方面更快(循环列举文件,从Google Driver中读取大文件)。缓存策略也能让读取速度更快(x4-7 的修改更突显了与google-drive-ocamlfuse的差别)当文件被结存后,此为浪费更多的内在”。 #### 安装 GCSF -GCSF 能在[**AUR**][10]上面找到, 对于Arch用户来说直接使用AUR助手来安装就行了,例如[**Yay**][3]. +GCSF能在[**AUR**][10]上面找到, 对于Arch用户来说直接使用AUR助手来安装就行了,例如[**Yay**][3]。 ``` $ yay -S gcsf-git @@ -109,13 +110,13 @@ $ yay -S gcsf-git 首先,你得确认系统中是否安装了Rust语言。 -确保**pkg-config**和**fuse**软件包是否安装了。它们在绝大多数的Linux发行片的默认仓库中都能找到。例如,在Ubuntu及其衍生版本中,你可以使用如下的命令进行安装: +确保**pkg-config**和**fuse**软件包是否安装了。它们在绝大多数的Linux发行片的默认仓库中都能找到。例如,在Ubuntu及其衍生版本中,你可以使用如下的命令进行安装: ``` $ sudo apt-get install -y libfuse-dev pkg-config ``` -当所有的依赖软件安装完成后,你可以使用如下的命令来安装GCSF: +当所有的依赖软件安装完成后,你可以使用如下的命令来安装GCSF: ``` $ cargo install gcsf @@ -123,7 +124,7 @@ $ cargo install gcsf #### 使用方法 -首先,我们需要对Google Driver的操作进行授权,跟上面的一样方法,终端输入如下命令: +首先,我们需要对Google Driver的操作进行授权,跟上面的一样方法,终端输入如下命令: ``` $ gcsf login ostechnix @@ -147,7 +148,7 @@ $ mkdir ~/mygoogledrive ``` -之后,修改**/etc/fuse.conf**文件: +之后,修改**/etc/fuse.conf**文件: ``` $ sudo vi /etc/fuse.conf @@ -161,7 +162,7 @@ user_allow_other 保存并关闭文件。 -最后一步,挂载Google Driver命令如下的命令: +最后一步,挂载Google Driver命令如下的命令: ``` $ gcsf mount ~/mygoogledrive -s ostechnix @@ -178,7 +179,7 @@ INFO gcsf::gcsf::file_manager > Checking for changes and possibly applying them. ``` -重复一次,使用自己的会话名来更换**ostechnix**。你可以命令如下的命令来查看已经存在的会话: +重复一次,使用自己的会话名来更换**ostechnix**。你可以命令如下的命令来查看已经存在的会话: ``` $ gcsf list Sessions: @@ -186,15 +187,15 @@ Sessions: ``` -你现在可以使用终端和文件管理器对Google Driver进行操作了。. +你现在可以使用终端和文件管理器对Google Driver进行操作了。 -使用**终端** : +使用**终端**: ``` $ ls ~/mygoogledrive ``` -使用**文件管理器** : +使用**文件管理器**: ![][12] @@ -216,7 +217,7 @@ GCSF on /home/sk/mygoogledrive type fuse (rw,nosuid,nodev,relatime,user_id=1000, ``` -当操作完成后,你可以使用如下命令来卸载Google Driver: +当操作完成后,你可以使用如下命令来卸载Google Driver: ``` $ fusermount -u ~/mygoogledrive @@ -228,7 +229,7 @@ $ fusermount -u ~/mygoogledrive **Tuxdrive**是其它的非官方Linux Google Driver客户端。我们之前有写过一篇关于Tuxdrive比较详细的使用方法。你可以找一找之前的文档。 -这当然,还有其它的非官方的Google Driver客户端在过去有出现过,例如Grive2, Syncdrive。但它们好像都已经停止开发了。我会对这个列表进行持续的跟进当有更受欢迎的Google Driver客户端出现。 +这当然,还有其它的非官方的Google Driver客户端在过去有出现过,例如Grive2,Syncdrive。但它们好像都已经停止开发了。我会对这个列表进行持续的跟进当有更受欢迎的Google Driver客户端出现。 谢谢你的阅读。 From db499ef2287ac0864eab1c456c34d03cbe9b1f4c Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Wed, 6 Feb 2019 16:11:45 +0800 Subject: [PATCH 023/813] Translating by qhwdw --- ...616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md index 0b3cc3940c..ad479ae35a 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 06dfbfd847283c8fff64745aff2bb0584409157b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 17:25:26 +0800 Subject: [PATCH 024/813] PRF:20180206 Building Slack for the Linux community and adopting snaps.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tomjlw 恭喜您,完成了第一篇翻译! --- ... the Linux community and adopting snaps.md | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md b/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md index ef97cf3485..836e9338bf 100644 --- a/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md +++ b/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md @@ -1,58 +1,62 @@ -为 Linux 社区采用 snaps 搭建 Slack +采用 snaps 为 Linux 社区构建 Slack ====== + ![][1] -作为一个被数以百万计用户使用的企业级软件平台,[Slack][2] 允许任意规模的团队和企业有效地沟通。Slack 通过在一个单一集成环境中与其它软件工具无缝衔接,为一个组织内的通讯、信息和项目提供了一个易于接触的档案馆。尽管自从诞生后 Slack 就在过去四年中快速成长,但是他们负责该平台跨 Windows、MacOS 和 Linux 运行的桌面工程师团队仅由四人组成。我们通过与在这个团队中负责追踪[上月首发的 Slack snap][3] 的主任工程师 Felix Rieseberg 交谈,来探索更多有关该公司对于 Linux 社区的态度以及他们决定搭建一个 snap 的原因。 -[安装 Slack snap][4] +- [安装 Slack snap][4] ### 你们能告诉我们更多关于已发布的 Slack snap 的信息吗? -我们上月发布了我们的第一个 snap 作为我们为Linux 社区的一种新的发布形式。在企业界,我们发现人们更倾向于以一种相对于个人消费者较慢的速度来采用新科技, 因此我们将会在未来继续提供 .deb 形式的 snap。 +作为发布给 Linux 社区的一种新形式,我们上月发布了我们的第一个 snap。在企业界,我们发现人们更倾向于以一种相对于个人消费者来说较慢的速度来采用新科技,因此我们将会在未来继续提供 .deb 形式的软件包。 ### 你们觉得 Linux 社区会对 Slack 有多大的兴趣呢? -在所有的平台上人们对 Slack 的兴趣都正在增长,这一点使我感到十分兴奋。因此这对于我们来说,很难说源自 Linux 社区的兴趣和我们大体上所见到的兴趣有什么区别。当然,不管用户们在什么平台上面工作,满足他们对我们都是很重要的。我们有一个专门负责 Linux 的测试工程师并且我们同时也尽全力提供最好的用户体验。只是我们发现总体相对于 Windows 来说,为 Linux 搭建 snap 略微有点难度,因为我们是在一个较难以预测的平台上工作——而这正是 Linux 社区之光照耀的领域。在汇报程序缺陷以及寻找程序崩溃原因方面,我们有相当多数极富帮助的用户。 +我很高兴在所有的平台上人们都对 Slack 的兴趣越来越大。因此,很难说来自 Linux 社区的兴趣和我们大体上所见到的兴趣有什么区别。当然,不管用户们在什么平台上面工作,满足他们对我们都是很重要的。我们有一个专门负责 Linux 的测试工程师,并且我们同时也会尽全力提供最好的用户体验。 + +只是我们发现总体相对于 Windows 来说,为 Linux 搭建 snap 略微有点难度,因为我们是在一个较难以预测的平台上工作——而这正是 Linux 社区之光照耀的领域。在汇报程序缺陷以及寻找程序崩溃原因方面,我们有相当多极有帮助的用户。 ### 你们是如何得知 snap 的? -Canonical 公司的 Martin Wimpress 和我接触并向我解释了 snap 的概念。说实话尽管我也用 Ubuntu 但最初我还是迟疑的,因为它看起来像需要搭建与维护的另一套标准。尽管如此,一当我了解到其中的好处之后,我确信这是一笔有回报的投入。 +Canonical 公司的 Martin Wimpress 接触了我,并向我解释了 snap 的概念。说实话尽管我也用 Ubuntu 但最初我还是迟疑的,因为它看起来像需要搭建与维护的另一套标准。然而,一当我了解到其中的好处之后,我确信这是一笔值得的投入。 ### snap 的什么方面吸引了你们并使你们决定投入其中? -毫无疑问,我们决定搭建 snap 最重要的原因是它的更新特性。在 Slack 上我们大量运用网页技术,这些技术反过来也使得我们提供大量的特性——比如将 YouTube 视频或者 Spotify 播放列表集成在 Slack 中。与浏览器十分相似,这意味着我们需要频繁更新应用。 +毫无疑问,我们决定搭建 snap 最重要的原因是它的更新特性。在 Slack 上我们大量运用了网页技术,这些技术反过来也使得我们提供大量的特性——比如将 YouTube 视频或者 Spotify 播放列表集成在 Slack 中。与浏览器十分相似,这意味着我们需要频繁更新应用。 -在 MacOS 和 Windows 上,我们已经有了一个甚至无需用户考虑更新的专门的自动更新器。我们发现哪怕是为了更新,任何形式的中断都是一种我们需要避免的烦恼。因此通过 snap 自动化的更新就显得无缝和便捷得多。 +在 MacOS 和 Windows 上,我们已经有了一个专门的自动更新器,甚至无需用户关注更新。任何形式的中断都是一种我们需要避免的烦恼,哪怕是为了更新。因此通过 snap 自动化的更新就显得更加无缝和便捷。 -### 相比于其它形式的打包方式,搭建 snap 感觉如何? 将它与现有的设施和进程集成在一起有多简便呢? +### 相比于其它形式的打包方式,构建 snap 感觉如何?将它与现有的设施和流程集成在一起有多简便呢? -就 Linux 而言,我们尚未尝试其它新的打包方式,但我们迟早会的。鉴于我们的大多数用户都使用 Ubuntu,snap 是一个很简便的选项。同时 snap 在其它发行版上同样也可以使用,这也是一个巨大的加分项。Canonical 正将 snap 做到跨发行版而不是仅仅集中在 Ubuntu 上,这一点我认为是很好的。 +就 Linux 而言,我们尚未尝试其它的“新”打包方式,但我们迟早会的。鉴于我们的大多数用户都使用 Ubuntu,snap 是一个自然的选择。同时 snap 在其它发行版上同样也可以使用,这也是一个巨大的加分项。Canonical 正将 snap 做到跨发行版,而不是仅仅集中在 Ubuntu 上,这一点我认为是很好的。 -搭建 snap 简单得出乎意料,我们有一个创建安装器和软件包的统一流程,我们的 snap 创建过程从一个 .deb 软件包炮制出一个 snap。对于其它技术而言,有时候我们不得不为了支持搭建链先造一个内部工具。但是 snapcraft 工具正是我们需要的东西。在整个过程中 Canonical 的团队不可思议般得有助,因为我们一路上确实碰到了一些问题。 +搭建 snap 极其简单,我们有一个创建安装器和软件包的统一流程,我们的 snap 创建过程就是从一个 .deb 软件包炮制出一个 snap。对于其它技术而言,有时候我们为了支持构建链而先打造一个内部工具。但是 snapcraft 工具正是我们需要的东西。在整个过程中 Canonical 的团队非常有帮助,因为我们一路上确实碰到了一些问题。 ### 你们觉得 snap 商店是如何改变用户们寻找、安装你们软件的方式的呢? Slack 真正的独特之处在于人们不仅仅是碰巧发现它,他们从别的地方知道它并积极地试图找到它。因此尽管我们已经有了相当高的觉悟,我希望对于我们的用户来说,在商店中可以获得 snap 能够让安装过程变得简单一点。 -### 你们对用 snap 而不是为了其它发行版不得不再发行软件包有什么期待,或者有什么已经是你们可见的节省呢? +我们总是尽力为用户服务。当我们觉得它比其他安装方式更好,我们就会向用户更多推荐它。 -我们希望 snap 可以给予我们的用户更多的便利并确保他们能够更加享受使用 Slack。在我们看来,鉴于用户们不必被困在之前的版本,这自然而然地解决了许多问题,因此 snap 可以让我们在客户支持方面节约时间。有 snap 对我们来说也是一个额外的加分项,因为我们能有一个可供搭建的平台而不是替换我们现有的东西。 +### 通过使用 snap 而不是为其它发行版打包,你期待或者已经看到的节省是什么? + +我们希望 snap 可以给予我们的用户更多的便利,并确保他们能够更加喜欢使用 Slack。在我们看来,鉴于用户们不必被困在之前的版本,这自然而然地解决了许多问题,因此 snap 可以让我们在客户支持方面节约时间。snap 对我们来说也是一个额外的加分项,因为我们能有一个可供搭建的平台,而不是替换我们现有的东西。 ### 如果存在的话,你们正使用或者准备使用边缘 (edge)、测试 (beta)、候选 (candidate)、稳定 (stable) 中的哪种发行频道? -我们仅仅在开发中使用边缘 (edge) 频道以与 Canonical 的团队共享。为 Linux 打造的 Slack 总体任在测试 (beta) 频道中。但是长远来看,拥有不同频道的选项十分有意思,同时能够提早一点为感兴趣的客户发行版本也肯定是有好处的。 +我们开发中专门使用边缘 (edge) 频道以与 Canonical 团队合作。为 Linux 打造的 Slack 总体人处于测试 (beta) 频道中。但是长远来看,拥有不同频道的选择十分有意思,同时能够提早一点为感兴趣的客户发布版本也肯定是有好处的。 -### 你们认为将软件打包成一个 snap 是如何能够帮助用户的?你们从用户那边得到了什么反馈吗? +### 你们如何认为将软件打包成一个 snap 能够帮助用户?你们从用户那边得到了什么反馈吗? -对我们的用户来说一个很大的好处是安装和更新总体来说都会变得简便一点。长远来看,问题在于“那些安装 snap 的用户是不是比其它用户少碰到一些困难?”,我十分期望 snap 自带的依赖关系能够使其变成可能。 +对我们的用户来说一个很大的好处是安装和更新总体来说都会变得简便一点。长远来看,问题是“那些安装 snap 的用户是不是比其它用户少碰到一些困难?”,我十分期望 snap 自带的依赖关系能够使其变成可能。 -### 你们有什么会和刚使用 snap 的新用户们分享的建议或知识呢? +### 你们对刚使用 snap 的新用户们有什么建议或知识呢? -我会推荐从 Debian 软件包来着手搭建你们的 snap——那出乎意料得简单。这同样也缩小了开始的范围避免变得不堪重负。这只需要投入相当少的时间,并且很大可能是一笔值得的投入。同样如果你们可以的话,尽量试着找到 Canonical 的人员来协作——他们拥有了不起的工程师。 +我会推荐从 Debian 软件包来着手搭建你们的 snap ——那出乎意料得简单。这同样也缩小了范围,避免变得不堪重负。这只需要投入相当少的时间,并且很大可能是一笔值得的投入。同样如果你们可以的话,尽量试着找到 Canonical 的人员来协作——他们拥有了不起的工程师。 ### 对于开发来说,你们在什么地方看到了最大的机遇? -我们现在正一步步来,先是让人们用上 snap,再从那里开始搭建。正在使用 snap 的人们将会感到更加稳健因为他们将会得益于最新的更新。 +我们现在正一步步来,先是让人们接受 snap,再从那里开始搭建。正在使用 snap 的人们将会感到更加稳健,因为他们将会得益于最新的更新。 -------------------------------------------------------------------------------- @@ -60,7 +64,7 @@ via: https://insights.ubuntu.com/2018/02/06/building-slack-for-the-linux-communi 作者:[Sarah][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dfa8232cee6747cac6598c219d56dc6850cae346 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 17:26:38 +0800 Subject: [PATCH 025/813] PUB:20180206 Building Slack for the Linux community and adopting snaps.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tomjlw 本文首发地址:https://linux.cn/article-10513-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/tomjlw 请注册领取 LCCN: https://lctt.linux.cn --- ... Building Slack for the Linux community and adopting snaps.md | 1 + 1 file changed, 1 insertion(+) rename {translated/talk => published}/20180206 Building Slack for the Linux community and adopting snaps.md (89%) diff --git a/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md b/published/20180206 Building Slack for the Linux community and adopting snaps.md similarity index 89% rename from translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md rename to published/20180206 Building Slack for the Linux community and adopting snaps.md index 836e9338bf..371adf6568 100644 --- a/translated/talk/20180206 Building Slack for the Linux community and adopting snaps.md +++ b/published/20180206 Building Slack for the Linux community and adopting snaps.md @@ -3,6 +3,7 @@ ![][1] +作为一个被数以百万计用户使用的企业级软件平台,[Slack][2] 可以让各种规模的团队和企业有效地沟通。Slack 通过在一个单一集成环境中与其它软件工具无缝衔接,为一个组织内的通讯、信息和项目提供了一个易于接触的档案馆。尽管自从诞生后 Slack 就在过去四年中快速成长,但是他们负责该平台的 Windows、MacOS 和 Linux 桌面的工程师团队仅由四人组成。我们采访了这个团队的主任工程师 Felix Rieseberg(他负责追踪[上月首次发布的 Slack snap][3],LCTT 译注:原文发布于 2018.2),来了解更多有关该公司对于 Linux 社区的态度,以及他们决定构建一个 snap 软件包的原因。 - [安装 Slack snap][4] From c7e32d8bfd0be89b7b6d70b19271439ea600512b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 18:21:24 +0800 Subject: [PATCH 026/813] PRF:20190117 How to Update-Change Users Password in Linux Using Different Ways.md @MjSeven --- ... Password in Linux Using Different Ways.md | 83 +++++++++---------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md b/translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md index 2c8cc10e3c..0f997ddf27 100644 --- a/translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md +++ b/translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md @@ -1,50 +1,37 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Update/Change Users Password in Linux Using Different Ways) [#]: via: (https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) -如何使用不同的方式更新或更改 Linux 用户密码 +如何使用不同的方式更改 Linux 用户密码 ====== -在 Linux 中创建用户账号时,设置用户密码是一件基本的事情。 +在 Linux 中创建用户账号时,设置用户密码是一件基本的事情。每个人都使用 `passwd` 命令跟上用户名,比如 `passwd USERNAME` 来为用户设置密码。 -每个人都使用 passwd 命令和用户名,比如 `passwd USERNAME` 来为用户设置密码。 +确保你一定要设置一个难以猜测的密码,这可以帮助你使系统更安全。我的意思是,密码应该是字母、符号和数字的组合。此外,出于安全原因,我建议你至少每月更改一次密码。 -确保你一定设置一个难以猜测的密码,这可以帮助你使系统更安全。 +当你使用 `passwd` 命令时,它会要求你输入两次密码来设置。这是一种设置用户密码的原生方法。 -我的意思是,密码应该是字母,符合和数字的组合。 +如果你不想两次更新密码,并希望以不同的方式进行更新,怎么办呢?当然,这可以的,有可能做到。 -此外,出于安全原因,我建议你至少每月更改一次密码。 - -当你使用 passwd 命令时,它会要求你输入两次密码来设置。这是一种设置用户密码的原生方法。 - -如果你不想两次更新密码,并希望以不同的方式进行更新,怎么办呢? - -当然,这可以的,有可能做到。 - -如果你是 Linux 管理员,你可能已经多次问过下面的问题。 - -你们可能,也可能没有得到这些问题的答案。 +如果你是 Linux 管理员,你可能已经多次问过下面的问题。你可能、也可能没有得到这些问题的答案。 无论如何,不要担心,我们会回答你所有的问题。 - * 如何用一条命令更新或更改用户密码? - * 如何在 Linux 中为多个用户更新或更改相同的密码? - * 如何在 Linux 中更新或更改多个用户的密码? - * 如何在 Linux 中更新或更改多个用户的密码?(to 校正:这句和上一句有不同?) - * 如何在 Linux 中更新或更改多个用户的不同密码? - * 如何在多个 Linux 服务器中更新或更改用户的密码? - * 如何在多个 Linux 服务器中更新或更改多个用户的密码? + * 如何用一条命令更改用户密码? + * 如何在 Linux 中为多个用户更改为相同的密码? + * 如何在 Linux 中更改多个用户的密码? + * 如何在 Linux 中为多个用户更改为不同的密码? + * 如何在多个 Linux 服务器中更改用户的密码? + * 如何在多个 Linux 服务器中更改多个用户的密码? +### 方法-1:使用 passwd 命令 - -### 方法-1: 使用 passwd 命令 - -passwd 命令是在 Linux 中为用户设置,更新或更改密码的标准方法。以下是标准方法。 +`passwd` 命令是在 Linux 中为用户设置、更改密码的标准方法。以下是标准方法。 ``` # passwd renu @@ -63,17 +50,17 @@ Changing password for user thanu. passwd: all authentication tokens updated successfully. ``` -### 方法-2: 使用 chpasswd 命令 +### 方法-2:使用 chpasswd 命令 -chpasswd 是另一个命令,允许我们为 Linux 中的用户设置,更新或更改密码。如果希望在一条命令中使用 chpasswd 命令更改用户密码,用以下格式。 +`chpasswd` 是另一个命令,允许我们为 Linux 中的用户设置、更改密码。如果希望在一条命令中使用 `chpasswd` 命令更改用户密码,用以下格式。 ``` # echo "thanu:new_password" | chpasswd ``` -### 方法-3: 如何为多个用户设置不同的密码 +### 方法-3:如何为多个用户设置不同的密码 -如果你要为 Linux 中的多个用户设置,更新或更改密码,并且使用不同的密码,使用以下脚本。 +如果你要为 Linux 中的多个用户设置、更改密码,并且使用不同的密码,使用以下脚本。 为此,首先我们需要使用以下命令获取用户列表。下面的命令将列出拥有 `/home` 目录的用户,并将输出重定向到 `user-list.txt` 文件。 @@ -81,7 +68,7 @@ chpasswd 是另一个命令,允许我们为 Linux 中的用户设置,更新 # cat /etc/passwd | grep "/home" | cut -d":" -f1 > user-list.txt ``` -使用 cat 命令列出用户。如果你不想重置特定用户的密码,那么从列表中移除该用户。 +使用 `cat` 命令列出用户。如果你不想重置特定用户的密码,那么从列表中移除该用户。 ``` # cat user-list.txt @@ -92,7 +79,7 @@ thanu renu ``` -创建以下小 shell 脚本来实现此目的。 +创建以下 shell 小脚本来实现此目的。 ``` # vi password-update.sh @@ -130,9 +117,9 @@ Changing password for user renu. passwd: all authentication tokens updated successfully. ``` -### 方法-4: 如何为多个用户设置相同的密码 +### 方法-4:如何为多个用户设置相同的密码 -如果要在 Linux 中为多个用户设置,更新或更改相同的密码,使用以下脚本。 +如果要在 Linux 中为多个用户设置、更改相同的密码,使用以下脚本。 ``` # vi password-update.sh @@ -145,7 +132,7 @@ chage -d 0 $user done ``` -### 方法-5: 如何在多个服务器中更改用户密码 +### 方法-5:如何在多个服务器中更改用户密码 如果希望更改多个服务器中的用户密码,使用以下脚本。在本例中,我们将更改 `renu` 用户的密码,确保你必须提供你希望更新密码的用户名而不是我们的用户名。 @@ -179,9 +166,9 @@ Retype new password: Changing password for user renu. passwd: all authentication tokens updated successfully. ``` -### 方法-6: 如何使用 pssh 命令更改多个服务器中的用户密码 +### 方法-6:如何使用 pssh 命令更改多个服务器中的用户密码 -pssh 是一个在多个主机上并行执行 ssh 的程序。它提供了一些特性,例如向所有进程发送输入,向 sshh 传递密码,将输出保存到文件以及超时处理。导航到以下链接以了解关于 **[PSSH 命令][1]**的更多信息。 +`pssh` 是一个在多个主机上并行执行 ssh 连接的程序。它提供了一些特性,例如向所有进程发送输入,向 ssh 传递密码,将输出保存到文件以及超时处理。导航到以下链接以了解关于 [PSSH 命令][1]的更多信息。 ``` # pssh -i -h /tmp/server-list.txt "printf '%s\n' new_pass new_pass | passwd --stdin root" @@ -203,9 +190,9 @@ Stderr: New password: BAD PASSWORD: it is based on a dictionary word BAD PASSWORD: is too simple ``` -### 方法-7: 如何使用 chpasswd 命令更改多个服务器中的用户密码 +### 方法-7:如何使用 chpasswd 命令更改多个服务器中的用户密码 -或者,我们可以使用 chpasswd 命令更新多个服务器中的用户密码。 +或者,我们可以使用 `chpasswd` 命令更新多个服务器中的用户密码。 ``` # ./password-update.sh @@ -217,13 +204,21 @@ ssh [email protected]$server 'echo "magi:new_password" | chpasswd' done ``` -### 方法-8: 如何使用 chpasswd 命令在 Linux 服务器中更改多个用户的密码 +### 方法-8:如何使用 chpasswd 命令在 Linux 服务器中更改多个用户的密码 为此,首先创建一个文件,以下面的格式更新用户名和密码。在本例中,我创建了一个名为 `user-list.txt` 的文件。 参考下面的详细信息。 -创建下面的小 shell 脚本来实现这一点。 +``` +# cat user-list.txt +magi:new@123 +daygeek:new@123 +thanu:new@123 +renu:new@123 +``` + +创建下面的 shell 小脚本来实现这一点。 ``` # vi password-update.sh @@ -242,7 +237,7 @@ via: https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-us 作者:[Vinoth Kumar][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 d77cca83f5fe5d60752afe45dce37f4ca77042d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 18:22:01 +0800 Subject: [PATCH 027/813] PUB:20190117 How to Update-Change Users Password in Linux Using Different Ways.md @MjSeven https://linux.cn/article-10514-1.html --- ...ate-Change Users Password in Linux Using Different Ways.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190117 How to Update-Change Users Password in Linux Using Different Ways.md (99%) diff --git a/translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md b/published/20190117 How to Update-Change Users Password in Linux Using Different Ways.md similarity index 99% rename from translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md rename to published/20190117 How to Update-Change Users Password in Linux Using Different Ways.md index 0f997ddf27..0b0b5132bd 100644 --- a/translated/tech/20190117 How to Update-Change Users Password in Linux Using Different Ways.md +++ b/published/20190117 How to Update-Change Users Password in Linux Using Different Ways.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10514-1.html) [#]: subject: (How to Update/Change Users Password in Linux Using Different Ways) [#]: via: (https://www.2daygeek.com/linux-passwd-chpasswd-command-set-update-change-users-password-in-linux-using-shell-script/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) From f301cf693caed19602955d4bb70e17402545f4e9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 22:41:06 +0800 Subject: [PATCH 028/813] PRF:20150513 XML vs JSON.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wwhio 翻译的很棒很细心。 --- translated/talk/20150513 XML vs JSON.md | 84 +++++++++++++------------ 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/translated/talk/20150513 XML vs JSON.md b/translated/talk/20150513 XML vs JSON.md index 01bef8bec7..f6a1ee65f7 100644 --- a/translated/talk/20150513 XML vs JSON.md +++ b/translated/talk/20150513 XML vs JSON.md @@ -1,24 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (wwhio) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (XML vs JSON) [#]: via: (https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html) -[#]: author: (TOM STRASSNER tomstrassner@gmail.com) +[#]: author: (TOM STRASSNER tomstrassner@gmail.com) -XML vs JSON +XML 与 JSON 优劣对比 ====== ### 简介 -XML 和 JSON 是现今互联网中最常用的两种数据交换格式。XML 格式由 W3C 于 1996 年提出。JSON 格式由 Douglas Crockford 于 2020 年提出。虽然这两种格式的设计目标并不相同,但它们常常用于数据交换中。XML 和 JSON 的文档都很完善([RFC 7159][1], [RFC 4825][2]),且都同时具有人类可读性human-readable机器可读性machine-readable。这两种格式并没有哪一个比另一个更强,只是各自适用的领域不用。(LCTT译注:W3C 是[互联网联盟](https://www.w3.org/),制定了各种 Web 相关的标准,如 HTML、CSS 等。Douglas Crockford 除了制定了 JSON 格式,还致力于改进 JavaScript,开发了 JavaScript 相关工具 [JSLint](http://jslint.com/) 和 [JSMin](http://www.crockford.com/javascript/jsmin.html)。) +XML 和 JSON 是现今互联网中最常用的两种数据交换格式。XML 格式由 W3C 于 1996 年提出。JSON 格式由 Douglas Crockford 于 2002 年提出。虽然这两种格式的设计目标并不相同,但它们常常用于同一个任务,也就是数据交换中。XML 和 JSON 的文档都很完善([RFC 7159][1]、[RFC 4825][2]),且都同时具有人类可读性human-readable机器可读性machine-readable。这两种格式并没有哪一个比另一个更强,只是各自适用的领域不用。(LCTT 译注:W3C 是[互联网联盟](https://www.w3.org/),制定了各种 Web 相关的标准,如 HTML、CSS 等。Douglas Crockford 除了制定了 JSON 格式,还致力于改进 JavaScript,开发了 JavaScript 相关工具 [JSLint](http://jslint.com/) 和 [JSMin](http://www.crockford.com/javascript/jsmin.html)) ### XML 的优点 -XML 与 JSON 相比有很多优点。二者间最大的不同在于 XML 可以通过在标签中添加属性这一简单的方法来存储元数据metadata。而使用 JSON 时需要创建一个对象,把元数据当作对象的成员来存储。虽然二者都能达到存储元数据的目的,但在这一情况下 XML 往往是更好的选择,因为 JSON 的表达形式会让客户端程序开发人员误以为要将数据转换成一个对象。举个例子,如果你的 C++ 程序需要使用 JSON 格式发送一个附带元数据的整型数据,需要创建一个对象,用对象中的一个名称/值对name/value pair来记录整型数据的值,再为每一个附带的属性添加一个名称/值对。接收到这个 JSON 的程序在读取后很可能把它当成一个对象,可事实并不是这样。虽然这是使用 JSON 传递元数据的一种变通方法,但他违背了 JSON 的核心理念:“JSON 的结构与常规的程序语言中的结构相对应,而无需修改。JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] +XML 与 JSON 相比有很多优点。二者间最大的不同在于 XML 可以通过在标签中添加属性这一简单的方法来存储元数据metadata。而使用 JSON 时需要创建一个对象,把元数据当作对象的成员来存储。虽然二者都能达到存储元数据的目的,但在这一情况下 XML 往往是更好的选择,因为 JSON 的表达形式会让客户端程序开发人员误以为要将数据转换成一个对象。举个例子,如果你的 C++ 程序需要使用 JSON 格式发送一个附带元数据的整型数据,需要创建一个对象,用对象中的一个名称/值对name/value pair来记录整型数据的值,再为每一个附带的属性添加一个名称/值对。接收到这个 JSON 的程序在读取后很可能把它当成一个对象,可事实并不是这样。虽然这是使用 JSON 传递元数据的一种变通方法,但他违背了 JSON 的核心理念:“JSON 的结构与常规的程序语言中的结构相对应,而无需修改。JSON's structures look like conventional programming language structures. No restructuring is necessary.”[^2] -虽然稍后我会说这也是 XML 的一个缺点,但 XML 中对命名冲突、前缀prefix的处理机制赋予了它 JSON 所不具备的能力。程序员们可以通过前缀来把统一名称给予两个不同的实体。[1]当不同的实体在客户端中使用的名称相同时,这一特性会非常有用。 +虽然稍后我会说这也是 XML 的一个缺点,但 XML 中对命名冲突、前缀prefix的处理机制赋予了它 JSON 所不具备的能力。程序员们可以通过前缀来把统一名称给予两个不同的实体。[^1] 当不同的实体在客户端中使用的名称相同时,这一特性会非常有用。 XML 的另一个优势在于大多数的浏览器可以把它以具有高可读性和强组织性的方式highly readable and organized way展现给用户。XML 的树形结构让它易于结构化,浏览器也让用户可以自行展开或折叠树中的元素,这简直就是调试的福音。 @@ -26,70 +26,76 @@ XML 对比 JSON 有一个很重要的优势就是它可以记录混合内 ### JSON 的优点 -JSON 自身也有很多优点。其中最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要标签的打开和关闭,而 JSON 使用名称/值对表示数据,使用简单的“{”和“}”来标记对象,“\[”和“\]”来标记数组,“,”来表示数据的分隔,“:”表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[6]正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究[3][4]表明使用 JSON 执行序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理在 CPU 资源的使用上也优于 XML。研究人员发现 JSON 在总体上使用的资源更少,其中更多的 CPU 资源消耗在用户空间,系统空间消耗的 CPU 资源较少。这一实验是在 RedHat 的设备上进行的,RedHat 表示更倾向于在用户空间使用 CPU 资源。[3]不出意外,Sumaray 和 Makki 在研究里还说明了在移动设备上 JSON 的性能也优于 XML。[4]这很直接,因为 JSON 消耗的资源更少,移动设备的性能也更弱。 +JSON 自身也有很多优点。其中最显而易见的一点就是 JSON 比 XML 简洁得多。因为 XML 中需要打开和关闭标签,而 JSON 使用名称/值对表示数据,使用简单的 `{` 和 `}` 来标记对象,`[` 和 `]` 来标记数组,`,` 来表示数据的分隔,`:` 表示名称和值的分隔。就算是使用 gzip 压缩,JSON 还是比 XML 要小,而且耗时更少。[^6] 正如 Sumaray 和 Makki 在实验中指出的那样,JSON 在很多方面都比 XML 更具优势,得出同样结果的还有 Nurseitov、Paulson、Reynolds 和 Izurieta。首先,由于 JSON 文件天生的简洁性,与包含相同信息的 XML 相比,JSON 总是更小,这意味着更快的传输和处理速度。第二,在不考虑大小的情况下,两组研究 [^3] [^4] 表明使用 JSON 执行序列化和反序列化的速度显著优于使用 XML。第三,后续的研究指出 JSON 的处理在 CPU 资源的使用上也优于 XML。研究人员发现 JSON 在总体上使用的资源更少,其中更多的 CPU 资源消耗在用户空间,系统空间消耗的 CPU 资源较少。这一实验是在 RedHat 的设备上进行的,RedHat 表示更倾向于在用户空间使用 CPU 资源。[^3a] 不出意外,Sumaray 和 Makki 在研究里还说明了在移动设备上 JSON 的性能也优于 XML。[^4a] 这是有道理的,因为 JSON 消耗的资源更少,而移动设备的性能也更弱。 -JSON 的另一个优点在于其对对象和数组的表述和宿主语言host language中的数据结构相对应,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有数组array向量vector列表list,以及对象组成的数组等等。[2] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,但往往需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,XML 标准缺乏对象、数组的标签的明确定义。当结构化的标记可以替代嵌套的标签时,JSON 的优势极为突出。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也包含前文中的问题,在表示元数据时 JSON 不如 XML 准确。 +JSON 的另一个优点在于其对对象和数组的表述和宿主语言host language中的数据结构相对应,例如对象object记录record结构体struct字典dictionary哈希表hash table键值列表keyed list还有数组array向量vector列表list,以及对象组成的数组等等。[^2a] 虽然 XML 里也能表达这些数据结构,也只需调用一个函数就能完成解析,而往往需要更多的代码才能正确的完成 XML 的序列化和反序列化处理。而且 XML 对于人类来说不如 JSON 那么直观,XML 标准缺乏对象、数组的标签的明确定义。当结构化的标记可以替代嵌套的标签时,JSON 的优势极为突出。JSON 中的花括号和中括号则明确表示了数据的结构,当然这一优势也包含前文中的问题,在表示元数据时 JSON 不如 XML 准确。 虽然 XML 支持命名空间namespace前缀prefix,但这不代表 JSON 没有处理命名冲突的能力。比起 XML 的前缀,它处理命名冲突的方式更简洁,在程序中的处理也更自然。在 JSON 里,每一个对象都在它自己的命名空间中,因此不同对象内的元素名称可以随意重复。在大多数编程语言中,不同的对象中的成员可以包含相同的名字,所以 JSON 根据对象进行名称区分的规则在处理时更加自然。 -也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都实现了处理 JSON 所需的函数。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 +也许 JSON 比 XML 更优的部分是因为 JSON 是 JavaScript 的子集,所以在 JavaScript 代码中对它的解析或封装都非常的自然。虽然这看起来对 JavaScript 程序非常有用,而其他程序则不能直接从中获益,可实际上这一问题已经被很好的解决了。现在 JSON 的网站的列表上展示了 64 种不同语言的 175 个工具,它们都实现了处理 JSON 所需的功能。虽然我不能评价大多数工具的质量,但它们的存在明确了开发者社区拥抱 JSON 这一现象,而且它们切实简化了在不同平台使用 JSON 的难度。 ### 二者的动机 -简单地说,XML 的目标是完成一种文档标记。这和 JSON 的目标想去甚远,所以只要用得到 XML 的地方就尽管用。它使用树形的结构和包含语义的文本来表达混合内容以实现这一目标。在 XML 中可以表示数据的结构,但这并不是它的长处。 +简单地说,XML 的目标是标记文档。这和 JSON 的目标想去甚远,所以只要用得到 XML 的地方就尽管用。它使用树形的结构和包含语义的文本来表达混合内容以实现这一目标。在 XML 中可以表示数据的结构,但这并不是它的长处。 -JSON’s purpose is structured data interchange. It serves this purpose by directly representing objects, arrays, numbers, strings, and booleans. Its purpose is distinctly not document markup. As described above, JSON does not have a natural way to represent mixed content. JSON 的目标是用于数据交换的一种结构化表示。它直接使用对象、数组、数字、字符串、布尔值这些元素来达成这一目标。这完全不同于文档标记语言。正如上面说的那样,JSON 没有原生支持混合内容mixed content的记录。 ### 软件 这些主流的开放 API 仅提供 XML:亚马逊产品广告 APIAmazon Product Advertising API。 -这些主流 API 仅提供 JSON:脸书图 APIFacebook Graph API谷歌地图 APIGoogle Maps API推特 APITwitter API,AccuWeather API,Pinterest API,Reddit API,Foursquare API。 +这些主流 API 仅提供 JSON:脸书图 APIFacebook Graph API谷歌地图 APIGoogle Maps API推特 APITwitter API、AccuWeather API、Pinterest API、Reddit API、Foursquare API。 -这些主流 API 同时提供 XML 和 JSON:谷歌云存储Google Cloud Storage领英 APILinkedin API,Flickr API。 +这些主流 API 同时提供 XML 和 JSON:谷歌云存储Google Cloud Storage领英 APILinkedin API、Flickr API。 -根据可编程网络Programmable Web[9]的数据,最流行的 10 个 API 中只有一个是仅提供 XML 且不支持 JSON 的。其他的要么同时支持 XML 和 JSON,要么只支持 JSON。这表明了大多数应用开发者都更倾向于使用支持 JSON 的 API,原因大概是 JSON 更快的处理速度与良好口碑,加之与 XML 相比更加轻量。此外,大多数 API 只是传递数据而非文档,所以 JSON 更加合适。例如 Facebook 的重点在于用户的交流与帖子,谷歌地图则主要处理坐标和地图信息,AccuWeather 就只传递天气数据。总之,虽然不能说天气 API 在使用时究竟是 JSON 用的多还是 XML 用的多,但是趋势明确偏向了 JSON。[10][11] +根据可编程网络Programmable Web [^9] 的数据,最流行的 10 个 API 中只有一个是仅提供 XML 且不支持 JSON 的。其他的要么同时支持 XML 和 JSON,要么只支持 JSON。这表明了大多数应用开发者都更倾向于使用支持 JSON 的 API,原因大概是 JSON 更快的处理速度与良好口碑,加之与 XML 相比更加轻量。此外,大多数 API 只是传递数据而非文档,所以 JSON 更加合适。例如 Facebook 的重点在于用户的交流与帖子,谷歌地图则主要处理坐标和地图信息,AccuWeather 就只传递天气数据。总之,虽然不能说天气 API 在使用时究竟是 JSON 用的多还是 XML 用的多,但是趋势明确偏向了 JSON。[^10] [^11] -这些主流的桌面软件仍然只是用 XML:Microsoft Word,Apache OpenOffice,LibraOffice。 +这些主流的桌面软件仍然只是用 XML:Microsoft Word、Apache OpenOffice、LibraOffice。 因为这些软件需要考虑引用、格式、存储等等,所以比起 JSON,XML 优势更大。另外,这三款程序都支持混合内容,而 JSON 在这一点上做得并不如 XML 好。举例说明,当用户使用 Microsoft Word 编辑一篇论文时,用户需要使用不同的文字字形、文字大小、文字颜色、页边距、段落格式等,而 XML 结构化的组织形式与标签属性生来就是为了表达这些信息的。 -这些主流的数据库支持 XML:IBM DB2,Microsoft SQL Server,Oracle Database,PostgresSQL,BaseX,eXistDB,MarkLogic,MySQL。 +这些主流的数据库支持 XML:IBM DB2、Microsoft SQL Server、Oracle Database、PostgresSQL、BaseX、eXistDB、MarkLogic、MySQL。 -这些是支持 JSON 的主流数据库:MongoDB,CouchDB,eXistDB,Elastisearch,BaseX,MarkLogic,OrientDB,Oracle Database,PostgresSQL,Riak。 +这些是支持 JSON 的主流数据库:MongoDB、CouchDB、eXistDB、Elastisearch、BaseX、MarkLogic、OrientDB、Oracle Database、PostgreSQL、Riak。 -在很长一段时间里,SQL 和关系型数据库统治着整个数据库市场。像甲骨文Oracle微软Microsoft这样的软件巨头都提供这类数据库,然而近几年 NoSQL 数据库正逐步受到开发者的青睐。也许是正巧碰上了 JSON 的普及,大多数 NoSQL 数据库都支持 JSON,像 MongoDB、CouchDB 和 Riak 这样的数据库甚至使用 JSON 来存储数据。这些数据库有两个重要的特性是它们适用于现代网站:一是它们与关系型数据库相比更容易扩展more scalable;二是它们设计的目标就是 web 运行所需的核心组件。由于 JSON 更加轻量,又是 JavaScript 的子集,所以很适合 NoSQL 数据库,并且让这两个品质更容易实现。此外,许多旧的关系型数据库增加了 JSON 支持,例如 Oracle Database 和 PostgresSql。由于 XML 与 JSON 间的转换比较麻烦,所以大多数开发者会直接在他们的应用里使用 JSON,因此开发数据库的公司才有支持 JSON 的理由。(LCTT译注:NoSQL是对不同于传统的关系数据库的数据库管理系统的统称。[参考来源](https://zh.wikipedia.org/wiki/NoSQL)) +在很长一段时间里,SQL 和关系型数据库统治着整个数据库市场。像甲骨文Oracle微软Microsoft这样的软件巨头都提供这类数据库,然而近几年 NoSQL 数据库正逐步受到开发者的青睐。也许是正巧碰上了 JSON 的普及,大多数 NoSQL 数据库都支持 JSON,像 MongoDB、CouchDB 和 Riak 这样的数据库甚至使用 JSON 来存储数据。这些数据库有两个重要的特性是它们适用于现代网站:一是它们与关系型数据库相比更容易扩展more scalable;二是它们设计的目标就是 web 运行所需的核心组件。[^10a] 由于 JSON 更加轻量,又是 JavaScript 的子集,所以很适合 NoSQL 数据库,并且让这两个品质更容易实现。此外,许多旧的关系型数据库增加了 JSON 支持,例如 Oracle Database 和 PostgreSQL。由于 XML 与 JSON 间的转换比较麻烦,所以大多数开发者会直接在他们的应用里使用 JSON,因此开发数据库的公司才有支持 JSON 的理由。(LCTT 译注:NoSQL 是对不同于传统的关系数据库的数据库管理系统的统称。[参考来源](https://zh.wikipedia.org/wiki/NoSQL)) [^7] ### 未来 -对互联网的种种变革中,最让人期待的便是物联网Internet of Things。这会给互联网带来大量计算机之外的设备,例如手表、温度计、电视、冰箱等等。这一势头的发展良好,预期在不久的将来迎来爆发式的增长。据估计,到 2020 年时会有 260 亿 到 2000 亿的物联网设备被接入互联网。[12][13] 几乎所有的物联网设备都是小型设备,因此性能比笔记本或台式电脑要弱很多,而且大多数都是嵌入式系统。因此,当他们需要与互联网上的系统交换数据时,更轻量,更快速的 JSON 自然比 XML 更受青睐。[10] 受益于 JSON 在 web 上的快速普及,与 XML 相比,这些新的物联网设备更有可能从使用 JSON 中受益。这是一个典型的梅特卡夫定律的例子,无论是 XML 还是 JSON,抑或是什么其他全新的格式,现存的设备和新的设备都会从支持最广泛使用的格式中受益。 +对互联网的种种变革中,最让人期待的便是物联网Internet of Things(IoT)。这会给互联网带来大量计算机之外的设备,例如手表、温度计、电视、冰箱等等。这一势头的发展良好,预期在不久的将来迎来爆发式的增长。据估计,到 2020 年时会有 260 亿 到 2000 亿的物联网设备被接入互联网。[^12] [^13] 几乎所有的物联网设备都是小型设备,因此性能比笔记本或台式电脑要弱很多,而且大多数都是嵌入式系统。因此,当它们需要与互联网上的系统交换数据时,更轻量、更快速的 JSON 自然比 XML 更受青睐。[^10b] 受益于 JSON 在 web 上的快速普及,与 XML 相比,这些新的物联网设备更有可能从使用 JSON 中受益。这是一个典型的梅特卡夫定律的例子,无论是 XML 还是 JSON,抑或是什么其他全新的格式,现存的设备和新的设备都会从支持最广泛使用的格式中受益。 -Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。这些都预示着 JSON 光明的未来,这些软件的出现让 JSON 运用在全栈开发的每一个环节成为可能,这将使应用更加轻量,响应更快。这也是任何应用的追求之一,所以,全栈使用 JavaScript 的趋势在不久的未来都不会消退。[10] +Node.js 是一款服务器端的 JavaScript 框架,随着她的诞生与快速成长,与 MongoDB 等 NoSQL 数据库一起,让全栈使用 JavaScript 开发成为可能。这些都预示着 JSON 光明的未来,这些软件的出现让 JSON 运用在全栈开发的每一个环节成为可能,这将使应用更加轻量,响应更快。这也是任何应用的追求之一,所以,全栈使用 JavaScript 的趋势在不久的未来都不会消退。[^10c] -此外,另一个应用开发的趋势是从 SOAP 转向 REST。[11][15][16] XML 和 JSON 都可以用于 REST,可 SOAP 只能使用 XML。 +此外,另一个应用开发的趋势是从 SOAP 转向 REST。[^11a] [^15] [^16] XML 和 JSON 都可以用于 REST,可 SOAP 只能使用 XML。 从这些趋势中可以推断,JSON 的发展将统一 Web 的信息交换格式,XML 的使用率将继续降低。虽然不应该把 JSON 吹过头了,因为 XML 在 Web 中的使用依旧很广,而且它还是 SOAP 的唯一选择,可考虑到 SOAP 到 REST 的迁移,NoSQL 数据库和全栈 JavaScript 的兴起,JSON 卓越的性能,我相信 JSON 很快就会在 Web 开发中超过 XML。至于其他领域,XML 比 JSON 更好的情况并不多。 -### 参考链接 +### 角注 -1. [XML Tutorial](http://www.w3schools.com/xml/default.asp) -2. [Introducing JSON](http://www.json.org/) -3. [Comparison of JSON and XML Data Interchange Formats: A Case Study](http://www.cs.montana.edu/izurieta/pubs/caine2009.pdf) -4. [A comparison of data serialization formats for optimal efficiency on a mobile platform](http://dl.acm.org/citation.cfm?id=2184810) -5. [JSON vs. XML: The Debate](http://ajaxian.com/archives/json-vs-xml-the-debate) -6. [JSON vs. XML: Some hard numbers about verbosity](http://www.codeproject.com/Articles/604720/JSON-vs-XML-Some-hard-numbers-about-verbosity) -7. [How JSON sparked NoSQL -- and will return to the RDBMS fold](http://www.infoworld.com/article/2608293/nosql/how-json-sparked-nosql----and-will-return-to-the-rdbms-fold.html) -8. [Did You Say "JSON Support" in Oracle 12.1.0.2?](https://blogs.oracle.com/OTN-DBA-DEV-Watercooler/entry/did_you_say_json_support) -9. [Most Popular APIs: At Least One Will Surprise You](http://www.programmableweb.com/news/most-popular-apis-least-one-will-surprise-you/2014/01/23) -10. [Why JSON will continue to push XML out of the picture](https://www.centurylinkcloud.com/blog/post/why-json-will-continue-to-push-xml-out-of-the-picture/) -11. [Thousands of APIs Paint a Bright Future for the Web](http://www.webmonkey.com/2011/03/thousand-of-apis-paint-a-bright-future-for-the-web/) -12. [A Simple Explanation Of 'The Internet Of Things’](http://www.forbes.com/sites/jacobmorgan/2014/05/13/simple-explanation-internet-things-that-anyone-can-understand/) -13. [Proofpoint Uncovers Internet of Things (IoT) Cyberattack](http://www.proofpoint.com/about-us/press-releases/01162014.php) -14. [The Internet of Things: New Threats Emerge in a Connected World](http://www.symantec.com/connect/blogs/internet-things-new-threats-emerge-connected-world) -15. [3,000 Web APIs: Trends From A Quickly Growing Directory](http://www.programmableweb.com/news/3000-web-apis-trends-quickly-growing-directory/2011/03/08) -16. [How REST replaced SOAP on the Web: What it means to you](http://www.infoq.com/articles/rest-soap) +[^1]: [XML Tutorial](http://www.w3schools.com/xml/default.asp) +[^2]: [Introducing JSON](http://www.json.org/) +[^2a]: [Introducing JSON](http://www.json.org/) +[^3]: [Comparison of JSON and XML Data Interchange Formats: A Case Study](http://www.cs.montana.edu/izurieta/pubs/caine2009.pdf) +[^3a]: [Comparison of JSON and XML Data Interchange Formats: A Case Study](http://www.cs.montana.edu/izurieta/pubs/caine2009.pdf) +[^4]: [A comparison of data serialization formats for optimal efficiency on a mobile platform](http://dl.acm.org/citation.cfm?id=2184810) +[^4a]: [A comparison of data serialization formats for optimal efficiency on a mobile platform](http://dl.acm.org/citation.cfm?id=2184810) +[^5]: [JSON vs. XML: The Debate](http://ajaxian.com/archives/json-vs-xml-the-debate) +[^6]: [JSON vs. XML: Some hard numbers about verbosity](http://www.codeproject.com/Articles/604720/JSON-vs-XML-Some-hard-numbers-about-verbosity) +[^7]: [How JSON sparked NoSQL -- and will return to the RDBMS fold](http://www.infoworld.com/article/2608293/nosql/how-json-sparked-nosql----and-will-return-to-the-rdbms-fold.html) +[^8]: [Did You Say "JSON Support" in Oracle 12.1.0.2?](https://blogs.oracle.com/OTN-DBA-DEV-Watercooler/entry/did_you_say_json_support) +[^9]: [Most Popular APIs: At Least One Will Surprise You](http://www.programmableweb.com/news/most-popular-apis-least-one-will-surprise-you/2014/01/23) +[^10]: [Why JSON will continue to push XML out of the picture](https://www.centurylinkcloud.com/blog/post/why-json-will-continue-to-push-xml-out-of-the-picture/) +[^10a]: [Why JSON will continue to push XML out of the picture](https://www.centurylinkcloud.com/blog/post/why-json-will-continue-to-push-xml-out-of-the-picture/) +[^10b]: [Why JSON will continue to push XML out of the picture](https://www.centurylinkcloud.com/blog/post/why-json-will-continue-to-push-xml-out-of-the-picture/) +[^10c]: [Why JSON will continue to push XML out of the picture](https://www.centurylinkcloud.com/blog/post/why-json-will-continue-to-push-xml-out-of-the-picture/) +[^11]: [Thousands of APIs Paint a Bright Future for the Web](http://www.webmonkey.com/2011/03/thousand-of-apis-paint-a-bright-future-for-the-web/) +[^11a]: [Thousands of APIs Paint a Bright Future for the Web](http://www.webmonkey.com/2011/03/thousand-of-apis-paint-a-bright-future-for-the-web/) +[^12]: [A Simple Explanation Of 'The Internet Of Things’](http://www.forbes.com/sites/jacobmorgan/2014/05/13/simple-explanation-internet-things-that-anyone-can-understand/) +[^13]: [Proofpoint Uncovers Internet of Things (IoT) Cyberattack](http://www.proofpoint.com/about-us/press-releases/01162014.php) +[^14]: [The Internet of Things: New Threats Emerge in a Connected World](http://www.symantec.com/connect/blogs/internet-things-new-threats-emerge-connected-world) +[^15]: [3,000 Web APIs: Trends From A Quickly Growing Directory](http://www.programmableweb.com/news/3000-web-apis-trends-quickly-growing-directory/2011/03/08) +[^16]: [How REST replaced SOAP on the Web: What it means to you](http://www.infoq.com/articles/rest-soap) -------------------------------------------------------------------------------- @@ -99,7 +105,7 @@ via: https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/Fi 作者:[TOM STRASSNER][a] 选题:[lujun9972][b] 译者:[wwhio](https://github.com/wwhio) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c406161d62e7bf174623df4dcd1c68d3b9e9b904 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Feb 2019 22:44:33 +0800 Subject: [PATCH 029/813] PUB:20150513 XML vs JSON.md @wwhio https://linux.cn/article-10515-1.html --- {translated/talk => published}/20150513 XML vs JSON.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20150513 XML vs JSON.md (99%) diff --git a/translated/talk/20150513 XML vs JSON.md b/published/20150513 XML vs JSON.md similarity index 99% rename from translated/talk/20150513 XML vs JSON.md rename to published/20150513 XML vs JSON.md index f6a1ee65f7..282ae76893 100644 --- a/translated/talk/20150513 XML vs JSON.md +++ b/published/20150513 XML vs JSON.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wwhio) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10515-1.html) [#]: subject: (XML vs JSON) [#]: via: (https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html) [#]: author: (TOM STRASSNER tomstrassner@gmail.com) From cc1315a2875ab745a052bb7ea96fd42c24756589 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Wed, 6 Feb 2019 17:00:25 +0000 Subject: [PATCH 030/813] =?UTF-8?q?Revert=20"=E7=94=B3=E8=AF=B7=E7=BF=BB?= =?UTF-8?q?=E8=AF=91"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5f25c6e7d17f25ceefc4b9a31e2296ea2469ce82. --- ...40412 My Lisp Experiences and the Development of GNU Emacs.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md b/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md index 60e1094af9..7be913c3bf 100644 --- a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md +++ b/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md @@ -1,4 +1,3 @@ -zgj1024 is translating My Lisp Experiences and the Development of GNU Emacs ====== From 25a2a7a610a6df0dfbda8972468465b21ea5d0b7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 10:05:22 +0800 Subject: [PATCH 031/813] PRF:20180206 Building Slack for the Linux community and adopting snaps.md --- ...Building Slack for the Linux community and adopting snaps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180206 Building Slack for the Linux community and adopting snaps.md b/published/20180206 Building Slack for the Linux community and adopting snaps.md index 371adf6568..8705db5463 100644 --- a/published/20180206 Building Slack for the Linux community and adopting snaps.md +++ b/published/20180206 Building Slack for the Linux community and adopting snaps.md @@ -45,7 +45,7 @@ Slack 真正的独特之处在于人们不仅仅是碰巧发现它,他们从 ### 如果存在的话,你们正使用或者准备使用边缘 (edge)、测试 (beta)、候选 (candidate)、稳定 (stable) 中的哪种发行频道? -我们开发中专门使用边缘 (edge) 频道以与 Canonical 团队合作。为 Linux 打造的 Slack 总体人处于测试 (beta) 频道中。但是长远来看,拥有不同频道的选择十分有意思,同时能够提早一点为感兴趣的客户发布版本也肯定是有好处的。 +我们开发中专门使用边缘 (edge) 频道以与 Canonical 团队合作。为 Linux 打造的 Slack 总体仍处于测试 (beta) 频道中。但是长远来看,拥有不同频道的选择十分有意思,同时能够提早一点为感兴趣的客户发布版本也肯定是有好处的。 ### 你们如何认为将软件打包成一个 snap 能够帮助用户?你们从用户那边得到了什么反馈吗? From 351f4c28568723c3af40224176431449b4dfc1bf Mon Sep 17 00:00:00 2001 From: HuanCheng Bai <13283837+bestony@users.noreply.github.com> Date: Thu, 7 Feb 2019 11:24:24 +0800 Subject: [PATCH 032/813] =?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 --- ...Share Your Terminal Sessions On The Fly.md | 107 ++++++++++-------- 1 file changed, 61 insertions(+), 46 deletions(-) rename {sources => translated}/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md (61%) diff --git a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md similarity index 61% rename from sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md rename to translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md index 20bcfbe26d..cde1e24855 100644 --- a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md +++ b/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -1,4 +1,4 @@ -[#]: collector: (lujun9972) + [#]: collector: (lujun9972) [#]: translator: (bestony) [#]: reviewer: ( ) [#]: publisher: ( ) @@ -7,86 +7,93 @@ [#]: via: (https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Asciinema – Record And Share Your Terminal Sessions On The Fly +Asciinema - 在云端记录并分享你的终端会话 ====== -This is known topic and we had already written so many article about this topic. +这个众所周知的话题我们早已经写过了足够多的文章。 -Even today also we are going to discuss about the same topic. +即使这样,我们今天也要去讨论相同的话题。 -Other tools are works locally but Asciinema works in both way like local and web. +其他的工具都是在本地运行的,但是 Asciinema 可以以相同的方式在本地和 Web 端运行。 -I mean we can share the recording on the web. +我的意思是我们可以在 Web 上分享这个录像。 -By default everyone prefer history command to review/recall the previously entered commands in terminal. +默认情况下下,每个人都更愿意使用 history 命令来回看、调用之前在终端内输入的命令。 -But unfortunately, that shows only the commands that we ran and doesn’t shows the commands output which was performed previously. +不过,不行的是,这个命令只展示了我们运行的命令却没有展示这些命令上次运行时的输出。 -There are many utilities available in Linux to record the terminal session activity. +在 Linux 下有很多的组件来记录终端会话活动。 -Also, we had written about few utilities in the past and today also we are going to discuss about the same kind of topic. +在过去,我们也写了一些组件,不过今天我们依然要讨论这同一类心的工具。 -If you would like to check other utilities to record your Linux terminal session activity then you can give a try to **[Script Command][1]** , **[Terminalizer Tool][2]** and **[Asciinema Tool][3]**. +如果你想要使用其他工具来记录你的 Linux 终端会话活动,你可以试试 **[Script Command][1]** , **[Terminalizer Tool][2]** 和 **[Asciinema Tool][3]**. -But if you are looking for **[GIF Recorder][4]** then try **[Gifine][5]** , **[Kgif][6]** and **[Peek][7]** utilities. +不过如果你想要找一个 **[GIF 录制工具][4]**,可以试试 **[Gifine][5]** , **[Kgif][6]** 和 **[Peek][7]**. -### What is Asciinema -asciinema is a free and open source solution for recording terminal sessions and sharing them on the web. +### 什么是 Asciinema -When you run asciinema rec in your terminal the recording starts, capturing all output that is being printed to your terminal while you’re issuing the shell commands. +asciinema 是一个免费且开源的用于录制终端会话并将它们分享到网络上的解决方案。 -When the recording finishes (by hitting `Ctrl-D` or typing `exit`) then the captured output is uploaded to asciinema.org website and prepared for playback on the web. +当你在你的终端内运行 asciinema rec 来启动录像时,你输入命令的时候,终端内的所有输出都会被抓取。 -Asciinema project is built of several complementary pieces such as asciinema command line tool, API at asciinema.org and javascript player. +当抓取停止时(通过按下 `Ctrl-D` 或输出 `exit`),抓取的输出将会被上传到 asciinema.org 的网站,并为后续的回放做准备。 + +Asciinema 项目基于多个不同的完整的部分构建的,比如 asciinema 命令行工具、asciinema.org API 和 JavaScript 播放器。 + +Asciinema 是受到了 script 和 scriptreplay 命令影响而产生的。 Asciinema was inspired by script and scriptreplay commands. -### How to Install Asciinema In Linux +### 如何在 Linux 上安装 Asciinema -It was written in Python and pip installation is a recommended method to install Asciinema on Linux. -Make sure you should have installed python-pip package on your system. If no, use the following command to install it. +Asciinema 基于 Python 写就,在 Linux 上,推荐使用 pip 安装的方法来安装。 + +确保你已经在你的系统里安装了 python-pip 包。如果没有,使用下述命令来安装它。 + + +对于 Debian/Ubuntu 用户,使用 **[Apt 命令][8]**或 **[Apt-Get 命令][9]** 来安装 pip 包。 + -For Debian/Ubuntu users, use **[Apt Command][8]** or **[Apt-Get Command][9]** to install pip package. ``` $ sudo apt install python-pip ``` -For Archlinux users, use **[Pacman Command][10]** to install pip package. +对于 Archlinux 用户, 使用 **[Pacman 命令][10]** 来安装 pip 包。 ``` $ sudo pacman -S python-pip ``` -For Fedora users, use **[DNF Command][11]** to install pip package. +对于 Fedora 用户, 使用 **[DNF 命令][11]** 来安装 pip 包。 ``` $ sudo dnf install python-pip ``` -For CentOS/RHEL users, use **[YUM Command][12]** to install pip package. +对于 CentOS/RHEL 用户, 使用 **[YUM Command][12]** 来安装 pip 包。 ``` $ sudo yum install python-pip ``` -For openSUSE users, use **[Zypper Command][13]** to install pip package. +对于 openSUSE 用户, 使用 **[Zypper Command][13]** 来安装 pip 包。 ``` $ sudo zypper install python-pip ``` -Finally run the following **[pip command][14]** to install Asciinema tool in Linux. +最后,运行如下的 **[pip 命令][14]** 来在 Linux 上安装 Asciinema 工具。 ``` $ sudo pip3 install asciinema ``` -### How to Record Your Terminal Session Using Asciinema +### 如何使用 Asciinema 工具来记录你的终端会话 -Once you successfully installed Asciinema. Just run the following command to start recording. +一旦你成功的安装了 Asciinema,只需要运行如下命令来开始录制 ``` $ asciinema rec 2g-test @@ -94,7 +101,7 @@ asciinema: recording asciicast to 2g-test asciinema: press "ctrl-d" or type "exit" when you're done ``` -For testing purpose run few commands and see whether it’s working fine or not. +为了测试的目的,运行一些简单的命令,并看一看它是否运行的很好。 ``` $ free @@ -141,10 +148,10 @@ L1i cache: 32K L2 cache: 256K L3 cache: 6144K NUMA node0 CPU(s): 0-7 -Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_add fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d ``` -Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in the same directory. +当你完成后,简单的按下 `CTRL+D` 或输入 `exit` 来退出录制。这个结果将会被保存在同一个目录。 ``` $ exit @@ -153,35 +160,37 @@ asciinema: recording finished asciinema: asciicast saved to 2g-test ``` -If you would like to save the output in the different directory then mention the path where you want to save the file. +如果你想要保存输出到不同的目录中,就需要提醒 Asciinema 你想要保存文件的目录 ``` $ asciinema rec /opt/session-record/2g-test1 ``` -We can play the recorded session using the following command. +我们可以使用如下命令来回放录制的会话。 ``` $ asciinema play 2g-test ``` -We can play the recorded session with double speed. +我们能够以两倍速来运行录制的会话。 ``` $ asciinema play -s 2 2g-test ``` -Alternatively we can play the recorded session with normal speed with idle time limited to 2 seconds. +或者,我们可以以正常速度播放录制的会话,限制空白时间为2秒。 ``` $ asciinema play -i 2 2g-test ``` -### How To Share the Recorded Session on The Web +### 如何在网络上分享已经录制的会话 If you would like to share the recorded session with your friends, just run the following command which upload the recording to asciinema.org and provide you the unique link. -It will be automatically archived 7 days after upload. +如果你想要分享录制的会话给你的朋友,只要运行下述上传你的会话到 asciinema.org 的命令,就可以获得一个唯一链接。 + +它将会在被上传 7 天后被归档。 ``` $ asciinema upload 2g-test @@ -201,19 +210,24 @@ installation with asciinema.org account by opening the following link: ![][16] -If you would like to share the recorded session on social media, just click the `Share` button in the bottom of the page. +如果你想要分享录制的会话在社交媒体上,只需要点击页面底部的 `分享` 按钮。 + +如果任何人想要去下载这个录制,只需要点击页面底部的 `下载` 按钮,就可以将其保存在你系统里。 If anyone wants to download this recording, just click the `Download` button in the bottom of the page to save on your system. -### How to Manage Recording on asciinema.org Site +### 如何 asciinema.org 中的录制片段 If you want to preserve all recordings made on this machine, connect this installation with asciinema.org account by opening the following link and follow the instructions. +如果你想要保护所有在这个机器上录制的片段,点击下方的链接并使用你在 asciinema.org 的账户登陆,然后跟随这个说明继续操作。 + ``` https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 ``` -If you have already recorded an asciicast but you don’t see it on your profile on asciinema.org website. Just run the `asciinema auth` command in your terminal to move those. +如果你早已录制了一个 asciicast,但是你没有在你的 asciinema.org 账户界面看到它,只需要运行 `asciinema auth` 命令来移动他们。 + ``` $ asciinema auth @@ -227,7 +241,7 @@ This will associate all recordings uploaded from this machine (past and future o ![][17] -Run the following command if you would like to upload the file directly to asciinema.org instead of locally saving. +如果你想直接上传文件而不是将其保存在本地,直接运行如下命令: ``` $ asciinema rec @@ -235,7 +249,7 @@ asciinema: recording asciicast to /tmp/tmp6kuh4247-ascii.cast asciinema: press "ctrl-d" or type "exit" when you're done ``` -Just run the following command to start recording. +只要运行如下命令来开始录制。 ``` $ asciinema rec 2g-test @@ -243,7 +257,7 @@ asciinema: recording asciicast to 2g-test asciinema: press "ctrl-d" or type "exit" when you're done ``` -For testing purpose run few commands and see whether it’s working fine or not. +出于测试目的,运行下述命令,并看一看它是否运行的很好。 ``` $ free @@ -265,9 +279,10 @@ $ uname -a Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux ``` -Once you have done, simple press `CTRL+D` or type `exit` to stop the recording then hit `Enter` button to upload the recording to asciinema.org website. -It will take few seconds to generate the unique url for your uploaded recording. Once it’s done you will be getting the results same as below. +如果你完成了,简单的按下 `CTRL+D` 或输入 `exit` 来停止录制,然后按下`回车`按钮来上传文件到 asciinema.org 网站。 + +这将会花费一些时间来为你的录制生成唯一链接。一旦它完成,你会看到和下面一样的样式: ``` $ exit @@ -286,7 +301,7 @@ via: https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-shar 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[Bestony](https://github.com/bestony) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 244e150fadd0127b8459ad96a737bb466df6144b Mon Sep 17 00:00:00 2001 From: HuanCheng Bai <13283837+bestony@users.noreply.github.com> Date: Thu, 7 Feb 2019 12:00:21 +0800 Subject: [PATCH 033/813] Update and rename sources/tech/20190125 PyGame Zero- Games without boilerplate.md to translated/tech/20190125 PyGame Zero- Games without boilerplate.md --- ... PyGame Zero- Games without boilerplate.md | 99 ----------------- ... PyGame Zero- Games without boilerplate.md | 102 ++++++++++++++++++ 2 files changed, 102 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20190125 PyGame Zero- Games without boilerplate.md create mode 100644 translated/tech/20190125 PyGame Zero- Games without boilerplate.md diff --git a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md b/sources/tech/20190125 PyGame Zero- Games without boilerplate.md deleted file mode 100644 index f60c2b3407..0000000000 --- a/sources/tech/20190125 PyGame Zero- Games without boilerplate.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (xiqingongzi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (PyGame Zero: Games without boilerplate) -[#]: via: (https://opensource.com/article/19/1/pygame-zero) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -PyGame Zero: Games without boilerplate -====== -Say goodbye to boring boilerplate in your game development with PyGame Zero. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3) - -Python is a good beginner programming language. And games are a good beginner project: they are visual, self-motivating, and fun to show off to friends and family. However, the most common library to write games in Python, [PyGame][1], can be frustrating for beginners because forgetting seemingly small details can easily lead to nothing rendering. - -Until people understand why all the parts are there, they treat many of them as "mindless boilerplate"—magic paragraphs that need to be copied and pasted into their program to make it work. - -[PyGame Zero][2] is intended to bridge that gap by putting a layer of abstraction over PyGame so it requires literally no boilerplate. - -When we say literally, we mean it. - -This is a valid PyGame Zero file: - -``` -# This comment is here for clarity reasons -``` - -We can run put it in a **game.py** file and run: - -``` -$ pgzrun game.py -``` - -This will show a window and run a game loop that can be shut down by closing the window or interrupting the program with **CTRL-C**. - -This will, sadly, be a boring game. Nothing happens. - -To make it slightly more interesting, we can draw a different background: - -``` -def draw(): -    screen.fill((255, 0, 0)) -``` - -This will make the background red instead of black. But it is still a boring game. Nothing is happening. We can make it slightly more interesting: - -``` -colors = [0, 0, 0] - -def draw(): -    screen.fill(tuple(colors)) - -def update(): -    colors[0] = (colors[0] + 1) % 256 -``` - -This will make a window that starts black, becomes brighter and brighter red, then goes back to black, over and over again. - -The **update** function updates parameters, while the **draw** function renders the game based on these parameters. - -However, there is no way for the player to interact with the game! Let's try something else: - -``` -colors = [0, 0, 0] - -def draw(): -    screen.fill(tuple(colors)) - -def update(): -    colors[0] = (colors[0] + 1) % 256 - -def on_key_down(key, mod, unicode): -    colors[1] = (colors[1] + 1) % 256 -``` - -Now pressing keys on the keyboard will increase the "greenness." - -These comprise the three important parts of a game loop: respond to user input, update parameters, and re-render the screen. - -PyGame Zero offers much more, including functions for drawing sprites and playing sound clips. - -Try it out and see what type of game you can come up with! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/pygame-zero - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[xiqingongzi](https://github.com/xiqingongzi) -校对:[校对者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://www.pygame.org/news -[2]: https://pygame-zero.readthedocs.io/en/stable/ diff --git a/translated/tech/20190125 PyGame Zero- Games without boilerplate.md b/translated/tech/20190125 PyGame Zero- Games without boilerplate.md new file mode 100644 index 0000000000..417e7ade02 --- /dev/null +++ b/translated/tech/20190125 PyGame Zero- Games without boilerplate.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (bestony) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PyGame Zero: Games without boilerplate) +[#]: via: (https://opensource.com/article/19/1/pygame-zero) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +PyGame Zero: 从 0 开始的游戏 +====== + +在你的游戏开发过程中有了 PyGame Zero,和枯燥的模板说再见吧。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3) + +Python 说一个很好的入门编程语言。并且,游戏是一个很好的入门项目:它们是可视化的,自驱动的,并且可以很愉快的与朋友和家人分享。虽然,绝大多数的 Python 写就的库,比如 [PyGame][1] ,会让初学者因为忘记微小的细节很容易导致什么都没渲染而感到困扰 + +在人们理解所有部分的原因前,他们将其中的许多部分都视为“无意识的样板文件”——需要复制和粘贴到程序中才能使其工作的神奇段落。 + +[PyGame Zero][2] 试图通过在 PyGame 上放置一个抽象的层来弥合这一差距,因此它实际上并不需要模板。 + +我们在字面上说的,就是我们的意思 + +这是一个合格的 PyGame Zero 文件: + +``` +# This comment is here for clarity reasons +``` + +我们可以将它放在一个 **game.py** 文件里,并运行: + +``` +$ pgzrun game.py +``` + +这将会展示一个可以通过关闭窗口或按下**CTRL-C**中断的窗口,并在后台运行一个游戏循环 , + +遗憾的是,这将是一场无聊的游戏。什么都没发生。 + +为了让他更有趣一点,我们可以画一个不同的背景: + +``` +def draw(): +    screen.fill((255, 0, 0)) +``` + +这将会把背景色从黑色换为红色。但是这仍是一个很无聊的游戏,什么都没发生。我们可以让它变的更有意思一点: + +``` +colors = [0, 0, 0] + +def draw(): +    screen.fill(tuple(colors)) + +def update(): +    colors[0] = (colors[0] + 1) % 256 +``` + +这将会让窗口从黑色开始,逐渐变亮,直到变为亮红色,再返回黑色,一遍一遍循环。 + +**update** 函数更新了 **draw** 渲染这个游戏所需的这些参数的值。 + +即使是这样,这里也没有任何方式给玩家与这个游戏的交互的方式。 +让我们试试其他一些事情: + +``` +colors = [0, 0, 0] + +def draw(): +    screen.fill(tuple(colors)) + +def update(): +    colors[0] = (colors[0] + 1) % 256 + +def on_key_down(key, mod, unicode): +    colors[1] = (colors[1] + 1) % 256 +``` + +现在,按下按钮来提升亮度。 + +这些包括游戏循环的三个重要部分:响应用户输入,更新参数和重新渲染屏幕。 + +PyGame Zero 提供了更多功能,包括绘制精灵图和播放声音片段的功能。 + +试一试,看看你能想出什么类型的游戏! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/pygame-zero + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[bestony](https://github.com/bestony) +校对:[校对者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://www.pygame.org/news +[2]: https://pygame-zero.readthedocs.io/en/stable/ From 851cded6693afad09d52f95009a52da97afc37d4 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Thu, 7 Feb 2019 12:55:22 +0800 Subject: [PATCH 034/813] Translated by qhwdw --- ...atory - Raspberry Pi- Lesson 6 Screen01.md | 503 ----------------- ...atory - Raspberry Pi- Lesson 6 Screen01.md | 504 ++++++++++++++++++ 2 files changed, 504 insertions(+), 503 deletions(-) delete mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md create mode 100644 translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md deleted file mode 100644 index ad479ae35a..0000000000 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md +++ /dev/null @@ -1,503 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 6 Screen01) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html) -[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) - -Computer Laboratory – Raspberry Pi: Lesson 6 Screen01 -====== - -Welcome to the Screen lesson series. In this series, you will learn how to control the screen using the Raspberry Pi in assembly code, starting at just displaying random data, then moving up to displaying a fixed image, displaying text and then formatting numbers into text. It is assumed that you have already completed the OK series, and so things covered in this series will not be repeated here. - -This first screen lesson teaches some basic theory about graphics, and then applies it to display a gradient pattern to the screen or TV. - -### 1 Getting Started - -It is expected that you have completed the OK series, and so functions in the 'gpio.s' file and 'systemTimer.s' file from that series will be called. If you do not have these files, or prefer to use a correct implementation, download the solution to OK05.s. The 'main.s' file from here will also be useful, up to and including mov sp,#0x8000. Please delete anything after that line. - -### 2 Computer Graphics - -There are a few systems for representing colours as numbers. Here we focus on RGB systems, but HSL is another common system used. - -As you're hopefully beginning to appreciate, at a fundamental level, computers are very stupid. They have a limited number of instructions, almost exclusively to do with maths, and yet somehow they are capable of doing many things. The thing we currently wish to understand is how a computer could possibly put an image on the screen. How would we translate this problem into binary? The answer is relatively straightforward; we devise some system of numbering each colour, and then we store one number for every pixel on the screen. A pixel is a small dot on your screen. If you move very close, you will probably be able to make out individual pixels on your screen, and be able to see that everything image is just made out of these pixels in combination. - -As the computer age advanced, people wanted more and more complicated graphics, and so the concept of a graphics card was invented. The graphics card is a secondary processor on your computer which only exists to draw images to the screen. It has the job of turning the pixel value information into light intensity levels to be transmitted to the screen. On modern computers, graphics cards can also do a lot more than that, such as drawing 3D graphics. In this tutorial however, we will just concentrate on the first use of graphics cards; getting pixel colours from memory out to the screen. - -One issue that is raised immediately by all this is the system we use for numbering colours. There are several choices, each producing outputs of different quality. I will outline a few here for completeness. - -Although some images here have few colours they use a technique called spatial dithering. This allows them to still show a good representation of the image, with very few colours. Many early Operating Systems used this technique. - -| Name | Unique Colours | Description | Examples | -| ----------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | -| Monochrome | 2 | Use 1 bit to store each pixel, with a 1 being white, and a 0 being black. | ![Monochrome image of a bird][1] | -| Greyscale | 256 | Use 1 byte to store each pixel, with 255 representing white, 0 representing black, and all values in between representing a linear combination of the two. | ![Geryscale image of a bird][2] | -| 8 Colour | 8 | Use 3 bits to store each pixel, the first bit representing the presence of a red channel, the second representing a green channel and the third a blue channel. | ![8 colour image of a bird][3] | -| Low Colour | 256 | Use 8 bits to store each pixel, the first 3 bit representing the intensity of the red channel, the next 3 bits representing the intensity of the green channel and the final 2 bits representing the intensity of the blue channel. | ![Low colour image of a bird][4] | -| High Colour | 65,536 | Use 16 bits to store each pixel, the first 5 bit representing the intensity of the red channel, the next 6 bits representing the intensity of the green channel and the final 5 bits representing the intensity of the blue channel. | ![High colour image of a bird][5] | -| True Colour | 16,777,216 | Use 24 bits to store each pixel, the first 8 bits representing the intensity of the red channel, the second 8 representing the green channel and the final 8 bits the blue channel. | ![True colour image of a bird][6] | -| RGBA32 | 16,777,216 with 256 transparency levels | Use 32 bits to store each pixel, the first 8 bits representing the intensity of the red channel, the second 8 representing the green channel, the third 8 bits the blue channel, and the final 8 bits a transparency channel. The transparency channel is only considered when drawing one image on top of another and is stored such that a value of 0 indicates the image behind's colour, a value of 255 represents this image's colour, and all values between represent a mix. | | - - -In this tutorial we shall use High Colour initially. As you can see form the image, it is produces clear, good quality images, but it doesn't take up as much space as True Colour. That said, for quite a small display of 800x600 pixels, it would still take just under 1 megabyte of space. It also has the advantage that the size is a multiple of a power of 2, which greatly reduces the complexity of getting information compared with True Colour. - -``` -Storing the frame buffer places a heavy memory burden on a computer. For this reason, early computers often cheated, by, for example, storing a screens worth of text, and just drawing each letter to the screen every time it is refreshed separately. -``` - -The Raspberry Pi has a very special and rather odd relationship with it's graphics processor. On the Raspberry Pi, the graphics processor actually runs first, and is responsible for starting up the main processor. This is very unusual. Ultimately it doesn't make too much difference, but in many interactions, it often feels like the processor is secondary, and the graphics processor is the most important. The two communicate on the Raspberry Pi by what is called the 'mailbox'. Each can deposit mail for the other, which will be collected at some future point and then dealt with. We shall use the mailbox to ask the graphics processor for an address. The address will be a location to which we can write the pixel colour information for the screen, called a frame buffer, and the graphics card will regularly check this location, and update the pixels on the screen appropriately. - -### 3 Programming the Postman - -``` -Message passing is quite a common way for components to communicate. Some Operating Systems use virtual message passing to allow programs to communicate. -``` - -The first thing we are going to need to program is a 'postman'. This is just two methods: MailboxRead, reading one message from the mailbox channel in r0. and MailboxWrite, writing the value in the top 28 bits of r0 to the mailbox channel in r1. The Raspberry Pi has 7 mailbox channels for communication with the graphics processor, only the first of which is useful to us, as it is for negotiating the frame buffer. - -The following table and diagrams describe the operation of the mailbox. - -Table 3.1 Mailbox Addresses -| Address | Size / Bytes | Name | Description | Read / Write | -| 2000B880 | 4 | Read | Receiving mail. | R | -| 2000B890 | 4 | Poll | Receive without retrieving. | R | -| 2000B894 | 4 | Sender | Sender information. | R | -| 2000B898 | 4 | Status | Information. | R | -| 2000B89C | 4 | Configuration | Settings. | RW | -| 2000B8A0 | 4 | Write | Sending mail. | W | - -In order to send a message to a particular mailbox: - - 1. The sender waits until the Status field has a 0 in the top bit. - 2. The sender writes to Write such that the lowest 4 bits are the mailbox to write to, and the upper 28 bits are the message to write. - - - -In order to read a message: - - 1. The receiver waits until the Status field has a 0 in the 30th bit. - 2. The receiver reads from Read. - 3. The receiver confirms the message is for the correct mailbox, and tries again if not. - - - -If you're feeling particularly confident, you now have enough information to write the two methods we need. If not, read on. - -As always the first method I recommend you implement is one to get the address of the mailbox region. - -``` -.globl GetMailboxBase -GetMailboxBase: -ldr r0,=0x2000B880 -mov pc,lr -``` - -The sending procedure is least complicated, so we shall implement this first. As your methods become more and more complicated, you will need to start planning them in advance. A good way to do this might be to write out a simple list of the steps that need to be done, in a fair amount of detail, like below. - - 1. Our input will be what to write (r0), and what mailbox to write it to (r1). We must validate this is by checking it is a real mailbox, and that the low 4 bits of the value are 0. Never forget to validate inputs. - 2. Use GetMailboxBase to retrieve the address. - 3. Read from the Status field. - 4. Check the top bit is 0. If not, go back to 3. - 5. Combine the value to write and the channel. - 6. Write to the Write. - - - -Let's handle each of these in order. - -1. -``` -.globl MailboxWrite -MailboxWrite: -tst r0,#0b1111 -movne pc,lr -cmp r1,#15 -movhi pc,lr -``` - -``` -tst reg,#val computes and reg,#val and compares the result with 0. -``` - -This achieves our validation on r0 and r1. tst is a function that compares two numbers by computing the logical and operation of the numbers, and then comparing the result with 0. In this case it checks that the lowest 4 bits of the input in r0 are all 0. - -2. -``` -channel .req r1 -value .req r2 -mov value,r0 -push {lr} -bl GetMailboxBase -mailbox .req r0 -``` - -This code ensures we will not overwrite our value, or link register and calls GetMailboxBase. - -3. -``` -wait1$: -status .req r3 -ldr status,[mailbox,#0x18] -``` - -This code loads in the current status. - -4. -``` -tst status,#0x80000000 -.unreq status -bne wait1$ -``` - -This code checks that the top bit of the status field is 0, and loops back to 3. if it is not. - -5. -``` -add value,channel -.unreq channel -``` - -This code combines the channel and value together. - -6. -``` -str value,[mailbox,#0x20] -.unreq value -.unreq mailbox -pop {pc} -``` - -This code stores the result to the write field. - - - - -The code for MailboxRead is quite similar. - - 1. Our input will be what mailbox to read from (r0). We must validate this is by checking it is a real mailbox. Never forget to validate inputs. - 2. Use GetMailboxBase to retrieve the address. - 3. Read from the Status field. - 4. Check the 30th bit is 0. If not, go back to 3. - 5. Read from the Read field. - 6. Check the mailbox is the one we want, if not go back to 3. - 7. Return the result. - - - -Let's handle each of these in order. - -1. -``` -.globl MailboxRead -MailboxRead: -cmp r0,#15 -movhi pc,lr -``` - -This achieves our validation on r0. - -2. -``` -channel .req r1 -mov channel,r0 -push {lr} -bl GetMailboxBase -mailbox .req r0 -``` - -This code ensures we will not overwrite our value, or link register and calls GetMailboxBase. - -3. -``` -rightmail$: -wait2$: -status .req r2 -ldr status,[mailbox,#0x18] -``` - -This code loads in the current status. - -4. -``` -tst status,#0x40000000 -.unreq status -bne wait2$ -``` - -This code checks that the 30th bit of the status field is 0, and loops back to 3. if it is not. - -5. -``` -mail .req r2 -ldr mail,[mailbox,#0] -``` - -This code reads the next item from the mailbox. - -6. -``` -inchan .req r3 -and inchan,mail,#0b1111 -teq inchan,channel -.unreq inchan -bne rightmail$ -.unreq mailbox -.unreq channel -``` - -This code checks that the channel of the mail we just read is the one we were supplied. If not it loops back to 3. - -7. -``` -and r0,mail,#0xfffffff0 -.unreq mail -pop {pc} -``` - -This code moves the answer (the top 28 bits of mail) to r0. - - - - -### 4 My Dearest Graphics Processor - -Through our new postman, we now have the ability to send a message to the graphics card. What should we send though? This was certainly a difficult question for me to find the answer to, as it isn't in any online manual that I have found. Nevertheless, by looking at the GNU/Linux for the Raspberry Pi, we are able to work out what we needed to send. - -``` -Since the RAM is shared between the graphics processor and the processor on the Pi, we can just send where to find our message. This is called DMA, many complicated devices use this to speed up access times. -``` - -The message is very simple. We describe the framebuffer we would like, and the graphics card either agrees to our request, in which case it sends us back a 0, and fills in a small questionnaire we make, or it sends back a non-zero number, in which case we know it is unhappy. Unfortunately, I have no idea what any of the other numbers it can send back are, nor what they mean, but only when it sends a zero it is happy. Fortunately it always seems to send a zero for sensible inputs, so we don't need to worry too much. - -For simplicity we shall design our request in advance, and store it in the .data section. In a file called 'framebuffer.s' place the following code: - -``` -.section .data -.align 4 -.globl FrameBufferInfo -FrameBufferInfo: -.int 1024 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #0 Physical Width */ -.int 768 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #4 Physical Height */ -.int 1024 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #8 Virtual Width */ -.int 768 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #12 Virtual Height */ -.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #16 GPU - Pitch */ -.int 16 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #20 Bit Depth */ -.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #24 X */ -.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #28 Y */ -.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #32 GPU - Pointer */ -.int 0 /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var #36 GPU - Size */ -``` - -This is the format of our messages to the graphics processor. The first two words describe the physical width and height. The second pair is the virtual width and height. The framebuffer's width and height are the virtual width and height, and the GPU scales the framebuffer as need to fit the physical screen. The next word is one of the ones the GPU will fill in if it grants our request. It will be the number of bytes on each row of the frame buffer, in this case 2 × 1024 = 2048. The next word is how many bits to allocate to each pixel. Using a value of 16 means that the graphics processor uses High Colour mode described above. A value of 24 would use True Colour, and 32 would use RGBA32. The next two words are x and y offsets, which mean the number of pixels to skip in the top left corner of the screen when copying the framebuffer to the screen. Finally, the last two words are filled in by the graphics processor, the first of which is the actual pointer to the frame buffer, and the second is the size of the frame buffer in bytes. - -``` -When working with devices using DMA, alignment constraints become very important. The GPU expects the message to be 16 byte aligned. -``` - -I was very careful to include a .align 4 here. As discussed before, this ensures the lowest 4 bits of the address of the next line are 0. Thus, we know for sure that FrameBufferInfo will be placed at an address we can send to the graphics processor, as our mailbox only sends values with the low 4 bits all 0. - -So, now that we have our message, we can write code to send it. The communication will go as follows: - - 1. Write the address of FrameBufferInfo + 0x40000000 to mailbox 1. - 2. Read the result from mailbox 1. If it is not zero, we didn't ask for a proper frame buffer. - 3. Copy our images to the pointer, and they will appear on screen! - - - -I've said something that I've not mentioned before in step 1. We have to add 0x40000000 to the address of FrameBufferInfo before sending it. This is actually a special signal to the GPU of how it should write to the structure. If we just send the address, the GPU will write its response, but will not make sure we can see it by flushing its cache. The cache is a piece of memory where a processor stores values its working on before sending them to the RAM. By adding 0x40000000, we tell the GPU not to use its cache for these writes, which ensures we will be able to see the change. - -Since there is quite a lot going on there, it would be best to implement this as a function, rather than just putting the code into main.s. We shall write a function InitialiseFrameBuffer which does all this negotiation and returns the pointer to the frame buffer info data above, once it has a pointer in it. For ease, we should also make it so that the width, height and bit depth of the frame buffer are inputs to this method, so that it is easy to change in main.s without having to get into the details of the negotiation. - -Once again, let's write down in detail the steps we will have to take. If you're feeling confident, try writing the function straight away. - - 1. Validate our inputs. - 2. Write the inputs into the frame buffer. - 3. Send the address of the frame buffer + 0x40000000 to the mailbox. - 4. Receive the reply from the mailbox. - 5. If the reply is not 0, the method has failed. We should return 0 to indicate failure. - 6. Return a pointer to the frame buffer info. - - - -Now we're getting into much bigger methods than before. Below is one implementation of the above. - -1. -``` -.section .text -.globl InitialiseFrameBuffer -InitialiseFrameBuffer: -width .req r0 -height .req r1 -bitDepth .req r2 -cmp width,#4096 -cmpls height,#4096 -cmpls bitDepth,#32 -result .req r0 -movhi result,#0 -movhi pc,lr -``` - -This code checks that the width and height are less than or equal to 4096, and that the bit depth is less than or equal to 32. This is once again using a trick with conditional execution. Convince yourself that this works. - -2. -``` -fbInfoAddr .req r3 -push {lr} -ldr fbInfoAddr,=FrameBufferInfo -str width,[fbInfoAddr,#0] -str height,[fbInfoAddr,#4] -str width,[fbInfoAddr,#8] -str height,[fbInfoAddr,#12] -str bitDepth,[fbInfoAddr,#20] -.unreq width -.unreq height -.unreq bitDepth -``` - -This code simply writes into our frame buffer structure defined above. I also take the opportunity to push the link register onto the stack. - -3. -``` -mov r0,fbInfoAddr -add r0,#0x40000000 -mov r1,#1 -bl MailboxWrite -``` - -The inputs to the MailboxWrite method are the value to write in r0, and the channel to write to in r1. - -4. -``` -mov r0,#1 -bl MailboxRead -``` - -The inputs to the MailboxRead method is the channel to write to in r0, and the output is the value read. - -5. -``` -teq result,#0 -movne result,#0 -popne {pc} -``` - -This code checks if the result of the MailboxRead method is 0, and returns 0 if not. - -6. -``` -mov result,fbInfoAddr -pop {pc} -.unreq result -.unreq fbInfoAddr -``` - -This code finishes off and returns the frame buffer info address. - - - - -### 5 A Pixel Within a Row Within a Frame - -So, we've now created our methods to communicate with the graphics processor. It should now be capable of giving us the pointer to a frame buffer we can draw graphics to. Let's draw something now. - -In this first example, we'll just draw consecutive colours to the screen. It won't look pretty, but at least it will be working. How we will do this is by setting each pixel in the framebuffer to a consecutive number, and continually doing so. - -Copy the following code to 'main.s' after mov sp,#0x8000 - -``` -mov r0,#1024 -mov r1,#768 -mov r2,#16 -bl InitialiseFrameBuffer -``` - -This code simply uses our InitialiseFrameBuffer method to create a frame buffer with width 1024, height 768, and bit depth 16. You can try different values in here if you wish, as long as you are consistent throughout the code. Since it's possible that this method can return 0 if the graphics processor did not give us a frame buffer, we had better check for this, and turn the OK LED on if it happens. - -``` -teq r0,#0 -bne noError$ - -mov r0,#16 -mov r1,#1 -bl SetGpioFunction -mov r0,#16 -mov r1,#0 -bl SetGpio - -error$: -b error$ - -noError$: -fbInfoAddr .req r4 -mov fbInfoAddr,r0 -``` - -Now that we have the frame buffer info address, we need to get the frame buffer pointer from it, and start drawing to the screen. We will do this using two loops, one going down the rows, and one going along the columns. On the Raspberry Pi, indeed in most applications, pictures are stored left to right then top to bottom, so we have to do the loops in the order I have said. - - -``` -render$: - - fbAddr .req r3 - ldr fbAddr,[fbInfoAddr,#32] - - colour .req r0 - y .req r1 - mov y,#768 - drawRow$: - - x .req r2 - mov x,#1024 - drawPixel$: - - strh colour,[fbAddr] - add fbAddr,#2 - sub x,#1 - teq x,#0 - bne drawPixel$ - - sub y,#1 - add colour,#1 - teq y,#0 - bne drawRow$ - - b render$ - -.unreq fbAddr -.unreq fbInfoAddr -``` - -``` -strh reg,[dest] stores the low half word number in reg at the address given by dest. -``` - -This is quite a large chunk of code, and has a loop within a loop within a loop. To help get your head around the looping, I've indented the code which is looped, depending on which loop it is in. This is quite common in most high level programming languages, and the assembler simply ignores the tabs. We see here that I load in the frame buffer address from the frame buffer information structure, and then loop over every row, then every pixel on the row. At each pixel, I use an strh (store half word) command to store the current colour, then increment the address we're writing to. After drawing each row, we increment the colour that we are drawing. After drawing the full screen, we branch back to the beginning. - -### 6 Seeing the Light - -Now you're ready to test this code on the Raspberry Pi. You should see a changing gradient pattern. Be careful: until the first message is sent to the mailbox, the Raspberry Pi displays a still gradient pattern between the four corners. If it doesn't work, please see our troubleshooting page. - -If it does work, congratulations! You can now control the screen! Feel free to alter this code to draw whatever pattern you like. You can do some very nice gradient patterns, and can compute the value of each pixel directly, since y contains a y-coordinate for the pixel, and x contains an x-coordinate. In the next lesson, [Lesson 7: Screen 02][7], we will look at one of the most common drawing tasks, lines. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html - -作者:[Alex Chadwick][a] -选题:[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.cl.cam.ac.uk -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour1bImage.png -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour8gImage.png -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour3bImage.png -[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour8bImage.png -[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour16bImage.png -[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour24bImage.png -[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md new file mode 100644 index 0000000000..99da7c98fc --- /dev/null +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @@ -0,0 +1,504 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 6 Screen01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +计算机实验室 – 树莓派:课程 6 屏幕01 +====== + +欢迎来到屏幕系列课程。在本系列中,你将学习在树莓派中如何使用汇编代码控制屏幕,从显示随机数据开始,接着学习显示一个固定的图像和显示文本,然后格式化文本中的数字。假设你已经完成了 `OK` 系列课程的学习,所以在本系列中出现的有些知识将不再重复。 + +第一节的屏幕课程教你一些关于图形的基础理论,然后用这些理论在屏幕或电视上显示一个图案。 + +### 1、入门 + +预期你已经完成了 `OK` 系列的课程,以及那个系列课程中在 `gpio.s` 和 `systemTimer.s` 文件中调用的函数。如果你没有完成这些,或你喜欢完美的实现,可以去下载 `OK05.s` 解决方案。在这里也要使用 `main.s` 文件中从开始到包含 `mov sp,#0x8000` 的这一行之前的代码。请删除这一行以后的部分。 + +### 2、计算机图形 + +将颜色表示为数字有几种方法。在这里我们专注于 RGB 方法,但 HSL 也是很常用的另一种方法。 + +正如你所认识到的,从根本上来说,计算机是非常愚蠢的。它们只能执行有限数量的指令,仅仅能做一些数学,但是它们也能以某种方式来做很多很多的事情。而在这些事情中,我们目前想知道的是,计算机是如何将一个图像显示到屏幕上的。我们如何将这个问题转换成二进制?答案相当简单;我们为每个颜色设计一些编码方法,然后我们为生个像素在屏幕上保存一个编码。一个像素在你的屏幕上就是一个非常小的点。如果你离屏幕足够近,你或许能够在你的屏幕上辨别出单个的像素,能够看到每个图像都是由这些像素组成的。 + +随着计算机时代的到来,人们希望显示更多更复杂的图形,于是发明了图形卡的概念。图形卡是你的计算机上用来在屏幕上专门绘制图像的第二个处理器。它的任务就是将像素值信息转换成显示在屏幕上的亮度级别。在现代计算机中,图形卡已经能够做更多更复杂的事情了,比如绘制三维图形。但是在本系列教程中,我们只专注于图形卡的基本使用;从内存中取得像素然后把它显示到屏幕上。 + +不念经使用哪种方法,现在马上出现的一个问题就是我们使用的颜色编码。这里有几种选择,每个产生不同的输出质量。为了完整起见,我在这里只是简单概述它们。 + +不过这里的一些图像几乎没有颜色,因为它们使用了一个叫空间抖动的技术。这允许它们以很少的颜色仍然能表示出非常好的图像。许多早期的操作系统就使用了这种技术。 + +| 名字 | 唯一颜色数量 | 描述 | 示例 | +| ----------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | +| 单色 | 2 | 每个像素使用 1 位去保存,其中 1 表示白色,0 表示黑色。 | ![Monochrome image of a bird][1] | +| 灰度 | 256 | 每个像素使用 1 个字节去保存,使用 255 表示白色,0 表示黑色,介于这两个值之间的所有值表示这两个颜色的一个线性组合。 | ![Geryscale image of a bird][2] | +| 8 色 | 8 | 每个像素使用 3 位去保存,第一位表示红色通道,第二位表示绿色通道,第三位表示蓝色通道。 | ![8 colour image of a bird][3] | +| 低色值 | 256 | 每个像素使用 8 位去保存,前三位表示红色通道的强度,接下来的三位表示绿色通道的强度,最后两位表示蓝色通道的强度。 | ![Low colour image of a bird][4] | +| 高色值 | 65,536 | 每个像素使用 16 位去保存,前五位表示红色通道的强度,接下来的六位表示绿色通道的强度,最后的五位表示蓝色通道的强度。 | ![High colour image of a bird][5] | +| 真彩色 | 16,777,216 | 每个像素使用 24 位去保存,前八位表示红色通道,第二个八位表示绿色通道,最后八位表示蓝色通道。 | ![True colour image of a bird][6] | +| RGBA32 | 16,777,216 带 256 级透明度 | 每个像素使用 32 位去保存,前八位表示红色通道,第二个八位表示绿色通道,第三个八位表示蓝色通道。只有一个图像绘制在另一个图像的上方时才考虑使用透明通道,值为 0 时表示下面图像的颜色,值为 255 时表示上面这个图像的颜色,介于这两个值之间的所有值表示这两个图像颜色的混合。 || + + +在本教程中,我们将从使用高色值开始。这样你就可以看到图像的构成,它的形成过程清楚,图像质量好,又不像真彩色那样占用太多的空间。也就是说,显示一个比较小的 800x600 像素的图像,它只需要小于 1 MiB 的空间。它另外的好处是它的大小是 2 次幂的倍数,相比真彩色这将极大地降低了获取信息的复杂度。 + +``` +保存帧缓冲给一台计算机带来了很大的内存负担。基于这种原因,早期计算机经常作弊,比如,保存一屏幕文本,在每次单独刷新时,它只绘制刷新了的字母。 +``` + +树莓派和它的图形处理器有一种特殊而奇怪的关系。在树莓派上,首先运行的事实上是图形处理器,它负责启动主处理器。这是很不常见的。最终它不会有太大的差别,但在许多交互中,它经常给人感觉主处理器是次要的,而图形处理器才是主要的。在树莓派上这两者之间依靠一个叫 “邮箱” 的东西来通讯。它们中的每一个都可以为对方投放邮件,这个邮件将在未来的某个时刻被对方收集并处理。我们将使用这个邮箱去向图形处理器请求一个地址。这个地址将是一个我们在屏幕上写入像素颜色信息的位置,我们称为帧缓冲,图形卡将定期检查这个位置,然后更新屏幕上相应的像素。 + +### 3、编写邮差程序 + +``` +消息传递是组件间通讯时使用的常见方法。一些操作系统在程序之间使用虚拟消息进行通讯。 +``` + +接下来我们做的第一件事情就是编写一个“邮差”程序。它有两个方法:MailboxRead,从寄存器 `r0` 中的邮箱通道读取一个消息。而 MailboxWrite,将寄存器 `r0` 中的头 28 位的值写到寄存器 `r1` 中的邮箱通道。树莓派有 7 个与图形处理器进行通讯的邮箱通道。但仅第一个对我们有用,因为它用于协调帧缓冲。 + +下列的表和示意图描述了邮箱的操作。 + +表 3.1 邮箱地址 +| 地址 | 大小 / 字节 | 名字 | 描述 | 读 / 写 | +| 2000B880 | 4 | Read | 接收邮件 | R | +| 2000B890 | 4 | Poll | 不检索接收 | R | +| 2000B894 | 4 | Sender |发送者信息 | R | +| 2000B898 | 4 | Status | 信息 | R | +| 2000B89C | 4 | Configuration | 设置 | RW | +| 2000B8A0 | 4 | Write | 发送邮件 | W | + +为了给指定的邮箱发送一个消息: + + 1. 发送者等待,直到 `Status`字段的头一位为 0。 + 2. 发送者写入到 `Write`,低 4 位是要发送到的邮箱,高 28 位是要写入的消息。 + + + +为了读取一个消息: + + 1. 接收者等待,直到 `Status` 字段的第 30 位为 0。 + 2. 接收者读取消息。 + 3. 接收者确认消息来自正确的邮箱,否则再次重试。 + + + +如果你觉得有信心,你现在有足够的信息去写出我们所需的两个方法。如果没有信心,请继续往下看。 + +与以前一样,我建议你实现的第一个方法是获取邮箱区域的地址。 + +```assembly +.globl GetMailboxBase +GetMailboxBase: +ldr r0,=0x2000B880 +mov pc,lr +``` + +发送程序相对简单一些,因此我们将首先去实现它。随着你的方法越来越复杂,你需要提前去规划它们。规划它们的一个好的方式是写出一个简单步骤列表,详细地列出你需要做的事情,像下面一样。 + + 1. 我们的输入将要写什么(`r0`),以及写到什么邮箱(`r1`)。我们必须验证邮箱的真实性,以及它的低 4 位的值是否为 0。不要忘了验证输入。 + 2. 使用 `GetMailboxBase` 去检索地址。 + 3. 读取 `Status` 字段。 + 4. 检查头一位是否为 0。如果不是,回到第 3 步。 + 5. 将写入的值和邮箱通道组合到一起。 + 6. 写入到 `Write`。 + + + +我们来按顺序写出它们中的每一步。 + +1. +```assembly +.globl MailboxWrite +MailboxWrite: +tst r0,#0b1111 +movne pc,lr +cmp r1,#15 +movhi pc,lr +``` + +```assembly +tst reg,#val 计算寄存器 reg 和 #val 的逻辑与,然后将计算结果与 0 进行比较。 +``` + +这将实现我们验证 `r0` 和 `r1` 的目的。`tst` 是通过计算两个操作数的逻辑与来比较两个操作数的函数,然后将结果与 0 进行比较。在本案例中,它将检查在寄存器 `r0` 中的输入的低 4 位是否为全 0。 + +2. +```assembly +channel .req r1 +value .req r2 +mov value,r0 +push {lr} +bl GetMailboxBase +mailbox .req r0 +``` + +这段代码确保我们不会覆盖我们的值,或链接寄存器,然后调用 `GetMailboxBase`。 + +3. +```assembly +wait1$: +status .req r3 +ldr status,[mailbox,#0x18] +``` + +这段代码加载当前状态。 + +4. +```assembly +tst status,#0x80000000 +.unreq status +bne wait1$ +``` + +这段代码检查状态字段的头一位是否为 0,如果不为 0,循环回到第 3 步。 + +5. +```assembly +add value,channel +.unreq channel +``` + +这段代码将通道和值组合到一起。 + +6. +```assembly +str value,[mailbox,#0x20] +.unreq value +.unreq mailbox +pop {pc} +``` + +这段代码保存结果到写入字段。 + + + + +MailboxRead 的代码和它非常类似。 + + 1. 我们的输入将从哪个邮箱读取(`r0`)。我们必须要验证邮箱的真实性。不要忘了验证输入。 + 2. 使用 `GetMailboxBase` 去检索地址。 + 3. 读取 `Status` 字段。 + 4. 检查第 30 位是否为 0。如果不为 0,返回到第 3 步。 + 5. 读取 `Read` 字段。 + 6. 检查邮箱是否是我们所要的,如果不是返回到第 3 步。 + 7. 返回结果。 + + + +我们来按顺序写出它们中的每一步。 + +1. +```assembly +.globl MailboxRead +MailboxRead: +cmp r0,#15 +movhi pc,lr +``` + +这一段代码来验证 `r0` 中的值。 + +2. +```assembly +channel .req r1 +mov channel,r0 +push {lr} +bl GetMailboxBase +mailbox .req r0 +``` + +这段代码确保我们不会覆盖掉我们的值,或链接寄存器,然后调用 `GetMailboxBase`。 + +3. +```assembly +rightmail$: +wait2$: +status .req r2 +ldr status,[mailbox,#0x18] +``` + +这段代码加载当前状态。 + +4. +```assembly +tst status,#0x40000000 +.unreq status +bne wait2$ +``` + +这段代码检查状态字段第 30 位是否为 0,如果不为 0,返回到第 3 步。 + +5. +```assembly +mail .req r2 +ldr mail,[mailbox,#0] +``` + +这段代码从邮箱中读取下一条消息。 + +6. +```assembly +inchan .req r3 +and inchan,mail,#0b1111 +teq inchan,channel +.unreq inchan +bne rightmail$ +.unreq mailbox +.unreq channel +``` + +这段代码检查我们正在读取的邮箱通道是否为提供给我们的通道。如果不是,返回到第 3 步。 + +7. + +```assembly +and r0,mail,#0xfffffff0 +.unreq mail +pop {pc} +``` + +这段代码将答案(邮件的前 28 位)移动到寄存器 `r0` 中。 + + + + +### 4、我心爱的图形处理器 + +通过我们新的邮差程序,我们现在已经能够向图形卡上发送消息了。我们应该发送些什么呢?这对我来说可能是个很难找到答案的问题,因为它不是任何线上手册能够找到答案的问题。尽管如此,通过查找有关树莓派的 GNU/Linux,我们能够找出我们需要发送的内容。 + +``` +由于在树莓派的内存是在图形处理器和主处理器之间共享的,我们能够只发送可以找到我们信息的位置即可。这就是 DMA,许多复杂的设备使用这种技术去加速访问时间。 +``` + +消息很简单。我们描述我们想要的帧缓冲区,而图形卡要么接受我们的请求,给我们返回一个 0,然后用我们写的一个小的调查问卷来填充屏幕;要么发送一个非 0 值,我们知道那表示很遗憾(出错了)。不幸的是,我并不知道它返回的其它数字是什么,也不知道它意味着什么,但我们知道仅当它返回一个 0,才表示一切顺利。幸运的是,对于合理的输入,它总是返回一个 0,因此我们不用过于担心。 + +为简单起见,我们将提前设计好我们的请求,并将它保存到 `framebuffer.s` 文件的 `.data` 节中,它的代码如下: + +```assembly +.section .data +.align 4 +.globl FrameBufferInfo +FrameBufferInfo: +.int 1024 /* #0 物理宽度 */ +.int 768 /* #4 物理高度 */ +.int 1024 /* #8 虚拟宽度 */ +.int 768 /* #12 虚拟高度 */ +.int 0 /* #16 GPU - 间距 */ +.int 16 /* #20 位深 */ +.int 0 /* #24 X */ +.int 0 /* #28 Y */ +.int 0 /* #32 GPU - 指针 */ +.int 0 /* #36 GPU - 大小 */ +``` + +这就是我们发送到图形处理器的消息格式。第一对两个关键字描述了物理宽度和高度。第二对关键字描述了虚拟宽度和高度。帧缓冲的宽度和高度就是虚拟的宽度和高度,而 GPU 按需要伸缩帧缓冲去填充物理屏幕。如果 GPU 接受我们的请求,接下来的关键字将是 GPU 去填充的参数。它们是帧缓冲每行的字节数,在本案例中它是 `2 × 1024 = 2048`。下一个关键字是每个像素分配的位数。使用了一个 16 作为值意味着图形处理器使用了我们上面所描述的高色值模式。值为 24 是真彩色,而值为 32 则是 RGBA32。接下来的两个关键字是 x 和 y 偏移量,它表示当将帧缓冲复制到屏幕时,从屏幕左上角跳过的像素数目。最后两个关键字是由图形处理器填写的,第一个表示指向帧缓冲的实际指针,第二个是用字节数表示的帧缓冲大小。 + +``` +当设备使用 DMA 时,对齐约束变得非常重要。GPU 预期消息都是 16 字节对齐的。 +``` + +在这里我非常谨慎地使用了一个 `.align 4` 指令。正如前面所讨论的,这样确保了下一行地址的低 4 位是 0。所以,我们可以确保将被放到那个地址上的帧缓冲是可以发送到图形处理器上的,因为我们的邮箱仅发送低 4 位全为 0 的值。 + +到目前为止,我们已经有了待发送的消息,我们可以写代码去发送它了。通讯将按如下的步骤进行: + + 1. 写入 `FrameBufferInfo + 0x40000000` 的地址到邮箱 1。 + 2. 从邮箱 1 上读取结果。如果它是非 0 值,意味着我们没有请求一个正确的帧缓冲。 + 3. 复制我们的图像到指针,这时图像将出现在屏幕上! + + + +我在步骤 1 中说了一些以前没有提到的事情。我们在发送之前,在帧缓冲地址上加了 `0x40000000`。这其实是一个给 GPU 的特殊信号,它告诉 GPU 应该如何写到结构上。如果我们只是发送地址,GPU 将写到它的回复上,这样不能保证我们可以通过刷新缓存看到它。缓存是处理器使用的值在它们被发送到存储之前保存在内存中的片段。通过加上 `0x40000000`,我们告诉 GPU 不要将写入到它的缓存中,这样将确保我们能够看到变化。 + +因为在那里发生很多事情,因此最好将它实现为一个函数,而不是将它以代码的方式写入到 `main.s` 中。我们将要写一个函数 `InitialiseFrameBuffer`,由它来完成所有协调和返回指向到上面提到的帧缓冲数据的指针。为方便起见,我们还将帧缓冲的宽度、高度、位深作为这个方法的输入,这样就很容易地修改 `main.s` 而不必知道协调的细节了。 + +再一次,来写下我们要做的详细步骤。如果你有信心,可以略过这一步直接尝试去写函数。 + + 1. 验证我们的输入。 + 2. 写输入到帧缓冲。 + 3. 发送 `frame buffer + 0x40000000` 的地址到邮箱。 + 4. 从邮箱中接收回复。 + 5. 如果回复是非 0 值,方法失败。我们应该返回 0 去表示失败。 + 6. 返回指向帧缓冲信息的指针。 + + + +现在,我们开始写更多的方法。以下是上面其中一个实现。 + +1. +```assembly +.section .text +.globl InitialiseFrameBuffer +InitialiseFrameBuffer: +width .req r0 +height .req r1 +bitDepth .req r2 +cmp width,#4096 +cmpls height,#4096 +cmpls bitDepth,#32 +result .req r0 +movhi result,#0 +movhi pc,lr +``` + +这段代码检查宽度和高度是小于或等于 4096,位深小于或等于 32。这里再次使用了条件运行的技巧。相信自己这是可行的。 + +2. +```assembly +fbInfoAddr .req r3 +push {lr} +ldr fbInfoAddr,=FrameBufferInfo +str width,[fbInfoAddr,#0] +str height,[fbInfoAddr,#4] +str width,[fbInfoAddr,#8] +str height,[fbInfoAddr,#12] +str bitDepth,[fbInfoAddr,#20] +.unreq width +.unreq height +.unreq bitDepth +``` + +这段代码写入到我们上面定义的帧缓冲结构中。我也趁机将链接寄存器推入到栈上。 + +3. +```assembly +mov r0,fbInfoAddr +add r0,#0x40000000 +mov r1,#1 +bl MailboxWrite +``` + +`MailboxWrite` 方法的输入是写入到寄存器 `r0` 中的值,并将通道写入到寄存器 `r1` 中。 + +4. +```assembly +mov r0,#1 +bl MailboxRead +``` + +`MailboxRead` 方法的输入是写入到寄存器 `r0` 中的通道,而输出是值读数。 + +5. +```assembly +teq result,#0 +movne result,#0 +popne {pc} +``` + +这段代码检查 `MailboxRead` 方法的结果是否为 0,如果不为 0,则返回 0。 + +6. +```assembly +mov result,fbInfoAddr +pop {pc} +.unreq result +.unreq fbInfoAddr +``` + +这是代码结束,并返回帧缓冲信息地址。 + + + + +### 5、在一帧中一行之内的一个像素 + +到目前为止,我们已经创建了与图形处理器通讯的方法。现在它已经能够给我们返回一个指向到帧缓冲的指针去绘制图形了。我们现在来绘制一个图形。 + +第一示例,我们将在屏幕上绘制连续的颜色。它看起来并不漂亮,但至少能说明它在工作。我们如何才能在帧缓冲中设置每个像素为一个连续的数字,并且要持续不断地这样做。 + +将下列代码复制到 `main.s` 文件中,并放置在 `mov sp,#0x8000` 行之后。 + +```assembly +mov r0,#1024 +mov r1,#768 +mov r2,#16 +bl InitialiseFrameBuffer +``` + +这段代码使用了我们的 `InitialiseFrameBuffer` 方法,简单地创建了一个宽 1024、高 768、位深为 16 的帧缓冲区。在这里,如果你愿意可以尝试使用不同的值,只要整个代码中都一样就可以。如果图形处理器没有给我们创建好一个帧缓冲区,这个方法将返回 0,我们最好检查一下返回值,如果出现返回值为 0 的情况,我们打开 `OK` LED 灯。 + +```assembly +teq r0,#0 +bne noError$ + +mov r0,#16 +mov r1,#1 +bl SetGpioFunction +mov r0,#16 +mov r1,#0 +bl SetGpio + +error$: +b error$ + +noError$: +fbInfoAddr .req r4 +mov fbInfoAddr,r0 +``` + +现在,我们已经有了帧缓冲信息的地址,我们需要取得帧缓冲信息的指针,并开始绘制屏幕。我们使用两个循环来做实现,一个走行,一个走列。事实上,树莓派中的大多数应用程序中,图片都是以从左右然后从上下到的顺序来保存的,因此我们也按这个顺序来写循环。 + + +```assembly +render$: + + fbAddr .req r3 + ldr fbAddr,[fbInfoAddr,#32] + + colour .req r0 + y .req r1 + mov y,#768 + drawRow$: + + x .req r2 + mov x,#1024 + drawPixel$: + + strh colour,[fbAddr] + add fbAddr,#2 + sub x,#1 + teq x,#0 + bne drawPixel$ + + sub y,#1 + add colour,#1 + teq y,#0 + bne drawRow$ + + b render$ + +.unreq fbAddr +.unreq fbInfoAddr +``` + +```assembly +strh reg,[dest] 将寄存器中的低位半个字保存到给定的 dest 地址上。 +``` + +这是一个很长的代码块,它嵌套了三层循环。为了帮你理清头绪,我们将循环进行缩进处理,这就有点类似于高级编程语言,而汇编器会忽略掉这些用于缩进的 `tab` 字符。我们看到,在这里它从帧缓冲信息结构中加载了帧缓冲的地址,然后基于每行来循环,接着是每行上的每个像素。在每个像素上,我们使用一个 `strh`(保存半个字)命令去保存当前颜色,然后增加地址继续写入。每行绘制完成后,我们增加绘制的颜色号。在整个屏幕绘制完成后,我们跳转到开始位置。 + +### 6、看到曙光 + +现在,你已经准备好在树莓派上测试这些代码了。你应该会看到一个渐变图案。注意:在第一个消息被发送到邮箱之前,树莓派在它的四个角上一直显示一个渐变图案。如果它不能正常工作,请查看我们的排错页面。 + +如果一切正常,恭喜你!你现在可以控制屏幕了!你可以随意修改这些代码去绘制你想到的任意图案。你还可以做更精彩的渐变图案,可以直接计算每个像素值,因为每个像素包含了一个 Y 坐标和 X 坐标。在下一个 [课程 7:Screen 02][7] 中,我们将学习一个更常用的绘制任务:行。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour1bImage.png +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour8gImage.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour3bImage.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour8bImage.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour16bImage.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/colour24bImage.png +[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html From 9a96560aa4466ac73e3cb9e6b52f4e6be3fbb9d6 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Thu, 7 Feb 2019 14:19:06 +0800 Subject: [PATCH 035/813] Translating by qhwdw --- ...616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md index 3a8fe60f6f..8846d270da 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6aee9e1ed5ab96becd3fd04f146d5655d94b2945 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 15:51:54 +0800 Subject: [PATCH 036/813] PRF:20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @dianbanjiu --- ...To Transfer Files Between Linux Systems.md | 70 ++++++++++--------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md index 266f82a30c..543213f354 100644 --- a/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md +++ b/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @@ -1,83 +1,79 @@ [#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Dcp (Dat Copy) – Easy And Secure Way To Transfer Files Between Linux Systems) [#]: via: (https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) -Dcp(Dat Copy)—— 在不同 Linux 系统之间传输文件的安全又容易的方式 +dcp:采用对等网络传输文件的方式 ====== -Linux 本就有 scp 和 rsync 可以完美地完成这个任务。然而我们今天还是想试点新东西。 - -同时我们也很鼓励那些使用不同的理论和新技术开发新东西的开发者。 +Linux 本就有 `scp` 和 `rsync` 可以完美地完成这个任务。然而我们今天还是想试点新东西。同时我们也想鼓励那些使用不同的理论和新技术开发新东西的开发者。 我们也写过其他很多有关这个主题的文章,你可以点击下面的链接访问这些内容。 -它们分别是 **[OnionShare][1]**,**[Magic Wormhole][2]**,**[Transfer.sh][3]** 和 **ffsend**。 +它们分别是 [OnionShare][1]、[Magic Wormhole][2]、[Transfer.sh][3] 和 ffsend。 -### 什么是 Dcp? +### 什么是 dcp? -[dcp][4] 在不同主机之间使用对等网络复制文件。 +[dcp][4] 可以在不同主机之间使用 Dat 对等网络复制文件。 -dcp 被视作一个像是 scp 这样工具的替代品,无需在主机间进行 SSH 授权。 +`dcp` 被视作一个像是 `scp` 这样工具的替代品,而无需在主机间进行 SSH 授权。 -这可以让你在两个主机间传输文件时,无需操心所述主机之间互相访问的细节,以及这些主机是否使用了 NATs。 +这可以让你在两个主机间传输文件时,无需操心所述主机之间互相访问的细节,以及这些主机是否使用了 NAT。 -dcp 零配置、安全、快速、且是 P2P 传输。这并不是一个商用软件,使用产生的风险将由使用者自己承担。 +`dcp` 零配置、安全、快速、且是 P2P 传输。这并不是一个商用软件,使用产生的风险将由使用者自己承担。 ### 什么是 Dat 协议 -Dat 是一个 P2P 协议,是一个致力于下一代 Web 的社区驱动的项目。 +Dat 是一个 P2P 协议,是一个致力于下一代 Web 的由社区驱动的项目。 ### dcp 如何工作 -dcp 将会为指定的文件或者文件夹创建一个 dat 归档,并生成一个公钥,使用这个公钥可以让其他人从另外一台主机上下载上面的文件。 +`dcp` 将会为指定的文件或者文件夹创建一个 dat 归档,并生成一个公开密钥,使用这个公开密钥可以让其他人从另外一台主机上下载上面的文件。 -使用网络共享的任何数据都使用归档的公钥加密,也就是说文件的接收权仅限于那些知道公钥的人。 +使用网络共享的任何数据都使用该归档的公开密钥加密,也就是说文件的接收权仅限于那些拥有该公开密钥的人。 ### dcp 使用案例 - * 向多个同事发送文件 —— 只需要告诉他们生成的公钥,然后他们就可以在他们的机器上收到对应的文件了。 + * 向多个同事发送文件 —— 只需要告诉他们生成的公开密钥,然后他们就可以在他们的机器上收到对应的文件了。 * 无需设置 SSH 授权就可以在你本地网络的两个不同物理机上同步文件。 * 无需压缩文件并把文件上传到云端就可以轻松地发送文件。 * 当你有 shell 授权而没有 SSH 授权时也可以复制文件到远程服务器上。 * 在没有很好的 SSH 支持的 Linux/macOS 以及 Windows 系统之间分享文件。 - - ### 如何在 Linux 上安装 NodeJS & npm? -dcp 是用 JavaScript 写成的,所以在安装 dcp 前,需要先安装 NodeJS。在 Linux 上使用下面的命令安装 NodeJS。 +`dcp` 是用 JavaScript 写成的,所以在安装 `dcp` 前,需要先安装 NodeJS。在 Linux 上使用下面的命令安装 NodeJS。 -**Fedora** 系统,使用 **[DNF 命令][5]** 安装 NodeJS & npm。 +Fedora 系统,使用 [DNF 命令][5] 安装 NodeJS & npm。 ``` $ sudo dnf install nodejs npm ``` -**`Debian/Ubuntu`** 系统,使用 **[APT-GET 命令][6]** 或者 **[APT 命令][6]** 安装 NodeJS & npm。 +Debian/Ubuntu 系统,使用 [APT-GET 命令][6] 或者 [APT 命令][6] 安装 NodeJS & npm。 ``` $ sudo apt install nodejs npm ``` -**`Arch Linux`** 系统,使用 **[Pacman 命令][8]** 安装 NodeJS & npm。 +Arch Linux 系统,使用 [Pacman 命令][8] 安装 NodeJS & npm。 ``` $ sudo pacman -S nodejs npm ``` -**`RHEL/CentOS`** 系统,使用 **[YUM 命令][9]** 安装 NodeJS & npm。 +RHEL/CentOS 系统,使用 [YUM 命令][9] 安装 NodeJS & npm。 ``` $ sudo yum install epel-release $ sudo yum install nodejs npm ``` -**`openSUSE Leap`** 系统,使用 **[Zypper 命令][10]** 安装 NodeJS & npm。 +openSUSE Leap 系统,使用 [Zypper 命令][10] 安装 NodeJS & npm。 ``` $ sudo zypper nodejs6 @@ -85,26 +81,27 @@ $ sudo zypper nodejs6 ### 如何在 Linux 上安装 dcp? -在安装好 NodeJS 后,使用下面的 npm 命令安装 dcp。 +在安装好 NodeJS 后,使用下面的 `npm` 命令安装 `dcp`。 -npm 是一个 JavaScript 的包管理。它是 JavaScript 的运行环境 Node.js 的默认包管理。 +`npm` 是一个 JavaScript 的包管理器。它是 JavaScript 的运行环境 Node.js 的默认包管理器。 ``` # npm i -g dat-cp ``` + ### 如何通过 dcp 发送文件? -在 dcp 命令后跟你想要传输的文件或者文件夹。而且无需注明目标机器的名字。 +在 `dcp` 命令后跟你想要传输的文件或者文件夹。而且无需注明目标机器的名字。 ``` # dcp [File Name Which You Want To Transfer] ``` -在你运行 dcp 命令时将会为传送的文件生成一个 dat 归档。一旦执行完成将会在页面底部生成一个公钥。 +在你运行 `dcp` 命令时将会为传送的文件生成一个 dat 归档。一旦执行完成将会在页面底部生成一个公开密钥。(LCTT 译注:此处并非非对称加密中的公钥/私钥对,而是一种公开的密钥,属于对称加密。) ### 如何通过 dcp 接收文件 -在远程服务器上输入公钥即可接收对应的文件或者文件夹。 +在远程服务器上输入公开密钥即可接收对应的文件或者文件夹。 ``` # dcp [Public Key] @@ -117,24 +114,31 @@ npm 是一个 JavaScript 的包管理。它是 JavaScript 的运行环境 Node.j ``` 下面这个例子我们将会传输单个文件。 + ![][12] -上述文件的输出。 +上述文件传输的输出。 + ![][13] 如果你想传输不止一个文件,使用下面的格式。 + ![][14] -上述文件的输出。 +上述文件传输的输出。 + ![][15] 递归复制文件夹。 + ![][16] 上述文件夹传输的输出。 + ![][17] 这种方式下你只能够下载一次文件或者文件夹,不可以多次下载。这也就意味着一旦你下载了这些文件或者文件夹,这个链接就会立即失效。 + ![][18] 也可以在手册页查看更多的相关选项。 @@ -149,8 +153,8 @@ via: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between- 作者:[Vinoth Kumar][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[dianbanjiu](https://github.com/dianbanjiu) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c84b11555e1d84fcd48ec14931e5d323cb550ce5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 15:52:34 +0800 Subject: [PATCH 037/813] PUB:20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @dianbanjiu https://linux.cn/article-10516-1.html --- ... And Secure Way To Transfer Files Between Linux Systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md (98%) diff --git a/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/published/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md similarity index 98% rename from translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md rename to published/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md index 543213f354..ed9f269196 100644 --- a/translated/tech/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md +++ b/published/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10516-1.html) [#]: subject: (Dcp (Dat Copy) – Easy And Secure Way To Transfer Files Between Linux Systems) [#]: via: (https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) From aacdccf48b4de1bb21a9dc061634d4d0ee3dd328 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 16:38:08 +0800 Subject: [PATCH 038/813] PRF:20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @sndnvaps 恭喜你完成了第一篇翻译。 请参照我的校对,了解如何翻译的更好。 --- ...Locally As Virtual File System In Linux.md | 150 +++++++++--------- 1 file changed, 77 insertions(+), 73 deletions(-) diff --git a/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md b/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md index 03b2c4a172..bfafba2bb8 100644 --- a/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md +++ b/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md @@ -1,174 +1,180 @@ -如何把Google Driver当做虚拟磁盘一样挂载到Linux操作系统 +如何把 Google 云端硬盘当做虚拟磁盘一样挂载到 Linux ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/07/Google-Drive-720x340.png) -[**Google Drive**][1] 是全球比较受欢迎的云存储平台. 直到2017年, 全球有超过8亿的活跃用户在使用它。即使用户数在持续增长,但直到现在Google还是没有发布一款可以在Linux平台使用的客户端。但这难不倒Linux开源组织的大神。 不时,一些开发者已经把功能实现了。 下面我将会介绍三个用于Linux系统非官方开发的Google Driver客户端。使用这些客户端,你能把Google Driver像虚拟磁盘一样挂载到Linux系统。 请记好笔记了。 +[Google 云端硬盘][1] 是全球比较受欢迎的云存储平台. 直到 2017 年, 全球有超过 8 亿的活跃用户在使用它。即使用户数在持续增长,但直到现在 Google 还是没有发布一款可以在 Linux 平台使用的客户端。但这难不倒 Linux 社区。不时就有一些开发者给 Linux 操作系统带来一些客户端。下面我将会介绍三个用于 Linux 系统非官方开发的 Google 云端硬盘客户端。使用这些客户端,你能把 Google 云端硬盘像虚拟磁盘一样挂载到 Linux 系统。请继续阅读。 -### 1. Google-drive-ocamlfuse - -**google-driver-ocamlfuse**把Google Driver当做是一个FUSE类型的文件系统,是用OCam语言写的。FUSE到底是何物,用户态文件系统,此项目允许非管理员用户在用户空间开发文件系统。**google-drive-ocamlfuse**可以让你把Google Driver当做磁盘一样挂载到Linux系统。支持对文件和目录的读写操作,支持只读操作,支持多用户,支持拖拉文件,支持访问Google Driver的回收站,等操作。 +### 1、Google-drive-ocamlfuse +google-drive-ocamlfuse 把 Google 云端硬盘当做是一个 FUSE 类型的文件系统,它是用 OCam 语言写的。FUSE 意即用户态文件系统Filesystem in Userspace,此项目允许非管理员用户在用户空间创建虚拟文件系统。google-drive-ocamlfuse 可以让你把 Google 云端硬盘当做磁盘一样挂载到 Linux 系统。支持对普通文件和目录的读写操作,支持对 Google dock、表单和演示稿的只读操作,支持多个 Googe 云端硬盘用户,重复文件处理,支持访问回收站等等。 #### 安装 google-drive-ocamlfuse -google-drive-ocamlfuse 能在Arch系统的[**AUR**][2]上直接找到, 所以这安装起来就比较简单了, 使用[**Yay**][3]命令直接安装。 +google-drive-ocamlfuse 能在 Arch 系统的 [AUR][2] 上直接找到,所以你可以使用 AUR 助手程序,如 [Yay][3] 来安装。 + ``` $ yay -S google-drive-ocamlfuse - ``` -在Ubuntu系统: +在 Ubuntu 系统: + ``` $ sudo add-apt-repository ppa:alessandro-strada/ppa $ sudo apt-get update $ sudo apt-get install google-drive-ocamlfuse - ``` -安装最新的测试版本: +安装最新的测试版本: + ``` $ sudo add-apt-repository ppa:alessandro-strada/google-drive-ocamlfuse-beta $ sudo apt-get update $ sudo apt-get install google-drive-ocamlfuse - ``` #### 使用方法 -安装完成后,直接在终端里面输入如下命令,就可以启动**google-drive-ocamlfuse**程序了: -``` -$ google-drive-ocamlfuse +安装完成后,直接在终端里面输入如下命令,就可以启动 google-drive-ocamlfuse 程序了: ``` -当你第一次运行命令,程序会直接打开你的浏览器并要求你确认是否对Google Driver的操作进行授权。当你确认授权后,授权信息和挂载Google Driver用到的目录都会自动进行创建的。 +$ google-drive-ocamlfuse +``` + +当你第一次运行该命令,程序会直接打开你的浏览器并要求你确认是否对 Google 云端硬盘的文件的操作进行授权。当你确认授权后,挂载 Google 云端硬盘所需要的配置文件和目录都会自动进行创建。 ![][5] 当成功授权后,你会在终端里面看到如下的信息。 -``` -Access token retrieved correctly. ``` -好了,我们可以进行下一步操作了。关闭浏览器并为我们的Google Driver创建一个挂载点吧。 +Access token retrieved correctly. +``` + +好了,我们可以进行下一步操作了。关闭浏览器并为我们的 Google 云端硬盘创建一个挂载点吧。 + ``` $ mkdir ~/mygoogledrive ``` -最后操作,使用如下命令挂载Google Driver: + +最后操作,使用如下命令挂载 Google 云端硬盘: + ``` $ google-drive-ocamlfuse ~/mygoogledrive - ``` -恭喜你了!你可以使用终端或文件管理器来访问Google Driver里面的文件了。 +恭喜你了!你可以使用终端或文件管理器来访问 Google 云端硬盘里面的文件了。 + +使用终端: -使用**终端**: ``` $ ls ~/mygoogledrive - ``` -使用**文件管理器**: +使用文件管理器: ![][6] -如何你有不止一个账户,可以使用**label**命令对其进行区分不同的账户,就像下面一样 +如何你有不止一个账户,可以使用 `label` 命令对其进行区分不同的账户,就像下面一样: + ``` $ google-drive-ocamlfuse -label label [mountpoint] - ``` -当操作完成后,你可以使用如下的命令卸载Google Driver: +当操作完成后,你可以使用如下的命令卸载 Google 云端硬盘: + ``` $ fusermount -u ~/mygoogledrive - ``` -获取更多信息,你可以命令用户操作手册。 +获取更多信息,你可以参考 man 手册。 + ``` $ google-drive-ocamlfuse --help - ``` -当然你也可以看看[**官方文档**][7]和[**Github项目**][8]以获取更多内容。 +当然你也可以看看[官方文档][7]和该项目的 [GitHub 项目][8]以获取更多内容。 ### 2. GCSF -**GCSF** 是Google Driver基于FUSE的文件系统,使用**Rust**语言编写。GCSF主要是来源于罗马尼亚语中的“ **G** oogle **C** onduce **S** istem de **F** ișiere”,翻译成英文就是“Google Drive Filesystem”(即Google Drive 文件系统)使用GCSF,你可以把Google Driver当做虚拟磁盘一样挂载到Linux系统,可以通过终端和文件管理器对其进行操作。你肯定会很好奇,这到底于其它的Google Dirver FUSE项目有什么不同,就比如**google-drive-ocamlfuse**。就类型的问题,GCSF的开发者有如下的回复[在Reddit论坛上的评论][9] “GCSF意在某些方面更快(循环列举文件,从Google Driver中读取大文件)。缓存策略也能让读取速度更快(x4-7 的修改更突显了与google-drive-ocamlfuse的差别)当文件被结存后,此为浪费更多的内在”。 +GCSF 是基于 Google 云端硬盘的 FUSE 文件系统,使用 Rust 语言编写。GCSF 得名于罗马尼亚语中的“ **G** oogle **C** onduce **S** istem de **F** ișiere”,翻译成英文就是“Google Drive Filesystem”(即 Google 云端硬盘文件系统)。使用 GCSF,你可以把 Google 云端硬盘当做虚拟磁盘一样挂载到 Linux 系统,可以通过终端和文件管理器对其进行操作。你肯定会很好奇,这到底与其它的 Google 云端硬盘 FUSE 项目有什么不同,比如 google-drive-ocamlfuse。GCSF 的开发者回应 [Reddit 上的类似评论][9]:“GCSF 意在某些方面更快(递归列举文件、从 Google 云端硬盘中读取大文件)。当文件被缓存后,在消耗更多的内存后,其缓存策略也能让读取速度更快(相对于 google-drive-ocamlfuse 4-7 倍的提升)”。 #### 安装 GCSF -GCSF能在[**AUR**][10]上面找到, 对于Arch用户来说直接使用AUR助手来安装就行了,例如[**Yay**][3]。 +GCSF 能在 [AUR][10] 上面找到,对于 Arch 用户来说直接使用 AUR 助手来安装就行了,例如[Yay][3]。 + ``` $ yay -S gcsf-git - ``` -对于其它的发行版本,需要进行如下的操作来进行安装。 +对于其它的发行版,需要进行如下的操作来进行安装。 首先,你得确认系统中是否安装了Rust语言。 -确保**pkg-config**和**fuse**软件包是否安装了。它们在绝大多数的Linux发行片的默认仓库中都能找到。例如,在Ubuntu及其衍生版本中,你可以使用如下的命令进行安装: +- [在 Linux 上安装 Rust](https://www.ostechnix.com/install-rust-programming-language-in-linux/) + +确保 `pkg-config` 和 `fuse` 软件包是否安装了。它们在绝大多数的 Linux 发行版的默认仓库中都能找到。例如,在 Ubuntu 及其衍生版本中,你可以使用如下的命令进行安装: + ``` $ sudo apt-get install -y libfuse-dev pkg-config - ``` -当所有的依赖软件安装完成后,你可以使用如下的命令来安装GCSF: +当所有的依赖软件安装完成后,你可以使用如下的命令来安装 GCSF: + ``` $ cargo install gcsf - ``` #### 使用方法 -首先,我们需要对Google Driver的操作进行授权,跟上面的一样方法,终端输入如下命令: +首先,我们需要对 Google 云端硬盘的操作进行授权,简单输入如下命令: + ``` $ gcsf login ostechnix - ``` -你必须要指定一个会话名称。使用自己的会话名称来代**ostechnix**。你会看到像下图的提示信息和Google Driver账户的授权验证连接。 +你必须指定一个会话名称。请使用自己的会话名称来代 `ostechnix`。你会看到像下图的提示信息和Google 云端硬盘账户的授权验证连接。 ![][11] -直接把授权验证信息复制出来,并用浏览器打开它,并点击最下面的**allow**来完成授权操作。当完成授权后,你的终端会显示如下的信息。 +直接复制并用浏览器打开上述 URL,并点击 “allow” 来授权访问你的 Google 云端硬盘账户。当完成授权后,你的终端会显示如下的信息。 + ``` Successfully logged in. Credentials saved to "/home/sk/.config/gcsf/ostechnix". - ``` -GCSF会把配置保存文件在**$XDG_CONFIG_HOME/gcsf/gcsf.toml**,一般文件会保存在**$HOME/.config/gcsf/gcsf.toml**。授权信息也会保存在此目录当中。 +GCSF 会把配置保存文件在 `$XDG_CONFIG_HOME/gcsf/gcsf.toml`,通常位于 `$HOME/.config/gcsf/gcsf.toml`。授权凭证也会保存在此目录当中。 + +下一步,创建一个用来挂载 Google 云端硬盘的目录。 -下一步,创建一个用来挂载Google Driver的目录。 ``` $ mkdir ~/mygoogledrive - ``` -之后,修改**/etc/fuse.conf**文件: +之后,修改 `/etc/fuse.conf` 文件: + ``` $ sudo vi /etc/fuse.conf - ``` -注释掉以下的行,以允许非管理员进行挂载操作(内容像allow_other或allow_root) +注释掉以下的行,以允许非管理员用 `allow_other` 或 `allow_root` 挂载选项来挂载。 + ``` user_allow_other - ``` 保存并关闭文件。 -最后一步,挂载Google Driver命令如下的命令: +最后一步,使用如下命令挂载 Google 云端硬盘: + ``` $ gcsf mount ~/mygoogledrive -s ostechnix - ``` -简单的终端输入内容: +示例输出: + ``` INFO gcsf > Creating and populating file system... INFO gcsf > File sytem created. @@ -176,30 +182,30 @@ INFO gcsf > Mounting to /home/sk/mygoogledrive INFO gcsf > Mounted to /home/sk/mygoogledrive INFO gcsf::gcsf::file_manager > Checking for changes and possibly applying them. INFO gcsf::gcsf::file_manager > Checking for changes and possibly applying them. - ``` -重复一次,使用自己的会话名来更换**ostechnix**。你可以命令如下的命令来查看已经存在的会话: +重复一次,使用自己的会话名来更换 `ostechnix`。你可以使用如下的命令来查看已经存在的会话: + ``` $ gcsf list Sessions: - ostechnix - ``` -你现在可以使用终端和文件管理器对Google Driver进行操作了。 +你现在可以使用终端和文件管理器对 Google 云端硬盘进行操作了。 + +使用终端: -使用**终端**: ``` $ ls ~/mygoogledrive - ``` -使用**文件管理器**: +使用文件管理器: ![][12] -如果你不知道自己把Google Driver挂载到哪个目录了,可以使用**df**或者**mount**命令,就像下面一样。 +如果你不知道自己把 Google 云端硬盘挂载到哪个目录了,可以使用 `df` 或者 `mount` 命令,就像下面一样。 + ``` $ df -h Filesystem Size Used Avail Use% Mounted on @@ -214,36 +220,34 @@ GCSF 15G 857M 15G 6% /home/sk/mygoogledrive $ mount | grep GCSF GCSF on /home/sk/mygoogledrive type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other) - ``` -当操作完成后,你可以使用如下命令来卸载Google Driver: +当操作完成后,你可以使用如下命令来卸载 Google 云端硬盘: + ``` $ fusermount -u ~/mygoogledrive - ``` -浏览[**GCSF GitHub项目**][13]以获取更多内容。 +浏览[GCSF GitHub 项目][13]以获取更多内容。 -### 3. Tuxdrive +### 3、Tuxdrive -**Tuxdrive**是其它的非官方Linux Google Driver客户端。我们之前有写过一篇关于Tuxdrive比较详细的使用方法。你可以找一找之前的文档。 +Tuxdrive 也是一个非官方 Linux Google 云端硬盘客户端。我们之前有写过一篇关于 Tuxdrive 比较详细的使用方法。可以查看如下链接: -这当然,还有其它的非官方的Google Driver客户端在过去有出现过,例如Grive2,Syncdrive。但它们好像都已经停止开发了。我会对这个列表进行持续的跟进当有更受欢迎的Google Driver客户端出现。 +- [Tuxdrive: 一个 Linux 下的 Google 云端硬盘客户端](https://www.ostechnix.com/tuxdrive-commandline-google-drive-client-linux/) +当然,之前还有过其它的非官方 Google 云端硬盘客户端,例如 Grive2、Syncdrive。但它们好像都已经停止开发了。当有更受欢迎的 Google 云端硬盘客户端出现,我会对这个列表进行持续的跟进。 谢谢你的阅读。 - - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/ 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/sndnvaps) -校对:[校对者ID](https://github.com/校对者ID) +译者:[sndnvaps](https://github.com/sndnvaps) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 93224cb53c5941773ef684704ce8e90965277546 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 16:39:06 +0800 Subject: [PATCH 039/813] PUB:20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @sndnvaps 本文首发地址: https://linux.cn/article-10517-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/sndnvaps 请注册领取LCCN: https://lctt.linux.cn/ --- ... Mount Google Drive Locally As Virtual File System In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md (100%) diff --git a/translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md b/published/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md similarity index 100% rename from translated/tech/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md rename to published/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md From 7f8d2b702b2c6cdf5c228a4680b24fc70c55e3c3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 20:10:34 +0800 Subject: [PATCH 040/813] PRF:20190114 Remote Working Survival Guide.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @beamrolling 翻译的很好! --- .../20190114 Remote Working Survival Guide.md | 84 ++++++++++--------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/translated/talk/20190114 Remote Working Survival Guide.md b/translated/talk/20190114 Remote Working Survival Guide.md index 54893cbdca..c7be53fe9b 100644 --- a/translated/talk/20190114 Remote Working Survival Guide.md +++ b/translated/talk/20190114 Remote Working Survival Guide.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (beamrolling) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Remote Working Survival Guide) @@ -9,94 +9,98 @@ 远程工作生存指南 ====== + ![](https://www.jonobacon.com/wp-content/uploads/2019/01/5b5471d7eadb585ec8b8a0c3_featureimage-remotejob-1080x675.jpg) -远程工作似乎是最近的一个热门话题。CNBC 报道称, [70% 的专业人士至少每周在家工作一次][1]。同样地,CoSo Cloud 调查发现, [77% 的人在远程工作时效率更高][2] ,而 aftercollege 的一份调查显示, [8% 的千禧一代会更多地考虑提供远程工作的公司][3]。 这看起来很合理:技术,网络以及文化似乎越来越推动远程工作的发展。哦,自制咖啡也比以前任何时候更好喝了。 +远程工作似乎是最近的一个热门话题。CNBC 报道称,[70% 的专业人士至少每周在家工作一次][1]。同样地,CoSo Cloud 调查发现, [77% 的人在远程工作时效率更高][2] ,而 aftercollege 的一份调查显示,[8% 的千禧一代会更多地考虑提供远程工作的公司][3]。 这看起来很合理:技术、网络以及文化似乎越来越推动了远程工作的发展。哦,自制咖啡也比以前任何时候更好喝了。 目前,我准备写另一篇关于公司如何优化远程工作的文章(所以请确保你加入我们的会员以持续关注——这是免费的)。 -但今天,我想 **分享一些个人如何做好远程工作的建议**。 不管你是全职远程工作者,或者是可以选择一周某几天在家工作的人,希望这篇文章对你有用。 +但今天,我想 **分享一些个人如何做好远程工作的建议**。不管你是全职远程工作者,或者是可以选择一周某几天在家工作的人,希望这篇文章对你有用。 -眼下,你需要明白, **远程工作不是万能药**。当然,穿着睡衣满屋子乱逛,听听反社会音乐,喝一大杯咖啡看起来似乎挺完美的,但这不适合每个人。 +眼下,你需要明白,**远程工作不是万能药**。当然,穿着睡衣满屋子乱逛,听听反社会音乐,喝一大杯咖啡看起来似乎挺完美的,但这不适合每个人。 -有的人需要办公室的结构。有的人需要办公室的社会元素。有的人需要从家里走出来。有的人在家里缺乏保持关注的纪律。有的人因为好几年未缴退税而避免政府工作人员来住处敲门。 +有的人需要办公室的空间。有的人需要办公室的社会元素。有的人需要从家里走出来。有的人在家里缺乏保持专注的自律。有的人因为好几年未缴退税而怕政府工作人员来住处敲门。 -**远程工作就好像一块肌肉:如果你锻炼并且保持它,那么它能带来极大的力量和能力**。 如果不这么做,结果就不一样了。 +**远程工作就好像一块肌肉:如果你锻炼并且保持它,那么它能带来极大的力量和能力**。如果不这么做,结果就不一样了。 + +在我职业生涯的大多数时间里,我在家工作。我喜欢这么做。当我在家工作的时候,我更有效率,更开心,更有能力。我并非不喜欢在办公室工作,我享受办公室的社会元素,但我更喜欢在家工作时我的“空间”。我喜欢听重金属音乐,但当整个办公室的人不想听到 [After The Burial][5] 的时候,这会引起一些问题。 -在我职业生涯的大多数时间里,我在家工作。我喜欢这么做。当我在家工作的时候,我更有效率,更开心,更有能力。我并非不喜欢在办公室工作,我享受办公室的社会元素,但我更喜欢在家工作时我的“空间”。 我喜欢听重金属音乐,但当整个办公室的人不想听到 [After The Burial][5] 的时候,这会引起一些问题。 ![][6] -“Squirrel.” -[图片来源][7] -已经学会了如何正确平衡工作,旅行以及其他元素来管理我的远程工作,以下是我的一些建议。 请务必**在评论中分享一些你的建议**。 +*“Squirrel.” [图片来源][7]* -### 1\.你需要训练和习惯(以及了解你的“波浪”) +我已经学会了如何正确平衡工作、旅行以及其他元素来管理我的远程工作,以下是我的一些建议。请务必**在评论中分享一些你的建议**。 -远程工作确实是需要训练的一块肌肉。就像构建真正的肌肉一样,它需要一个清楚的惯例和一小块健康的训练混合起来。 +### 1、你需要纪律和习惯(以及了解你的“波动”) -永远保持穿戴整齐(不要穿睡衣)。设置你一天工作的开始和结束时间(大多时候我从早上9点工作到下午6点)。选好你的午餐休息时间(我的是中午12点)。选好你的早晨仪式(我的是电子邮件,紧接着是全面审查客户需求)。决定你的主工作地在哪(我的主工作地是我家里的工作室)。决定好每天你什么时候运动(大多数时候我在下午5点运动)。 +远程工作确实是需要训练的一块肌肉。就像练出真正的肌肉一样,它需要一个明确的习惯混以健康的纪律。 -**设计一个实际的习惯并坚持66天**。构建一个习惯需要很长时间,不要尝试着背离你的习惯。你越坚持这个习惯,做下去所花费的功夫越少。在这66天的末尾,你想都不会想,自然而然地就按习惯去做了。 +永远保持穿戴整齐(不要穿睡衣)。设置你一天工作的开始和结束时间(大多时候我从早上 9 点工作到下午 6 点)。选好你的午餐休息时间(我的是中午 12 点)。选好你的早晨仪式(我的是电子邮件,紧接着是全面审查客户需求)。决定你的主工作场所在哪(我的主工作场所是我家庭办公室)。决定好每天你什么时候运动(大多数时候我在下午 5 点运动)。 -话虽这么说,我们又不住在真空里 ([更干净,或者别的什么][8])。我们都有自己的“波浪”。 +**设计一个实际的习惯并坚持 66 天**。建立一个习惯需要很长时间,尽量不要偏离你的习惯。你越坚持这个习惯,做下去所花费的功夫越少。在这 66 天的末尾,你想都不会想,自然而然地就按习惯去做了。 -“波浪”是你为了改变做事的方法时,对日常做出的一些改变。举个例子,夏天的时候我通常需要更多的阳光。那时我经常会在室外的花园工作。临近假期的时候我更容易分心,所以我在上班时间会更需要呆在室内。有时候我只想要多点人际接触,因此我会在咖啡馆工作几周。有时候我就是喜欢在厨房或者长椅上工作。你需要学习你的“波浪”并倾听你的身体。 **首先构建你自己的兴趣,然后在你认识到自己的“波浪”的时候再对它进行适当的修改**。 +话虽这么说,我们又不住在真空里 ([更干净,或者别的什么][8])。我们都有自己的“波动”。 -### 2\. 和你的同事以及上司一起设立预期 +“波动”是你为了改变做事的方法时,对日常做出的一些改变。举个例子,夏天的时候我通常需要更多的阳光。那时我经常会在室外的花园工作。临近假期的时候我更容易分心,所以我在上班时间会更需要呆在室内。有时候我只想要多点人际接触,因此我会在咖啡馆里工作几周。有时候我就是喜欢在厨房或者长椅上工作。你需要认识你的“波动”并倾听你的身体。 **首先养成习惯,然后在你认识到自己的“波动”的时候再对它进行适当的调整**。 -不是每个人都知道怎么远程工作,如果你的公司对远程工作没那么熟悉,你尤其需要和同事一起设立预期。 +### 2、与你的上司及同事一起设立预期目标 -这件事十分简单:**当你要设计自己的工作日常的时候,清楚地跟你的上司和团队进行交流。**让他们知道如何找到你,紧急情况下如何联系你,以及你在家的时候如何保持合作。 +不是每个人都知道怎么远程工作,如果你的公司对远程工作没那么熟悉,你尤其需要和同事一起设立预期目标。 -这里的通信构件至关重要。有些远程工作者很怕离开他们的电脑,因为害怕当他们不在的时候有人给他们发消息(他们担心别人会觉得他们在边吃奇多边看 Netflix)。 +这件事十分简单:**当你要设计自己的日常工作的时候,清楚地跟你的上司和团队进行交流。**让他们知道如何找到你,紧急情况下如何联系你,以及你在家的时候如何保持合作。 -你需要离开一会的时间。你需要吃午餐的时候眼睛不用一直盯着电脑屏幕。你又不是911接线员。 **设定预期以后,有时候你可能不能立刻回复,但你会尽快回复**。 +在这里通信方式至关重要。有些远程工作者很怕离开他们的电脑,因为害怕当他们不在的时候有人给他们发消息(他们担心别人会觉得他们在边吃奇多边看 Netflix)。 -同样地,设定你的一般可用性的预期。举个例子,我对客户设立的预期是我一般每天早上9点到下午6点工作。当然,如果某个客户急需某样东西,我很乐意在这段时间外回应他,但作为一个一般性规则,我通常只在这段时间内工作。这对于生活的平衡是必要的。 +你需要离开一会的时间。你需要在吃午餐的时候眼睛不用一直盯着电脑屏幕。你又不是 911 接线员。**设定预期:有时候你可能不能立刻回复,但你会尽快回复**。 -### 3\. 分心是你的敌人,它们需要管理 +同样地,设定你的通常可响应的时间范围的预期。举个例子,我对客户设立的预期是我一般每天早上 9 点到下午 6 点工作。当然,如果某个客户急需某样东西,我很乐意在这段时间外回应他,但作为一个一般性规则,我通常只在这段时间内工作。这对于生活的平衡是必要的。 -我们都会分心,这是人类的本能。让你分心的事情可能是你的孩子回家了,想玩变形金刚:救援机器人;可能是看看Facebook,Instagram,或者 Twitter 以确保你不会错过任何不受欢迎的政治观点,或者某人的午餐图片;可能是你生活中即将到来的某件事带走了你的注意力(例如,即将举办的婚礼,活动,或者一次大旅行)。 +### 3、分心是你的敌人,它们需要管理 + +我们都会分心,这是人类的本能。让你分心的事情可能是你的孩子回家了,想玩救援机器人;可能是看看Facebook、Instagram,或者 Twitter 以确保你不会错过任何不受欢迎的政治观点,或者某人的午餐图片;可能是你生活中即将到来的某件事带走了你的注意力(例如,即将举办的婚礼、活动,或者一次大旅行)。 **你需要明白什么让你分心以及如何管理它**。举个例子,我知道我的电子邮件和 Twitter 会让我分心。我经常查看它们,并且每次查看都会让我脱离我正在工作的空间。拿水或者咖啡的时候我总会分心去吃零食,看 Youtube 的视频。 ![][9] -我的分心克星 -由电子产品造成的分心有一个简单对策:**锁起来**。直到你完成你手头的事情再关闭选项卡。有繁重的工作的时候我总这么干:我把让我分心的东西锁起来,直到做完手头的工作。这需要控制能力,但所有的一切都需要。 +*我的分心克星* -因为别人影响而分心的元素更难解决。如果你是有家庭的人,你需要在你工作的时候不被打扰,你通常需要独处。这也是为什么家庭办公室这么重要:你需要设一些“爸爸/妈妈正在工作”的界限。如果有急事才能进来,否则让孩子自个儿玩去。 +由数字信息造成的分心有一个简单对策:**锁起来**。关闭选项卡,直到你完成了你手头的事情。有一大堆工作的时候我总这么干:我把让我分心的东西锁起来,直到做完手头的工作。这需要控制能力,但所有的一切都需要。 -把让你分心的事分开有许多方法:把你的电话静音;把自己的状态设成“离开”;换到一个没有让你分心的事的房间(或建筑物)。再重申一次,了解是什么让你分心并控制好它。如果不这么做,你会永远被分心的事摆布。 +因为别人影响而分心的元素更难解决。如果你是有家庭的人,你需要明确表示,在你工作的时候常需要独处。这也是为什么家庭办公室这么重要:你需要设一些“爸爸/妈妈正在工作”的界限。如果有急事才能进来,否则让孩子自个儿玩去。 -### 4\. (良好的)关系需要面对面的关注 +把让你分心的事锁起来有许多方法:把你的电话静音;把自己的 Facebook 状态设成“离开”;换到一个没有让你分心的事的房间(或建筑物)。再重申一次,了解是什么让你分心并控制好它。如果不这么做,你会永远被分心的事摆布。 -有的角色比其他角色与远程工作更合拍。例如,我见过工程、质量保证、支持、安全以及其他团队(通常更专注于数字协作)的出色工作。其他团队,如设计或营销,往往在远程环境下更难熬(因为它们更注重触觉)。 +### 4、(良好的)关系需要面对面的关注 -但是,对于任何团队而言,建立牢固的关系至关重要,而现场讨论,协作和社交很有必要。我们的许多感官(例如肢体语言)在数字环境中被删除,这些在我们建立信任和关系的方式中发挥着关键作用。 +有些角色比其他角色更适合远程工作。例如,我见过工程、质量保证、支持、安全以及其他团队(通常更专注于数字信息协作)的出色工作。其他团队,如设计或营销,往往在远程环境下更难熬(因为它们更注重触觉性)。 + +但是,对于任何团队而言,建立牢固的关系至关重要,而现场讨论、协作和社交很有必要。我们的许多感官(例如肢体语言)在数字环境中被剔除,而这些在我们建立信任和关系的方式中发挥着关键作用。 ![][10] -火箭也很有帮助 -这尤为重要,如果(a)你初来这家公司,需要建立关系;(b)你是一个新角色,需要和你的团队建立关系;或者(c)你处于领导地位,建立买入和参与是你工作的关键部分。 +*火箭也很有帮助* + +这尤为重要,如果(a)你初来这家公司,需要建立关系;(b)对某种角色不熟悉,需要和你的团队建立关系;或者(c)你处于领导地位,构建团队融入和参与是你工作的关键部分。 **解决方法是?合理搭配远程工作与面对面的时间。** 如果你的公司就在附近,可以用一部分的时间在家工作,一部分时间在公司工作。如果你的公司比较远,安排定期前往办公室(并对你的上司设定你需要这么做的预期)。例如,当我在 XPRIZE 工作的时候,我每几周就会飞往洛杉矶几天。当我在 Canonical 工作时(总部在伦敦),我们每三个月来一次冲刺。 -### 5\. 保持专注,不要松懈 +### 5、保持专注,不要松懈 -本文所有内容的关键在于构建能力,并培养远程工作的肌肉。这就像建立你的日常,坚持它,并明白你的“波浪”和让你分心的事情以及如何管理它们一样简单。 +本文所有内容的关键在于构建一种(远程工作的)能力,并培养远程工作的肌肉。这就像建立你的日常惯例,坚持它,并认识你的“波动”和让你分心的事情以及如何管理它们一样简单。 我以一种相当具体的方式来看待这个世界:**我们所做的一切都有机会得到改进和完善**。举个例子,我已经公开演讲超过 15 年,但我总是能发现新的改进方法,以及修复新的错误(说到这些,请参阅我的 [提升你公众演讲的10个方法][11])。 发现新的改善方法,以及把每个绊脚石和错误视为一个开启新的不同的“啊哈!”时刻让人兴奋。远程工作和这没什么不同:寻找有助于解锁方式的模式,让你的远程工作时间更高效,更舒适,更有趣。 ![][12] -看看这些书。它们非常适合个人发展。 -参阅我的 [150 美元个人发展工具包][13] 文章 -...但别为此狂热。有的人花尽他们每一分钟来关注如何变得更好,他们经常以“做得还不够好”,“完成度不够高”等为由打击自己,无法达到他们内心关于完美的不切实际的观点。 +*看看这些书。它们非常适合个人发展。参阅我的 [150 美元个人发展工具包][13] 文章* -我们都是人,我们是有生命的,不是机器人。始终致力于改进,但要明白不是所有东西都是完美的。你将会有一些休息日或休息周。你将会因为压力和倦怠而挣扎。你将会处理一些在办公室比远程工作更容易的情况。从这些时刻中学习,但不要沉迷于此。生命太短暂了。 +……但别为此狂热。有的人花尽他们每一分钟来寻求如何变得更好,他们经常以“做得还不够好”、“完成度不够高”等为由打击自己,无法达到他们内心关于完美的不切实际的观点。 + +我们都是人,我们是有生命的,不是机器人。始终致力于改进,但要明白不是所有东西都是完美的。你应该有一些休息日或休息周。你也会因为压力和倦怠而挣扎。你也会遇到一些在办公室比远程工作更容易的情况。从这些时刻中学习,但不要沉迷于此。生命太短暂了。 **你有什么提示,技巧和建议吗?你如何管理远程工作?我的建议中还缺少什么吗?在评论区中与我分享!** @@ -108,7 +112,7 @@ via: https://www.jonobacon.com/2019/01/14/remote-working-survival/ 作者:[Jono Bacon][a] 选题:[lujun9972][b] 译者:[beamrolling](https://github.com/beamrolling) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d6f6d05003553102bae523abcb3ffc20e0578e63 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Feb 2019 20:11:15 +0800 Subject: [PATCH 041/813] PUB:20190114 Remote Working Survival Guide.md @beamrolling https://linux.cn/article-10518-1.html --- .../20190114 Remote Working Survival Guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190114 Remote Working Survival Guide.md (99%) diff --git a/translated/talk/20190114 Remote Working Survival Guide.md b/published/20190114 Remote Working Survival Guide.md similarity index 99% rename from translated/talk/20190114 Remote Working Survival Guide.md rename to published/20190114 Remote Working Survival Guide.md index c7be53fe9b..0c51a15885 100644 --- a/translated/talk/20190114 Remote Working Survival Guide.md +++ b/published/20190114 Remote Working Survival Guide.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (beamrolling) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10518-1.html) [#]: subject: (Remote Working Survival Guide) [#]: via: (https://www.jonobacon.com/2019/01/14/remote-working-survival/) [#]: author: (Jono Bacon https://www.jonobacon.com/author/admin/) From 0f17b14b1b5b851992c61fd23af03e6f090b2e23 Mon Sep 17 00:00:00 2001 From: Ezio Date: Thu, 7 Feb 2019 23:03:33 +0800 Subject: [PATCH 042/813] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E5=8A=A8=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md (100%) diff --git a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md similarity index 100% rename from sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md rename to translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md From 8225f5bf9572e882b0423ccd2ff9c9027187e5ac Mon Sep 17 00:00:00 2001 From: oska874 Date: Thu, 7 Feb 2019 23:13:42 +0800 Subject: [PATCH 043/813] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md index beb7613b2f..eb0f8091d4 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (ezio ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,6 +7,8 @@ [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) +ezio is translating + Computer Laboratory – Raspberry Pi: Lesson 10 Input01 ====== @@ -482,7 +484,7 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html 作者:[Alex Chadwick][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[ezio](https://github.com/oska874) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ff2aa30dc25a4cf66c3bee19eacb5d6609566ce4 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Fri, 8 Feb 2019 12:52:29 +0800 Subject: [PATCH 044/813] Translated by qhwdw --- ...atory - Raspberry Pi- Lesson 7 Screen02.md | 449 ----------------- ...atory - Raspberry Pi- Lesson 7 Screen02.md | 463 ++++++++++++++++++ 2 files changed, 463 insertions(+), 449 deletions(-) delete mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md create mode 100644 translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md deleted file mode 100644 index 8846d270da..0000000000 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md +++ /dev/null @@ -1,449 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 7 Screen02) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html) -[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) - -Computer Laboratory – Raspberry Pi: Lesson 7 Screen02 -====== - -The Screen02 lesson builds on Screen01, by teaching how to draw lines and also a small feature on generating pseudo random numbers. It is assumed you have the code for the [Lesson 6: Screen01][1] operating system as a basis. - -### 1 Dots - -Now that we've got the screen working, it is only natural to start waiting to create sensible images. It would be very nice indeed if we were able to actually draw something. One of the most basic components in all drawings is a line. If we were able to draw a line between any two points on the screen, we could start creating more complicated drawings just using combinations of these lines. - -``` -To allow complex drawing, some systems use a colouring function rather than just one colour to draw things. Each pixel calls the colouring function to determine what colour to draw there. -``` - -We will attempt to implement this in assembly code, but first we could really use some other functions to help. We need a function I will call SetPixel that changes the colour of a particular pixel, supplied as inputs in r0 and r1. It will be helpful for future if we write code that could draw to any memory, not just the screen, so first of all, we need some system to control where we are actually going to draw to. I think that the best way to do this would be to have a piece of memory which stores where we are going to draw to. What we should end up with is a stored address which normally points to the frame buffer structure from last time. We will use this at all times in our drawing method. That way, if we want to draw to a different image in another part of our operating system, we could make this value the address of a different structure, and use the exact same code. For simplicity we will use another piece of data to control the colour of our drawings. - -Copy the following code to a new file called 'drawing.s'. - -``` -.section .data -.align 1 -foreColour: -.hword 0xFFFF - -.align 2 -graphicsAddress: -.int 0 - -.section .text -.globl SetForeColour -SetForeColour: -cmp r0,#0x10000 -movhs pc,lr -ldr r1,=foreColour -strh r0,[r1] -mov pc,lr - -.globl SetGraphicsAddress -SetGraphicsAddress: -ldr r1,=graphicsAddress -str r0,[r1] -mov pc,lr -``` - -This is just the pair of functions that I described above, along with their data. We will use them in 'main.s' before drawing anything to control where and what we are drawing. - -``` -Building generic methods like SetPixel which we can build other methods on top of is a useful idea. We have to make sure the method is fast though, since we will use it a lot. -``` - -Our next task is to implement a SetPixel method. This needs to take two parameters, the x and y co-ordinate of a pixel, and it should use the graphicsAddress and foreColour we have just defined to control exactly what and where it is drawing. If you think you can implement this immediately, do, if not I shall outline the steps to be taken, and then give an example implementation. - - 1. Load in the graphicsAddress. - 2. Check that the x and y co-ordinates of the pixel are less than the width and height. - 3. Compute the address of the pixel to write. (hint: frameBufferAddress + (x + y core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated width) * pixel size) - 4. Load in the foreColour. - 5. Store it at the address. - - - -An implementation of the above follows. - -1. -``` -.globl DrawPixel -DrawPixel: -px .req r0 -py .req r1 -addr .req r2 -ldr addr,=graphicsAddress -ldr addr,[addr] -``` - -2. -``` -height .req r3 -ldr height,[addr,#4] -sub height,#1 -cmp py,height -movhi pc,lr -.unreq height - -width .req r3 -ldr width,[addr,#0] -sub width,#1 -cmp px,width -movhi pc,lr -``` - -Remember that the width and height are stored at offsets of 0 and 4 into the frame buffer description respectively. You can refer back to 'frameBuffer.s' if necessary. - -3. -``` -ldr addr,[addr,#32] -add width,#1 -mla px,py,width,px -.unreq width -.unreq py -add addr, px,lsl #1 -.unreq px -``` - -``` -mla dst,reg1,reg2,reg3 multiplies the values from reg1 and reg2, adds the value from reg3 and places the least significant 32 bits of the result in dst. -``` - -Admittedly, this code is specific to high colour frame buffers, as I use a bit shift directly to compute this address. You may wish to code a version of this function without the specific requirement to use high colour frame buffers, remembering to update the SetForeColour code. It may be significantly more complicated to implement. - -4. -``` -fore .req r3 -ldr fore,=foreColour -ldrh fore,[fore] -``` - -As above, this is high colour specific. - -5. -``` -strh fore,[addr] -.unreq fore -.unreq addr -mov pc,lr -``` - -As above, this is high colour specific. - - - - -### 2 Lines - -The trouble is, line drawing isn't quite as simple as you may expect. By now you must realise that when making operating system, we have to do almost everything ourselves, and line drawing is no exception. I suggest for a few minutes you have a think about how you would draw a line between any two points. - -``` -When programming normally, we tend to be lazy with things like division. Operating Systems must be incredibly efficient, and so we must focus on doing things as best as possible. -``` - -I expect the central idea of most strategies will involve computing the gradient of the line, and stepping along it. This sounds perfectly reasonable, but is actually a terrible idea. The problem with it is it involves division, which is something that we know can't easily be done in assembly, and also keeping track of decimal numbers, which is again difficult. There is, in fact, an algorithm called Bresenham's Algorithm, which is perfect for assembly code because it only involves addition, subtraction and bit shifts. -``` -Let's start off by defining a reasonably straightforward line drawing algorithm as follows: - -if x1 > x0 then - -set deltax to x1 - x0 -set stepx to +1 - -otherwise - -set deltax to x0 - x1 -set stepx to -1 - -end if - -if y1 > y0 then - -set deltay to y1 - y0 -set stepy to +1 - -otherwise - -set deltay to y0 - y1 -set stepy to -1 - -end if - -if deltax > deltay then - -set error to 0 -until x0 = x1 + stepx - -setPixel(x0, y0) -set error to error + deltax ÷ deltay -if error ≥ 0.5 then - -set y0 to y0 + stepy -set error to error - 1 - -end if -set x0 to x0 + stepx - -repeat - -otherwise - -end if - -This algorithm is a representation of the sort of thing you may have imagined. The variable error keeps track of how far away from the actual line we are. Every step we take along the x axis increases this error, and every time we move down the y axis, the error decreases by 1 unit again. The error is measured as a distance along the y axis. - -While this algorithm works, it suffers a major problem in that we clearly have to use decimal numbers to store error, and also we have to do a division. An immediate optimisation would therefore be to change the units of error. There is no need to store it in any particular units, as long as we scale every use of it by the same amount. Therefore, we could rewrite the algorithm simply by multiplying all equations involving error by deltay, and simplifying the result. Just showing the main loop: - -set error to 0 × deltay -until x0 = x1 + stepx - -setPixel(x0, y0) -set error to error + deltax ÷ deltay × deltay -if error ≥ 0.5 × deltay then - -set y0 to y0 + stepy -set error to error - 1 × deltay - -end if -set x0 to x0 + stepx - -repeat - -Which simplifies to: - -set error to 0 -until x0 = x1 + stepx - -setPixel(x0, y0) -set error to error + deltax -if error × 2 ≥ deltay then - -set y0 to y0 + stepy -set error to error - deltay - -end if -set x0 to x0 + stepx - -repeat - -Suddenly we have a much better algorithm. We see now that we've eliminated the need for division altogether. Better still, the only multiplication is by 2, which we know is just a bit shift left by 1! This is now very close to Bresenham's Algorithm, but one further optimisation can be made. At the moment, we have an if statement which leads to two very similar blocks of code, one for lines with larger x differences, and one for lines with larger y differences. It is worth checking if the code could be converted to a single statement for both types of line. - -The difficulty arises somewhat in that in the first case, error is to do with y, and in the second case error is to do with x. The solution is to track the error in both variables simultaneously, using negative error to represent an error in x, and positive error in y. - -set error to deltax - deltay -until x0 = x1 + stepx or y0 = y1 + stepy - -setPixel(x0, y0) -if error × 2 > -deltay then - -set x0 to x0 + stepx -set error to error - deltay - -end if -if error × 2 < deltax then - -set y0 to y0 + stepy -set error to error + deltax - -end if - -repeat - -It may take some time to convince yourself that this actually works. At each step, we consider if it would be correct to move in x or y. We do this by checking if the magnitude of the error would be lower if we moved in the x or y co-ordinates, and then moving if so. -``` - -``` -Bresenham's Line Algorithm was developed in 1962 by Jack Elton Bresenham, 24 at the time, whilst studying for a PhD. -``` - -Bresenham's Algorithm for drawing a line can be described by the following pseudo code. Pseudo code is just text which looks like computer instructions, but is actually intended for programmers to understand algorithms, rather than being machine readable. - -``` -/* We wish to draw a line from (x0,y0) to (x1,y1), using only a function setPixel(x,y) which draws a dot in the pixel given by (x,y). */ -if x1 > x0 then - set deltax to x1 - x0 - set stepx to +1 -otherwise - set deltax to x0 - x1 - set stepx to -1 -end if - -set error to deltax - deltay -until x0 = x1 + stepx or y0 = y1 + stepy - setPixel(x0, y0) - if error × 2 ≥ -deltay then - set x0 to x0 + stepx - set error to error - deltay - end if - if error × 2 ≤ deltax then - set y0 to y0 + stepy - set error to error + deltax - end if -repeat -``` - -Rather than numbered lists as I have used so far, this representation of an algorithm is far more common. See if you can implement this yourself. For reference, I have provided my implementation below. - -``` -.globl DrawLine -DrawLine: -push {r4,r5,r6,r7,r8,r9,r10,r11,r12,lr} -x0 .req r9 -x1 .req r10 -y0 .req r11 -y1 .req r12 - -mov x0,r0 -mov x1,r2 -mov y0,r1 -mov y1,r3 - -dx .req r4 -dyn .req r5 /* Note that we only ever use -deltay, so I store its negative for speed. (hence dyn) */ -sx .req r6 -sy .req r7 -err .req r8 - -cmp x0,x1 -subgt dx,x0,x1 -movgt sx,#-1 -suble dx,x1,x0 -movle sx,#1 - -cmp y0,y1 -subgt dyn,y1,y0 -movgt sy,#-1 -suble dyn,y0,y1 -movle sy,#1 - -add err,dx,dyn -add x1,sx -add y1,sy - -pixelLoop$: - - teq x0,x1 - teqne y0,y1 - popeq {r4,r5,r6,r7,r8,r9,r10,r11,r12,pc} - - mov r0,x0 - mov r1,y0 - bl DrawPixel - - cmp dyn, err,lsl #1 - addle err,dyn - addle x0,sx - - cmp dx, err,lsl #1 - addge err,dx - addge y0,sy - - b pixelLoop$ - -.unreq x0 -.unreq x1 -.unreq y0 -.unreq y1 -.unreq dx -.unreq dyn -.unreq sx -.unreq sy -.unreq err -``` - -### 3 Randomness - -So, now we can draw lines. Although we could use this to draw pictures and whatnot (feel free to do so!), I thought I would take the opportunity to introduce the idea of computer randomness. What we will do is select a pair of random co-ordinates, and then draw a line from the last pair to that point in steadily incrementing colours. I do this purely because it looks quite pretty. - -``` -Hardware random number generators are occasionally used in security, where the predictability sequence of random numbers may affect the security of some encryption. -``` - -So, now it comes down to it, how do we be random? Unfortunately for us there isn't some device which generates random numbers (such devices are very rare). So somehow using only the operations we've learned so far we need to invent 'random numbers'. It shouldn't take you long to realise this is impossible. The operations always have well defined results, executing the same sequence of instructions with the same registers yields the same answer. What we instead do is deduce a sequence that is pseudo random. This means numbers that, to the outside observer, look random, but in fact were completely determined. So, we need a formula to generate random numbers. One might be tempted to just spam mathematical operators out for example: 4x2! / 64, but in actuality this generally produces low quality random numbers. In this case for example, if x were 0, the answer would be 0. Stupid though it sounds, we need a very careful choice of equation to produce high quality random numbers. - -``` -This sort of discussion often begs the question what do we mean by a random number? We generally mean statistical randomness: A sequence of numbers that has no obvious patterns or properties that could be used to generalise it. -``` - -The method I'm going to teach you is called the quadratic congruence generator. This is a good choice because it can be implemented in 5 instructions, and yet generates a seemingly random order of the numbers from 0 to 232-1. - -The reason why the generator can create such long sequence with so few instructions is unfortunately a little beyond the scope of this course, but I encourage the interested to research it. It all centralises on the following quadratic formula, where xn is the nth random number generated. - -x_(n+1) = ax_(n)^2 + bx_(n) + c mod 2^32 - -Subject to the following constraints: - - 1. a is even - - 2. b = a + 1 mod 4 - - 3. c is odd - - - - -If you've not seen mod before, it means the remainder of a division by the number after it. For example b = a + 1 mod 4 means that b is the remainder of dividing a + 1 by 4, so if a were 12 say, b would be 1 as a + 1 is 13, and 13 divided by 4 is 3 remainder 1. - -Copy the following code into a file called 'random.s'. - -``` -.globl Random -Random: -xnm .req r0 -a .req r1 - -mov a,#0xef00 -mul a,xnm -mul a,xnm -add a,xnm -.unreq xnm -add r0,a,#73 - -.unreq a -mov pc,lr -``` - -This is an implementation of the random function, with an input of the last value generated in r0, and an output of the next number. In my case, I've used a = EF0016, b = 1, c = 73. This choice was arbitrary but meets the requirements above. Feel free to use any numbers you wish instead, as long as they obey the rules. - -### 4 Pi-casso - -OK, now we have all the functions we're going to need, let's try it out. Alter main to do the following, after getting the frame buffer info address: - - 1. Call SetGraphicsAddress with r0 containing the frame buffer info address. - 2. Set four registers to 0. One will be the last random number, one will be the colour, one will be the last x co-ordinate and one will be the last y co-ordinate. - 3. Call random to generate the next x-coordinate, using the last random number as the input. - 4. Call random again to generate the next y-coordinate, using the x-coordinate you generated as an input. - 5. Update the last random number to contain the y-coordinate. - 6. Call SetForeColour with the colour, then increment the colour. If it goes above FFFF16, make sure it goes back to 0. - 7. The x and y coordinates we have generated are between 0 and FFFFFFFF16. Convert them to a number between 0 and 102310 by using a logical shift right of 22. - 8. Check the y coordinate is on the screen. Valid y coordinates are between 0 and 76710. If not, go back to 3. - 9. Draw a line from the last x and y coordinates to the current x and y coordinates. - 10. Update the last x and y coordinates to contain the current ones. - 11. Go back to 3. - - - -As always, a solution for this can be found on the downloads page. - -Once you've finished, test it on the Raspberry Pi. You should see a very fast sequence of random lines being drawn on the screen, in steadily incrementing colours. This should never stop. If it doesn't work, please see our troubleshooting page. - -When you have it working, congratulations! We've now learned about meaningful graphics, and also about random numbers. I encourage you to play with line drawing, as it can be used to render almost anything you want. You may also want to explore more complicated shapes. Most can be made out of lines, but is this necessarily the best strategy? If you like the line program, try experimenting with the SetPixel function. What happens if instead of just setting the value of the pixel, you increase it by a small amount? What other patterns can you make? In the next lesson, [Lesson 8: Screen 03][2], we will look at the invaluable skill of drawing text. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html - -作者:[Alex Chadwick][a] -选题:[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.cl.cam.ac.uk -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md new file mode 100644 index 0000000000..6d6086d1ab --- /dev/null +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @@ -0,0 +1,463 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 7 Screen02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +计算机实验室 – 树莓派:课程 7 屏幕02 +====== + +屏幕02 课程在屏幕01 的基础上构建,它教你如何绘制线和一个生成伪随机数的小特性。假设你已经有了 [课程6:屏幕01][1] 的操作系统代码,我们将以它为基础来构建。 + +### 1、点 + +现在,我们的屏幕已经正常工作了,现在开始去创建一个更实用的图像,是水到渠成的事。如果我们能够绘制出更实用的图形那就更好了。如果我们能够在屏幕上的两点之间绘制一条线,那我们就能够组合这些线绘制出更复杂的图形了。 + +``` +为了绘制出更复杂的图形,一些方法使用一个着色函数而不是一个颜色去绘制。每个点都能够调用着色函数来确定在那里用什么颜色去绘制。 +``` + +我们将尝试用汇编代码去实现它,但在开始时,我们确实需要使用一些其它的函数去帮助它。我们需要一个函数,我将调用 `SetPixel` 去修改指定像素的颜色,在寄存器 `r0` 和 `r1` 中提供输入。如果我们写出的代码可以在任意内存中而不仅仅是屏幕上绘制图形,这将在以后非常有用,因此,我们首先需要一些控制真实绘制位置的方法。我认为实现上述目标的最好方法是,能够有一个内存片段用于保存将要绘制的图形。我应该最终使用它来保存地址,这个地址就是指向到自上次以来的帧缓存结构上。我们将在后面的代码中使用这个绘制方法。这样,如果我们想在我们的操作系统的另一部分绘制一个不同的图像,我们就可以生成一个不同结构的地址值,而使用的是完全相同的代码。为简单起见,我们将使用另一个数据片段去控制我们绘制的颜色。 + +复制下列代码到一个名为 `drawing.s` 的新文件中。 + +```assembly +.section .data +.align 1 +foreColour: +.hword 0xFFFF + +.align 2 +graphicsAddress: +.int 0 + +.section .text +.globl SetForeColour +SetForeColour: +cmp r0,#0x10000 +movhs pc,lr +ldr r1,=foreColour +strh r0,[r1] +mov pc,lr + +.globl SetGraphicsAddress +SetGraphicsAddress: +ldr r1,=graphicsAddress +str r0,[r1] +mov pc,lr +``` + +这段代码就是我上面所说的一对函数以及它们的数据。我们将在 `main.s` 中使用它们,在绘制图像之前去控制在何处绘制什么内容。 + +``` +构建一个通用方法,比如 `SetPixel`,我们将在它之上构建另一个方法是一个很好的创意。但我们必须要确保这个方法很快,因为我们要经常使用它。 +``` + +我们的下一个任务是去实现一个 `SetPixel` 方法。它需要带两个参数,像素的 x 和 y 轴,并且它应该会使用 `graphicsAddress` 和 `foreColour`,我们只定义精确控制在哪里绘制什么图像即可。如果你认为你能立即实现这些,那么去动手实现吧,如果不能,按照我们提供的步骤,按示例去实现它。 + + 1. 加载 `graphicsAddress`。 + 2. 检查像素的 x 和 y 轴是否小于宽度和高度。 + 3. 计算要写入的像素地址(提示:`frameBufferAddress +(x + y * 宽度)* 像素大小`) + 4. 加载 `foreColour`。 + 5. 保存到地址。 + + + +上述步骤实现如下: + +1. +```assembly +.globl DrawPixel +DrawPixel: +px .req r0 +py .req r1 +addr .req r2 +ldr addr,=graphicsAddress +ldr addr,[addr] +``` + +2. +```assembly +height .req r3 +ldr height,[addr,#4] +sub height,#1 +cmp py,height +movhi pc,lr +.unreq height + +width .req r3 +ldr width,[addr,#0] +sub width,#1 +cmp px,width +movhi pc,lr +``` + +记住,宽度和高度被各自保存在帧缓冲偏移量的 0 和 4 处。如有必要可以参考 `frameBuffer.s`。 + +3. +```assembly +ldr addr,[addr,#32] +add width,#1 +mla px,py,width,px +.unreq width +.unreq py +add addr, px,lsl #1 +.unreq px +``` + +```assembly +mla dst,reg1,reg2,reg3 将寄存器 `reg1` 和 `reg2` 中的值相乘,然后将结果与寄存器 `reg3` 中的值相加,并将结果的低 32 位保存到 dst 中。 +``` + +确实,这段代码是专用于高色值帧缓存的,因为我使用一个逻辑左移操作去计算地址。你可能希望去编写一个不需要专用的高色值帧缓冲的函数版本,记得去更新 `SetForeColour` 的代码。它实现起来可能更复杂一些。 + +4. +```assembly +fore .req r3 +ldr fore,=foreColour +ldrh fore,[fore] +``` + +以上是专用于高色值的。 + +5. +```assembly +strh fore,[addr] +.unreq fore +.unreq addr +mov pc,lr +``` + +以上是专用于高色值的。 + + + + +### 2、线 + +问题是,线的绘制并不是你所想像的那么简单。到目前为止,你必须认识到,编写一个操作系统时,几乎所有的事情都必须我们自己去做,绘制线条也不例外。我建议你们花点时间想想如何在任意两点之间绘制一条线。 + +``` +在我们日常编程中,我们对像除法这样的运算通常懒得去优化。但是操作系统不同,它必须高效,因此我们要始终专注于如何让事情做的尽可能更好。 +``` + +我估计大多数的策略可能是去计算线的梯度,并沿着它来绘制。这看上去似乎很完美,但它事实上是个很糟糕的主意。主要问题是它涉及到除法,我们知道在汇编中,做除法很不容易,并且还要始终记录小数,这也很困难。事实上,在这里,有一个叫布鲁塞姆的算法,它非常适合汇编代码,因为它只使用加法、减法和位移运算。 + + + +> 我们从定义一个简单的直线绘制算法开始,代码如下: +> +> ```matlab +> /* 我们希望从 (x0,y0) 到 (x1,y1) 去绘制一条线,只使用一个函数 setPixel(x,y),它的功能是在给定的 (x,y) 上绘制一个点。 */ +> +> if x1 > x0 then +> +> set deltax to x1 - x0 +> set stepx to +1 +> +> otherwise +> +> set deltax to x0 - x1 +> set stepx to -1 +> +> end if +> +> if y1 > y0 then +> +> set deltay to y1 - y0 +> set stepy to +1 +> +> otherwise +> +> set deltay to y0 - y1 +> set stepy to -1 +> +> end if +> +> if deltax > deltay then +> +> set error to 0 +> until x0 = x1 + stepx +> +> setPixel(x0, y0) +> set error to error + deltax ÷ deltay +> if error ≥ 0.5 then +> +> set y0 to y0 + stepy +> set error to error - 1 +> +> end if +> set x0 to x0 + stepx +> +> repeat +> +> otherwise +> +> end if +> ``` +> +> 这个算法用来表示你可能想像到的那些东西。变量 `error` 用来记录你离实线的距离。沿着 x 轴每走一步,这个 `error` 的值都会增加,而沿着 y 轴每走一步,这个 `error` 值就会减 1 个单位。`error` 是用于测量距离 y 轴的距离。 +> +> 虽然这个算法是有效的,但它存在一个重要的问题,很明显,我们使用了小数去保存 `error`,并且也使用了除法。所以,一个立即要做的优化将是去改变 `error` 的单位。这里并不需要用特定的单位去保存它,只要我们每次使用它时都按相同数量去伸缩即可。所以,我们可以重写这个算法,通过在所有涉及 `error` 的等式上都简单地乘以 `deltay`,从面让它简化。下面只展示主要的循环: +> +> ```matlab +> set error to 0 × deltay +> until x0 = x1 + stepx +> +> setPixel(x0, y0) +> set error to error + deltax ÷ deltay × deltay +> if error ≥ 0.5 × deltay then +> +> set y0 to y0 + stepy +> set error to error - 1 × deltay +> +> end if +> set x0 to x0 + stepx +> +> repeat +> ``` +> +> 它将简化为: +> +> ```matlab +> cset error to 0 +> until x0 = x1 + stepx +> +> setPixel(x0, y0) +> set error to error + deltax +> if error × 2 ≥ deltay then +> +> set y0 to y0 + stepy +> set error to error - deltay +> +> end if +> set x0 to x0 + stepx +> +> repeat +> ``` +> +> 突然,我们有了一个更好的算法。现在,我们看一下如何完全去除所需要的除法运算。最好保留唯一的被 2 相乘的乘法运算,我们知道它可以通过左移 1 位来实现!现在,这是非常接近布鲁塞姆算法的,但还可以进一步优化它。现在,我们有一个 `if` 语句,它将导致产生两个代码块,其中一个用于 x 差异较大的线,另一个用于 y 差异较大的线。对于这两种类型的线,如果审查代码能够将它们转换成一个单语句,还是很值得去做的。 +> +> 困难之处在于,在第一种情况下,`error` 是与 y 一起变化,而第二种情况下 `error` 是与 x 一起变化。解决方案是在一个变量中同时记录它们,使用负的 `error` 去表示 x 中的一个 `error`,而用正的 `error` 表示它是 y 中的。 +> +> ```matlab +> set error to deltax - deltay +> until x0 = x1 + stepx or y0 = y1 + stepy +> +> setPixel(x0, y0) +> if error × 2 > -deltay then +> +> set x0 to x0 + stepx +> set error to error - deltay +> +> end if +> if error × 2 < deltax then +> +> set y0 to y0 + stepy +> set error to error + deltax +> +> end if +> +> repeat +> ``` +> +> 你可能需要一些时间来搞明白它。在每一步中,我们都认为它正确地在 x 和 y 中移动。我们通过检查来做到这一点,如果我们在 x 或 y 轴上移动,`error` 的数量会变低,那么我们就继续这样移动。 +> + + +``` +布鲁塞姆算法是在 1962 年由 Jack Elton Bresenham 开发,当时他 24 岁,正在攻读博士学位。 +``` + +用于画线的布鲁塞姆算法可以通过以下的伪代码来描述。以下伪代码是文本,它只是看起来有点像是计算机指令而已,但它却能让程序员实实在在地理解算法,而不是为机器可读。 + +```matlab +/* 我们希望从 (x0,y0) 到 (x1,y1) 去绘制一条线,只使用一个函数 setPixel(x,y),它的功能是在给定的 (x,y) 上绘制一个点。 */ + +if x1 > x0 then + set deltax to x1 - x0 + set stepx to +1 +otherwise + set deltax to x0 - x1 + set stepx to -1 +end if + +set error to deltax - deltay +until x0 = x1 + stepx or y0 = y1 + stepy + setPixel(x0, y0) + if error × 2 ≥ -deltay then + set x0 to x0 + stepx + set error to error - deltay + end if + if error × 2 ≤ deltax then + set y0 to y0 + stepy + set error to error + deltax + end if +repeat +``` + +与我们目前所使用的编号列表不同,这个算法的表示方式更常用。看看你能否自己实现它。我在下面提供了我的实现作为参考。 + +```assembly +.globl DrawLine +DrawLine: +push {r4,r5,r6,r7,r8,r9,r10,r11,r12,lr} +x0 .req r9 +x1 .req r10 +y0 .req r11 +y1 .req r12 + +mov x0,r0 +mov x1,r2 +mov y0,r1 +mov y1,r3 + +dx .req r4 +dyn .req r5 /* 注意,我们只使用 -deltay,因此为了速度,我保存它的负值。(因此命名为 dyn)*/ +sx .req r6 +sy .req r7 +err .req r8 + +cmp x0,x1 +subgt dx,x0,x1 +movgt sx,#-1 +suble dx,x1,x0 +movle sx,#1 + +cmp y0,y1 +subgt dyn,y1,y0 +movgt sy,#-1 +suble dyn,y0,y1 +movle sy,#1 + +add err,dx,dyn +add x1,sx +add y1,sy + +pixelLoop$: + + teq x0,x1 + teqne y0,y1 + popeq {r4,r5,r6,r7,r8,r9,r10,r11,r12,pc} + + mov r0,x0 + mov r1,y0 + bl DrawPixel + + cmp dyn, err,lsl #1 + addle err,dyn + addle x0,sx + + cmp dx, err,lsl #1 + addge err,dx + addge y0,sy + + b pixelLoop$ + +.unreq x0 +.unreq x1 +.unreq y0 +.unreq y1 +.unreq dx +.unreq dyn +.unreq sx +.unreq sy +.unreq err +``` + +### 3、随机性 + +到目前,我们可以绘制线条了。虽然我们可以使用它来绘制图片及诸如此类的东西(你可以随意去做!),我想应该借此机会引入计算机中随机性的概念。我将这样去做,选择一对随机的坐标,然后从最后一对坐标用渐变色绘制一条线到那个点。我这样做纯粹是认为它看起来很漂亮。 + +``` +硬件随机数生成器是在安全中使用很少,可预测的随机数序列可能影响某些加密的安全。 +``` + +那么,总结一下,我们如何才能产生随机数呢?不幸的是,我们并没有产生随机数的一些设备(这种设备很罕见)。因此只能利用我们目前所学过的操作,需要我们以某种方式来发明`随机数`。你很快就会意识到这是不可能的。操作总是给出定义好的结果,用相同的寄存器运行相同的指令序列总是给出相同的答案。而我们要做的是推导出一个伪随机序列。这意味着数字在外人看来是随机的,但实际上它是完全确定的。因此,我们需要一个生成随机数的公式。其中有人可能会想到很垃圾的数学运算,比如:4x2! / 64,而事实上它产生的是一个低质量的随机数。在这个示例中,如果 x 是 0,那么答案将是 0。看起来很愚蠢,我们需要非常谨慎地选择一个能够产生高质量随机数的方程式。 + +``` +这类讨论经常寻求一个问题,那就是我们所谓的随机数到底是什么?通常从统计学的角度来说的随机性是:一组没有明显模式或属性能够概括它的数的序列。 +``` + +我将要教给你的方法叫“二次同余发生器”。这是一个非常好的选择,因为它能够在 5 个指令中实现,并且能够产生一个从 0 到 232-1 之间的看似很随机的数字序列。 + +不幸的是,对为什么使用如此少的指令能够产生如此长的序列的原因的研究,已经远超出了本课程的教学范围。但我还是鼓励有兴趣的人去研究它。它的全部核心所在就是下面的二次方程,其中 `xn` 是产生的第 `n` 个随机数。 + +x_(n+1) = ax_(n)^2 + bx_(n) + c mod 2^32 + +这个方程受到以下的限制: + + 1. a 是偶数 + + 2. b = a + 1 mod 4 + + 3. c 是奇数 + + + + +如果你之前没有见到过 `mod` 运算,我来解释一下,它的意思是被它后面的数相除之后的余数。比如 `b = a + 1 mod 4` 的意思是 `b` 是 `a + 1` 除以 `4` 的余数,因此,如果 `a` 是 12,那么 `b` 将是 `1`,因为 `a + 1` 是 13,而 `13` 除以 4 的结果是 3 余 1。 + +复制下列代码到名为 `random.s` 的文件中。 + +```assembly +.globl Random +Random: +xnm .req r0 +a .req r1 + +mov a,#0xef00 +mul a,xnm +mul a,xnm +add a,xnm +.unreq xnm +add r0,a,#73 + +.unreq a +mov pc,lr +``` + +这是随机函数的一个实现,使用一个在寄存器 `r0` 中最后生成的值作为输入,而接下来的数字则是输出。在我的案例中,我使用 a = EF0016,b = 1, c = 73。这个选择是随意的,但是需要满足上述的限制。你可以使用任何数字代替它们,只要符合上述的规则就行。 + +### 4、Pi-casso + +OK,现在我们有了所有我们需要的函数,我们来试用一下它们。获取帧缓冲信息的地址之后,按如下的要求修改 `main`: + + 1. 使用包含了帧缓冲信息地址的寄存器 `r0` 调用 `SetGraphicsAddress`。 + 2. 设置四个寄存器为 0。一个将是最后的随机数,一个将是颜色,一个将是最后的 x 坐标,而最后一个将是最后的 y 坐标。 + 3. 调用 `random` 去产生下一个 x 坐标,使用最后一个随机数作为输入。 + 4. 调用 `random` 再次去生成下一个 y 坐标,使用你生成的 x 坐标作为输入。 + 5. 更新最后的随机数为 y 坐标。 + 6. 使用 `colour` 值调用 `SetForeColour`,接着增加 `colour` 值。如果它大于 FFFF~16~,确保它返回为 0。 + 7. 我们生成的 x 和 y 坐标将介于 0 到 FFFFFFFF~16~。通过将它们逻辑右移 22 位,将它们转换为介于 0 到 1023~10~ 之间的数。 + 8. 检查 y 坐标是否在屏幕上。验证 y 坐标是否介于 0 到 767~10~ 之间。如果不在这个区间,返回到第 3 步。 + 9. 从最后的 x 坐标和 y 坐标到当前的 x 坐标和 y 坐标之间绘制一条线。 + 10. 更新最后的 x 和 y 坐标去为当前的坐标。 + 11. 返回到第 3 步。 + + + +一如既往,你可以在下载页面上找到这个解决方案。 + +在你完成之后,在树莓派上做测试。你应该会看到一系列颜色递增的随机线条以非常快的速度出现在屏幕上。它一直持续下去。如果你的代码不能正常工作,请查看我们的排错页面。 + +如果一切顺利,恭喜你!我们现在已经学习了有意义的图形和随机数。我鼓励你去使用它绘制线条,因为它能够用于渲染你想要的任何东西,你可以去探索更复杂的图案了。它们中的大多数都可以由线条生成,但这需要更好的策略?如果你愿意写一个画线程序,尝试使用 `SetPixel` 函数。如果不是去设置像素值而是一点点地增加它,会发生什么情况?你可以用它产生什么样的图案?在下一节课 [课程 8:屏幕 03][2] 中,我们将学习绘制文本的宝贵技能。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html From 72fd112a6bccc3d52a873f99fed7b7654788f4c1 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Fri, 8 Feb 2019 12:57:50 +0800 Subject: [PATCH 045/813] Translating by qhwdw --- ...616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md index 08803fd50f..4ff644a816 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 856371fa63e1e474c5a17ba352a9b5633246d966 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Feb 2019 23:00:14 +0800 Subject: [PATCH 046/813] PRF:20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qhwdw 这篇比较长,但是也出现了一些明显的错误。 --- ...aboratory - Raspberry Pi- Lesson 3 OK03.md | 207 ++++++++---------- 1 file changed, 91 insertions(+), 116 deletions(-) diff --git a/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md index 21cdb40c2f..8ad653b7d6 100644 --- a/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md +++ b/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 3 OK03) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 3 OK03 +计算机实验室之树莓派:课程 3 OK03 ====== OK03 课程基于 OK02 课程来构建,它教你在汇编中如何使用函数让代码可复用和可读性更好。假设你已经有了 [课程 2:OK02][1] 的操作系统,我们将以它为基础。 @@ -16,68 +16,63 @@ OK03 课程基于 OK02 课程来构建,它教你在汇编中如何使用函数 到目前为止,我们所写的代码都是以我们希望发生的事为顺序来输入的。对于非常小的程序来说,这种做法很好,但是如果我们以这种方式去写一个完整的系统,所写的代码可读性将非常差。我们应该去使用函数。 -``` -一个函数是一段可复用的代码片断,可以用于去计算某些答案,或执行某些动作。你也可以称它们为程序、整套动作或子动作。虽然它们都是不同的,但人们几乎都没有正确地使用这个术语。 +> 一个函数是一段可复用的代码片断,可以用于去计算某些答案,或执行某些动作。你也可以称它们为过程procedure例程routine子例程subroutine。虽然它们都是不同的,但人们几乎都没有正确地使用这个术语。 -你应该在数学上遇到了函数的概念。例如,余弦函数应用于一个给定的数时,会得到介于 -1 到 1 之间的另一个数,这个数就是角的余弦。一般我们写成 cos(x) 来表示应用到一个值 x 上的余弦函数。 +> 你应该在数学上遇到了函数的概念。例如,余弦函数应用于一个给定的数时,会得到介于 -1 到 1 之间的另一个数,这个数就是角的余弦。一般我们写成 `cos(x)` 来表示应用到一个值 `x` 上的余弦函数。 -在代码中,函数可以有多个输入(也可以没有输入),然后函数给出多个输出(也可以没有输出),并可能导致负面效应。例如一个函数可以在一个文件系统上创建一个文件,第一个输入是它的名字,第二个输入是文件的长度。 -``` +> 在代码中,函数可以有多个输入(也可以没有输入),然后函数给出多个输出(也可以没有输出),并可能导致副作用。例如一个函数可以在一个文件系统上创建一个文件,第一个输入是它的名字,第二个输入是文件的长度。 -![Function as black boxes][2] +> ![Function as black boxes][2] -``` -函数可以认为是一个“黑匣子”。我们给它输入,然后它给我们输出,而我们不需要知道它是如何工作的。 -``` +> 函数可以认为是一个“黑匣子”。我们给它输入,然后它给我们输出,而我们不需要知道它是如何工作的。 在像 C 或 C++ 这样的高级代码中,函数是语言的组成部分。在汇编代码中,函数只是我们的创意。 -理想情况下,我们希望能够在我们的寄存器中设置一些值,分支地址,以及预期在某个时刻,分支将返回,并通过代码来设置输出值到寄存器。这就是我们所设想的汇编代码中的函数。困难之处在于我们用什么样的方式去设置寄存器。如果我们只是使用平时所接触到的任意方法去设置寄存器,每个程序可能使用不同的方法,这样你将会发现你很难理解其他程序员所写的代码。另外,编译器也不能像使用汇编代码那样轻松地工作,因为它们压根不知道如何去使用函数。为避免这种困惑,为每个汇编语言设计了一个称为应用程序二进制接口(ABI)的标准,由它来规范函数如何去运行。如果每个人都使用相同的方法去写函数,这样每个人都可以去使用其他人写的函数。在这里,我将教你们这个标准,而从现在开始,我所写的函数将全部遵循这个标准。 +理想情况下,我们希望能够在我们的寄存器中设置一些输入值,然后分支切换到某个地址,然后预期在某个时刻分支返回到我们代码,并通过代码来设置输出值到寄存器。这就是我们所设想的汇编代码中的函数。困难之处在于我们用什么样的方式去设置寄存器。如果我们只是使用平时所接触到的某种方法去设置寄存器,每个程序员可能使用不同的方法,这样你将会发现你很难理解其他程序员所写的代码。另外,编译器也不能像使用汇编代码那样轻松地工作,因为它们压根不知道如何去使用函数。为避免这种困惑,为每个汇编语言设计了一个称为应用程序二进制接口Application Binary Interface(ABI)的标准,由它来规范函数如何去运行。如果每个人都使用相同的方法去写函数,这样每个人都可以去使用其他人写的函数。在这里,我将教你们这个标准,而从现在开始,我所写的函数将全部遵循这个标准。 -标准规定,寄存器 `r0`、`r1`、`r2` 和 `r3` 将被依此用于函数的输入。如果函数没有输入,那么它有没有值就无关紧要了。如果只需要一个输入,那么它应该总是在寄存器 `r0` 中,如果它需要两个输入,那么第一个输入在寄存器 `r0` 中,而第二个输入在寄存器 `r1` 中,依此类推。输出值也总是在寄存器 `r0` 中。如果函数没有输出,那么 `ro` 中是什么值就不重要了。 +该标准规定,寄存器 `r0`、`r1`、`r2` 和 `r3` 将被依次用于函数的输入。如果函数没有输入,那么它不会在意值是什么。如果只需要一个输入,那么它应该总是在寄存器 `r0` 中,如果它需要两个输入,那么第一个输入在寄存器 `r0` 中,而第二个输入在寄存器 `r1` 中,依此类推。输出值也总是在寄存器 `r0` 中。如果函数没有输出,那么 `r0` 中是什么值就不重要了。 -另外,标准要求当一个函数运行之后,寄存器 `r4` 到 `r12` 的值必须与函数启动时的值相同。这意味着当你调用一个函数时,你可以确保寄存器 `r4` 到 `r12` 中的值没有发生变化,但是不能确保寄存器 `r0` 到 `r3` 中的值也没有发生变化。 +另外,该标准要求当一个函数运行之后,寄存器 `r4` 到 `r12` 的值必须与函数启动时的值相同。这意味着当你调用一个函数时,你可以确保寄存器 `r4` 到 `r12` 中的值没有发生变化,但是不能确保寄存器 `r0` 到 `r3` 中的值也没有发生变化。 -当一个函数运行完成后,它将返回到启动它的代码分支处。这意味着它必须知道启动它的代码的地址。为此,需要一个称为`lr`(链接寄存器)的专用寄存器,它总是在保存调用这个函数的指令的地址。 +当一个函数运行完成后,它将返回到启动它的代码分支处。这意味着它必须知道启动它的代码的地址。为此,需要一个称为 `lr`(链接寄存器)的专用寄存器,它总是在保存调用这个函数的指令后面指令的地址。 -表 1.1 ARM ABI 寄存器用法 -| 寄存器 | 简介 | 保留 | 规则 | -| ------ | ---------- | ---- | ------------------------------------------------------------ | -| r0 | 参数和结果 | 否 | r0 和 r1 用于给函数传递前两个参数,以及函数返回的结果。如果函数返回值不使用它,那么在函数运行之后,它们可以携带任何值。 | -| r1 | 参数和结果 | 否 | | -| r2 | 参数 | 否 | r2 和 r3 用去给函数传递后两个参数。在函数运行之后,它们可以携带任何值。 | -| r3 | 参数 | 否 | | -| r4 | 通用寄存器 | 是 | r4 到 r12 用于保存函数运行过程中的值,它们的值在函数调用之后必须与调用之前相同。 | -| r5 | 通用寄存器 | 是 | | -| r6 | 通用寄存器 | 是 | | -| r7 | 通用寄存器 | 是 | | -| r8 | 通用寄存器 | 是 | | -| r9 | 通用寄存器 | 是 | | -| r10 | 通用寄存器 | 是 | | -| r11 | 通用寄存器 | 是 | | -| r12 | 通用寄存器 | 是 | | -| lr | 返回地址 | 否 | 当函数运行完成后,lr 中保存了分支的返回地址,但在函数运行完成之后,它将保存相同的地址。 | -| sp | 栈指针 | 是 | sp 是栈指针,在下面有详细描述。它的值在函数运行完成后,必须是相同的。 | +表 1.1 ARM ABI 寄存器用法 -通常,函数需要使用很多的寄存器,而不仅是 `r0` 到 `r3`。但是,由于 `r4` 到 `r12` 必须在系列动作完成之后值必须保持相同,因此它们需要被保存到某个地方。我们将它们保存到称为栈的地方。 +| 寄存器 | 简介 | 保留 | 规则 | +| ------ | --------- | ---- | ----------------- | +| `r0` | 参数和结果 | 否 | `r0` 和 `r1` 用于给函数传递前两个参数,以及函数返回的结果。如果函数返回值不使用它,那么在函数运行之后,它们可以携带任何值。 | +| `r1` | 参数和结果 | 否 | | +| `r2` | 参数 | 否 | `r2` 和 `r3` 用去给函数传递后两个参数。在函数运行之后,它们可以携带任何值。 | +| `r3` | 参数 | 否 | | +| `r4` | 通用寄存器 | 是 | `r4` 到 `r12` 用于保存函数运行过程中的值,它们的值在函数调用之后必须与调用之前相同。 | +| `r5` | 通用寄存器 | 是 | | +| `r6` | 通用寄存器 | 是 | | +| `r7` | 通用寄存器 | 是 | | +| `r8` | 通用寄存器 | 是 | | +| `r9` | 通用寄存器 | 是 | | +| `r10` | 通用寄存器 | 是 | | +| `r11` | 通用寄存器 | 是 | | +| `r12` | 通用寄存器 | 是 | | +| `lr` | 返回地址 | 否 | 当函数运行完成后,`lr` 中保存了分支的返回地址,但在函数运行完成之后,它将保存相同的地址。 | +| `sp` | 栈指针 | 是 | `sp` 是栈指针,在下面有详细描述。它的值在函数运行完成后,必须是相同的。 | +通常,函数需要使用很多的寄存器,而不仅是 `r0` 到 `r3`。但是,由于 `r4` 到 `r12` 必须在函数完成之后值必须保持相同,因此它们需要被保存到某个地方。我们将它们保存到称为栈的地方。 -![Stack diagram][3] -``` -一个栈就是我们在计算中用来保存值的一个很形象的方法。就像是摞起来的一堆盘子,你可以从上到下来移除它们,而添加它们时,你只能从下到上来添加。 +> ![Stack diagram][3] -在函数运行时,使用栈来保存寄存器值是个非常好的创意。例如,如果我有一个函数需要去使用寄存器 r4 和 r5,它将在一个栈上存放这些寄存器的值。最后用这种方式,它可以再次将它拿回来。更高明的是,如果为完成运行我的函数,需要去运行另一个函数,并且那个函数需要保存一些寄存器,在它运行时,它将把寄存器保存在栈顶上,然后在结束后再将它们拿走。而这并不会影响我保存在寄存器 r4 和 r5 中的值,因为它们是在栈顶上添加的,拿走时也是从栈顶上取出的。 +> 一个stack就是我们在计算中用来保存值的一个很形象的方法。就像是摞起来的一堆盘子,你可以从上到下来移除它们,而添加它们时,你只能从下到上来添加。 -我们用专用的术语“栈帧”来表示使用特定的方法放到栈上的值。不是每种方法都使用一个栈帧,有些是不需要存储值的。 -``` +> 在函数运行时,使用栈来保存寄存器值是个非常好的创意。例如,如果我有一个函数需要去使用寄存器 `r4` 和 `r5`,它将在一个栈上存放这些寄存器的值。最后用这种方式,它可以再次将它拿回来。更高明的是,如果为了运行完我的函数,需要去运行另一个函数,并且那个函数需要保存一些寄存器,在那个函数运行时,它将把寄存器保存在栈顶上,然后在结束后再将它们拿走。而这并不会影响我保存在寄存器 `r4` 和 `r5` 中的值,因为它们是在栈顶上添加的,拿走时也是从栈顶上取出的。 -因为栈非常有用,它被直接实现在 ARMv6 的指令集中。一个名为 `sp` (栈指针)的专用寄存器用来保存栈的地址。当需要有东西添加到栈上时,`sp` 寄存器被更新,这样就总是保证它保存的是栈上前一个东西的地址。`push {r4,r5}` 将推送 `r4` 和 `r5` 中的值到栈顶上,而 `pop {r4,r5}` 将(以正确的次序)取回它们。 +> 用来表示使用特定的方法将值放到栈上的专用术语,我们称之为那个方法的“栈帧stack frame”。不是每种方法都使用一个栈帧,有些是不需要存储值的。 + +因为栈非常有用,它被直接实现在 ARMv6 的指令集中。一个名为 `sp`(栈指针)的专用寄存器用来保存栈的地址。当需要有值添加到栈上时,`sp` 寄存器被更新,这样就总是保证它保存的是栈上第一个值的地址。`push {r4,r5}` 将推送 `r4` 和 `r5` 中的值到栈顶上,而 `pop {r4,r5}` 将(以正确的次序)取回它们。 ### 2、我们的第一个函数 现在,关于函数的原理我们已经有了一些概念,我们尝试来写一个函数。由于是我们的第一个很基础的例子,我们写一个没有输入的函数,它将输出 GPIO 的地址。在上一节课程中,我们就是写到这个值上,但将它写成函数更好,因为我们在真实的操作系统中经常需要用到它,而我们不可能总是能够记住这个地址。 -复制下列代码到一个名为 `gpio.s` 的新文件中。就像在`source` 目录中使用的 `main.s` 一样。我们将把与 GPIO 控制器相关的所有函数放到一个文件中,这样更好查找。 +复制下列代码到一个名为 `gpio.s` 的新文件中。就像在 `source` 目录中使用的 `main.s` 一样。我们将把与 GPIO 控制器相关的所有函数放到一个文件中,这样更好查找。 ```assembly .globl GetGpioAddress @@ -86,27 +81,25 @@ ldr r0,=0x20200000 mov pc,lr ``` -```assembly -.globl lbl 使标签 lbl 从其它文件中可访问。 +> `.globl lbl` 使标签 `lbl` 从其它文件中可访问。 -mov reg1,reg2 复制 reg2 中的值到 reg1 中。 -``` +> `mov reg1,reg2` 复制 `reg2` 中的值到 `reg1` 中。 这就是一个很简单的完整的函数。`.globl GetGpioAddress` 命令是通知汇编器,让标签 `GetGpioAddress` 在所有文件中全局可访问。这意味着在我们的 `main.s` 文件中,我们可以使用分支指令到标签 `GetGpioAddress` 上,即便这个标签在那个文件中没有定义也没有问题。 -你应该认得 `ldr r0,=0x20200000` 命令,它将 GPIO 控制器地址保存到 r0 中。由于这是一个函数,我们要让它输出寄存器 `r0` 中的值,因此我们不能再像以前那样随意使用任意一个寄存器了。 +你应该认得 `ldr r0,=0x20200000` 命令,它将 GPIO 控制器地址保存到 `r0` 中。由于这是一个函数,我们必须要让它输出到寄存器 `r0` 中,我们不能再像以前那样随意使用任意一个寄存器了。 -`mov pc,lr` 将寄存器 `lr` 中的值复制到 `pc` 中。正如前面所提到的,寄存器 `lr` 总是保存着方法完成后我们要返回的代码的地址。`pc` 是一个专用寄存器,它总是包含下一个要运行的指令的地址。一个普通的分支命令只需要改变这个寄存器的值即可。通过将 `lr` 中的值复制到 `pc` 中,我们就可以将运行的下一行命令改变成我们将要返回的那一行。 +`mov pc,lr` 将寄存器 `lr` 中的值复制到 `pc` 中。正如前面所提到的,寄存器 `lr` 总是保存着方法完成后我们要返回的代码的地址。`pc` 是一个专用寄存器,它总是包含下一个要运行的指令的地址。一个普通的分支命令只需要改变这个寄存器的值即可。通过将 `lr` 中的值复制到 `pc` 中,我们就可以将要运行的下一行命令改变成我们将要返回的那一行。 -现在这里存在一个合乎常理的问题,那就是我们如何去运行这个代码?我们将需要一个特殊的分支类型 `bl`。它像一个普通的分支一样切换到一个标签,但它在切换之前先更新 `lr` 的值去包含一个分支之后的行的地址。这意味着当函数完成后,将返回到 `bl` 命令之后的那一行上。这就确保了函数能够像任何其它命令那样运行,它简单地运行,做任何需要做的事情,然后推进到下一行。这是函数最有用的方法。当我们使用它时,就将它们按“黑匣子”处理即可,不需要了解它是如何运行的,我们只了解它需要什么输入,以及它给我们什么输出即可。 +理所当然这里有一个问题,那就是我们如何去运行这个代码?我们将需要一个特殊的分支类型 `bl` 指令。它像一个普通的分支一样切换到一个标签,但它在切换之前先更新 `lr` 的值去包含一个在该分支之后的行的地址。这意味着当函数执行完成后,将返回到 `bl` 指令之后的那一行上。这就确保了函数能够像任何其它命令那样运行,它简单地运行,做任何需要做的事情,然后推进到下一行。这是理解函数最有用的方法。当我们使用它时,就将它们按“黑匣子”处理即可,不需要了解它是如何运行的,我们只了解它需要什么输入,以及它给我们什么输出即可。 到现在为止,我们已经明白了函数如何使用,下一节我们将使用它。 ### 3、一个大的函数 -现在,我们继续去实现一个更大的函数。我们的第一项任务是启用 GPIO 第 16 号针脚的输出。如果它是一个函数那就太好了。我们能够简单地指定针脚号作为函数的输入,然后函数将设置那个针脚的值。那样,我们就可以使用这个代码去控制任意的 GPIO 针脚,而不只是 LED 了。 +现在,我们继续去实现一个更大的函数。我们的第一项任务是启用 GPIO 第 16 号针脚的输出。如果它是一个函数那就太好了。我们能够简单地指定一个针脚号和一个函数作为输入,然后函数将设置那个针脚的值。那样,我们就可以使用这个代码去控制任意的 GPIO 针脚,而不只是 LED 了。 -将下列的命令复制到 `gpio.s` 文件中的 GetGpioAddress 函数中。 +将下列的命令复制到 `gpio.s` 文件中的 `GetGpioAddress` 函数中。 ```assembly .globl SetGpioFunction @@ -116,19 +109,17 @@ cmpls r1,#7 movhi pc,lr ``` -``` -带后缀 ls 的命令只有在上一个比较命令的结果是第一个数字小于或等于第二个数字的情况下才会被运行。它是无符号的。 +> 带后缀 `ls` 的命令只有在上一个比较命令的结果是第一个数字小于或与第二个数字相同的情况下才会被运行。它是无符号的。 -带后缀 hi 的命令只有上一个比较命令的结果是第一个数字大于第二个数字的情况下才会被运行。它是无符号的。 -``` +> 带后缀 `hi` 的命令只有上一个比较命令的结果是第一个数字大于第二个数字的情况下才会被运行。它是无符号的。 -在写一个函数时,我们首先要考虑的事情就是输入,如果输入错了我们怎么办?在这个函数中,我们有一个输入是 GPIO 针脚号,而它必须是介于 0 到 53 之间的数字,因为只有 54 个针脚。每个针脚有 8 个函数,被编号为 0 到 7,因此函数代码也必须是 0 到 7 之间的数字。我们可能假设输入应该是正确的,但是当在硬件上使用时,这种做法是非常危险的,因为不正确的值将导致极大的负面效应。所以,在这个案例中,我们希望确保输入值在正确的范围。 +在写一个函数时,我们首先要考虑的事情就是输入,如果输入错了我们怎么办?在这个函数中,我们有一个输入是 GPIO 针脚号,而它必须是介于 0 到 53 之间的数字,因为只有 54 个针脚。每个针脚有 8 个函数,被编号为 0 到 7,因此函数编号也必须是 0 到 7 之间的数字。我们可以假设输入应该是正确的,但是当在硬件上使用时,这种做法是非常危险的,因为不正确的值将导致非常糟糕的副作用。所以,在这个案例中,我们希望确保输入值在正确的范围。 -为了确保输入值在正确的范围,我们需要做一个检查,即 r0 <= 53 并且 r1 <= 7。首先我们使用前面看到的比较命令去将 `r0` 的值与 53 做比较。下一个指令 `cmpls` 仅在前一个比较指令结果是小于等于 53 时才会去运行。如果一切正常,它将寄存器 `r1` 的值与 7 进行比较,其它的部分都和前面的是一样的。如果最后的比较结果是寄存器值大于那个数字,最后我们将返回到运行函数的代码处。 +为了确保输入值在正确的范围,我们需要做一个检查,即 `r0` <= 53 并且 `r1` <= 7。首先我们使用前面看到的比较命令去将 `r0` 的值与 53 做比较。下一个指令 `cmpls` 仅在前一个比较指令结果是小于或与 53 相同时才会去运行。如果是这种情况,它将寄存器 `r1` 的值与 7 进行比较,其它的部分都和前面的是一样的。如果最后的比较结果是寄存器值大于那个数字,最后我们将返回到运行函数的代码处。 -这正是我们所希望的效果。如果 r0 中的值大于 53,那么 `cmpls` 命令将不会去运行,但是 `movhi` 会运行。如果 r0 中的值 <= 53,那么 `cmpls` 命令会运行,将 r1 中的值与 7 进行比较,如果它大于 7,`movhi` 会运行,函数结束,否则 `movhi` 不会运行,这样我们就确定 r0 <= 53 并且 r1 <= 7。 +这正是我们所希望的效果。如果 `r0` 中的值大于 53,那么 `cmpls` 命令将不会去运行,但是 `movhi` 会运行。如果 `r0` 中的值 <= 53,那么 `cmpls` 命令会运行,它会将 `r1` 中的值与 7 进行比较,如果 `r1` > 7,`movhi` 会运行,函数结束,否则 `movhi` 不会运行,这样我们就确定 `r0` <= 53 并且 `r1` <= 7。 -`ls`(低于或相同)与 `le`(小于或等于)有一些细微的差别,以及后缀 `hi` (高于)和 `gt` (大于)也一样有一些细微差别,我们在后面将会讲到。 +`ls`(低于或相同)与 `le`(小于或等于)有一些细微的差别,以及后缀 `hi`(高于)和 `gt`(大于)也一样有一些细微差别,我们在后面将会讲到。 将这些命令复制到上面的代码的下面位置。 @@ -138,19 +129,19 @@ mov r2,r0 bl GetGpioAddress ``` -```assembly -push {reg1,reg2,...} 复制列出的寄存器 reg1、reg2、... 到栈顶。该命令仅能用于通用寄存器和 lr 寄存器。 +> `push {reg1,reg2,...}` 复制列出的寄存器 `reg1`、`reg2`、... 到栈顶。该命令仅能用于通用寄存器和 `lr` 寄存器。 -bl lbl sets lr 设置下一个指令的地址并切换到标签 lbl。 -``` +> `bl lbl` 设置 `lr` 为下一个指令的地址并切换到标签 `lbl`。 -这三个命令用于调用我们第一个方法。`push {lr}` 命令复制 `lr` 中的值到栈顶,这样我们在后面可以检索到它。当我们调用 GetGpioAddress 时必须要这样做,我们将需要使用 `lr` 去保存我们函数的返回地址。 +这三个命令用于调用我们第一个方法。`push {lr}` 命令复制 `lr` 中的值到栈顶,这样我们在后面可以获取到它。当我们调用 `GetGpioAddress` 时必须要这样做,我们将需要使用 `lr` 去保存我们函数要返回的地址。 -如果我们对 `GetGpioAddress` 函数一无所知,我们应该假设它改变了 `r0`、`r1`、`r2` 和 `r3` 的值 ,我们将移动我们的值到 r4 和 r5 中,以保持在它完成之后寄存器的值相同。幸运的是,我们知道 `GetGpioAddress` 做了什么,并且我们也知道它仅改变了 `r0` 到地址,它并没有影响 `r1`、`r2` 或 `r3` 的值。因此,我们仅去将 GPIO 针脚号从 `r0` 中移出,这样它就不会被覆盖掉,但我们知道,可以将它安全地移到 `r2` 中,因为 `GetGpioAddress` 并不去改变 `r2`。 +如果我们对 `GetGpioAddress` 函数一无所知,我们必须假设它改变了 `r0`、`r1`、`r2` 和 `r3` 的值 ,并移动我们的值到 `r4` 和 `r5` 中,以在函数完成之后保持它们的值一样。幸运的是,我们知道 `GetGpioAddress` 做了什么,并且我们也知道它仅改变了 `r0` 为 GPIO 地址,它并没有影响 `r1`、`r2` 或 `r3` 的值。因此,我们仅去将 GPIO 针脚号从 `r0` 中移出,这样它就不会被覆盖掉,但我们知道,可以将它安全地移到 `r2` 中,因为 `GetGpioAddress` 并不去改变 `r2`。 -最后我们使用 `bl` 指令去运行 `GetGpioAddress`。通常,运行一个函数,我们使用一个术语叫“调用”,从现在开始我们将一直使用这个术语。正如我们前面讨论过的,`bl` 通过更新 `lr` 中的下一个指令的地址,去调用一个函数,接着切换到函数。 +最后我们使用 `bl` 指令去运行 `GetGpioAddress`。通常,运行一个函数,我们使用一个术语叫“调用”,从现在开始我们将一直使用这个术语。正如我们前面讨论过的,`bl` 调用一个函数是通过更新 `lr` 为下一个指令的地址并切换到该函数完成的。 -当一个函数结束时,我们称为“返回”。当一个 `GetGpioAddress` 调用返回时,我们已经知道了 `r0` 中包含了 GPIO 的地址,`r1` 中包含了函数代码,而 `r2` 中包含了 GPIO 针脚号。我前面说过,GPIO 函数每 10 个保存在一个块中,因此首先我们需要去判断我们的针脚在哪个块中。这似乎听起来像是要使用一个除法,但是除法做起来非常慢,因此对于这些比较小的数来说,不停地做减法要比除法更好。 +当一个函数结束时,我们称为“返回”。当一个 `GetGpioAddress` 调用返回时,我们已经知道了 `r0` 中包含了 GPIO 的地址,`r1` 中包含了函数编号,而 `r2` 中包含了 GPIO 针脚号。 + +我前面说过,GPIO 函数每 10 个保存在一个块中,因此首先我们需要去判断我们的针脚在哪个块中。这似乎听起来像是要使用一个除法,但是除法做起来非常慢,因此对于这些比较小的数来说,不停地做减法要比除法更好。 将下面的代码复制到上面的代码中最下面的位置。 @@ -163,13 +154,11 @@ addhi r0,#4 bhi functionLoop$ ``` -```assembly -add reg,#val 将数字 val 加到寄存器 reg 的内容上。 -``` +> `add reg,#val` 将数字 `val` 加到寄存器 `reg` 的内容上。 -这个简单的循环代码将针脚号与 9 进行比较。如果它大于 9,它将从针脚号上减去 10,并且将 GPIO 控制器地址加上 4,然后再次运行检查。 +这个简单的循环代码将针脚号(`r2`)与 9 进行比较。如果它大于 9,它将从针脚号上减去 10,并且将 GPIO 控制器地址加上 4,然后再次运行检查。 -这样做的效果就是,现在,`r2` 中将包含一个 0 到 9 之间的数字,它是针脚号除以 9 的余数。`r0` 将包含这个针脚的函数所设置的 GPIO 控制器的地址。它就如同是 “GPIO 控制器地址 + 4 × (GPIO Pin Number ÷ 10)”。 +这样做的效果就是,现在,`r2` 中将包含一个 0 到 9 之间的数字,它是针脚号除以 10 的余数。`r0` 将包含这个针脚的函数所设置的 GPIO 控制器的地址。它就如同是 “GPIO 控制器地址 + 4 × (GPIO 针脚号 ÷ 10)”。 最后,将下面的代码复制到上面的代码中最下面的位置。 @@ -180,33 +169,31 @@ str r1,[r0] pop {pc} ``` -```assembly -移位参数 reg,lsl #val 表示将寄存器 reg 中二进制表示的数逻辑左移 val 位之后的结果作为与前面运算的操作数。 +> 移位参数 `reg,lsl #val` 表示将寄存器 `reg` 中二进制表示的数逻辑左移 `val` 位之后的结果作为与前面运算的操作数。 -lsl reg,amt 将寄存器 reg 中的二进制数逻辑左移 amt 中的位数。 +> `lsl reg,amt` 将寄存器 `reg` 中的二进制数逻辑左移 `amt` 中的位数。 -str reg,[dst] 与 str reg,[dst,#0] 相同。 +> `str reg,[dst]` 与 `str reg,[dst,#0]` 相同。 -pop {reg1,reg2,...} 从栈顶复制值到寄存器列表 reg1、reg2、.... 仅有通用寄存器与 pc 可以这样弹出值。 -``` +> `pop {reg1,reg2,...}` 从栈顶复制值到寄存器列表 `reg1`、`reg2`、... 仅有通用寄存器与 `pc` 可以这样弹出值。 -这个代码完成了这个方法。第一行其实是乘以 3 的变体。乘法在汇编中是一个大而慢的指令,因为电路需要很长时间才能给出答案。有时使用一些能够很快给出答案的指令会让它变得更快。在本案例中,我们知道 r2 × 3 与 r2 × 2 + r2 是相同的。一个寄存器乘以 2 是非常容易的,因为它可以通过将二进制表示的数左移一位来很方便地实现。 +这个代码完成了这个方法。第一行其实是乘以 3 的变体。乘法在汇编中是一个大而慢的指令,因为电路需要很长时间才能给出答案。有时使用一些能够很快给出答案的指令会让它变得更快。在本案例中,我们知道 `r2` × 3 与 `r2` × 2 + `r2` 是相同的。一个寄存器乘以 2 是非常容易的,因为它可以通过将二进制表示的数左移一位来很方便地实现。 ARMv6 汇编语言其中一个非常有用的特性就是,在使用它之前可以先移动参数所表示的位数。在本案例中,我将 `r2` 加上 `r2` 中二进制表示的数左移一位的结果。在汇编代码中,你可以经常使用这个技巧去更快更容易地计算出答案,但如果你觉得这个技巧使用起来不方便,你也可以写成类似 `mov r3,r2`; `add r2,r3`; `add r2,r3` 这样的代码。 -现在,我们可以将一个函数的值左移 `r2` 中所表示的位数。大多数对数量的指令(比如加法和减法)都有一个可以使用寄存器而不是数字的变体。我们执行这个移位是因为我们想去设置表示针脚号的位,并且每个针脚有三个位。 +现在,我们可以将一个函数的值左移 `r2` 中所表示的位数。大多数对数量的指令(比如 `add` 和 `sub`)都有一个可以使用寄存器而不是数字的变体。我们执行这个移位是因为我们想去设置表示针脚号的位,并且每个针脚有三个位。 然后,我们将函数计算后的值保存到 GPIO 控制器的地址上。我们在循环中已经算出了那个地址,因此我们不需要像 OK01 和 OK02 中那样在一个偏移量上保存它。 最后,我们从这个方法调用中返回。由于我们将 `lr` 推送到了栈上,因此我们 `pop pc`,它将复制 `lr` 中的值并将它推送到 `pc` 中。这个操作类似于 `mov pc,lr`,因此函数调用将返回到运行它的那一行上。 -敏锐的人可能会注意到,这个函数其实并不能正确工作。虽然它将 GPIO 针脚函数设置为所要求的值,但它会导致在同一个块中的 10 个函数的所有针脚都归 0!在一个大量使用 GPIO 针脚的系统中,这将是一个很恼人的问题。我将这个问题留给有兴趣去修复这个函数的人,以确保只设置相关的 3 个位而不去覆写其它位,其它的所有位都保持不变。关于这个问题的解决方案可以在本课程的下载页面上找到。你可能会发现非常有用的几个函数是 `and`,它是计算两个寄存器的布尔与函数,`mvns` 是计算布尔非函数,而 `orr` 是计算布尔或函数。 +敏锐的人可能会注意到,这个函数其实并不能正确工作。虽然它将 GPIO 针脚函数设置为所要求的值,但它会导致在同一个块中的所有的 10 个针脚的函数都归 0!在一个大量使用 GPIO 针脚的系统中,这将是一个很恼人的问题。我将这个问题留给有兴趣去修复这个函数的人,以确保只设置相关的 3 个位而不去覆写其它位,其它的所有位都保持不变。关于这个问题的解决方案可以在本课程的下载页面上找到。你可能会发现非常有用的几个函数是 `and`,它是计算两个寄存器的布尔与函数,`mvns` 是计算布尔非函数,而 `orr` 是计算布尔或函数。 ### 4、另一个函数 -现在,我们已经有了能够设置 GPIO 针脚的函数。我们还需要写一个能够打开或关闭 GPIO 针脚的函数。我们不需要写一个打开的函数和一个关闭的函数,只需要一个函数就可以做这两件事情。 +现在,我们已经有了能够管理 GPIO 针脚函数的函数。我们还需要写一个能够打开或关闭 GPIO 针脚的函数。我们不需要写一个打开的函数和一个关闭的函数,只需要一个函数就可以做这两件事情。 -我们将写一个名为 `SetGpio` 的函数,它用 `r0` 中的值作为第一个输入,`r1` 中的值作为第二个输入。如果值为 `0`,我们将关闭针脚,而如果为非零则打开针脚。 +我们将写一个名为 `SetGpio` 的函数,它将 GPIO 针脚号作为第一个输入放入 `r0` 中,而将值作为第二个输入放入 `r1` 中。如果该值为 `0`,我们将关闭针脚,而如果为非零则打开针脚。 将下列的代码复制粘贴到 `gpio.s` 文件的结尾部分。 @@ -217,9 +204,7 @@ pinNum .req r0 pinVal .req r1 ``` -```assembly -alias .req reg 设置寄存器 reg 的别名为 alias。 -``` +> `alias .req reg` 设置寄存器 `reg` 的别名为 `alias`。 我们再次需要 `.globl` 命令,标记它为其它文件可访问的全局函数。这次我们将使用寄存器别名。寄存器别名允许我们为寄存器使用名字而不仅是 `r0` 或 `r1`。到目前为止,寄存器别名还不是很重要,但随着我们后面写的方法越来越大,它将被证明非常有用,现在开始我们将尝试使用别名。当在指令中使用到 `pinNum .req r0` 时,它的意思是 `pinNum` 表示 `r0`。 @@ -236,13 +221,11 @@ bl GetGpioAddress gpioAddr .req r0 ``` -```assembly -.unreq alias 删除别名 alias。 -``` +> `.unreq alias` 删除别名 `alias`。 -就像在函数 `SetGpio` 中所做的第一件事情是检查给定的针脚号是否有效一样。我们需要同样的方式去将 `pinNum (r0)` 与 53 进行比较,如果它大于 53 将立即返回。一旦我们再次调用 `GetGpioAddress`,我们就需要将 `lr`推送到栈上来保护它,将将 `pinNum` 移动到 `r2` 中。然后我们使用 `.unreq` 语句来删除我们给 `r0` 定义的别名。因为针脚号现在保存在寄存器 `r2` 中,我们希望通过别名能够映射到它,因此我们重新定义到 `r2` 的别名。你应该每次在别名使用结束后,立即删除它,这样当它不再存在时,你就不会在后面的代码中因它而产生错误。 +就像在函数 `SetGpio` 中所做的第一件事情是检查给定的针脚号是否有效一样。我们需要同样的方式去将 `pinNum`(`r0`)与 53 进行比较,如果它大于 53 将立即返回。一旦我们想要再次调用 `GetGpioAddress`,我们就需要将 `lr` 推送到栈上来保护它,将 `pinNum` 移动到 `r2` 中。然后我们使用 `.unreq` 语句来删除我们给 `r0` 定义的别名。因为针脚号现在保存在寄存器 `r2` 中,我们希望别名能够反映这个变化,因此我们从 `r0` 移走别名,重新定义到 `r2`。你应该每次在别名使用结束后,立即删除它,这样当它不再存在时,你就不会在后面的代码中因它而产生错误。 -然后,我们调用了 `GetGpioAddress`,并且我们创建了一个指向 `r0`的别名。 +然后,我们调用了 `GetGpioAddress`,并且我们创建了一个指向 `r0`的别名以反映此变化。 将下面的代码复制粘贴到上述代码的后面位置。 @@ -254,13 +237,11 @@ add gpioAddr,pinBank .unreq pinBank ``` -```assembly -lsr dst,src,#val 将 src 中二进制表示的数右移 val 位,并将结果保存到 dst。 -``` +> `lsr dst,src,#val` 将 `src` 中二进制表示的数右移 `val` 位,并将结果保存到 `dst`。 -对于打开和关闭 GPIO 针脚,每个针脚在 GPIO 控制器上有两个 4 字节组。在每个场景下,第一个 4 字节组控制前 32 个针脚,而第二个 4 字节组控制剩下的 22 个针脚。为了判断我们要设置的针脚在哪个 4 字节组中,我们需要将针脚号除以 32。幸运的是,这很容易,因为它等价于将二进制表示的针脚号右移 5 位。因此,在本案例中,我们将 `r3` 命名为 `pinBank`,然后计算 `pinNum ÷ 32`。因为它是一个 4 字节组,我们需要将它与 4 相乘的结果。它与二进制表示的数左移 2 位的相同的,这就是下一行的命令。你可能想知道我们能否将它右移 3 位呢,这样我们就可以先右移再左移。但是这样做是不行的,因为当我们做 ÷ 32 时有些答案可能是四舍五入的,而如果我们做 ÷ 8 时却不会这样。 +对于打开和关闭 GPIO 针脚,每个针脚在 GPIO 控制器上有两个 4 字节组。第一个 4 字节组每个位控制前 32 个针脚,而第二个 4 字节组控制剩下的 22 个针脚。为了判断我们要设置的针脚在哪个 4 字节组中,我们需要将针脚号除以 32。幸运的是,这很容易,因为它等价于将二进制表示的针脚号右移 5 位。因此,在本案例中,我们将 `r3` 命名为 `pinBank`,然后计算 `pinNum` ÷ 32。因为它是一个 4 字节组,我们需要将它与 4 相乘的结果。它与二进制表示的数左移 2 位相同,这就是下一行的命令。你可能想知道我们能否只将它右移 3 位呢,这样我们就不用先右移再左移。但是这样做是不行的,因为当我们做 ÷ 32 时答案有些位可能被舍弃,而如果我们做 ÷ 8 时却不会这样。 -现在,`gpioAddr` 的结果有可能是 20200000~16~(如果针脚号介于 0 到 31 之间),也有可能是 20200004~16~(如果针脚号介于 32 到 53 之间)。这意味着如果加上 28~10~ ,我们将得到打开针脚的地址,而如果加上 40~10~ ,我们将得到关闭针脚的地址。由于我们使用了 `pinBank` ,所以在它之后立即使用 `.unreq` 去删除它。、 +现在,`gpioAddr` 的结果有可能是 2020000016(如果针脚号介于 0 到 31 之间),也有可能是 2020000416(如果针脚号介于 32 到 53 之间)。这意味着如果加上 2810,我们将得到打开针脚的地址,而如果加上 4010 ,我们将得到关闭针脚的地址。由于我们用完了 `pinBank` ,所以在它之后立即使用 `.unreq` 去删除它。 将下面的代码复制粘贴到上述代码的下面位置。 @@ -272,13 +253,11 @@ lsl setBit,pinNum .unreq pinNum ``` -```assembly -and reg,#val 计算寄存器中的数与 val 的布尔与。 -``` +> `and reg,#val` 计算寄存器 `reg` 中的数与 `val` 的布尔与。 -函数的下一个部分是产生一个正确的设置数的位。至于 GPIO 控制器去打开或关闭针脚,我们在针脚号除以 32 的余数的位置,给它一个设置数字的位。例如,设置 16 号针脚,我们需要第 16 位设置数字为 1 。设置 45 号针脚,我们需要设置第 13 位数字为 1,因为 45 ÷ 32 = 1 余数 13。 +该函数的下一个部分是产生一个正确的位集合的数。至于 GPIO 控制器去打开或关闭针脚,我们在针脚号除以 32 的余数里设置了位的数。例如,设置 16 号针脚,我们需要第 16 位设置数字为 1 。设置 45 号针脚,我们需要设置第 13 位数字为 1,因为 45 ÷ 32 = 1 余数 13。 -这个 `and` 命令计算我们需要的余数。它是这样计算的,在输入中所有的二进制位都是 1 时,这个 `and` 运算的结果就是 1,否则就是 0。这是一个很基础的二进制操作,`and` 操作非常快。我们给定的输入是 “pinNum and 31~10~ = 11111~2~”。这意味着答案的后 5 位中只有 1,因此它肯定是在 0 到 31 之间。尤其是在 `pinNum` 的后 5 位的位置是 1 的地方它只有 1。这就如同被 32 整除的余数部分。就像 31 = 32 - 1 并不是巧合。 +这个 `and` 命令计算我们需要的余数。它是这样计算的,在两个输入中所有的二进制位都是 1 时,这个 `and` 运算的结果就是 1,否则就是 0。这是一个很基础的二进制操作,`and` 操作非常快。我们给定的输入是 “pinNum and 3110 = 111112”。这意味着答案的后 5 位中只有 1,因此它肯定是在 0 到 31 之间。尤其是在 `pinNum` 的后 5 位的位置是 1 的地方它只有 1。这就如同被 32 整除的余数部分。就像 31 = 32 - 1 并不是巧合。 ![binary division example][4] @@ -296,11 +275,9 @@ strne setBit,[gpioAddr,#28] pop {pc} ``` -```assembly -teq reg,#val 检查寄存器 reg 中的数字与 val 是否相等。 -``` +> `teq reg,#val` 检查寄存器 `reg` 中的数字与 `val` 是否相等。 -这个代码是方法的结束部分。如前面所说,当 `pinVal` 为 0 时,我们关闭它,否则就打开它。`teq`(等于测试)是另一个比较操作,它仅能够测试是否相等。它类似于 `cmp` ,但它并不能算出哪个数大。如果你只是希望测试数字是否相同,你可以使用 `teq`。 +这个代码结束了该方法。如前面所说,当 `pinVal` 为 0 时,我们关闭它,否则就打开它。`teq`(等于测试)是另一个比较操作,它仅能够测试是否相等。它类似于 `cmp` ,但它并不能算出哪个数大。如果你只是希望测试数字是否相同,你可以使用 `teq`。 如果 `pinVal` 是 0,我们将 `setBit` 保存在 GPIO 地址偏移 40 的位置,我们已经知道,这样会关闭那个针脚。否则将它保存在 GPIO 地址偏移 28 的位置,它将打开那个针脚。最后,我们通过弹出 `pc` 返回,这将设置它为我们推送链接寄存器时保存的值。 @@ -308,7 +285,7 @@ teq reg,#val 检查寄存器 reg 中的数字与 val 是否相等。 在完成上述工作后,我们终于有了我们的 GPIO 函数。现在,我们需要去修改 `main.s` 去使用它们。因为 `main.s` 现在已经有点大了,也更复杂了。将它分成两节将是一个很好的设计。到目前为止,我们一直使用的 `.init` 应该尽可能的让它保持小。我们可以更改代码来很容易地反映出这一点。 -将下列的代码插入到 `main.s` 文件中 `_start: ` 的后面: +将下列的代码插入到 `main.s` 文件中 `_start:` 的后面: ``` b main @@ -318,14 +295,12 @@ main: mov sp,#0x8000 ``` -在这里重要的改变是引入了 `.text` 节。我设计了 `makefile` 和链接器脚本,它将 `.text` 节(它是默认节)中的代码放在地址为 8000~16~ 的 `.init` 节之后。这是默认加载地址,并且它给我们提供了一些空间去保存栈。由于栈存在于内存中,它也有一个地址。栈向下增长内存,因此每个新值都低于前一个地址,所以,这便得栈顶是最低的一个地址。 - -``` -图中的 'ATAGs' 节的位置保存了有关树莓派的信息,比如它有多少内存,默认屏幕分辨率是多少。 -``` +在这里重要的改变是引入了 `.text` 节。我设计了 `makefile` 和链接器脚本,它将 `.text` 节(它是默认节)中的代码放在地址为 800016 的 `.init` 节之后。这是默认加载地址,并且它给我们提供了一些空间去保存栈。由于栈存在于内存中,它也有一个地址。栈向下增长内存,因此每个新值都低于前一个地址,所以,这使得栈顶是最低的一个地址。 ![Layout diagram of operating system][5] +> 图中的 “ATAGs” 节的位置保存了有关树莓派的信息,比如它有多少内存,默认屏幕分辨率是多少。 + 用下面的代码替换掉所有设置 GPIO 函数针脚的代码: ```assembly @@ -338,7 +313,7 @@ bl SetGpioFunction .unreq pinFunc ``` -这个代码将使用针脚号 16 和函数代码 1 去调用 `SetGpioFunction`。它的效果就是启用了 OK LED 灯的输出。 +这个代码将使用针脚号 16 和函数编号 1 去调用 `SetGpioFunction`。它的效果就是启用了 OK LED 灯的输出。 用下面的代码去替换打开 OK LED 灯的代码: @@ -358,7 +333,7 @@ bl SetGpio 但愿你能够顺利地在你的树莓派上测试我们所做的这一切。到目前为止,我们已经写了一大段代码,因此不可避免会出现错误。如果有错误,可以去查看我们的排错页面。 -如果你的代码已经正常工作,恭喜你。虽然我们的操作系统除了做 [课程 2:OK02][1] 中的事情之外,还做不了别的任何事情,但我们已经学会了函数和格式有关的知识,并且我们现在可以更好更快地编写新特性了。现在,我们在操作系统上修改 GPIO 寄存器将变得非常简单,而它就是用于控制硬件的! +如果你的代码已经正常工作,恭喜你。虽然我们的操作系统除了做 [课程 2:OK02][1] 中的事情,还做不了别的任何事情,但我们已经学会了函数和格式有关的知识,并且我们现在可以更好更快地编写新特性了。现在,我们在操作系统上修改 GPIO 寄存器将变得非常简单,而它就是用于控制硬件的! 在 [课程 4:OK04][6] 中,我们将处理我们的 `wait` 函数,目前,它的时间控制还不精确,这样我们就可以更好地控制我们的 LED 灯了,进而最终控制所有的 GPIO 针脚。 @@ -368,14 +343,14 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html 作者:[Robert Mullins][a] 选题:[lujun9972][b] -译者:[qhwdw](https://github.com/qhwdw ) -校对:[校对者ID](https://github.com/校对者ID) +译者:[qhwdw](https://github.com/qhwdw) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: http://www.cl.cam.ac.uk/~rdm34 [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html +[1]: https://linux.cn/article-10478-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/functions.png [3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/stack.png [4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png From 201c5165f136a723fad33a1fb660ab5af46fb987 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Feb 2019 23:00:55 +0800 Subject: [PATCH 047/813] PUB:20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @qhwdw https://linux.cn/article-10519-1.html --- ...20203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md (99%) diff --git a/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/published/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md similarity index 99% rename from translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md rename to published/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md index 8ad653b7d6..90e3be81ff 100644 --- a/translated/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md +++ b/published/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10519-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 3 OK03) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From 3cadcf09de4ca42fa7c2e0b0eb3894f272e7021e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Feb 2019 23:29:57 +0800 Subject: [PATCH 048/813] PRF:20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @bestony 不够认真 --- ...Share Your Terminal Sessions On The Fly.md | 103 ++++++------------ 1 file changed, 36 insertions(+), 67 deletions(-) diff --git a/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md index cde1e24855..1bf213cf6c 100644 --- a/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md +++ b/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -1,91 +1,76 @@ - [#]: collector: (lujun9972) +[#]: collector: (lujun9972) [#]: translator: (bestony) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Asciinema – Record And Share Your Terminal Sessions On The Fly) [#]: via: (https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Asciinema - 在云端记录并分享你的终端会话 +Asciinema:在云端记录并分享你的终端会话 ====== -这个众所周知的话题我们早已经写过了足够多的文章。 +这个众所周知的话题我们早已经写过了足够多的文章。即使这样,我们今天也要去讨论相同的话题。 -即使这样,我们今天也要去讨论相同的话题。 +其他的工具都是在本地运行的,但是 Asciinema 可以以相同的方式在本地和 Web 端运行。我的意思是我们可以在 Web 上分享这个录像。 -其他的工具都是在本地运行的,但是 Asciinema 可以以相同的方式在本地和 Web 端运行。 +默认情况下,每个人都更愿意使用 `history` 命令来回看、调用之前在终端内输入的命令。不过,不行的是,这个命令只展示了我们运行的命令却没有展示这些命令上次运行时的输出。 -我的意思是我们可以在 Web 上分享这个录像。 +在 Linux 下有很多的组件来记录终端会话活动。在过去,我们也写了一些组件,不过今天我们依然要讨论这同一类心的工具。 -默认情况下下,每个人都更愿意使用 history 命令来回看、调用之前在终端内输入的命令。 - -不过,不行的是,这个命令只展示了我们运行的命令却没有展示这些命令上次运行时的输出。 - -在 Linux 下有很多的组件来记录终端会话活动。 - -在过去,我们也写了一些组件,不过今天我们依然要讨论这同一类心的工具。 - -如果你想要使用其他工具来记录你的 Linux 终端会话活动,你可以试试 **[Script Command][1]** , **[Terminalizer Tool][2]** 和 **[Asciinema Tool][3]**. - -不过如果你想要找一个 **[GIF 录制工具][4]**,可以试试 **[Gifine][5]** , **[Kgif][6]** 和 **[Peek][7]**. +如果你想要使用其他工具来记录你的 Linux 终端会话活动,你可以试试 [Script 命令][1]、[Terminalizer 工具][2] 和 [Asciinema 工具][3]。 +不过如果你想要找一个 [GIF 录制工具][4],可以试试 [Gifine][5]、[Kgif][6] 和 [Peek][7]。 ### 什么是 Asciinema -asciinema 是一个免费且开源的用于录制终端会话并将它们分享到网络上的解决方案。 +`asciinema` 是一个自由开源的用于录制终端会话并将它们分享到网络上的解决方案。 -当你在你的终端内运行 asciinema rec 来启动录像时,你输入命令的时候,终端内的所有输出都会被抓取。 +当你在你的终端内运行 `asciinema rec` 来启动录像时,你输入命令的时候,终端内的所有输出都会被抓取。 当抓取停止时(通过按下 `Ctrl-D` 或输出 `exit`),抓取的输出将会被上传到 asciinema.org 的网站,并为后续的回放做准备。 -Asciinema 项目基于多个不同的完整的部分构建的,比如 asciinema 命令行工具、asciinema.org API 和 JavaScript 播放器。 +Asciinema 项目由多个不同的完整的部分组成,比如 `asciinema` 命令行工具、asciinema.org API 和 JavaScript 播放器。 -Asciinema 是受到了 script 和 scriptreplay 命令影响而产生的。 - -Asciinema was inspired by script and scriptreplay commands. +Asciinema 的灵感来自于 `script` 和 `scriptreplay` 命令。 ### 如何在 Linux 上安装 Asciinema - -Asciinema 基于 Python 写就,在 Linux 上,推荐使用 pip 安装的方法来安装。 +Asciinema 由 Python 写就,在 Linux 上,推荐使用 `pip` 安装的方法来安装。 确保你已经在你的系统里安装了 python-pip 包。如果没有,使用下述命令来安装它。 - -对于 Debian/Ubuntu 用户,使用 **[Apt 命令][8]**或 **[Apt-Get 命令][9]** 来安装 pip 包。 - - +对于 Debian/Ubuntu 用户,使用 [Apt 命令][8] 或 [Apt-Get 命令][9] 来安装 pip 包。 ``` $ sudo apt install python-pip ``` -对于 Archlinux 用户, 使用 **[Pacman 命令][10]** 来安装 pip 包。 +对于 Archlinux 用户,使用 [Pacman 命令][10] 来安装 pip 包。 ``` $ sudo pacman -S python-pip ``` -对于 Fedora 用户, 使用 **[DNF 命令][11]** 来安装 pip 包。 +对于 Fedora 用户,使用 [DNF 命令][11] 来安装 pip 包。 ``` $ sudo dnf install python-pip ``` -对于 CentOS/RHEL 用户, 使用 **[YUM Command][12]** 来安装 pip 包。 +对于 CentOS/RHEL 用户,使用 [YUM 命令][12] 来安装 pip 包。 ``` $ sudo yum install python-pip ``` -对于 openSUSE 用户, 使用 **[Zypper Command][13]** 来安装 pip 包。 +对于 openSUSE 用户,使用 [Zypper 命令][13] 来安装 pip 包。 ``` $ sudo zypper install python-pip ``` -最后,运行如下的 **[pip 命令][14]** 来在 Linux 上安装 Asciinema 工具。 +最后,运行如下的 [pip 命令][14] 来在 Linux 上安装 Asciinema 工具。 ``` $ sudo pip3 install asciinema @@ -93,7 +78,7 @@ $ sudo pip3 install asciinema ### 如何使用 Asciinema 工具来记录你的终端会话 -一旦你成功的安装了 Asciinema,只需要运行如下命令来开始录制 +一旦你成功的安装了 Asciinema,只需要运行如下命令来开始录制: ``` $ asciinema rec 2g-test @@ -101,7 +86,7 @@ asciinema: recording asciicast to 2g-test asciinema: press "ctrl-d" or type "exit" when you're done ``` -为了测试的目的,运行一些简单的命令,并看一看它是否运行的很好。 +出于测试的目的,运行一些简单的命令,并看一看它是否运行良好。 ``` $ free @@ -151,7 +136,7 @@ NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_add fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d ``` -当你完成后,简单的按下 `CTRL+D` 或输入 `exit` 来退出录制。这个结果将会被保存在同一个目录。 +当你完成后,简单的按下 `CTRL+D` 或输入 `exit` 来退出录制。这个结果将会被保存在同一个目录。 ``` $ exit @@ -160,7 +145,7 @@ asciinema: recording finished asciinema: asciicast saved to 2g-test ``` -如果你想要保存输出到不同的目录中,就需要提醒 Asciinema 你想要保存文件的目录 +如果你想要保存输出到不同的目录中,就需要提醒 Asciinema 你想要保存文件的目录。 ``` $ asciinema rec /opt/session-record/2g-test1 @@ -172,13 +157,13 @@ $ asciinema rec /opt/session-record/2g-test1 $ asciinema play 2g-test ``` -我们能够以两倍速来运行录制的会话。 +我们能够以两倍速来回放录制的会话。 ``` $ asciinema play -s 2 2g-test ``` -或者,我们可以以正常速度播放录制的会话,限制空白时间为2秒。 +或者,我们可以以正常速度播放录制的会话,限制空闲时间为 2 秒。 ``` $ asciinema play -i 2 2g-test @@ -186,9 +171,7 @@ $ asciinema play -i 2 2g-test ### 如何在网络上分享已经录制的会话 -If you would like to share the recorded session with your friends, just run the following command which upload the recording to asciinema.org and provide you the unique link. - -如果你想要分享录制的会话给你的朋友,只要运行下述上传你的会话到 asciinema.org 的命令,就可以获得一个唯一链接。 +如果你想要分享录制的会话给你的朋友,只要运行下述命令上传你的会话到 asciinema.org,就可以获得一个唯一链接。 它将会在被上传 7 天后被归档。 @@ -196,7 +179,7 @@ If you would like to share the recorded session with your friends, just run the $ asciinema upload 2g-test View the recording at: - https://asciinema.org/a/jdJrxhDLboeyrhzZRHsve0x8i + https://asciinema.org/a/jdJrxhDLboeyrhzZRHsve0x8i This installation of asciinema recorder hasn't been linked to any asciinema.org account. All unclaimed recordings (from unknown installations like this one) @@ -205,29 +188,24 @@ are automatically archived 7 days after upload. If you want to preserve all recordings made on this machine, connect this installation with asciinema.org account by opening the following link: - https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 + https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 ``` ![][16] -如果你想要分享录制的会话在社交媒体上,只需要点击页面底部的 `分享` 按钮。 +如果你想要分享录制的会话在社交媒体上,只需要点击页面底部的 “Share” 按钮。 -如果任何人想要去下载这个录制,只需要点击页面底部的 `下载` 按钮,就可以将其保存在你系统里。 +如果任何人想要去下载这个录制,只需要点击页面底部的 “Download” 按钮,就可以将其保存在你系统里。 -If anyone wants to download this recording, just click the `Download` button in the bottom of the page to save on your system. +### 如何管理 asciinema.org 中的录制片段 -### 如何 asciinema.org 中的录制片段 - -If you want to preserve all recordings made on this machine, connect this installation with asciinema.org account by opening the following link and follow the instructions. - -如果你想要保护所有在这个机器上录制的片段,点击下方的链接并使用你在 asciinema.org 的账户登陆,然后跟随这个说明继续操作。 +如果你想要留存所有在这个机器上录制的片段,点击上述显示的链接并使用你在 asciinema.org 的账户登录,然后跟随这个说明继续操作,来将你的机器和该网站连接起来。 ``` https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 ``` -如果你早已录制了一个 asciicast,但是你没有在你的 asciinema.org 账户界面看到它,只需要运行 `asciinema auth` 命令来移动他们。 - +如果你早已录制了一份,但是你没有在你的 asciinema.org 账户界面看到它,只需要运行 `asciinema auth` 命令来移动它们。 ``` $ asciinema auth @@ -249,14 +227,6 @@ asciinema: recording asciicast to /tmp/tmp6kuh4247-ascii.cast asciinema: press "ctrl-d" or type "exit" when you're done ``` -只要运行如下命令来开始录制。 - -``` -$ asciinema rec 2g-test -asciinema: recording asciicast to 2g-test -asciinema: press "ctrl-d" or type "exit" when you're done -``` - 出于测试目的,运行下述命令,并看一看它是否运行的很好。 ``` @@ -279,8 +249,7 @@ $ uname -a Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux ``` - -如果你完成了,简单的按下 `CTRL+D` 或输入 `exit` 来停止录制,然后按下`回车`按钮来上传文件到 asciinema.org 网站。 +如果你完成了,简单的按下 `CTRL+D` 或输入 `exit` 来停止录制,然后按下回车来上传文件到 asciinema.org 网站。 这将会花费一些时间来为你的录制生成唯一链接。一旦它完成,你会看到和下面一样的样式: @@ -302,7 +271,7 @@ via: https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-shar 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[Bestony](https://github.com/bestony) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7d38cd1e490d392fa7fe6f70fe3fc3706867825d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Feb 2019 23:30:28 +0800 Subject: [PATCH 049/813] PUB:20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @bestony https://linux.cn/article-10520-1.html --- ...ma - Record And Share Your Terminal Sessions On The Fly.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md (99%) diff --git a/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/published/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md similarity index 99% rename from translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md rename to published/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md index 1bf213cf6c..7de035fe34 100644 --- a/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md +++ b/published/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (bestony) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10520-1.html) [#]: subject: (Asciinema – Record And Share Your Terminal Sessions On The Fly) [#]: via: (https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 2b27e8649a100051a6ab83af6613787442a96617 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Feb 2019 00:06:57 +0800 Subject: [PATCH 050/813] PRF:20181224 An Introduction to Go.md @LazyWolfLin --- .../tech/20181224 An Introduction to Go.md | 131 ++++++++---------- 1 file changed, 60 insertions(+), 71 deletions(-) diff --git a/translated/tech/20181224 An Introduction to Go.md b/translated/tech/20181224 An Introduction to Go.md index 04adb076dc..3839a20088 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/translated/tech/20181224 An Introduction to Go.md @@ -1,30 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An Introduction to Go) [#]: via: (https://blog.jak-linux.org/2018/12/24/introduction-to-go/) [#]: author: (Julian Andres Klode https://blog.jak-linux.org/) -Go 简介 +Go 编程语言的简单介绍 ====== -(以下内容是我的硕士论文的摘录,几乎整个 2.1 章节,向具有 CS 背景的人快速介绍 Go) +(以下内容是我的硕士论文的摘录,几乎是整个 2.1 章节,向具有 CS 背景的人快速介绍 Go) -Go 是一门用于并发编程的命令式编程语言,它主要由创造者 Google 进行开发,最初主要由 Robert Griesemer、Rob Pike 和 Ken Thompson开发。这门语言的设计起始于 2017 年,并在 2019 年推出最初版本;而第一个稳定版本是 2012 年发布的 1.0 版本。 +Go 是一门用于并发编程的命令式编程语言,它主要由创造者 Google 进行开发,最初主要由 Robert Griesemer、Rob Pike 和 Ken Thompson 开发。这门语言的设计起始于 2007 年,并在 2009 年推出最初版本;而第一个稳定版本是 2012 年发布的 1.0 版本。[^1] -Go 有 C 风格的语法(没有预处理器),垃圾回收机制,而且类似它在贝尔实验室里被开发出来的前辈们:Newsqueak (Rob Pike)、Alef (Phil Winterbottom) 和 Inferno (Pike, Ritchie, et al.),使用所谓的 goroutines 和信道(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。 +Go 有 C 风格的语法(没有预处理器)、垃圾回收机制,而且类似它在贝尔实验室里被开发出来的前辈们:Newsqueak(Rob Pike)、Alef(Phil Winterbottom)和 Inferno(Pike、Ritchie 等人),使用所谓的 Go 协程goroutines信道channels(一种基于 Hoare 的“通信顺序进程”理论的协程)提供内建的并发支持。[^2] Go 程序以包的形式组织。包本质是一个包含 Go 文件的文件夹。包内的所有文件共享相同的命名空间,而包内的符号有两种可见性:以大写字母开头的符号对于其他包是可见,而其他符号则是该包私有的: ``` func PublicFunction() { - fmt.Println("Hello world") + fmt.Println("Hello world") } func privateFunction() { - fmt.Println("Hello package") + fmt.Println("Hello package") } ``` @@ -32,25 +32,16 @@ func privateFunction() { Go 有一个相当简单的类型系统:没有子类型(但有类型转换),没有泛型,没有多态函数,只有一些基本的类型: - 1. 基本类型:`int`、`int64`、`int8`、`uint`、`float32`、`float64` 等。 - + 1. 基本类型:`int`、`int64`、`int8`、`uint`、`float32`、`float64` 等 2. `struct` - - 3. `interface` \- 一组方法的集合 - - 4. `map[K, V]` \- 一个从键类型到值类型的映射 - - 5. `[number]Type` \- 一些 Type 类型的元素组成的数组 - - 6. `[]Type` \- 某种类型的切片(指向具有长度和功能的数组) - - 7. `chan Type` \- 一个线程安全的队列 - + 3. `interface`:一组方法的集合 + 4. `map[K, V]`:一个从键类型到值类型的映射 + 5. `[number]Type`:一些 Type 类型的元素组成的数组 + 6. `[]Type`:某种类型的切片(具有长度和功能的数组的指针) + 7. `chan Type`:一个线程安全的队列 8. 指针 `*T` 指向其他类型 - 9. 函数 - - 10. 具名类型 - 可能具有关联方法的其他类型的别名(译者注:这里的别名并非指 Go 1.9 中的新特性“类型别名”): + 10. 具名类型:可能具有关联方法的其他类型的别名(LCTT 译注:这里的别名并非指 Go 1.9 中的新特性“类型别名”): ``` type T struct { foo int } @@ -58,9 +49,9 @@ Go 有一个相当简单的类型系统:没有子类型(但有类型转换 type T OtherNamedType ``` - 具名类型完全不同于他们的底层类型,所以你不能让他们互相赋值,但一些运输符,例如 `+`,能够处理同一底层数值类型的具名类型对象们(所以你可以在上面的示例中把两个 `T` 加起来)。 + 具名类型完全不同于它们的底层类型,所以你不能让它们互相赋值,但一些操作符,例如 `+`,能够处理同一底层数值类型的具名类型对象们(所以你可以在上面的示例中把两个 `T` 加起来)。 -Maps、slices 和 channels 是类似于引用的类型——他们实际上是包含指针的结构。包括数组(具有固定长度并可被拷贝)在内的其他类型则是值(拷贝)传递。 +映射、切片和信道是类似于引用的类型——它们实际上是包含指针的结构。包括数组(具有固定长度并可被拷贝)在内的其他类型则是值传递(拷贝)。 #### 类型转换 @@ -93,66 +84,60 @@ const bar2 someType = typed // error: int 不能被赋值给 someType ### 接口和对象 -正如上面所说的,接口是一组方法的集合。Go 本身不是一种面向对象的语言,但它支持将方法关联到命名类型上:当声明一个函数时,可以提供一个接收者。接收者是函数的一个额外参数,可以在函数之前传递并参与函数查找,就像这样: +正如上面所说的,接口是一组方法的集合。Go 本身不是一种面向对象的语言,但它支持将方法关联到具名类型上:当声明一个函数时,可以提供一个接收者。接收者是函数的一个额外参数,可以在函数之前传递并参与函数查找,就像这样: ``` type SomeType struct { ... } +type SomeType struct { ... } func (s *SomeType) MyMethod() { } func main() { - var s SomeType - s.MyMethod() + var s SomeType + s.MyMethod() } ``` -如果对象实现了所有方法,那么它就实现了接口;例如,`*SomeType`(注意指针)实现了下面的接口 `MyMethoder`,因此 `*SomeType` 类型的值就能作为 `MyMethoder` 类型的值使用。最基本的接口类型是 `interface{}`,它是一个带空方法集的接口——任何对象都满足该接口。 +如果对象实现了所有方法,那么它就实现了接口;例如,`*SomeType`(注意指针)实现了下面的接口 `MyMethoder`,因此 `*SomeType` 类型的值就能作为 `MyMethoder` 类型的值使用。最基本的接口类型是 `interface{}`,它是一个带空方法集的接口 —— 任何对象都满足该接口。 ``` type MyMethoder interface { - MyMethod() + MyMethod() } ``` -合法的接收者类型是有些限制的;例如,命名类型可以是指针类型(例如,`type MyIntPointer *int`),但这种类型不是合法的接收者类型。 +合法的接收者类型是有些限制的;例如,具名类型可以是指针类型(例如,`type MyIntPointer *int`),但这种类型不是合法的接收者类型。 ### 控制流 Go 提供了三个主要的控制了语句:`if`、`switch` 和 `for`。这些语句同其他 C 风格语言内的语句非常类似,但有一些不同: * 条件语句没有括号,所以条件语句是 `if a == b {}` 而不是 `if (a == b) {}`。大括号是必须的。 - - * 所有的语句都可以有初始化,比如这个 - - `if result, err := someFunction(); err == nil { // use result }` - - * `switch` 语句在 cases 里可以使用任何表达式 - - * `switch` 语句可以处理空的表达式(等于 true) - - * 默认情况下,Go 不会从一个 case 进入下一个 case(不需要 `break`语句),在程序块的末尾使用 `fallthrough` 则会进入下一个 case。 - + * 所有的语句都可以有初始化,比如这个 `if result, err := someFunction(); err == nil { // use result }` + * `switch` 语句在分支里可以使用任何表达式 + * `switch` 语句可以处理空的表达式(等于 `true`) + * 默认情况下,Go 不会从一个分支进入下一个分支(不需要 `break` 语句),在程序块的末尾使用 `fallthrough` 则会进入下一个分支。 * 循环语句 `for` 不仅能循环值域:`for key, val := range map { do something }` -### Goroutines +### Go 协程 -关键词 `go` 会产生一个新的 goroutine,一个可以并行执行的函数。它可以用于任何函数调用,甚至一个匿名函数: +关键词 `go` 会产生一个新的 Go 协程goroutine,这是一个可以并行执行的函数。它可以用于任何函数调用,甚至一个匿名函数: ``` func main() { - ... - go func() { - ... - }() + ... + go func() { + ... + }() - go some_function(some_argument) + go some_function(some_argument) } ``` ### 信道 -Goroutines 通常和信道结合,用来提供一种通信顺序进程的扩展。信道是一个并发安全的队列,而且可以选择是否缓冲数据: +Go 协程通常和信道channels结合,用来提供一种通信顺序进程的扩展。信道是一个并发安全的队列,而且可以选择是否缓冲数据: ``` var unbuffered = make(chan int) // 直到数据被读取时完成数据块发送 @@ -170,21 +155,21 @@ otherChannel <- valueToSend ``` select { - case incoming := <- inboundChannel: - // 一条新消息 - case outgoingChannel <- outgoing: - // 可以发送消息 + case incoming := <- inboundChannel: + // 一条新消息 + case outgoingChannel <- outgoing: + // 可以发送消息 } ``` -### `defer` 声明 +### defer 声明 Go 提供语句 `defer` 允许函数退出时调用执行预定的函数。它可以用于进行资源释放操作,例如: ``` func myFunc(someFile io.ReadCloser) { - defer someFile.close() - /* 文件相关操作 */ + defer someFile.close() + /* 文件相关操作 */ } ``` @@ -199,7 +184,7 @@ func Read(p []byte) (n int, err error) // 内建类型: type error interface { - Error() string + Error() string } ``` @@ -209,7 +194,7 @@ type error interface { n0, _ := Read(Buffer) // 忽略错误 n, err := Read(buffer) if err != nil { - return err + return err } ``` @@ -217,21 +202,21 @@ if err != nil { ``` func Function() (err error) { - defer func() { - s := recover() - switch s := s.(type) { // type switch - case error: - err = s // s has type error now - default: - panic(s) + defer func() { + s := recover() + switch s := s.(type) { // type switch + case error: + err = s // s has type error now + default: + panic(s) + } } - } } ``` ### 数组和切片 -正如前边说的,数组是值类型而切片是指向数组的指针。切片可以由现有的数组切片产生,也可以使用 `make()` 创建切片,这会创建一个匿名数组以保存元素。 +正如前边说的,数组是值类型,而切片是指向数组的指针。切片可以由现有的数组切片产生,也可以使用 `make()` 创建切片,这会创建一个匿名数组以保存元素。 ``` slice1 := make([]int, 2, 5) // 分配 5 个元素,其中 2 个初始化为0 @@ -250,15 +235,19 @@ slice = append(slice, arrayOrSlice...) 切片也可以用于函数的变长参数。 -### Maps +### 映射 -Maps 是简单的键值对储存容器并支持索引和分配。但它们不是线程安全的。 +映射maps是简单的键值对储存容器,并支持索引和分配。但它们不是线程安全的。 ``` someValue := someMap[someKey] someValue, ok := someMap[someKey] // 如果键值不在 someMap 中,变量 ok 会赋值为 `false` someMap[someKey] = someValue ``` + +[^1]: Frequently Asked Questions (FAQ) - The Go Programming Language https://golang.org/doc/faq#history [return] +[^2]: HOARE, Charles Antony Richard. Communicating sequential processes. Communications of the ACM, 1978, 21. Jg., Nr. 8, S. 666-677. [return] + -------------------------------------------------------------------------------- via: https://blog.jak-linux.org/2018/12/24/introduction-to-go/ @@ -266,7 +255,7 @@ via: https://blog.jak-linux.org/2018/12/24/introduction-to-go/ 作者:[Julian Andres Klode][a] 选题:[lujun9972][b] 译者:[LazyWolfLin](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 84d9445aee02dafa66667ac5aef21d8349fd92c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Feb 2019 00:08:13 +0800 Subject: [PATCH 051/813] PUB:20181224 An Introduction to Go.md @LazyWolfLin https://linux.cn/article-10521-1.html --- .../tech => published}/20181224 An Introduction to Go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181224 An Introduction to Go.md (99%) diff --git a/translated/tech/20181224 An Introduction to Go.md b/published/20181224 An Introduction to Go.md similarity index 99% rename from translated/tech/20181224 An Introduction to Go.md rename to published/20181224 An Introduction to Go.md index 3839a20088..40504b2796 100644 --- a/translated/tech/20181224 An Introduction to Go.md +++ b/published/20181224 An Introduction to Go.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10521-1.html) [#]: subject: (An Introduction to Go) [#]: via: (https://blog.jak-linux.org/2018/12/24/introduction-to-go/) [#]: author: (Julian Andres Klode https://blog.jak-linux.org/) From 385d47198890a34aa7eab54e66c7350d050eea5b Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Feb 2019 14:30:21 +0800 Subject: [PATCH 052/813] Translated by qhwdw --- ...atory - Raspberry Pi- Lesson 8 Screen03.md | 485 ------------------ ...atory - Raspberry Pi- Lesson 8 Screen03.md | 469 +++++++++++++++++ 2 files changed, 469 insertions(+), 485 deletions(-) delete mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md create mode 100644 translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md deleted file mode 100644 index 4ff644a816..0000000000 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md +++ /dev/null @@ -1,485 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 8 Screen03) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html) -[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) - -Computer Laboratory – Raspberry Pi: Lesson 8 Screen03 -====== - -The Screen03 lesson builds on Screen02, by teaching how to draw text, and also a small feature on the command line arguments of the operating system. It is assumed you have the code for the [Lesson 7: Screen02][1] operating system as a basis. - -### 1 String Theory - -So, our task for this operating system is to draw text. We have several problems to address, the most pressing of which is probably about storing text. Unbelievably text has been one of the biggest flaws on computers to date. What should have been a straightforward type of data has brought down operating systems, crippled otherwise wonderful encryption, and caused many problems for users of different alphabets. Nevertheless, it is an incredibly important type of data, as it is an excellent link between the computer and the user. Text can be sufficiently structured that the operating system understands it, as well as sufficiently readable that humans can use it. - -``` -Variable data types such as text require much more complex handling. -``` - -So how exactly is text stored? Simply enough, we have some system by which we give each letter a unique number, and then store a sequence of such numbers. Sounds easy. The problem is that the number of numbers is not fixed. Some pieces of text are longer than others. With storing ordinary numbers, we have some fixed limit, e.g. 32 bits, and then we can't go beyond that, we write methods that use numbers of that length, etc. In terms of text, or strings as we often call it, we want to write functions that work on variable length strings, otherwise we would need a lot of functions! This is not a problem for numbers normally, as there are only a few common number formats (byte, word, half, double). - -``` -Buffer overrun attacks have plagued computers for years. Recently, the Wii, Xbox and Playstation 2 all suffered buffer overrun attacks, as well as large systems like Microsoft's Web and Database servers. -``` - -So, how do we determine how long the string is? I think the obvious answer is just to store how long the string is, and then to store the characters that make it up. This is called length prefixing, as the length comes before the string. Unfortunately, the pioneers of computer science did not agree. They felt it made more sense to have a special character called the null terminator (denoted \0) which represents when a string ends. This does indeed simplify many string algorithms, as you just keep working until the null terminator. Unfortunately this is the source of many security issues. What if a malicious user gives you a very long string? What if you didn't have enough space to store it. You might run a string copying function that copies until the null terminator, but because the string is so long, it overwrites your program. This may sound far fetched, but nevertheless, such buffer overrun attacks are incredibly common. Length prefixing mitigates this problem as it is easy to deduce the size of the buffer required to store the string. As an operating system developer, I leave it to you to decide how best to store text. - -The next thing we need to establish is how best to map characters to numbers. Fortunately, this is reasonably well standardised, so you have two major choices, Unicode and ASCII. Unicode maps almost every single useful symbol that can be written to a number, in exchange for having a lot more numbers, and a more complicated encoding system. ASCII uses one byte per character, and so only stores the Latin alphabet, numbers, a few symbols and a few special characters. Thus, ASCII is very easy to implement, compared to Unicode, in which not every character takes the same space, making string algorithms tricky. Normally operating systems use ASCII for strings which will not be displayed to end users (but perhaps to developers or experts), and Unicode for displaying messages to users, as Unicode can support things like Japanese characters, and so could be localised. - -Fortunately for us, this decision is irrelevant at the moment, as the first 128 characters of both are exactly the same, and are encoded exactly the same. - -Table 1.1 ASCII/Unicode symbols 0-127 - -| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | | -|----| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ----| -| 00 | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT | LF | VT | FF | CR | SO | SI | | -| 10 | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS | RS | US | | -| 20 | ! | " | # | $ | % | & | . | ( | ) | * | + | , | - | . | / | | | -| 30 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? | | -| 40 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | | -| 50 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ | | -| 60 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | | -| 70 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL | - -The table shows the first 128 symbols. The hexadecimal representation of the number for a symbol is the row value added to the column value, for example A is 4116. What you may find surprising is the first two rows, and the very last value. These 33 special characters are not printed at all. In fact, these days, many are ignored. They exist because ASCII was originally intended as a system for transmitting data over computer networks, and so a lot more information than just the symbols had to be sent. The key special symbols that you should learn are NUL, the null terminator character I mentioned before, HT, horizontal tab is what we normally refer to as a tab and LF, the line feed character is used to make a new line. You may wish to research and use the other characters for special meanings in your operating system. - -### 2 Characters - -So, now that we know a bit about strings, we can start to think about how they're displayed. The fundamental thing we need to do in order to be able to display a string is to be able to display a character. Our first task will be making a DrawCharacter function which takes in a character to draw and a location, and then draws the character. - -``` -The true type font format used in many Operating Systems is so powerful, it has its own assembly language built in to ensure letters look correct at any resolution. -``` - -Naturally, this leads to a discussion about fonts. We already know there are many ways to display any given letter in accordance with font choice. So how does a font work? In the very early days of computer science, a font was just a series of little pictures of all the letters, called a bitmap font, and all the draw character method would do is copy one of the pictures to the screen. The trouble with this is when people want to resize the text. Sometimes we need big letters, and sometimes small. Although we could keep drawing new pictures for every font at every size with every character, this would get tedious. Thus, vector fonts were invented. in vector fonts, rather than containing an image of the font, the font file contains a description of how to draw it, e.g. an 'o' could be circle with radius half that of the maximum letter height. Modern operating systems use such fonts almost exclusively, as they are perfect at any resolution. - -Unfortunately, much though I would love to include an implementation of one of the vector font formats, it would take up the remainder of this website. Thus, we will implement a bitmap font, though if you wish to make a decent graphical operating system, a vector font would be useful. -``` -00000000 -00000000 -00000000 -00010000 -00101000 -00101000 -00101000 -01000100 -01000100 -01111100 -11000110 -10000010 -00000000 -00000000 -00000000 -00000000 -``` - -On the downloads page, I have included several '.bin' files in the font section. These are just raw binary data files for a few fonts. For this tutorial, pick your favourite from the monospace, monochrome, 8x16 section. Download it and store it in the 'source' directory as 'font.bin'. These files are just monochrome images of each of the letters in turn, with each letter being exactly 8 by 16 pixels. Thus, each takes 16 bytes, the first byte being the top row, the second the next, etc. - -The diagram shows the 'A' character in the monospace, monochrome, 8x16 font Bitstream Vera Sans Mono. In the file, we would find this starting at the 4116 × 1016 = 41016th byte as the following sequence in hexadecimal: - -00, 00, 00, 10, 28, 28, 28, 44, 44, 7C, C6, 82, 00, 00, 00, 00 - -We're going to use a monospace font here, because in a monospace font every character is the same size. Unfortunately, yet another complication with most fonts is that the character's widths vary, leading to more complex display code. I've included a few other fonts on the downloads page, as well as an explanation of the format I've stored them all in. - -So let's get down to business. Copy the following to 'drawing.s' after the .int 0 of graphicsAddress. - -``` -.align 4 -font: -.incbin "font.bin" -``` - -``` -.incbin "file" inserts the binary data from the file file. -``` - -This code copies the font data from the file to the address labelled font. We've used an .align 4 here to ensure each character starts on a multiple of 16 bytes, which can be used for a speed trick later. - -Now we want to write the draw character method. I'll give the pseudo code for this, so you can try to implement it yourself if you want to. Conventionally >> means logical shift right. - -``` -function drawCharacter(r0 is character, r1 is x, r2 is y) - if character > 127 then exit - set charAddress to font + character × 16 - for row = 0 to 15 - set bits to readByte(charAddress + row) - for bit = 0 to 7 - if test(bits >> bit, 0x1) - then setPixel(x + bit, y + row) - next - next - return r0 = 8, r1 = 16 -end function - -``` -If implemented directly, this is deliberately not very efficient. With things like drawing characters, efficiency is a top priority, as we will do it a lot. Let's explore some improvements that bring this closer to optimal assembly code. Firstly, we have a × 16, which by now you should spot is the same as a logical shift left by 4 places. Next we have a variable row, which is only ever added to charAddress and to y. Thus, we can eliminate it by increasing these variables instead. The only issue now is how to tell when we've finished. This is where the .align 4 comes in handy. We know that charAddress will start with the low nibble containing 0. This means we can see how far into the character data we are by checking that low nibble. - -Though we can eliminate the need for bits, we must introduce a new variable to do so, so it is best left in. The only other improvement that can be made is to remove the nested bits >> bit. - -``` -function drawCharacter(r0 is character, r1 is x, r2 is y) - if character > 127 then exit - set charAddress to font + character << 4 - loop - set bits to readByte(charAddress) - set bit to 8 - loop - set bits to bits << 1 - set bit to bit - 1 - if test(bits, 0x100) - then setPixel(x + bit, y) - until bit = 0 - set y to y + 1 - set chadAddress to chadAddress + 1 - until charAddress AND 0b1111 = 0 - return r0 = 8, r1 = 16 -end function -``` - -Now we've got code that is much closer to assembly code, and is near optimal. Below is the assembly code version of the above. - -``` -.globl DrawCharacter -DrawCharacter: -cmp r0,#127 -movhi r0,#0 -movhi r1,#0 -movhi pc,lr - -push {r4,r5,r6,r7,r8,lr} -x .req r4 -y .req r5 -charAddr .req r6 -mov x,r1 -mov y,r2 -ldr charAddr,=font -add charAddr, r0,lsl #4 - -lineLoop$: - - bits .req r7 - bit .req r8 - ldrb bits,[charAddr] - mov bit,#8 - - charPixelLoop$: - - subs bit,#1 - blt charPixelLoopEnd$ - lsl bits,#1 - tst bits,#0x100 - beq charPixelLoop$ - - add r0,x,bit - mov r1,y - bl DrawPixel - - teq bit,#0 - bne charPixelLoop$ - - charPixelLoopEnd$: - .unreq bit - .unreq bits - add y,#1 - add charAddr,#1 - tst charAddr,#0b1111 - bne lineLoop$ - -.unreq x -.unreq y -.unreq charAddr - -width .req r0 -height .req r1 -mov width,#8 -mov height,#16 - -pop {r4,r5,r6,r7,r8,pc} -.unreq width -.unreq height -``` - -### 3 Strings - -Now that we can draw characters, we can draw text. We need to make a method that, for a given string, draws each character in turn, at incrementing positions. To be nice, we shall also implement new lines and tabs. It's decision time as far as null terminators are concerned, and if you want to make your operating system use them, feel free by changing the code below. To avoid the issue, I will have the length of the string passed as an argument to the DrawString function, along with the address of the string, and the x and y coordinates. - -``` -function drawString(r0 is string, r1 is length, r2 is x, r3 is y) - set x0 to x - for pos = 0 to length - 1 - set char to loadByte(string + pos) - set (cwidth, cheight) to DrawCharacter(char, x, y) - if char = '\n' then - set x to x0 - set y to y + cheight - otherwise if char = '\t' then - set x1 to x - until x1 > x0 - set x1 to x1 + 5 × cwidth - loop - set x to x1 - otherwise - set x to x + cwidth - end if - next -end function -``` - -Once again, this function isn't that close to assembly code. Feel free to try to implement it either directly or by simplifying it. I will give the simplification and then the assembly code below. - -Clearly the person who wrote this function wasn't being very efficient (me in case you were wondering). Once again we have a pos variable that just increments and is added to something else, which is completely unnecessary. We can remove it, and instead simultaneously decrement length until it is 0, saving the need for one register. The rest of the function is probably fine, except for that annoying multiplication by five. A key thing to do here would be to move the multiplication outside the loop; multiplication is slow even with bit shifts, and since we're always adding the same constant multiplied by 5, there is no need to recompute this. It can in fact be implemented in one operation using the argument shifting in assembly code, so I shall rephrase it like that. - -``` -function drawString(r0 is string, r1 is length, r2 is x, r3 is y) - set x0 to x - until length = 0 - set length to length - 1 - set char to loadByte(string) - set (cwidth, cheight) to DrawCharacter(char, x, y) - if char = '\n' then - set x to x0 - set y to y + cheight - otherwise if char = '\t' then - set x1 to x - set cwidth to cwidth + cwidth << 2 - until x1 > x0 - set x1 to x1 + cwidth - loop - set x to x1 - otherwise - set x to x + cwidth - end if - set string to string + 1 - loop -end function -``` - -In assembly code: - -``` -.globl DrawString -DrawString: -x .req r4 -y .req r5 -x0 .req r6 -string .req r7 -length .req r8 -char .req r9 -push {r4,r5,r6,r7,r8,r9,lr} - -mov string,r0 -mov x,r2 -mov x0,x -mov y,r3 -mov length,r1 - -stringLoop$: - subs length,#1 - blt stringLoopEnd$ - - ldrb char,[string] - add string,#1 - - mov r0,char - mov r1,x - mov r2,y - bl DrawCharacter - cwidth .req r0 - cheight .req r1 - - teq char,#'\n' - moveq x,x0 - addeq y,cheight - beq stringLoop$ - - teq char,#'\t' - addne x,cwidth - bne stringLoop$ - - add cwidth, cwidth,lsl #2 - x1 .req r1 - mov x1,x0 - - stringLoopTab$: - add x1,cwidth - cmp x,x1 - bge stringLoopTab$ - mov x,x1 - .unreq x1 - b stringLoop$ -stringLoopEnd$: -.unreq cwidth -.unreq cheight - -pop {r4,r5,r6,r7,r8,r9,pc} -.unreq x -.unreq y -.unreq x0 -.unreq string -.unreq length -``` - -``` -subs reg,#val subtracts val from the register reg and compares the result with 0. -``` - -This code makes clever use of a new operation, subs which subtracts one number from another, stores the result and then compares it with 0. In truth, all comparisons are implemented as a subtraction and then comparison with 0, but the result is normally discarded. This means that this operation is as fast as cmp. - -### 4 Your Wish is My Command Line - -Now that we can print strings, the challenge is to find an interesting one to draw. Normally in tutorials such as this, people just draw "Hello World!", but after all we've done so far, I feel that is a little patronising (feel free to do so if it helps). Instead we're going to draw our command line. - -A convention has been made for computers running ARM. When they boot, it is important they are given certain information about what they have available to them. Most all processors have some way of ascertaining this information, and on ARM this is by data left at the address 10016. The format of the data is as follows: - - 1. The data is broken down into a series of 'tags'. - 2. There are nine types of tag: 'core', 'mem', 'videotext', 'ramdisk', 'initrd2', 'serial' 'revision', 'videolfb', 'cmdline'. - 3. Each can only appear once, but all but the 'core' tag don't have to appear. - 4. The tags are placed from 0x100 in order one after the other. - 5. The end of the list of tags always contains 2 words which are 0. - 6. Every tag's size in bytes is a multiple of 4. - 7. Each tag starts with the size of the tag in words in the tag, including this number. - 8. This is followed by a half word containing the tag's number. These are numbered from 1 in the order above ('core' is 1, 'cmdline' is 9). - 9. This is followed by a half word containing 544116. - 10. After this comes the data of the tag, which varies depending on the tag. The size of the data in words + 2 is always the same as the length mentioned above. - 11. A 'core' tag is either 2 or 5 words in length. If it is 2, there is no data, if it is 5, it has 3 words. - 12. A 'mem' tag is always 4 words in length. The data is the first address in a block of memory, and the length of that block. - 13. A 'cmdline' tag contains a null terminated string which is the parameters of the kernel. - - -``` -Almost all Operating Systems support the notion of programs having a 'command line'. The idea is to provide a common mechanism for choosing the desired behaviour of the program. -``` - -On the current version of the Raspberry Pi, only the 'core', 'mem' and 'cmdline' tags are present. You may find these useful later, and a more complete reference for these is on our Raspberry Pi reference page. The one we're interested in at the moment is the 'cmdline' tag, because it contains a string. We're going to write some code to search for the command line tag, and, if found, to print it out with each item on a new line. The command line is just a list of things that either the graphics processor or the user thought it might be nice for the Operating System to know. On the Raspberry Pi, this includes the MAC Address, serial number and screen resolution. The string itself is just a list of expressions such as 'key.subkey=value' separated by spaces. - -Let's start by finding the 'cmdline' tag. In a new file called 'tags.s' copy the following code. - -``` -.section .data -tag_core: .int 0 -tag_mem: .int 0 -tag_videotext: .int 0 -tag_ramdisk: .int 0 -tag_initrd2: .int 0 -tag_serial: .int 0 -tag_revision: .int 0 -tag_videolfb: .int 0 -tag_cmdline: .int 0 -``` - -Looking through the list of tags will be a slow operation, as it involves a lot of memory access. Therefore, we only want to have to do it once. This code creates some data which will store the memory address of the first tag of each of the types. Then, to find a tag the following pseudo code will suffice. - -``` -function FindTag(r0 is tag) - if tag > 9 or tag = 0 then return 0 - set tagAddr to loadWord(tag_core + (tag - 1) × 4) - if not tagAddr = 0 then return tagAddr - if readWord(tag_core) = 0 then return 0 - set tagAddr to 0x100 - loop forever - set tagIndex to readHalfWord(tagAddr + 4) - if tagIndex = 0 then return FindTag(tag) - if readWord(tag_core+(tagIndex-1)×4) = 0 - then storeWord(tagAddr, tag_core+(tagIndex-1)×4) - set tagAddr to tagAddr + loadWord(tagAddr) × 4 - end loop -end function -``` -This code is already quite well optimised and close to assembly. It is optimistic in that the first thing it tries is loading the tag directly, as all but the first time this should be the case. If that fails, it checks if the core tag has an address. Since there must always be a core tag, the only reason that it would not have an address is if it doesn't exist. If it does have an address, the tag we were looking for didn't. If it doesn't we need to find the addresses of all the tags. It does this by reading the number of the tag. If it is zero, that must mean we are at the end of the list. This means we've now filled in all the tags in our directory. Therefore if we run our function again, it will now be able to produce an answer. If the tag number is not zero, we check to see if this tag type already has an address. If not, we store the address of this tag in our directory. We then add the length of this tag in bytes to the tag address to find the next tag. - -Have a go at implementing this code in assembly. You will need to simplify it. If you get stuck, my answer is below. Don't forget the .section .text! - -``` -.section .text -.globl FindTag -FindTag: -tag .req r0 -tagList .req r1 -tagAddr .req r2 - -sub tag,#1 -cmp tag,#8 -movhi tag,#0 -movhi pc,lr - -ldr tagList,=tag_core -tagReturn$: -add tagAddr,tagList, tag,lsl #2 -ldr tagAddr,[tagAddr] - -teq tagAddr,#0 -movne r0,tagAddr -movne pc,lr - -ldr tagAddr,[tagList] -teq tagAddr,#0 -movne r0,#0 -movne pc,lr - -mov tagAddr,#0x100 -push {r4} -tagIndex .req r3 -oldAddr .req r4 -tagLoop$: -ldrh tagIndex,[tagAddr,#4] -subs tagIndex,#1 -poplt {r4} -blt tagReturn$ - -add tagIndex,tagList, tagIndex,lsl #2 -ldr oldAddr,[tagIndex] -teq oldAddr,#0 -.unreq oldAddr -streq tagAddr,[tagIndex] - -ldr tagIndex,[tagAddr] -add tagAddr, tagIndex,lsl #2 -b tagLoop$ - -.unreq tag -.unreq tagList -.unreq tagAddr -.unreq tagIndex -``` - -### 5 Hello World - -Now that we have everything we need, we can draw our first string. In 'main.s' delete everything after bl SetGraphicsAddress, and replace it with the following: - -``` -mov r0,#9 -bl FindTag -ldr r1,[r0] -lsl r1,#2 -sub r1,#8 -add r0,#8 -mov r2,#0 -mov r3,#0 -bl DrawString -loop$: -b loop$ -``` - -This code simply uses our FindTag method to find the 9th tag (cmdline) and then calculates its length and passes the command and the length to the DrawString method, and tells it to draw the string at 0,0. Now test this on the Raspberry Pi. You should see a line of text on the screen. If not please see our troubleshooting page. - -Once it works, congratulations you've now got the ability to draw text. But there is still room for improvement. What if we wanted to write out a number, or a section of the memory or manipulate our command line? In [Lesson 9: Screen04][2], we will look at manipulating text and displaying useful numbers and information. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html - -作者:[Alex Chadwick][a] -选题:[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.cl.cam.ac.uk -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md new file mode 100644 index 0000000000..3e095a14d3 --- /dev/null +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -0,0 +1,469 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 8 Screen03) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +计算机实验室 – 树莓派:课程 8 屏幕03 +====== + +屏幕03 课程基于屏幕02 课程来构建,它教你如何绘制文本,和一个操作系统命令行参数上的一个小特性。假设你已经有了[课程 7:屏幕02][1] 的操作系统代码,我们将以它为基础来构建。 + +### 1、字符串的理论知识 + +是的,我们的任务是为这个操作系统绘制文本。我们有几个问题需要去处理,最紧急的那个可能是如何去保存文本。令人难以置信的是,文本是迄今为止在计算机上最大的缺陷之一。原本应该是简单的数据类型却导致了操作系统的崩溃,破坏了完美的加密,并给使用不同字母表的用户带来了许多问题。尽管如此,它仍然是极其重要的数据类型,因为它将计算机和用户很好地连接起来。文本是计算机能够理解的非常好的结构,同时人类使用它时也有足够的可读性。 + +``` +可变数据类型,比如文本要求能够进行很复杂的处理。 +``` + +那么,文本是如何保存的呢?非常简单,我们使用一种方法,给每个字母分配一个唯一的编号,然后我们保存一系列的这种编号。看起来很容易吧。问题是,那个编号的数字是不固定的。一些文本片断可能比其它的长。与保存普通数字一样,我们有一些固有的限制,即:3 位,我们不能超过这个限制,我们添加方法去使用那种长数字等等。“文本”这个术语,我们经常也叫它“字符串”,我们希望能够写一个可用于变长字符串的函数,否则就需要写很多函数!对于一般的数字来说,这不是个问题,因为只有几种通用的数字格式(字节、字、半字节、双字节)。 + +``` +缓冲区溢出攻击祸害计算机由来已久。最近,Wii、Xbox 和 Playstation 2、以及大型系统如 Microsoft 的 Web 和数据库服务器,都遭受到缓冲区溢出攻击。 +``` + +因此,如何判断字符串长度?我想显而易见的答案是存储多长的字符串,然后去存储组成字符串的字符。这称为长度前缀,因为长度位于字符串的前面。不幸的是,计算机科学家的先驱们不同意这么做。他们认为使用一个称为空终止符(NULL)的特殊字符(用 \0表示)来表示字符串结束更有意义。这样确定简化了许多字符串算法,因为你只需要持续操作直到遇到空终止符为止。不幸的是,这成为了许多安全问题的根源。如果一个恶意用户给你一个特别长的字符串会发生什么状况?如果没有足够的空间去保存这个特别长的字符串会发生什么状况?你可以使用一个字符串复制函数来做复制,直到遇到空终止符为止,但是因为字符串特别长,而覆写了你的程序,怎么办?这看上去似乎有些较真,但尽管如此,缓冲区溢出攻击还是经常发生。长度前缀可以很容易地缓解这种问题,因为它可以很容易地推算出保存这个字符串所需要的缓冲区的长度。作为一个操作系统开发者,我留下这个问题,由你去决定如何才能更好地存储文本。 + +接下来的事情是,我们需要去维护一个很好的从字符到数字的映射。幸运的是,这是高度标准化的,我们有两个主要的选择,Unicode 和 ASCII。Unicode 几乎将每个单个的有用的符号都映射为数字,作为交换,我们得到的是很多很多的数字,和一个更复杂的编码方法。ASCII 为每个字符使用一个字节,因此它仅保存拉丁字母、数字、少数符号和少数特殊字符。因此,ASCII 是非常易于实现的,与 Unicode 相比,它的每个字符占用的空间并不相同,这使得字符串算法更棘手。一般操作系统上字符使用 ASCII,并不是为了显示给最终用户的(开发者和专家用户除外),给终端用户显示信息使用 Unicode,因为 Unicode 能够支持像日语字符这样的东西,并且因此可以实现本地化。 + +幸运的是,在这里我们不需要去做选择,因为它们的前 128 个字符是完全相同的,并且编码也是完全一样的。 + +表 1.1 ASCII/Unicode 符号 0-127 + +| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | | +|----| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ----| +| 00 | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT | LF | VT | FF | CR | SO | SI | | +| 10 | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS | RS | US | | +| 20 | ! | " | # | $ | % | & | . | ( | ) | * | + | , | - | . | / | | | +| 30 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? | | +| 40 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | | +| 50 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ | | +| 60 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | | +| 70 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL | + +这个表显示了前 128 个符号。一个符号的十六进制表示是行的值加上列的值,比如 A 是 41~16~。你可以惊奇地发现前两行和最后的值。这 33 个特殊字符是不可打印字符。事实上,许多人都忽略了它们。它们之所以存在是因为 ASCII 最初设计是基于计算机网络来传输数据的一种方法。因此它要发送的信息不仅仅是符号。你应该学习的重要的特殊字符是 `NUL`,它就是我们前面提到的空终止符。`HT` 水平制表符就是我们经常说的 `tab`,而 `LF` 换行符用于生成一个新行。你可能想研究和使用其它特殊字符在你的操行系统中的意义。 + +### 2、字符 + +到目前为止,我们已经知道了一些关于字符串的知识,我们可以开始想想它们是如何显示的。为了显示一个字符串,我们需要做的最基础的事情是能够显示一个字符。我们的第一个任务是编写一个 `DrawCharacter` 函数,给它一个要绘制的字符和一个位置,然后它将这个字符绘制出来。 + +```markdown +在许多操作系统中使用的 `truetype` 字体格式是很强大的,它内置有它自己的汇编语言,以确保在任何分辨率下字母看起来都是正确的。 +``` + +这就很自然地引出关于字体的讨论。我们已经知道有许多方式去按照选定的字体去显示任何给定的字母。那么字体又是如何工作的呢?在计算机科学的早期阶段,一种字体就是所有字母的一系列小图片而已,这种字体称为位图字体,而所有的字符绘制方法就是将图片复制到屏幕上。当人们想去调整字体大小时就出问题了。有时我们需要大的字母,而有时我们需要的是小的字母。尽管我们可以为每个字体、每种大小、每个字符都绘制新图片,但这种作法过于单调乏味。所以,发明了矢量字体。矢量字体不包含字体的图像,它包含的是如何去绘制字符的描述,即:一个 `o` 可能是最大字母高度的一半为半径绘制的圆。现代操作系统都几乎仅使用这种字体,因为这种字体在任何分辨率下都很完美。 + +不幸的是,虽然我很想包含一个矢量字体的格式的实现,但它的内容太多了,将占用这个站点的剩余部分。所以,我们将去实现一个位图字体,可是,如果你想去做一个正宗的图形化的操作系统,那么矢量字体将是很有用的。 + +在下载页面上的字体节中,我们提供了几个 `.bin` 文件。这些只是字体的原始二进制数据文件。为完成本教程,从等宽、单色、8x16 节中挑选你喜欢的字体。然后下载它并保存到 `source` 目录中并命名为 `font.bin` 文件。这些文件只是每个字母的单色图片,它们每个字母刚好是 8 x 16 个像素。所以,每个字母占用 16 字节,第一个字节是第一行,第二个字节是第二行,依此类推。 + +![bitmap](https://ws2.sinaimg.cn/large/006tNc79ly1fzzb2064agj305l0apt96.jpg) + +这个示意图展示了等宽、单色、8x16 的字符 A 的 `Bitstream Vera Sans Mono`。在这个文件中,我们可以找到,它从第 41~16~ × 10~16~ = 410~16~ 字节开始的十六进制序列: + +00, 00, 00, 10, 28, 28, 28, 44, 44, 7C, C6, 82, 00, 00, 00, 00 + +在这里我们将使用等宽字体,因为等宽字体的每个字符大小是相同的。不幸的是,大多数字体的复杂之处就是因为它的宽度不同,从而导致它的显示代码更复杂。在下载页面上还包含有几个其它的字体,并包含了这种字体的存储格式介绍。 + +我们回到正题。复制下列代码到 `drawing.s` 中的 `graphicsAddress` 的 `.int 0` 之后。 + +```assembly +.align 4 +font: +.incbin "font.bin" +``` + +```assembly +.incbin "file" 插入来自文件 “file” 中的二进制数据。 +``` + +这段代码复制文件中的字体数据到标签为 `font` 的地址。我们在这里使用了一个 `.align 4` 去确保每个字符都是从 16 字节的倍数开始,这是一个以后经常用到的用于加快访问速度的技巧。 + +现在我们去写绘制字符的方法。我在下面给出了伪代码,你可以尝试自己去实现它。按惯例 `>>` 的意思是逻辑右移。 + +```c +function drawCharacter(r0 is character, r1 is x, r2 is y) + if character > 127 then exit + set charAddress to font + character × 16 + for row = 0 to 15 + set bits to readByte(charAddress + row) + for bit = 0 to 7 + if test(bits >> bit, 0x1) + then setPixel(x + bit, y + row) + next + next + return r0 = 8, r1 = 16 +end function + +``` +如果直接去实现它,这显然不是个高效率的做法。像绘制字符这样的事情,效率是最重要的。因为我们要频繁使用它。我们来探索一些改善的方法,使其成为最优化的汇编代码。首先,因为我们有一个 `× 16`,你应该会马上想到它等价于逻辑左移 4 位。紧接着我们有一个变量 `row`,它只与 `charAddress` 和 `y` 相加。所以,我们可以通过增加替代变量来消除它。现在唯一的问题是如何判断我们何时完成。这时,一个很好用的 `.align 4` 上场了。我们知道,`charAddress` 将从包含 0 的低位半字节开始。这意味着我们可以通过检查低位半字节来看到进入字符数据的程度。 + +虽然我们可以消除对 `bit` 的需求,但我们必须要引入新的变量才能实现,因此最好还是保留它。剩下唯一的改进就是去除嵌套的 `bits >> bit`。 + +```c +function drawCharacter(r0 is character, r1 is x, r2 is y) + if character > 127 then exit + set charAddress to font + character << 4 + loop + set bits to readByte(charAddress) + set bit to 8 + loop + set bits to bits << 1 + set bit to bit - 1 + if test(bits, 0x100) + then setPixel(x + bit, y) + until bit = 0 + set y to y + 1 + set chadAddress to chadAddress + 1 + until charAddress AND 0b1111 = 0 + return r0 = 8, r1 = 16 +end function +``` + +现在,我们已经得到了非常接近汇编代码的代码了,并且代码也是经过优化的。下面就是上述代码用汇编写出来的代码。 + +```assembly +.globl DrawCharacter +DrawCharacter: +cmp r0,#127 +movhi r0,#0 +movhi r1,#0 +movhi pc,lr + +push {r4,r5,r6,r7,r8,lr} +x .req r4 +y .req r5 +charAddr .req r6 +mov x,r1 +mov y,r2 +ldr charAddr,=font +add charAddr, r0,lsl #4 + +lineLoop$: + + bits .req r7 + bit .req r8 + ldrb bits,[charAddr] + mov bit,#8 + + charPixelLoop$: + + subs bit,#1 + blt charPixelLoopEnd$ + lsl bits,#1 + tst bits,#0x100 + beq charPixelLoop$ + + add r0,x,bit + mov r1,y + bl DrawPixel + + teq bit,#0 + bne charPixelLoop$ + + charPixelLoopEnd$: + .unreq bit + .unreq bits + add y,#1 + add charAddr,#1 + tst charAddr,#0b1111 + bne lineLoop$ + +.unreq x +.unreq y +.unreq charAddr + +width .req r0 +height .req r1 +mov width,#8 +mov height,#16 + +pop {r4,r5,r6,r7,r8,pc} +.unreq width +.unreq height +``` + +### 3、字符串 + +现在,我们可以绘制字符了,我们可以绘制文本了。我们需要去写一个方法,给它一个字符串为输入,它通过递增位置来绘制出每个字符。为了做的更好,我们应该去实现新的行和制表符。是时候决定关于空终止符的问题了,如果你想让你的操作系统使用它们,可以按需来修改下面的代码。为避免这个问题,我将给 `DrawString` 函数传递一个字符串长度,以及字符串的地址,和 x 和 y 的坐标作为参数。 + +```c +function drawString(r0 is string, r1 is length, r2 is x, r3 is y) + set x0 to x + for pos = 0 to length - 1 + set char to loadByte(string + pos) + set (cwidth, cheight) to DrawCharacter(char, x, y) + if char = '\n' then + set x to x0 + set y to y + cheight + otherwise if char = '\t' then + set x1 to x + until x1 > x0 + set x1 to x1 + 5 × cwidth + loop + set x to x1 + otherwise + set x to x + cwidth + end if + next +end function +``` + +同样,这个函数与汇编代码还有很大的差距。你可以随意去尝试实现它,即可以直接实现它,也可以简化它。我在下面给出了简化后的函数和汇编代码。 + +很明显,写这个函数的人并不很有效率(感到奇怪吗?它就是我写的)。再说一次,我们有一个 `pos` 变量,它用于递增和与其它东西相加,这是完全没有必要的。我们可以去掉它,而同时进行长度递减,直到减到 0 为止,这样就少用了一个寄存器。除了那个烦人的乘以 5 以外,函数的其余部分还不错。在这里要做的一个重要事情是,将乘法移到循环外面;即便使用位移运算,乘法仍然是很慢的,由于我们总是加一个乘以 5 的相同的常数,因此没有必要重新计算它。实际上,在汇编代码中它可以在一个操作数中通过参数移位来实现,因此我将代码改变为下面这样。 + +```c +function drawString(r0 is string, r1 is length, r2 is x, r3 is y) + set x0 to x + until length = 0 + set length to length - 1 + set char to loadByte(string) + set (cwidth, cheight) to DrawCharacter(char, x, y) + if char = '\n' then + set x to x0 + set y to y + cheight + otherwise if char = '\t' then + set x1 to x + set cwidth to cwidth + cwidth << 2 + until x1 > x0 + set x1 to x1 + cwidth + loop + set x to x1 + otherwise + set x to x + cwidth + end if + set string to string + 1 + loop +end function +``` + +以下是它的汇编代码: + +```assembly +.globl DrawString +DrawString: +x .req r4 +y .req r5 +x0 .req r6 +string .req r7 +length .req r8 +char .req r9 +push {r4,r5,r6,r7,r8,r9,lr} + +mov string,r0 +mov x,r2 +mov x0,x +mov y,r3 +mov length,r1 + +stringLoop$: + subs length,#1 + blt stringLoopEnd$ + + ldrb char,[string] + add string,#1 + + mov r0,char + mov r1,x + mov r2,y + bl DrawCharacter + cwidth .req r0 + cheight .req r1 + + teq char,#'\n' + moveq x,x0 + addeq y,cheight + beq stringLoop$ + + teq char,#'\t' + addne x,cwidth + bne stringLoop$ + + add cwidth, cwidth,lsl #2 + x1 .req r1 + mov x1,x0 + + stringLoopTab$: + add x1,cwidth + cmp x,x1 + bge stringLoopTab$ + mov x,x1 + .unreq x1 + b stringLoop$ +stringLoopEnd$: +.unreq cwidth +.unreq cheight + +pop {r4,r5,r6,r7,r8,r9,pc} +.unreq x +.unreq y +.unreq x0 +.unreq string +.unreq length +``` + +```assembly +subs reg,#val 从寄存器 reg 中减去 val,然后将结果与 0 进行比较。 +``` + +这个代码中非常聪明地使用了一个新运算,`subs` 是从一个操作数中减去另一个数,保存结果,然后将结果与 0 进行比较。实现上,所有的比较都可以实现为减法后的结果与 0 进行比较,但是结果通常会丢弃。这意味着这个操作与 `cmp` 一样快。 + +### 4、你的愿意是我的命令行 + +现在,我们可以输出字符串了,而挑战是找到一个有意思的字符串去绘制。一般在这样的教程中,人们都希望去绘制 “Hello World!”,但是到目前为止,虽然我们已经能做到了,我觉得这有点“君临天下”的感觉(如果喜欢这种感觉,请随意!)。因此,作为替代,我们去继续绘制我们的命令行。 + +有一个限制是我们所做的操作系统是用在 ARM 架构的计算机上。最关键的是,在它们引导时,给它一些信息告诉它有哪些可用资源。几乎所有的处理器都有某些方式来确定这些信息,而在 ARM 上,它是通过位于地址 10016 处的数据来确定的,这个数据的格式如下: + + 1. 数据是可分解的一系列的标签。 + 2. 这里有九种类型的标签:`core`,`mem`,`videotext`,`ramdisk`,`initrd2`,`serial`,`revision`,`videolfb`,`cmdline`。 + 3. 每个标签只能出现一次,除了 'core’ 标签是必不可少的之外,其它的都是可有可无的。 + 4. 所有标签都依次放置在地址 0x100 处。 + 5. 标签列表的结束处总是有两个word,它们全为 0。 + 6. 每个标签的字节数都是 4 的倍数。 + 7. 每个标签都是以标签中(以字为单位)的标签大小开始(标签包含这个数字)。 + 8. 紧接着是包含标签编号的一个半字。编号是按上面列出的顺序,从 1 开始(`core` 是 1,`cmdline` 是 9)。 + 9. 紧接着是一个包含 544116 的半字。 + 10. 之后是标签的数据,它根据标签不同是可变的。数据大小(以字为单位)+ 2 的和总是与前面提到的长度相同。 + 11. 一个 `core` 标签的长度可以是 2 个字也可以是 5 个字。如果是 2 个字,表示没有数据,如果是 5 个字,表示它有 3 个字的数据。 + 12. 一个 `mem` 标签总是 4 个字的长度。数据是内存块的第一个地址,和内存块的长度。 + 13. 一个 `cmdline` 标签包含一个 `null` 终止符字符串,它是个内核参数。 + + +```markdown +几乎所有的操作系统都支持一个`命令行`的程序。它的想法是为选择一个程序所期望的行为而提供一个通用的机制。 +``` + +在目前的树莓派版本中,只提供了 `core`、`mem` 和 `cmdline` 标签。你可以在后面找到它们的用法,更全面的参考资料在树莓派的参考页面上。现在,我们感兴趣的是 `cmdline` 标签,因为它包含一个字符串。我们继续写一些搜索命令行标签的代码,如果找到了,以每个条目一个新行的形式输出它。命令行只是为了让操作系统理解图形处理器或用户认为的很好的事情的一个列表。在树莓派上,这包含了 MAC 地址,序列号和屏幕分辨率。字符串本身也是一个像 `key.subkey=value` 这样的由空格隔开的表达式列表。 + +我们从查找 `cmdline` 标签开始。将下列的代码复制到一个名为 `tags.s` 的新文件中。 + +```assembly +.section .data +tag_core: .int 0 +tag_mem: .int 0 +tag_videotext: .int 0 +tag_ramdisk: .int 0 +tag_initrd2: .int 0 +tag_serial: .int 0 +tag_revision: .int 0 +tag_videolfb: .int 0 +tag_cmdline: .int 0 +``` + +通过标签列表来查找是一个很慢的操作,因为这涉及到许多内存访问。因此,我们只是想实现它一次。代码创建一些数据,用于保存每个类型的第一个标签的内存地址。接下来,用下面的伪代码就可以找到一个标签了。 + +```c +function FindTag(r0 is tag) + if tag > 9 or tag = 0 then return 0 + set tagAddr to loadWord(tag_core + (tag - 1) × 4) + if not tagAddr = 0 then return tagAddr + if readWord(tag_core) = 0 then return 0 + set tagAddr to 0x100 + loop forever + set tagIndex to readHalfWord(tagAddr + 4) + if tagIndex = 0 then return FindTag(tag) + if readWord(tag_core+(tagIndex-1)×4) = 0 + then storeWord(tagAddr, tag_core+(tagIndex-1)×4) + set tagAddr to tagAddr + loadWord(tagAddr) × 4 + end loop +end function +``` +这段代码已经是优化过的,并且很接近汇编了。它尝试直接加载标签,第一次这样做是有些乐观的,但是除了第一次之外 的其它所有情况都是可以这样做的。如果失败了,它将去检查 `core` 标签是否有地址。因为 `core` 标签是必不可少的,如果它没有地址,唯一可能的原因就是它不存在。如果它有地址,那就是我们没有找到我们要找的标签。如果没有找到,那我们就需要查找所有标签的地址。这是通过读取标签编号来做的。如果标签编号为 0,意味着已经到了标签列表的结束位置。这意味着我们已经查找了目录中所有的标签。所以,如果我们再次运行我们的函数,现在它应该能够给出一个答案。如果标签编号不为 0,我们检查这个标签类型是否已经有一个地址。如果没有,我们在目录中保存这个标签的地址。然后增加这个标签的长度(以字节为单位)到标签地址中,然后去查找下一个标签。 + +尝试去用汇编实现这段代码。你将需要简化它。如果被卡住了,下面是我的答案。不要忘了 `.section .text`! + +```assembly +.section .text +.globl FindTag +FindTag: +tag .req r0 +tagList .req r1 +tagAddr .req r2 + +sub tag,#1 +cmp tag,#8 +movhi tag,#0 +movhi pc,lr + +ldr tagList,=tag_core +tagReturn$: +add tagAddr,tagList, tag,lsl #2 +ldr tagAddr,[tagAddr] + +teq tagAddr,#0 +movne r0,tagAddr +movne pc,lr + +ldr tagAddr,[tagList] +teq tagAddr,#0 +movne r0,#0 +movne pc,lr + +mov tagAddr,#0x100 +push {r4} +tagIndex .req r3 +oldAddr .req r4 +tagLoop$: +ldrh tagIndex,[tagAddr,#4] +subs tagIndex,#1 +poplt {r4} +blt tagReturn$ + +add tagIndex,tagList, tagIndex,lsl #2 +ldr oldAddr,[tagIndex] +teq oldAddr,#0 +.unreq oldAddr +streq tagAddr,[tagIndex] + +ldr tagIndex,[tagAddr] +add tagAddr, tagIndex,lsl #2 +b tagLoop$ + +.unreq tag +.unreq tagList +.unreq tagAddr +.unreq tagIndex +``` + +### 5、Hello World + +现在,我们已经万事俱备了,我们可以去绘制我们的第一个字符串了。在 `main.s` 文件中删除 `bl SetGraphicsAddress` 之后的所有代码,然后将下面的代码放进去: + +```assembly +mov r0,#9 +bl FindTag +ldr r1,[r0] +lsl r1,#2 +sub r1,#8 +add r0,#8 +mov r2,#0 +mov r3,#0 +bl DrawString +loop$: +b loop$ +``` + +这段代码简单地使用了我们的 `FindTag` 方法去查找第 9 个标签(`cmdline`),然后计算它的长度,然后传递命令和长度给 `DrawString` 方法,告诉它在 `0,0` 处绘制字符串。现在可以在树莓派上测试它了。你应该会在屏幕上看到一行文本。如果没有,请查看我们的排错页面。 + +如果一切正常,恭喜你已经能够绘制文本了。但它还有很大的改进空间。如果想去写了一个数字,或内存的一部分,或管理我们的命令行,该怎么做呢?在 [课程 9:屏幕04][2] 中,我们将学习如何维护文本和显示有用的数字和信息。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html From 8630934dcc9734848916fd49f0a697bb96202c7b Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Feb 2019 14:45:56 +0800 Subject: [PATCH 053/813] Translating by qhwdw --- ...616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md index 1ca2a16609..819cde4781 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From edaccbacf756830308ea408b9ae1373fd74cdf48 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Feb 2019 15:01:28 +0800 Subject: [PATCH 054/813] Translated by qhwdw --- ...616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md index 3e095a14d3..7f58f5da24 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -450,7 +450,7 @@ b loop$ 这段代码简单地使用了我们的 `FindTag` 方法去查找第 9 个标签(`cmdline`),然后计算它的长度,然后传递命令和长度给 `DrawString` 方法,告诉它在 `0,0` 处绘制字符串。现在可以在树莓派上测试它了。你应该会在屏幕上看到一行文本。如果没有,请查看我们的排错页面。 -如果一切正常,恭喜你已经能够绘制文本了。但它还有很大的改进空间。如果想去写了一个数字,或内存的一部分,或管理我们的命令行,该怎么做呢?在 [课程 9:屏幕04][2] 中,我们将学习如何维护文本和显示有用的数字和信息。 +如果一切正常,恭喜你已经能够绘制文本了。但它还有很大的改进空间。如果想去写了一个数字,或内存的一部分,或操作我们的命令行,该怎么做呢?在 [课程 9:屏幕04][2] 中,我们将学习如何操作文本和显示有用的数字和信息。 -------------------------------------------------------------------------------- From 1a1395ec19daa6fce67af1f49e9e65d2e64a379f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Feb 2019 18:03:57 +0800 Subject: [PATCH 055/813] PRF:20180614 An introduction to the Tornado Python web app framework.md @MjSeven --- ...to the Tornado Python web app framework.md | 67 +++++++++++-------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/translated/tech/20180614 An introduction to the Tornado Python web app framework.md b/translated/tech/20180614 An introduction to the Tornado Python web app framework.md index 3816f5138b..791eec0f53 100644 --- a/translated/tech/20180614 An introduction to the Tornado Python web app framework.md +++ b/translated/tech/20180614 An introduction to the Tornado Python web app framework.md @@ -1,28 +1,29 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (An introduction to the Tornado Python web app framework) [#]: via: (https://opensource.com/article/18/6/tornado-framework) [#]: author: (Nicholas Hunt-Walker https://opensource.com/users/nhuntwalker) [#]: url: ( ) -Python Web 框架 Tornado 简介 +Python Web 应用程序 Tornado 框架简介 ====== -在比较 Python 框架的系列文章的第三部分中,我们来了解 Tornado,它是为处理异步进程而构建的。 +> 在比较 Python 框架的系列文章的第三部分中,我们来了解 Tornado,它是为处理异步进程而构建的。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tornado.png?itok=kAa3eXIU) -在这个由四部分组成的系列文章的前两篇中,我们介绍了 [Pyramid][1] 和 [Flask][2] Web 框架。我们已经构建了两次相同的应用程序,看到了一个完全的 DIY 框架和包含更多电池的框架之间的异同。 +在这个由四部分组成的系列文章的前两篇中,我们介绍了 [Pyramid][1] 和 [Flask][2] Web 框架。我们已经构建了两次相同的应用程序,看到了一个完整的 DIY 框架和包含了更多功能的框架之间的异同。 -现在让我们来看看另一个稍微不同的选项:[Tornado 框架][3]。Tornado 在很大程度上与 Flask 一样简单,但有一个主要区别:Tornado 是专门为处理异步进程而构建的。在我们本系列所构建的应用程序中,这种特殊的酱料(译者注:这里意思是 Tornado 的异步功能)并不是非常有用,但我们将看到在哪里可以使用它,以及它在更一般的情况下是如何工作的。 +现在让我们来看看另一个稍微不同的选择:[Tornado 框架][3]。Tornado 在很大程度上与 Flask 一样简单,但有一个主要区别:Tornado 是专门为处理异步进程而构建的。在我们本系列所构建的应用程序中,这种特殊的酱料(LCTT 译注:这里意思是 Tornado 的异步功能)在我们构建的 app 中并不是非常有用,但我们将看到在哪里可以使用它,以及它在更一般的情况下是如何工作的。 -让我们继续前两篇文章中设置的流程,首先从处理设置和配置。 +让我们继续前两篇文章中模式,首先从处理设置和配置开始。 ### Tornado 启动和配置 如果你一直关注这个系列,那么第一步应该对你来说习以为常。 + ``` $ mkdir tornado_todo $ cd tornado_todo @@ -32,6 +33,7 @@ $ pipenv shell ``` 创建一个 `setup.py` 文件来安装我们的应用程序相关的东西: + ``` (tornado-someHash) $ touch setup.py # setup.py @@ -61,6 +63,7 @@ setup( ``` 因为 Tornado 不需要任何外部配置,所以我们可以直接编写 Python 代码来让程序运行。让我们创建 `todo` 目录,并用需要的前几个文件填充它。 + ``` todo/     __init__.py @@ -68,7 +71,18 @@ todo/     views.py ``` -就像 Flask 和 Pyramid 一样,Tornado 也有一些基本配置,将放在 `__init__.py` 中。从 `tornado.web` 中,我们将导入 `Application` 对象,它将处理路由和视图的连接,包括数据库(当我们谈到那里时再说)以及运行 Tornado 应用程序所需的其它额外设置。 +就像 Flask 和 Pyramid 一样,Tornado 也有一些基本配置,放在 `__init__.py` 中。从 `tornado.web` 中,我们将导入 `Application` 对象,它将处理路由和视图的连接,包括数据库(当我们谈到那里时再说)以及运行 Tornado 应用程序所需的其它额外设置。 + +``` +# __init__.py +from tornado.web import Application + +def main(): + """Construct and serve the tornado application.""" + app = Application() +``` + +像 Flask 一样,Tornado 主要是一个 DIY 框架。当构建我们的 app 时,我们必须设置该应用实例。因为 Tornado 用它自己的 HTTP 服务器来提供该应用,我们必须设置如何提供该应用。首先,在 `tornado.options.define` 中定义要监听的端口。然后我们实例化 Tornado 的 `HTTPServer`,将该 `Application` 对象的实例作为参数传递给它。 ``` # __init__.py @@ -109,13 +123,13 @@ def main():     IOLoop.current().start() ``` -我喜欢某种形式的 `print` 声明,告诉我什么时候应用程序正在提供服务,我就是这样子。如果你愿意,可以不使用 `print`。 +我喜欢某种形式的 `print` 语句,来告诉我什么时候应用程序正在提供服务,这是我的习惯。如果你愿意,可以不使用 `print`。 我们以 `IOLoop.current().start()` 开始我们的 I/O 循环。让我们进一步讨论输入,输出和异步性。 ### Python 中的异步和 I/O 循环的基础知识 -请允许我提前说明,我绝对,肯定,肯定并且安心地说不是异步编程方面的专家。就像我写的所有内容一样,接下来的内容源于我对这个概念的理解的局限性。因为我是人,可能有很深很深的缺陷。 +请允许我提前说明,我绝对,肯定,一定并且放心地说不是异步编程方面的专家。就像我写的所有内容一样,接下来的内容源于我对这个概念的理解的局限性。因为我是人,可能有很深很深的缺陷。 异步程序的主要问题是: @@ -123,7 +137,7 @@ def main(): * 数据如何出去? * 什么时候可以在不占用我全部注意力情况下运行某个过程? -由于[全局解释器锁][4](GIL),Python 被设计为一种单线程语言。对于 Python 程序必须执行的每个任务,其线程执行的全部注意力都集中在该任务的持续时间内。我们的 HTTP 服务器是用 Python 编写的,因此,当接收到数据(如 HTTP 请求)时,服务器的唯一关心的是传入的数据。这意味着,在大多数情况下,无论是程序需要运行还是处理数据,程序都将完全消耗服务器的执行线程,阻止接收其它可能的数据,直到服务器完成它需要做的事情。 +由于[全局解释器锁][4](GIL),Python 被设计为一种[单线程][5]语言。对于 Python 程序必须执行的每个任务,其线程执行的全部注意力都集中在该任务的持续时间内。我们的 HTTP 服务器是用 Python 编写的,因此,当接收到数据(如 HTTP 请求)时,服务器的唯一关心的是传入的数据。这意味着,在大多数情况下,无论是程序需要运行还是处理数据,程序都将完全消耗服务器的执行线程,阻止接收其它可能的数据,直到服务器完成它需要做的事情。 在许多情况下,这不是太成问题。典型的 Web 请求,响应周期只需要几分之一秒。除此之外,构建 HTTP 服务器的套接字可以维护待处理的传入请求的积压。因此,如果请求在该套接字处理其它内容时进入,则它很可能只是在处理之前稍微排队等待一会。对于低到中等流量的站点,几分之一秒的时间并不是什么大问题,你可以使用多个部署的实例以及 [NGINX][6] 等负载均衡器来为更大的请求负载分配流量。 @@ -182,9 +196,9 @@ def main(): 尽管经历了在 Python 中讨论异步的所有麻烦,我们还是决定暂不使用它。先来编写一个基本的 Tornado 视图。 -与我们在 Flask 和 Pyramid 实现中看到的基于函数的视图不同,Tornado 的视图都是基于类的。这意味着我们将不在使用单独的,独立的函数来规定如何处理请求。相反,传入的 HTTP 请求将被捕获并将其分配为我们定义的类的一个属性。然后,它的方法将处理相应的请求类型。 +与我们在 Flask 和 Pyramid 实现中看到的基于函数的视图不同,Tornado 的视图都是基于类的。这意味着我们将不在使用单独的、独立的函数来规定如何处理请求。相反,传入的 HTTP 请求将被捕获并将其分配为我们定义的类的一个属性。然后,它的方法将处理相应的请求类型。 -让我们从一个基本的视图开始,即在屏幕上打印 "Hello, World"。我们为 Tornado 应用程序构造的每个基于类的视图都必须继承 `tornado.web` 中的 `RequestHandler` 对象。这将设置我们需要(但不想写)的所有底层逻辑来接收请求,同时构造正确格式的 HTTP 响应。 +让我们从一个基本的视图开始,即在屏幕上打印 “Hello, World”。我们为 Tornado 应用程序构造的每个基于类的视图都必须继承 `tornado.web` 中的 `RequestHandler` 对象。这将设置我们需要(但不想写)的所有底层逻辑来接收请求,同时构造正确格式的 HTTP 响应。 ``` from tornado.web import RequestHandler @@ -197,7 +211,7 @@ class HelloWorld(RequestHandler):         self.write("Hello, world!") ``` -因为我们要处理 `GET` 请求,所以我们声明(实际上是重写) `get` 方法。我们提供文本或 JSON 可序列化对象,用 `self.write` 写入响应体。之后,我们让 `RequestHandler` 来做在发送响应之前必须完成的其它工作。 +因为我们要处理 `GET` 请求,所以我们声明(实际上是重写)了 `get` 方法。我们提供文本或 JSON 可序列化对象,用 `self.write` 写入响应体。之后,我们让 `RequestHandler` 来做在发送响应之前必须完成的其它工作。 就目前而言,此视图与 Tornado 应用程序本身并没有实际连接。我们必须回到 `__init__.py`,并稍微更新 `main` 函数。以下是新的内容: @@ -226,15 +240,15 @@ def main(): 我们将 `views.py` 文件中的 `HelloWorld` 视图导入到脚本 `__init__.py` 的顶部。然后我们添加了一个路由-视图对应的列表,作为 `Application` 实例化的第一个参数。每当我们想要在应用程序中声明一个路由时,它必须绑定到一个视图。如果需要,可以对多个路由使用相同的视图,但每个路由必须有一个视图。 -我们可以通过在 `setup.py` 中启用的 `serve_app` 命令来运行应用程序,从而确保这一切都能正常工作。查看 `http://localhost:8888/` 并看到它显示 "Hello, world!"。 +我们可以通过在 `setup.py` 中启用的 `serve_app` 命令来运行应用程序,从而确保这一切都能正常工作。查看 `http://localhost:8888/` 并看到它显示 “Hello, world!”。 当然,在这个领域中我们还能做更多,也将做更多,但现在让我们来讨论模型吧。 ### 连接数据库 -如果我们想要保留数据,我们需要连接数据库。与 Flask 一样,我们将使用一个特定于框架的 SQLAchemy 变体,名为 [tornado-sqlalchemy][7]。 +如果我们想要保留数据,就需要连接数据库。与 Flask 一样,我们将使用一个特定于框架的 SQLAchemy 变体,名为 [tornado-sqlalchemy][7]。 -为什么要使用它而不是 [SQLAlchemy][8] 呢?好吧,其实 `tornado-sqlalchemy` 具有简单 SQLAlchemy 的所有优点,因此我们仍然可以使用通用的 `Base` 声明模型,并使用我们习以为常的所有列数据类型和关系。除了我们已经从习惯中了解到的,`tornado-sqlalchemy` 还为其数据库查询功能提供了一种可访问的异步模式,专门用于与 Tornado 现有的 I/O 循环一起工作。 +为什么要使用它而不是 [SQLAlchemy][8] 呢?好吧,其实 `tornado-sqlalchemy` 具有简单 SQLAlchemy 的所有优点,因此我们仍然可以使用通用的 `Base` 声明模型,并使用我们习以为常的所有列数据类型和关系。除了我们已经惯常了解到的,`tornado-sqlalchemy` 还为其数据库查询功能提供了一种可访问的异步模式,专门用于与 Tornado 现有的 I/O 循环一起工作。 我们通过将 `tornado-sqlalchemy` 和 `psycopg2` 添加到 `setup.py` 到所需包的列表并重新安装包来创建环境。在 `models.py` 中,我们声明了模型。这一步看起来与我们在 Flask 和 Pyramid 中已经看到的完全一样,所以我将跳过全部声明,只列出了 `Task` 模型的必要部分。 @@ -463,7 +477,7 @@ class TaskListView(BaseView):                 }) ``` -这里的第一个主要部分是 `@coroutine` 装饰器,它从 `tornado.gen` 导入。任何具有与调用堆栈的正常流程不同步的部分的 Python 可调用实际上是“协程”。一个可以与其它协程一起运行的协程。在我的家务劳动的例子中,几乎所有的家务活都是一个共同的例行协程。有些人阻止了例行协程(例如,给地板吸尘),但这种例行协程只会阻碍我开始或关心其它任何事情的能力。它没有阻止已经启动的任何其他协程继续进行。 +这里的第一个主要部分是 `@coroutine` 装饰器,它从 `tornado.gen` 导入。任何具有与调用堆栈的正常流程不同步的 Python 可调用部分实际上是“协程”,即一个可以与其它协程一起运行的协程。在我的家务劳动的例子中,几乎所有的家务活都是一个共同的例行协程。有些阻止了例行协程(例如,给地板吸尘),但这种例行协程只会阻碍我开始或关心其它任何事情的能力。它没有阻止已经启动的任何其他协程继续进行。 Tornado 提供了许多方法来构建一个利用协程的应用程序,包括允许我们设置函数调用锁,同步异步协程的条件,以及手动修改控制 I/O 循环的事件系统。 @@ -525,9 +539,9 @@ def post(self, username): 在我们继续浏览这些 Web 框架时,我们开始看到它们都可以有效地处理相同的问题。对于像这样的待办事项列表,任何框架都可以完成这项任务。但是,有些 Web 框架比其它框架更适合某些工作,这具体取决于对你来说什么“更合适”和你的需求。 -虽然 Tornado 显然能够处理 Pyramid 或 Flask 可以处理的相同工作,但将它用于这样的应用程序实际上是一种浪费,这就像开车从家走一个街区(to 校正:这里意思应该是从家开始走一个街区只需步行即可)。是的,它可以完成“旅行”的工作,但短途旅行不是你选择汽车而不是自行车或者使用双脚的原因。 +虽然 Tornado 显然和 Pyramid 或 Flask 一样可以处理相同工作,但将它用于这样的应用程序实际上是一种浪费,这就像开车从家走一个街区(LCTT 译注:这里意思应该是从家开始走一个街区只需步行即可)。是的,它可以完成“旅行”的工作,但短途旅行不是你选择汽车而不是自行车或者使用双脚的原因。 -根据文档,Tornado 被称为 “Python Web 框架和异步网络库”。在 Python Web 框架生态系统中很少有人喜欢它。如果你尝试完成的工作需要(或将从中获益)以任何方式,形状或形式的异步性,使用 Tornado。如果你的应用程序需要处理多个长期连接,同时又不想牺牲太多性能,选择 Tornado。如果你的应用程序是多个应用程序,并且需要线程感知以准确处理数据,使用 Tornado。这是它最有效的地方。 +根据文档,Tornado 被称为 “Python Web 框架和异步网络库”。在 Python Web 框架生态系统中很少有人喜欢它。如果你尝试完成的工作需要(或将从中获益)以任何方式、形状或形式的异步性,使用 Tornado。如果你的应用程序需要处理多个长期连接,同时又不想牺牲太多性能,选择 Tornado。如果你的应用程序是多个应用程序,并且需要线程感知以准确处理数据,使用 Tornado。这是它最有效的地方。 用你的汽车做“汽车的事情”,使用其他交通工具做其他事情。 @@ -535,13 +549,10 @@ def post(self, username): 谈到使用合适的工具来完成合适的工作,在选择框架时,请记住应用程序的范围和规模,包括现在和未来。到目前为止,我们只研究了适用于中小型 Web 应用程序的框架。本系列的下一篇也是最后一篇将介绍最受欢迎的 Python 框架之一 Django,它适用于可能会变得更大的大型应用程序。同样,尽管它在技术上能够并且将会处理待办事项列表问题,但请记住,这不是它的真正用途。我们仍然会通过它来展示如何使用它来构建应用程序,但我们必须牢记框架的意图以及它是如何反映在架构中的: -  * **Flask:** 适用于小型,简单的项目。它可以使我们轻松地构建视图并将它们快速连接到路由,它可以简单地封装在一个文件中。 - -  * **Pyramid:** 适用于可能增长的项目。它包含一些配置来启动和运行。应用程序组件的独立领域可以很容易地划分并构建到任意深度,而不会忽略中央应用程序。 - -  * **Tornado:** 适用于受益于精确和有意识的 I/O 控制的项目。它允许协程,并轻松公开可以控制如何接收请求或发送响应以及何时发生这些操作的方法。 - -  * **Django:**(我们将会看到)意味着可能会变得更大的东西。它有着非常庞大的生态系统,包括大量插件和模块。它非常有主见的配置和管理,以保持所有不同部分在同一条线上。 +* **Flask**: 适用于小型,简单的项目。它可以使我们轻松地构建视图并将它们快速连接到路由,它可以简单地封装在一个文件中。 +* **Pyramid**: 适用于可能增长的项目。它包含一些配置来启动和运行。应用程序组件的独立领域可以很容易地划分并构建到任意深度,而不会忽略中央应用程序。 +* **Tornado**: 适用于受益于精确和有意识的 I/O 控制的项目。它允许协程,并轻松公开可以控制如何接收请求或发送响应以及何时发生这些操作的方法。 +* **Django**:(我们将会看到)意味着可能会变得更大的东西。它有着非常庞大的生态系统,包括大量插件和模块。它非常有主见的配置和管理,以保持所有不同部分在同一条线上。 无论你是从本系列的第一篇文章开始阅读,还是稍后才加入的,都要感谢阅读!请随意留下问题或意见。下次再见时,我手里会拿着 Django。 @@ -549,7 +560,7 @@ def post(self, username): 我必须把功劳归于它应得的地方,非常感谢 [Guido van Rossum][12],不仅仅是因为他创造了我最喜欢的编程语言。 -在 [PyCascades 2018][13] 期间,我很幸运的不仅给了基于这个文章系列的演讲,而且还被邀请参加了演讲者的晚宴。整个晚上我都坐在 Guido 旁边,不停地问他问题。其中一个问题是,在 Python 中异步到底是如何工作的,但他没有一点大惊小怪,而是花时间向我解释,让我开始理解这个概念。他后来[推特给我][14]发了一条消息:是用于学习异步 Python 的广阔资源。我随后在三个月内阅读了三次,然后写了这篇文章。你真是一个非常棒的人,Guido! +在 [PyCascades 2018][13] 期间,我很幸运的不仅做了基于这个文章系列的演讲,而且还被邀请参加了演讲者的晚宴。整个晚上我都坐在 Guido 旁边,不停地问他问题。其中一个问题是,在 Python 中异步到底是如何工作的,但他没有一点大惊小怪,而是花时间向我解释,让我开始理解这个概念。他后来[推特给我][14]发了一条消息:是用于学习异步 Python 的广阔资源。我随后在三个月内阅读了三次,然后写了这篇文章。你真是一个非常棒的人,Guido! -------------------------------------------------------------------------------- @@ -558,7 +569,7 @@ via: https://opensource.com/article/18/6/tornado-framework 作者:[Nicholas Hunt-Walker][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 8ad572d753db5636570f075a889c8899c73af0c2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Feb 2019 18:04:32 +0800 Subject: [PATCH 056/813] PUB:20180614 An introduction to the Tornado Python web app framework.md @MjSeven https://linux.cn/article-10522-1.html --- ...An introduction to the Tornado Python web app framework.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180614 An introduction to the Tornado Python web app framework.md (99%) diff --git a/translated/tech/20180614 An introduction to the Tornado Python web app framework.md b/published/20180614 An introduction to the Tornado Python web app framework.md similarity index 99% rename from translated/tech/20180614 An introduction to the Tornado Python web app framework.md rename to published/20180614 An introduction to the Tornado Python web app framework.md index 791eec0f53..26ff727f99 100644 --- a/translated/tech/20180614 An introduction to the Tornado Python web app framework.md +++ b/published/20180614 An introduction to the Tornado Python web app framework.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (An introduction to the Tornado Python web app framework) [#]: via: (https://opensource.com/article/18/6/tornado-framework) [#]: author: (Nicholas Hunt-Walker https://opensource.com/users/nhuntwalker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10522-1.html) Python Web 应用程序 Tornado 框架简介 ====== From 7470bce873e2c5f3968bd991ae37aecc84b37159 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Feb 2019 23:21:11 +0800 Subject: [PATCH 057/813] PRF:20171215 Top 5 Linux Music Players.md @tomjlw --- .../20171215 Top 5 Linux Music Players.md | 78 ++++++++----------- 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/translated/tech/20171215 Top 5 Linux Music Players.md b/translated/tech/20171215 Top 5 Linux Music Players.md index ceeef6fe77..59ccc3a8b7 100644 --- a/translated/tech/20171215 Top 5 Linux Music Players.md +++ b/translated/tech/20171215 Top 5 Linux Music Players.md @@ -1,112 +1,100 @@ Linux 上最好的五款音乐播放器 ====== +> Jack Wallen 盘点他最爱的五款 Linux 音乐播放器。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/live-music.jpg?itok=Ejbo4rf7_) ->Jack Wallen 盘点他最爱的五款 Linux 音乐播放器。图片来源 Creative Commons Zero ->Pixabay -不管你做什么,你都有时会来一点背景音乐。不管你是码农,运维或是一个典型的电脑用户,享受美妙的音乐都可能是你在电脑上最想做的事情之一。同时随着即将到来的假期,你可能收到一些能让你买几首新歌的礼物卡。如果你所选的音乐是数字形式(我的恰好是唱片形式)而且你的平台是 Linux 的话,你会想要一个好的图形用户界面播放器来享受音乐。 +不管你做什么,你都有时会来一点背景音乐。不管你是开发、运维或是一个典型的电脑用户,享受美妙的音乐都可能是你在电脑上最想做的事情之一。同时随着即将到来的假期,你可能收到一些能让你买几首新歌的礼物卡。如果你所选的音乐是数字形式(我的恰好是唱片形式)而且你的平台是 Linux 的话,你会想要一个好的图形用户界面播放器来享受音乐。 幸运的是,Linux 不缺好的数字音乐播放器。事实上,Linux 上有不少播放器,大部分是开源并且可以免费获得的。让我们看看其中的几款,看哪个能满足你的需要。 ### Clementine -我想从当了我许多年默认选项的播放器开始。[Clementine][1] 可能在播放器中提供了最好的易用性与灵活性间的平衡。Clementine是新的停运的 [Amarok][2] 音乐播放器的复刻,但它不仅限于 Linux; Clementine 在 Mac OS 和 Windows 平台上也可以获得。它的一系列特性十分惊艳,包括: +我想从我用来许多年的默认选项的播放器开始。[Clementine][1] 可能是最好的平衡了易用性与灵活性的播放器。Clementine 是新停摆的 [Amarok][2] 音乐播放器的复刻,但它不仅限于 Linux; Clementine 在 Mac OS 和 Windows 平台上也可以获得。它的一系列特性十分惊艳,包括: * 內建的均衡器 -* 可定制的界面(将现在的专辑封面显示成背景——图一) -* 播放本地音乐或者从 Spotify, Last.fm 等播放音乐 -* 便于库导向的侧边栏 -* 內建的音频转码(转成 MP3,OGG,Flac等) +* 可定制的界面(将现在的专辑封面显示成背景,见图一) +* 播放本地音乐或者从 Spotify、Last.fm 等播放音乐 +* 便于库导航的侧边栏 +* 內建的音频转码(转成 MP3、OGG、Flac 等) * 通过 [安卓应用][3] 远程控制 * 便利的搜索功能 -* 分页的播放列表 -* 简单的规律性和智能化的播放列表创建 -* 支持音乐追踪表单 +* 选项卡式播放列表 +* 简单创建常规和智能化的播放列表 +* 支持 CUE 文件 * 支持标签 - - - ![Clementine][5] - -图一:Clementine 界面可能有一点老派,但是它不可思议得灵活好用。 - -[受许可使用][6] +*图一:Clementine 界面可能有一点老派,但是它不可思议得灵活好用。* -在所有我用过的音乐播放器中,Clementine 是目前为止功能最多也是最容易使用的。它同时也包含了你能在 Linux 音乐播放器中找到的最好的均衡器(有十个频带可以调)。尽管它的界面不够时髦,但它创建、操控播放列表的能力是无与伦比的。如果你的音乐集很大,同时你想完全控制你的音乐集的话,这就是你想要的播放器。 +在所有我用过的音乐播放器中,Clementine 是目前为止功能最多也是最容易使用的。它同时也包含了你能在 Linux 音乐播放器中找到的最好的均衡器(有十个频带可以调)。尽管它的界面不够时髦,但它创建、操控播放列表的能力是无与伦比的。如果你的音乐集很大,同时你想完全操控你的音乐集的话,这就是你想要的播放器。 Clementine 可以在标准仓库中找到。它可以从你的发行版的软件中心或通过命令行来安装。 ### Rhythmbox -[Rhythmbox][7] 是 GNOME 桌面的默认播放器,但是它在其它桌面工作得也很好。Rhythmbox 的界面比 Clementine 的界面稍微时尚一点,它的设计遵循极简的理念。这并不意味着它缺乏特性,相反 Rhythmbox 提供无间隔回放,Soundcloud 支持,专辑封面显示,从 Last.fm 和 Libre.fm 导入音频,Jamendo 支持,播客订阅 (从 [Apple iTunes][8]),从网页远程控制等特性。 +[Rhythmbox][7] 是 GNOME 桌面的默认播放器,但是它在其它桌面工作得也很好。Rhythmbox 的界面比 Clementine 的界面稍微时尚一点,它的设计遵循极简的理念。这并不意味着它缺乏特性,相反 Rhythmbox 提供无间隔回放、支持 Soundcloud、专辑封面显示、从 Last.fm 和 Libre.fm 导入音频、支持 Jamendo、播客订阅(从 [Apple iTunes][8])、从网页远程控制等特性。 -在 Rhythmbox 中发现的一个很好的特性是插件支持,这使得你可以使用像 DAAP 音乐分享,FM 电台,封面艺术查找,通知,ReplayGain,歌词等特性。 +在 Rhythmbox 中发现的一个很好的特性是支持插件,这使得你可以使用像 DAAP 音乐分享、FM 电台、封面查找、通知、ReplayGain、歌词等特性。 -Rhythmbox 播放列表特性不像 Clementine 上的那么强大,但是将你的音乐整理进任何形式的快速播放列表还是很简单的。尽管 Rhythmbox 的界面(图二)比 Clementine 要时髦一点,但是它不像 Clementine 那样灵活。 +Rhythmbox 播放列表特性不像 Clementine 的那么强大,但是将你的音乐整理进任何形式的快速播放列表还是很简单的。尽管 Rhythmbox 的界面(图二)比 Clementine 要时髦一点,但是它不像 Clementine 那样灵活。 ![Rhythmbox][10] - -图二: Rhythmbox 界面简单直接。 - -[受许可使用][6] +*图二:Rhythmbox 界面简单直接。* ### VLC Media Player -对于部分人来说,[VLC][11] 在视频播放方面是无懈可击的。然而 VLC 不仅限于视频播放。事实上,VLC在播放音频文件方面做得也很好。对于 [KDE Neon][12] 用户来说,VLC 既是音乐也是视频的默认播放器。 尽管 VLC 是 Linux 市场最好的视频播放器的之一(它是我的默认播放器),它在音频方面确实略有瑕疵——缺少播放列表以及不能够连接到你网络中的远程仓库。但如果你是在寻找一种播放本地文件或者网络 mms/rtsp 的简单可靠的方式,VLC是上佳之选。VLC 确实包括一个均衡器(图三),一个压缩器以及一个空间音响。它同样也能够从捕捉到的设备录音。 +对于部分人来说,[VLC][11] 在视频播放方面是无懈可击的。然而 VLC 不仅限于视频播放。事实上,VLC在播放音频文件方面做得也很好。对于 [KDE Neon][12] 用户来说,VLC 既是音乐也是视频的默认播放器。尽管 VLC 是 Linux 市场最好的视频播放器的之一(它是我的默认播放器),它在音频方面确实略有瑕疵 —— 缺少播放列表以及不能够连接到你网络中的远程仓库。但如果你是在寻找一种播放本地文件或者网络 mms/rtsp 的简单可靠的方式,VLC 是上佳之选。VLC 包括一个均衡器(图三)、一个压缩器以及一个空间音响。它同样也能够从捕捉到的设备录音。 ![VLC][14] - -图三: 运转中的 VLC 均衡器。 - -[受许可使用][6] +*图三:运转中的 VLC 均衡器。* ### Audacious -如果你在寻找一个轻量级的音乐播放器,Audacious 完美地满足要求。这个音乐播放器相当的专一,但是它确实包括了一个均衡器和一小部分能够改善许多音频的声效(比如回声,消除默音,调节速度和音调,去除人声等——图四)。 + +如果你在寻找一个轻量级的音乐播放器,Audacious 完美地满足要求。这个音乐播放器相当的专一,但是它包括了一个均衡器和一小部分能够改善许多音频的声效(比如回声、消除默音、调节速度和音调、去除人声等,见图四)。 ![Audacious][16] - -图四: Audacious 均衡器和插件。 - -[受许可使用][6] +*图四:Audacious 均衡器和插件。* Audacious 也包括了一个十分简便的闹铃功能。它允许你设置一个能在用户选定的时间点和持续的时间段内播放选定乐段的闹铃。 ### Spotify -我必须承认,我每天都用 Spotify。我是一个 Spotify 的订阅者并用它去发现、购买新的音乐——这意味着我在不停地探索发现。辛运的是,Spotify 有一个我能按照 [Spotify官方 Linux 平台安装指导][17] 轻松安装的桌面客户端。在桌面客户端与 [安卓应用][18] 间无缝转换对我来说也大有帮助,这样我就永远不会错过我喜欢的音乐了。 +我必须承认,我每天都用 Spotify。我是一个 Spotify 的订阅者并用它去发现、购买新的音乐 —— 这意味着我在不停地探索发现。幸运的是,Spotify 有一个我能按照 [Spotify官方 Linux 平台安装指导][17] 轻松安装的桌面客户端。在桌面客户端与 [安卓应用][18] 间无缝转换对我来说也大有帮助,这样我就永远不会错过我喜欢的音乐了。 ![Spotify][16] +*图五:Linux 上的 Spotify 官方客户端。* -图五: Linux 上的 Spotify 官方客户端。 - -[受许可使用][6] - -Spotify 界面十分易于使用,事实上它完胜网页端的播放器。不要在 Linux 上装 [Spotify 网页播放器][21] 因为桌面客户端在创建管理你的播放列表方面简便得多。如果你是 Spotify 重度用户,甚至没必要用其他桌面应用的內建流传输客户端支持——一旦你用过 Spotify 桌面客户端,其它应用就根本没可比性。 +Spotify 界面十分易于使用,事实上它完胜网页端的播放器。不要在 Linux 上装 [Spotify 网页播放器][21] 因为桌面客户端在创建管理你的播放列表方面简便得多。如果你是 Spotify 重度用户,甚至没必要用其他桌面应用的內建流传输客户端支持 —— 一旦你用过 Spotify 桌面客户端,其它应用就根本没可比性。 ### 选择在你 其它选择也是有的(查看你的桌面软件中心),但这五款客户端(在我看来)是最好的了。对我来说,Clementine 和 Spotify 的组合拳就已经让我美好得唱赞歌了。尝试它们看看哪个能更好地满足你的需要。 +### 额外奖品 + +虽然这篇文章翻译于国外作者,但作为给中国的 Linux 用户看的文章,如果在一篇分享音乐播放器的文章中**不提及**网易云音乐,那一定会被猛烈吐槽(事实上,我们曾经被吐槽过好多次了,哈哈)。 + +网易云音乐是我见过的最好的音乐播放器之一,不只是在 Linux 上,它甚至还支持包括 Windows、Mac、 iOS、安卓等在内的 8 个操作系统平台。当前的 Linux 版本是 1.1.0 版,支持 64 位的深度 Linux 15 和 Ubuntu 16.04 及之后的版本。下载地址和截图就不在这里安利了,大家想必自己能找到的。 + 通过 edX 和 Linux Foundation 上免费的 ["Introduction to Linux" ][22] 课程学习更多有关 Linux 的知识。 -------------------------------------------------------------------------------- via: https://www.linux.com/learn/intro-to-linux/2017/12/top-5-linux-music-players -作者:[][a] +作者:[JACK WALLEN][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:https://www.linux.com +[a]:https://www.linux.com/users/jlwallen [1]:https://www.clementine-player.org/ [2]:https://en.wikipedia.org/wiki/Amarok_(software) [3]:https://play.google.com/store/apps/details?id=de.qspool.clementineremote From ce78c02880a48a62b73c60e5fc6df6d5ba78b5e4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Feb 2019 23:22:35 +0800 Subject: [PATCH 058/813] PUB:20171215 Top 5 Linux Music Players.md @tomjlw https://linux.cn/article-10523-1.html --- .../tech => published}/20171215 Top 5 Linux Music Players.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171215 Top 5 Linux Music Players.md (100%) diff --git a/translated/tech/20171215 Top 5 Linux Music Players.md b/published/20171215 Top 5 Linux Music Players.md similarity index 100% rename from translated/tech/20171215 Top 5 Linux Music Players.md rename to published/20171215 Top 5 Linux Music Players.md From b63f579270c792c4461573d342319631a77e3730 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 10 Feb 2019 16:23:07 +0800 Subject: [PATCH 059/813] Translated by qhwdw --- ...atory - Raspberry Pi- Lesson 9 Screen04.md | 540 ------------------ ...atory - Raspberry Pi- Lesson 9 Screen04.md | 538 +++++++++++++++++ 2 files changed, 538 insertions(+), 540 deletions(-) delete mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md create mode 100644 translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md deleted file mode 100644 index 819cde4781..0000000000 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md +++ /dev/null @@ -1,540 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 9 Screen04) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html) -[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) - -Computer Laboratory – Raspberry Pi: Lesson 9 Screen04 -====== - -The Screen04 lesson builds on Screen03, by teaching how to manipulate text. It is assumed you have the code for the [Lesson 8: Screen03][1] operating system as a basis. - -### 1 String Manipulation - -``` -Variadic functions look much less intuitive in assembly code. Nevertheless, they are useful and powerful concepts. -``` - -Being able to draw text is lovely, but unfortunately at the moment you can only draw strings which are already prepared. This is fine for displaying something like the command line, but ideally we would like to be able to display and text we so desire. As per usual, if we put the effort in and make an excellent function that does all the string manipulation we could ever want, we get much easier code later on in return. Once such complicated function in C programming is sprintf. This function generates a string based on a description given as another string and additional arguments. What is interesting about this function is that it is variadic. This means that it takes a variable number of parameters. The number of parameters depends on the exact format string, and so cannot be determined in advance. - -The full function has many options, and I list a few here. I've highlighted the ones which we will implement in this tutorial, though you can try to implement more. - -The function works by reading the format string, and then interpreting it using the table below. Once an argument is used, it is not considered again. The return value of the function is the number of characters written. If the method fails, a negative number is returned. - -Table 1.1 sprintf formatting rules -| Sequence | Meaning | -| ---------------------- | ---------------------- | -| Any character except % | Copies the character to the output. | -| %% | Writes a % character to the output. | -| %c | Writes the next argument as a character. | -| %d or %i | Writes the next argument as a base 10 signed integer. | -| %e | Writes the next argument in scientific notation using eN to mean ×10N. | -| %E | Writes the next argument in scientific notation using EN to mean ×10N. | -| %f | Writes the next argument as a decimal IEEE 754 floating point number. | -| %g | Same as the shorter of %e and %f. | -| %G | Same as the shorter of %E and %f. | -| %o | Writes the next argument as a base 8 unsigned integer. | -| %s | Writes the next argument as if it were a pointer to a null terminated string. | -| %u | Writes the next argument as a base 10 unsigned integer. | -| %x | Writes the next argument as a base 16 unsigned integer, with lowercase a,b,c,d,e and f. | -| %X | Writes the next argument as a base 16 unsigned integer, with uppercase A,B,C,D,E and F. | -| %p | Writes the next argument as a pointer address. | -| %n | Writes nothing. Copies instead the number of characters written so far to the location addressed by the next argument. | - -Further to the above, many additional tweaks exist to the sequences, such as specifying minimum length, signs, etc. More information can be found at [sprintf - C++ Reference][2]. - -Here are a few examples of calls to the method and their results to illustrate its use. - -Table 1.2 sprintf example calls -| Format String | Arguments | Result | -| "%d" | 13 | "13" | -| "+%d degrees" | 12 | "+12 degrees" | -| "+%x degrees" | 24 | "+1c degrees" | -| "'%c' = 0%o" | 65, 65 | "'A' = 0101" | -| "%d * %d%% = %d" | 200, 40, 80 | "200 * 40% = 80" | -| "+%d degrees" | -5 | "+-5 degrees" | -| "+%u degrees" | -5 | "+4294967291 degrees" | - -Hopefully you can already begin to see the usefulness of the function. It does take a fair amount of work to program, but our reward is a very general function we can use for all sorts of purposes. - -### 2 Division - -``` -Division is the slowest and most complicated of the basic mathematical operators. It is not implemented directly in ARM assembly code because it takes so long to deduce the answer, and so isn't a 'simple' operation. -``` - -While this function does look very powerful, it also looks very complicated. The easiest way to deal with its many cases is probably to write functions to deal with some common tasks it has. What would be useful would be a function to generate the string for a signed and an unsigned number in any base. So, how can we go about doing that? Try to devise an algorithm quickly before reading on. - -The easiest way is probably the exact way I mentioned in [Lesson 1: OK01][3], which is the division remainder method. The idea is the following: - - 1. Divide the current value by the base you're working in. - 2. Store the remainder. - 3. If the new value is not 0, go to 1. - 4. Reverse the order of the remainders. This is the answer. - - - -For example: - -Table 2.1 Example base 2 -conversion -| Value | New Value | Remainder | -| ----- | --------- | --------- | -| 137 | 68 | 1 | -| 68 | 34 | 0 | -| 34 | 17 | 0 | -| 17 | 8 | 1 | -| 8 | 4 | 0 | -| 4 | 2 | 0 | -| 2 | 1 | 0 | -| 1 | 0 | 1 | - -So the answer is 100010012 - -The unfortunate part about this procedure is that it unavoidably uses division. Therefore, we must first contemplate division in binary. - -For a refresher on long division expand the box below. - -``` -Let's suppose we wish to divide 4135 by 17. - - 0243 r 4 -17)4135 - 0 0 × 17 = 0000 - 4135 4135 - 0 = 4135 - 34 200 × 17 = 3400 - 735 4135 - 3400 = 735 - 68 40 × 17 = 680 - 55 735 - 680 = 55 - 51 3 × 17 = 51 - 4 55 - 51 = 4 - Answer: 243 remainder 4 - -First of all we would look at the top digit of the dividend. We see that the smallest multiple of the divisor which is less or equal to it is 0. We output a 0 to the result. - -Next we look at the second to top digit of the dividend and all higher digits. We see the smallest multiple of the divisor which is less than or equal is 34. We output a 2 and subtract 3400. - -Next we look at the third digit of the dividend and all higher digits. The smallest multiple of the divisor that is less than or equal to this is 68. We output 4 and subtract 680. - -Finally we look at all remaining digits. We see that the lowest multiple of the divisor that is less than the remaining digits is 51. We output a 3, subtract 51. The result of the subtraction is our remainder. -``` - -To implement division in assembly code, we will implement binary long division. We do this because the numbers are stored in binary, which gives us easy access to the all important bit shift operations, and because division in binary is simpler than in any higher base due to the much lower number of cases. - -``` - 1011 r 1 -1010)1101111 - 1010 - 11111 - 1010 - 1011 - 1010 - 1 -This example shows how binary long division works. You simply shift the divisor as far right as possible without exceeding the dividend, output a 1 according to the poisition and subtract the number. Whatever remains is the remainder. In this case we show 11011112 ÷ 10102 = 10112 remainder 12. In decimal, 111 ÷ 10 = 11 remainder 1. -``` - - -Try to implement long division yourself now. You should write a function, DivideU32 which divides r0 by r1, returning the result in r0, and the remainder in r1. Below, we will go through a very efficient implementation. - -``` -function DivideU32(r0 is dividend, r1 is divisor) - set shift to 31 - set result to 0 - while shift ≥ 0 - if dividend ≥ (divisor << shift) then - set dividend to dividend - (divisor << shift) - set result to result + 1 - end if - set result to result << 1 - set shift to shift - 1 - loop - return (result, dividend) -end function -``` - -This code does achieve what we need, but would not work as assembly code. Our problem comes from the fact that our registers only hold 32 bits, and so the result of divisor << shift may not fit in a register (we call this overflow). This is a real problem. Did your solution have overflow? - -Fortunately, an instruction exists called clz or count leading zeros, which counts the number of zeros in the binary representation of a number starting at the top bit. Conveniently, this is exactly the number of times we can shift the register left before overflow occurs. Another optimisation you may spot is that we compute divisor << shift twice each loop. We could improve upon this by shifting the divisor at the beginning, then shifting it down at the end of each loop to avoid any need to shift it elsewhere. - -Let's have a look at the assembly code to make further improvements. - -``` -.globl DivideU32 -DivideU32: -result .req r0 -remainder .req r1 -shift .req r2 -current .req r3 - -clz shift,r1 -lsl current,r1,shift -mov remainder,r0 -mov result,#0 - -divideU32Loop$: - cmp shift,#0 - blt divideU32Return$ - cmp remainder,current - - addge result,result,#1 - subge remainder,current - sub shift,#1 - lsr current,#1 - lsl result,#1 - b divideU32Loop$ -divideU32Return$: -.unreq current -mov pc,lr - -.unreq result -.unreq remainder -.unreq shift -``` - -``` -clz dest,src stores the number of zeros from the top to the first one of register dest to register src -``` - -You may, quite rightly, think that this looks quite efficient. It is pretty good, but division is a very expensive operation, and one we may wish to do quite often, so it would be good if we could improve the speed in any way. When looking to optimise code with a loop in it, it is always important to consider how many times the loop must run. In this case, the loop will run a maximum of 31 times for an input of 1. Without making special cases, this could often be improved easily. For example when dividing 1 by 1, no shift is required, yet we shift the divisor to each of the positions above it. This could be improved by simply using the new clz command on the dividend and subtracting this from the shift. In the case of 1 ÷ 1, this means shift would be set to 0, rightly indicating no shift is required. If this causes the shift to be negative, the divisor is bigger than the dividend and so we know the result is 0 remainder the dividend. Another quick check we could make is if the current value is ever 0, then we have a perfect division and can stop looping. - -``` -.globl DivideU32 -DivideU32: -result .req r0 -remainder .req r1 -shift .req r2 -current .req r3 - -clz shift,r1 -clz r3,r0 -subs shift,r3 -lsl current,r1,shift -mov remainder,r0 -mov result,#0 -blt divideU32Return$ - -divideU32Loop$: - cmp remainder,current - blt divideU32LoopContinue$ - - add result,result,#1 - subs remainder,current - lsleq result,shift - beq divideU32Return$ -divideU32LoopContinue$: - subs shift,#1 - lsrge current,#1 - lslge result,#1 - bge divideU32Loop$ - -divideU32Return$: -.unreq current -mov pc,lr - -.unreq result -.unreq remainder -.unreq shift -``` - -Copy the code above to a file called 'maths.s'. - -### 3 Number Strings - -Now that we can do division, let's have another look at implementing number to string conversion. The following is pseudo code to convert numbers from registers into strings in up to base 36. By convention, a % b means the remainder of dividing a by b. - -``` -function SignedString(r0 is value, r1 is dest, r2 is base) - if value ≥ 0 - then return UnsignedString(value, dest, base) - otherwise - if dest > 0 then - setByte(dest, '-') - set dest to dest + 1 - end if - return UnsignedString(-value, dest, base) + 1 - end if -end function - -function UnsignedString(r0 is value, r1 is dest, r2 is base) - set length to 0 - do - - set (value, rem) to DivideU32(value, base) - if rem > 10 - then set rem to rem + '0' - otherwise set rem to rem - 10 + 'a' - if dest > 0 - then setByte(dest + length, rem) - set length to length + 1 - - while value > 0 - if dest > 0 - then ReverseString(dest, length) - return length -end function - -function ReverseString(r0 is string, r1 is length) - set end to string + length - 1 - while end > start - set temp1 to readByte(start) - set temp2 to readByte(end) - setByte(start, temp2) - setByte(end, temp1) - set start to start + 1 - set end to end - 1 - end while -end function -``` - -In a file called 'text.s' implement the above. Remember that if you get stuck, a full solution can be found on the downloads page. - -### 4 Format Strings - -Let's get back to our string formatting method. Since we're programming our own operating system, we can add or change formatting rules as we please. We may find it useful to add a %b operation that outputs a number in binary, and if you're not using null terminated strings, you may wish to alter the behaviour of %s to take the length of the string from another argument, or from a length prefix if you wish. I will use a null terminator in the example below. - -One of the main obstacles to implementing this function is that the number of arguments varies. According to the ABI, additional arguments are pushed onto the stack before calling the method in reverse order. So, for example, if we wish to call our method with 8 parameters; 1,2,3,4,5,6,7 and 8, we would do the following: - - 1. Set r0 = 5, r1 = 6, r2 = 7, r3 = 8 - 2. Push {r0,r1,r2,r3} - 3. Set r0 = 1, r1 = 2, r2 = 3, r3 = 4 - 4. Call the function - 5. Add sp,#4*4 - - - -Now we must decide what arguments our function actually needs. In my case, I used the format string address in r0, the length of the format string in r1, the destination string address in r2, followed by the list of arguments required, starting in r3 and continuing on the stack as above. If you wish to use a null terminated format string, the parameter in r1 can be removed. If you wish to have a maximum buffer length, you could store this in r3. As an additional modification, I think it is useful to alter the function so that if the destination string address is 0, no string is outputted, but an accurate length is still returned, so that the length of a formatted string can be accurately determined. - -If you wish to attempt the implementation on your own, try it now. If not, I will first construct the pseudo code for the method, then give the assembly code implementation. - -``` -function StringFormat(r0 is format, r1 is formatLength, r2 is dest, ...) - set index to 0 - set length to 0 - while index < formatLength - if readByte(format + index) = '%' then - set index to index + 1 - if readByte(format + index) = '%' then - if dest > 0 - then setByte(dest + length, '%') - set length to length + 1 - otherwise if readByte(format + index) = 'c' then - if dest > 0 - then setByte(dest + length, nextArg) - set length to length + 1 - otherwise if readByte(format + index) = 'd' or 'i' then - set length to length + SignedString(nextArg, dest, 10) - otherwise if readByte(format + index) = 'o' then - set length to length + UnsignedString(nextArg, dest, 8) - otherwise if readByte(format + index) = 'u' then - set length to length + UnsignedString(nextArg, dest, 10) - otherwise if readByte(format + index) = 'b' then - set length to length + UnsignedString(nextArg, dest, 2) - otherwise if readByte(format + index) = 'x' then - set length to length + UnsignedString(nextArg, dest, 16) - otherwise if readByte(format + index) = 's' then - set str to nextArg - while getByte(str) != '\0' - if dest > 0 - then setByte(dest + length, getByte(str)) - set length to length + 1 - set str to str + 1 - loop - otherwise if readByte(format + index) = 'n' then - setWord(nextArg, length) - end if - otherwise - if dest > 0 - then setByte(dest + length, readByte(format + index)) - set length to length + 1 - end if - set index to index + 1 - loop - return length -end function -``` - -Although this function is massive, it is quite straightforward. Most of the code goes into checking all the various conditions, the code for each one is simple. Further, all the various unsigned integer cases are the same but for the base, and so can be summarised in assembly. This is given below. - -``` -.globl FormatString -FormatString: -format .req r4 -formatLength .req r5 -dest .req r6 -nextArg .req r7 -argList .req r8 -length .req r9 - -push {r4,r5,r6,r7,r8,r9,lr} -mov format,r0 -mov formatLength,r1 -mov dest,r2 -mov nextArg,r3 -add argList,sp,#7*4 -mov length,#0 - -formatLoop$: - subs formatLength,#1 - movlt r0,length - poplt {r4,r5,r6,r7,r8,r9,pc} - - ldrb r0,[format] - add format,#1 - teq r0,#'%' - beq formatArg$ - -formatChar$: - teq dest,#0 - strneb r0,[dest] - addne dest,#1 - add length,#1 - b formatLoop$ - -formatArg$: - subs formatLength,#1 - movlt r0,length - poplt {r4,r5,r6,r7,r8,r9,pc} - - ldrb r0,[format] - add format,#1 - teq r0,#'%' - beq formatChar$ - - teq r0,#'c' - moveq r0,nextArg - ldreq nextArg,[argList] - addeq argList,#4 - beq formatChar$ - - teq r0,#'s' - beq formatString$ - - teq r0,#'d' - beq formatSigned$ - - teq r0,#'u' - teqne r0,#'x' - teqne r0,#'b' - teqne r0,#'o' - beq formatUnsigned$ - - b formatLoop$ - -formatString$: - ldrb r0,[nextArg] - teq r0,#0x0 - ldreq nextArg,[argList] - addeq argList,#4 - beq formatLoop$ - add length,#1 - teq dest,#0 - strneb r0,[dest] - addne dest,#1 - add nextArg,#1 - b formatString$ - -formatSigned$: - mov r0,nextArg - ldr nextArg,[argList] - add argList,#4 - mov r1,dest - mov r2,#10 - bl SignedString - teq dest,#0 - addne dest,r0 - add length,r0 - b formatLoop$ - -formatUnsigned$: - teq r0,#'u' - moveq r2,#10 - teq r0,#'x' - moveq r2,#16 - teq r0,#'b' - moveq r2,#2 - teq r0,#'o' - moveq r2,#8 - - mov r0,nextArg - ldr nextArg,[argList] - add argList,#4 - mov r1,dest - bl UnsignedString - teq dest,#0 - addne dest,r0 - add length,r0 - b formatLoop$ -``` - -### 5 Convert OS - -Feel free to try using this method however you wish. As an example, here is the code to generate a conversion chart from base 10 to binary to hexadecimal to octal and to ASCII. - -Delete all code after bl SetGraphicsAddress in 'main.s' and replace it with the following: - -``` -mov r4,#0 -loop$: -ldr r0,=format -mov r1,#formatEnd-format -ldr r2,=formatEnd -lsr r3,r4,#4 -push {r3} -push {r3} -push {r3} -push {r3} -bl FormatString -add sp,#16 - -mov r1,r0 -ldr r0,=formatEnd -mov r2,#0 -mov r3,r4 - -cmp r3,#768-16 -subhi r3,#768 -addhi r2,#256 -cmp r3,#768-16 -subhi r3,#768 -addhi r2,#256 -cmp r3,#768-16 -subhi r3,#768 -addhi r2,#256 - -bl DrawString - -add r4,#16 -b loop$ - -.section .data -format: -.ascii "%d=0b%b=0x%x=0%o='%c'" -formatEnd: -``` - -Can you work out what will happen before testing? Particularly what happens for r3 ≥ 128? Try it on the Raspberry Pi to see if you're right. If it doesn't work, please see our troubleshooting page. - -When it does work, congratulations, you've completed the Screen04 tutorial, and reached the end of the screen series! We've learned about pixels and frame buffers, and how these apply to the Raspberry Pi. We've learned how to draw simple lines, and also how to draw characters, as well as the invaluable skill of formatting numbers into text. We now have all that you would need to make graphical output on an Operating System. Can you make some more drawing methods? What about 3D graphics? Can you implement a 24bit frame buffer? What about reading the size of the framebuffer in from the command line? - -The next series is the [Input][4] series, which teaches how to use the keyboard and mouse to really get towards a traditional console computer. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html - -作者:[Alex Chadwick][a] -选题:[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.cl.cam.ac.uk -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html -[2]: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html -[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md new file mode 100644 index 0000000000..76573c4bd8 --- /dev/null +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @@ -0,0 +1,538 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 9 Screen04) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +计算机实验室 – 树莓派:课程 9 屏幕04 +====== + +屏幕04 课程基于屏幕03 课程来构建,它教你如何操作文本。假设你已经有了[课程 8:屏幕03][1] 的操作系统代码,我们将以它为基础。 + +### 1、操作字符串 + +``` +变长函数在汇编代码中看起来似乎不好理解,然而 ,它却是非常有用和很强大的概念。 +``` + +能够绘制文本是极好的,但不幸的是,现在你只能绘制预先准备好的字符串。如果能够像命令行那样显示任何东西才是完美的,而理想情况下应该是,我们能够显示任何我们期望的东西。一如既往地,如果我们付出努力而写出一个非常好的函数,它能够操作我们所希望的所有字符串,而作为回报,这将使我们以后写代码更容易。曾经如此复杂的函数,在 C 语言编程中只不过是一个 `sprintf` 而已。这个函数基于给定的另一个字符串和作为描述的额外的一个参数而生成一个字符串。我们对这个函数感兴趣的地方是,这个函数是个变长函数。这意味着它可以带可变数量的参数。参数的数量取决于具体的格式字符串,因此它的参数的数量不能预先确定。 + +完整的函数有许多选项,而我们在这里只列出了几个。在本教程中将要实现的选项我做了高亮处理,当然,你可以尝试去实现更多的选项。 + +函数通过读取格式字符串来工作,然后使用下表的意思去解释它。一旦一个参数已经使用了,就不会再次考虑它了。函数 的返回值是写入的字符数。如果方法失败,将返回一个负数。 + +表 1.1 sprintf 格式化规则 +| 选项 | 含义 | +| -------------------------- | ------------------------------------------------------------ | +| ==Any character except %== | 复制字符到输出。 | +| ==%%== | 写一个 % 字符到输出。 | +| ==%c== | 将下一个参数写成字符格式。 | +| ==%d or %i== | 将下一个参数写成十进制的有符号整数。 | +| %e | 将下一个参数写成科学记数法,使用 eN 意思是 ×10N。 | +| %E | 将下一个参数写成科学记数法,使用 EN 意思是 ×10N。 | +| %f | 将下一个参数写成十进制的 IEEE 754 浮点数。 | +| %g | 与 %e 和 %f 的指数表示形式相同。 | +| %G | 与 %E 和 %f 的指数表示形式相同。 | +| ==%o== | 将下一个参数写成八进制的无符号整数。 | +| ==%s== | 下一个参数如果是一个指针,将它写成空终止符字符串。 | +| ==%u== | 将下一个参数写成十进制无符号整数。 | +| ==%x== | 将下一个参数写成十六进制无符号整数(使用小写的 a、b、c、d、e 和 f)。 | +| %X | 将下一个参数写成十六进制的无符号整数(使用大写的 A、B、C、D、E 和 F)。 | +| %p | 将下一个参数写成指针地址。 | +| ==%n== | 什么也不输出。而是复制到目前为止被下一个参数在本地处理的字符个数。 | + +除此之外,对序列还有许多额外的处理,比如指定最小长度,符号等等。更多信息可以在 [sprintf - C++ 参考][2] 上找到。 + +下面是调用方法和返回的结果的示例。 + +表 1.2 sprintf 调用示例 +| 格式化字符串 | 参数 | 结果 | +| "%d" | 13 | "13" | +| "+%d degrees" | 12 | "+12 degrees" | +| "+%x degrees" | 24 | "+1c degrees" | +| "'%c' = 0%o" | 65, 65 | "'A' = 0101" | +| "%d * %d%% = %d" | 200, 40, 80 | "200 * 40% = 80" | +| "+%d degrees" | -5 | "+-5 degrees" | +| "+%u degrees" | -5 | "+4294967291 degrees" | + +希望你已经看到了这个函数是多么有用。实现它需要大量的编程工作,但给我们的回报却是一个非常有用的函数,可以用于各种用途。 + +### 2、除法 + +``` +除法是非常慢的,也是非常复杂的基础数学运算。它在 ARM 汇编代码中不能直接实现,因为如果直接实现的话,它得出答案需要花费很长的时间,因此它不是个“简单的”运算。 +``` + +虽然这个函数看起来很强大、也很复杂。但是,处理它的许多情况的最容易的方式可能是,编写一个函数去处理一些非常常见的任务。它是个非常有用的函数,可以为任何底的一个有符号或无符号的数字生成一个字符串。那么,我们如何去实现呢?在继续阅读之前,尝试快速地设计一个算法。 + +最简单的方法或许就是我在 [课程 1:OK01][3] 中提到的“除法余数法”。它的思路如下: + + 1. 用当前值除以你使用的底。 + 2. 保存余数。 + 3. 如果得到的新值不为 0,转到第 1 步。 + 4. 将余数反序连起来就是答案。 + + + +例如: + +表 2.1 以 2 为底的例子 +转换 + +| 值 | 新值 | 余数 | +| ---- | ---- | ---- | +| 137 | 68 | 1 | +| 68 | 34 | 0 | +| 34 | 17 | 0 | +| 17 | 8 | 1 | +| 8 | 4 | 0 | +| 4 | 2 | 0 | +| 2 | 1 | 0 | +| 1 | 0 | 1 | + +因此答案是 100010012 + +这个过程的不幸之外在于使用了除法。所以,我们必须首先要考虑二进制中的除法。 + +我们复习一下长除法 + +> 假如我们想把 4135 除以 17。 +> +> 0243 r 4 +> 17)4135 +> 0 0 × 17 = 0000 +> 4135 4135 - 0 = 4135 +> 34 200 × 17 = 3400 +> 735 4135 - 3400 = 735 +> 68 40 × 17 = 680 +> 55 735 - 680 = 55 +> 51 3 × 17 = 51 +> 4 55 - 51 = 4 +> 答案:243 余 4 +> +> 首先我们来看被除数的最高位。 我们看到它是小于或等于除数的最小倍数,因此它是 0。我们在结果中写一个 0。 +> +> 接下来我们看被除数倒数第二位和所有的高位。我们看到小于或等于那个数的除数的最小倍数是 34。我们在结果中写一个 2,和减去 3400。 +> +> 接下来我们看被除数的第三位和所有高位。我们看到小于或等于那个数的除数的最小倍数是 68。我们在结果中写一个 4,和减去 680。 +> +> 最后,我们看一下所有的余位。我们看到小于余数的除数的最小倍数是 51。我们在结果中写一个 3,减去 51。减法的结果就是我们的余数。 +> + +在汇编代码中做除法,我们将实现二进制的长除法。我们之所以实现它是因为,数字都是以二进制方式保存的,这让我们很容易地访问所有重要位的移位操作,并且因为在二进制中做除法比在其它高进制中做除法都要简单,因为它的数更少。 + +> 1011 r 1 +>1010)1101111 +> 1010 +> 11111 +> 1010 +> 1011 +> 1010 +> 1 +这个示例展示了如何做二进制的长除法。简单来说就是,在不超出被除数的情况下,尽可能将除数右移,根据位置输出一个 1,和减去这个数。剩下的就是余数。在这个例子中,我们展示了 11011112 ÷ 10102 = 10112 余数为 12。用十进制表示就是,111 ÷ 10 = 11 余 1。 + + +你自己尝试去实现这个长除法。你应该去写一个函数 `DivideU32` ,其中 `r0` 是被除数,而 `r1` 是除数,在 `r0` 中返回结果,在 `r1` 中返回余数。下面,我们将完成一个有效的实现。 + +```c +function DivideU32(r0 is dividend, r1 is divisor) + set shift to 31 + set result to 0 + while shift ≥ 0 + if dividend ≥ (divisor << shift) then + set dividend to dividend - (divisor << shift) + set result to result + 1 + end if + set result to result << 1 + set shift to shift - 1 + loop + return (result, dividend) +end function +``` + +这段代码实现了我们的目标,但却不能用于汇编代码。我们出现的问题是,我们的寄存器只能保存 32 位,而 `divisor << shift` 的结果可能在一个寄存器中装不下(我们称之为溢出)。这确实是个问题。你的解决方案是否有溢出的问题呢? + +幸运的是,有一个称为 `clz` 或 `计数前导零(count leading zeros)` 的指令,它能计算一个二进制表示的数字的前导零的个数。这样我们就可以在溢出发生之前,可以将寄存器中的值进行相应位数的左移。你可以找出的另一个优化就是,每个循环我们计算 `divisor << shift` 了两遍。我们可以通过将除数移到开始位置来改进它,然后在每个循环结束的时候将它移下去,这样可以避免将它移到别处。 + +我们来看一下进一步优化之后的汇编代码。 + +```assembly +.globl DivideU32 +DivideU32: +result .req r0 +remainder .req r1 +shift .req r2 +current .req r3 + +clz shift,r1 +lsl current,r1,shift +mov remainder,r0 +mov result,#0 + +divideU32Loop$: + cmp shift,#0 + blt divideU32Return$ + cmp remainder,current + + addge result,result,#1 + subge remainder,current + sub shift,#1 + lsr current,#1 + lsl result,#1 + b divideU32Loop$ +divideU32Return$: +.unreq current +mov pc,lr + +.unreq result +.unreq remainder +.unreq shift +``` + +```assembly +clz dest,src 将第一个寄存器 dest 中二进制表示的值的前导零的数量,保存到第二个寄存器 src 中。 +``` + +你可能毫无疑问的认为这是个非常高效的作法。它是很好,但是除法是个代价非常高的操作,并且我们的其中一个愿望就是不要经常做除法,因为如果能以任何方式提升速度就是件非常好的事情。当我们查看有循环的优化代码时,我们总是重点考虑一个问题,这个循环会运行多少次。在本案例中,在输入为 1 的情况下,这个循环最多运行 31 次。在不考虑特殊情况的时候,这很容易改进。例如,当 1 除以 1 时,不需要移位,我们将把除数移到它上面的每个位置。这可以通过简单地在被除数上使用新的 clz 命令并从中减去它来改进。在 `1 ÷ 1` 的案例中,这意味着移位将设置为 0,明确地表示它不需要移位。如果它设置移位为负数,表示除数大于被除数,因此我们就可以知道结果是 0,而余数是被除数。我们可以做的另一个快速检查就是,如果当前值为 0,那么它是一个整除的除法,我们就可以停止循环了。 + +```assembly +.globl DivideU32 +DivideU32: +result .req r0 +remainder .req r1 +shift .req r2 +current .req r3 + +clz shift,r1 +clz r3,r0 +subs shift,r3 +lsl current,r1,shift +mov remainder,r0 +mov result,#0 +blt divideU32Return$ + +divideU32Loop$: + cmp remainder,current + blt divideU32LoopContinue$ + + add result,result,#1 + subs remainder,current + lsleq result,shift + beq divideU32Return$ +divideU32LoopContinue$: + subs shift,#1 + lsrge current,#1 + lslge result,#1 + bge divideU32Loop$ + +divideU32Return$: +.unreq current +mov pc,lr + +.unreq result +.unreq remainder +.unreq shift +``` + +复制上面的代码到一个名为 `maths.s` 的文件中。 + +### 3、数字字符串 + +现在,我们已经可以做除法了,我们来看一下另外的一个将数字转换为字符串的实现。下列的伪代码将寄存器中的一个数字转换成以 36 为底的字符串。根据惯例,a % b 表示 a 被 b 相除之后的余数。 + +```c +function SignedString(r0 is value, r1 is dest, r2 is base) + if value ≥ 0 + then return UnsignedString(value, dest, base) + otherwise + if dest > 0 then + setByte(dest, '-') + set dest to dest + 1 + end if + return UnsignedString(-value, dest, base) + 1 + end if +end function + +function UnsignedString(r0 is value, r1 is dest, r2 is base) + set length to 0 + do + + set (value, rem) to DivideU32(value, base) + if rem > 10 + then set rem to rem + '0' + otherwise set rem to rem - 10 + 'a' + if dest > 0 + then setByte(dest + length, rem) + set length to length + 1 + + while value > 0 + if dest > 0 + then ReverseString(dest, length) + return length +end function + +function ReverseString(r0 is string, r1 is length) + set end to string + length - 1 + while end > start + set temp1 to readByte(start) + set temp2 to readByte(end) + setByte(start, temp2) + setByte(end, temp1) + set start to start + 1 + set end to end - 1 + end while +end function +``` + +上述代码实现在一个名为 `text.s` 的汇编文件中。记住,如果你遇到了困难,可以在下载页面找到完整的解决方案。 + +### 4、格式化字符串 + +我们继续回到我们的字符串格式化方法。因为我们正在编写我们自己的操作系统,我们根据我们自己的意愿来添加或修改格式化规则。我们可以发现,添加一个 `a %b` 操作去输出一个二进制的数字比较有用,而如果你不使用空终止符字符串,那么你应该去修改 `%s` 的行为,让它从另一个参数中得到字符串的长度,或者如果你愿意,可以从长度前缀中获取。我在下面的示例中使用了一个空终止符。 + +实现这个函数的一个主要的障碍是它的参数个数是可变的。根据 ABI 规定,额外的参数在调用方法之前以相反的顺序先推送到栈上。比如,我们使用 8 个参数 1、2、3、4、5、6、7 和 8 来调用我们的方法,我们将按下面的顺序来处理: + + 1. Set r0 = 5、r1 = 6、r2 = 7、r3 = 8 + 2. Push {r0,r1,r2,r3} + 3. Set r0 = 1、r1 = 2、r2 = 3、r3 = 4 + 4. 调用函数 + 5. Add sp,#4*4 + + + +现在,我们必须确定我们的函数确切需要的参数。在我的案例中,我将寄存器 `r0` 用来保存格式化字符串地址,格式化字符串长度则放在寄存器 `r1` 中,目标字符串地址放在寄存器 `r2` 中,紧接着是要求的参数列表,从寄存器 `r3` 开始和像上面描述的那样在栈上继续。如果你想去使用一个空终止符格式化字符串,在寄存器 r1 中的参数将被移除。如果你想有一个最大缓冲区长度,你可以将它保存在寄存器 `r3` 中。由于有额外的修改,我认为这样修改函数是很有用的,如果目标字符串地址为 0,意味着没有字符串被输出,但如果仍然返回一个精确的长度,意味着能够精确的判断格式化字符串的长度。 + +如果你希望尝试实现你自己的函数,现在就可以去做了。如果不去实现你自己的,下面我将首先构建方法的伪代码,然后给出实现的汇编代码。 + +```c +function StringFormat(r0 is format, r1 is formatLength, r2 is dest, ...) + set index to 0 + set length to 0 + while index < formatLength + if readByte(format + index) = '%' then + set index to index + 1 + if readByte(format + index) = '%' then + if dest > 0 + then setByte(dest + length, '%') + set length to length + 1 + otherwise if readByte(format + index) = 'c' then + if dest > 0 + then setByte(dest + length, nextArg) + set length to length + 1 + otherwise if readByte(format + index) = 'd' or 'i' then + set length to length + SignedString(nextArg, dest, 10) + otherwise if readByte(format + index) = 'o' then + set length to length + UnsignedString(nextArg, dest, 8) + otherwise if readByte(format + index) = 'u' then + set length to length + UnsignedString(nextArg, dest, 10) + otherwise if readByte(format + index) = 'b' then + set length to length + UnsignedString(nextArg, dest, 2) + otherwise if readByte(format + index) = 'x' then + set length to length + UnsignedString(nextArg, dest, 16) + otherwise if readByte(format + index) = 's' then + set str to nextArg + while getByte(str) != '\0' + if dest > 0 + then setByte(dest + length, getByte(str)) + set length to length + 1 + set str to str + 1 + loop + otherwise if readByte(format + index) = 'n' then + setWord(nextArg, length) + end if + otherwise + if dest > 0 + then setByte(dest + length, readByte(format + index)) + set length to length + 1 + end if + set index to index + 1 + loop + return length +end function +``` + +虽然这个函数很大,但它还是很简单的。大多数的代码都是在检查所有各种条件,每个代码都是很简单的。此外,所有的无符号整数的大小写都是相同的(除了底以外)。因此在汇编中可以将它们汇总。下面是它的汇编代码。 + +```assembly +.globl FormatString +FormatString: +format .req r4 +formatLength .req r5 +dest .req r6 +nextArg .req r7 +argList .req r8 +length .req r9 + +push {r4,r5,r6,r7,r8,r9,lr} +mov format,r0 +mov formatLength,r1 +mov dest,r2 +mov nextArg,r3 +add argList,sp,#7*4 +mov length,#0 + +formatLoop$: + subs formatLength,#1 + movlt r0,length + poplt {r4,r5,r6,r7,r8,r9,pc} + + ldrb r0,[format] + add format,#1 + teq r0,#'%' + beq formatArg$ + +formatChar$: + teq dest,#0 + strneb r0,[dest] + addne dest,#1 + add length,#1 + b formatLoop$ + +formatArg$: + subs formatLength,#1 + movlt r0,length + poplt {r4,r5,r6,r7,r8,r9,pc} + + ldrb r0,[format] + add format,#1 + teq r0,#'%' + beq formatChar$ + + teq r0,#'c' + moveq r0,nextArg + ldreq nextArg,[argList] + addeq argList,#4 + beq formatChar$ + + teq r0,#'s' + beq formatString$ + + teq r0,#'d' + beq formatSigned$ + + teq r0,#'u' + teqne r0,#'x' + teqne r0,#'b' + teqne r0,#'o' + beq formatUnsigned$ + + b formatLoop$ + +formatString$: + ldrb r0,[nextArg] + teq r0,#0x0 + ldreq nextArg,[argList] + addeq argList,#4 + beq formatLoop$ + add length,#1 + teq dest,#0 + strneb r0,[dest] + addne dest,#1 + add nextArg,#1 + b formatString$ + +formatSigned$: + mov r0,nextArg + ldr nextArg,[argList] + add argList,#4 + mov r1,dest + mov r2,#10 + bl SignedString + teq dest,#0 + addne dest,r0 + add length,r0 + b formatLoop$ + +formatUnsigned$: + teq r0,#'u' + moveq r2,#10 + teq r0,#'x' + moveq r2,#16 + teq r0,#'b' + moveq r2,#2 + teq r0,#'o' + moveq r2,#8 + + mov r0,nextArg + ldr nextArg,[argList] + add argList,#4 + mov r1,dest + bl UnsignedString + teq dest,#0 + addne dest,r0 + add length,r0 + b formatLoop$ +``` + +### 5、一个转换操作系统 + +你可以使用这个方法随意转换你希望的任何东西。比如,下面的代码将生成一个换算表,可以做从十进制到二进制到十六进制到八进制以及到 ASCII 的换算操作。 + +删除 `main.s` 文件中 `bl SetGraphicsAddress` 之后的所有代码,然后粘贴以下的代码进去。 + +```assembly +mov r4,#0 +loop$: +ldr r0,=format +mov r1,#formatEnd-format +ldr r2,=formatEnd +lsr r3,r4,#4 +push {r3} +push {r3} +push {r3} +push {r3} +bl FormatString +add sp,#16 + +mov r1,r0 +ldr r0,=formatEnd +mov r2,#0 +mov r3,r4 + +cmp r3,#768-16 +subhi r3,#768 +addhi r2,#256 +cmp r3,#768-16 +subhi r3,#768 +addhi r2,#256 +cmp r3,#768-16 +subhi r3,#768 +addhi r2,#256 + +bl DrawString + +add r4,#16 +b loop$ + +.section .data +format: +.ascii "%d=0b%b=0x%x=0%o='%c'" +formatEnd: +``` + +你能在测试之前推算出将发生什么吗?特别是对于 `r3 ≥ 128` 会发生什么?尝试在树莓派上运行它,看看你是否猜对了。如果不能正常运行,请查看我们的排错页面。 + +如果一切顺利,恭喜你!你已经完成了屏幕04 教程,屏幕系列的课程结束了!我们学习了像素和帧缓冲的知识,以及如何将它们应用到树莓派上。我们学习了如何绘制简单的线条,也学习如何绘制字符,以及将数字格式化为文本的宝贵技能。我们现在已经拥有了在一个操作系统上进行图形输出的全部知识。你可以写出更多的绘制方法吗?三维绘图是什么?你能实现一个 24 位帧缓冲吗?能够从命令行上读取帧缓冲的大小吗? + +接下来的课程是[输入][4]系列课程,它将教我们如何使用键盘和鼠标去实现一个传统的计算机控制台。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html +[2]: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html From 05d96b55fc6c3da6d86b8796bb12e9ad8f7a4e2d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Feb 2019 22:30:03 +0800 Subject: [PATCH 060/813] PRF:20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @geekpi --- ...rminal program for tablets and desktops.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md index cce0f28165..6464f9af83 100644 --- a/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md +++ b/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -1,15 +1,17 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops) [#]: via: (https://opensource.com/article/19/1/productivity-tool-edex-ui) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 eDEX-UI,一款受《创:战纪》影响的平板电脑和台式机终端程序 +开始使用 eDEX-UI 吧,一款受《电子世界争霸战》影响的终端程序 ====== -使用 eDEX-UI 让你的工作更有趣,这是我们开源工具系列中的第 15 个工具,它将使你在 2019 年更高效。 + +> 使用 eDEX-UI 让你的工作更有趣,这是我们开源工具系列中的第 15 个工具,它将使你在 2019 年更高效。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx) 每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 @@ -18,25 +20,25 @@ ### eDEX-UI -当[《创:战纪》][1]上映时我才 11是岁。我不能否认,尽管这部电影充满幻想,但它对我后来的职业选择产生了影响。 +当[《电子世界争霸战》][1]上映时我才 11 岁。我不能否认,尽管这部电影充满幻想,但它对我后来的职业选择产生了影响。 ![](https://opensource.com/sites/default/files/uploads/edex-ui-1.png) -[eDEX-UI][2] 是一款专为平板电脑和台式机设计的跨平台终端程序,它受到《创:战纪》用户界面的启发。它在选项卡式界面中有五个终端,因此可以轻松地在任务之间切换,以及显示有用的系统信息。 +[eDEX-UI][2] 是一款专为平板电脑和台式机设计的跨平台终端程序,它的用户界面受到《电子世界争霸战》的启发。它在选项卡式界面中有五个终端,因此可以轻松地在任务之间切换,以及显示有用的系统信息。 在启动时,eDEX-UI 会启动一系列的东西,其中包含它所基于的 ElectronJS 系统的信息。启动后,eDEX-UI 会显示系统信息、文件浏览器、键盘(用于平板电脑)和主终端选项卡。其他四个选项卡(被标记为 EMPTY)没有加载任何内容,并且当你单击它时将启动一个 shell。eDEX-UI 中的默认 shell 是 Bash(如果在 Windows 上,则可能需要将其更改为 PowerShell 或 cmd.exe)。 ![](https://opensource.com/sites/default/files/uploads/edex-ui-2.png) -更改文件浏览器中的目录将更改活动终端中的目录,反之亦然。文件浏览器可以执行你期望的所有操作,包括在单击文件时打开关联的应用。唯一的例外是 eDEX-UI 的 settings.json 文件(默认是 .config/eDEX-UI),它会打开配置编辑器。这允许你为终端设置 shell 命令、更改主题以及修改用户界面的其他几个设置。主题也保存在配置目录中,因为它们也是 JSON 文件,所以创建自定义主题非常简单。 +更改文件浏览器中的目录也将更改活动终端中的目录,反之亦然。文件浏览器可以执行你期望的所有操作,包括在单击文件时打开关联的应用。唯一的例外是 eDEX-UI 的 `settings.json` 文件(默认在 `.config/eDEX-UI`),它会打开配置编辑器。这允许你为终端设置 shell 命令、更改主题以及修改用户界面的其他几个设置。主题也保存在配置目录中,因为它们也是 JSON 文件,所以创建自定义主题非常简单。 ![](https://opensource.com/sites/default/files/uploads/edex-ui-3.png) -eDEX-UI 允许你使用完全仿真运行五个终端。默认终端类型是 xterm-color,这意味着它支持全色彩。需要注意的一点是,输入时键盘会亮起,因此如果你在平板电脑上使用 eDEX-UI,键盘可能会在人们看见屏幕的环境中带来安全风险。因此最好在这些设备上使用没有键盘的主题,尽管在打字时看起来确实很酷。 +eDEX-UI 允许你使用完全仿真运行五个终端。默认终端类型是 xterm-color,这意味着它支持全色彩。需要注意的一点是,输入时键会亮起,因此如果你在平板电脑上使用 eDEX-UI,键盘可能会在人们看见屏幕的环境中带来安全风险。因此最好在这些设备上使用没有键盘的主题,尽管在打字时看起来确实很酷。 ![](https://opensource.com/sites/default/files/uploads/edex-ui-4.png) -虽然 eDEX-UI 仅支持五个终端窗口,但这对我来说已经足够了。在平板电脑上,eDEX-UI 给了我网络空间的感觉而不会影响我的效率。在桌面上,eDEX-UI 支持所有功能,并让我在我的同事面前显得很酷。 +虽然 eDEX-UI 仅支持五个终端窗口,但这对我来说已经足够了。在平板电脑上,eDEX-UI 给了我网络空间感而不会影响我的效率。在桌面上,eDEX-UI 支持所有功能,并让我在我的同事面前显得很酷。 -------------------------------------------------------------------------------- @@ -45,7 +47,7 @@ via: https://opensource.com/article/19/1/productivity-tool-edex-ui 作者:[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 236684c502256314b78c1377c5f12c28833a36ad Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Feb 2019 22:30:33 +0800 Subject: [PATCH 061/813] PUB:20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @geekpi https://linux.cn/article-10525-1.html --- ...on-influenced terminal program for tablets and desktops.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md (98%) diff --git a/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/published/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md similarity index 98% rename from translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md rename to published/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md index 6464f9af83..aa42bef0ea 100644 --- a/translated/tech/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md +++ b/published/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10525-1.html) [#]: subject: (Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops) [#]: via: (https://opensource.com/article/19/1/productivity-tool-edex-ui) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From cc71021cf1e892398b2efea5992d484560b222c8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Feb 2019 23:42:45 +0800 Subject: [PATCH 062/813] PRF:20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @qhwdw --- ...aboratory - Raspberry Pi- Lesson 4 OK04.md | 58 ++++++++----------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md index 69a56f3e72..dd32f12706 100644 --- a/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md +++ b/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @@ -1,26 +1,27 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 4 OK04) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 4 OK04 +计算机实验室之树莓派:课程 4 OK04 ====== -OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 `OK` 或 `ACT` LED 灯按精确的时间间隔来闪烁。假设你已经有了 [课程 3:OK03][1] 的操作系统,我们将以它为基础来构建。 +OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 OK 或 ACT LED 灯按精确的时间间隔来闪烁。假设你已经有了 [课程 3:OK03][1] 的操作系统,我们将以它为基础来构建。 ### 1、一个新设备 -定时器是树莓派保持时间的唯一方法。大多数计算机都有一个电池供电的时钟,这样当计算机关机后仍然能保持时间。 - +> 定时器是树莓派保持时间的唯一方法。大多数计算机都有一个电池供电的时钟,这样当计算机关机后仍然能保持时间。 + 到目前为止,我们仅看了树莓派硬件的一小部分,即 GPIO 控制器。我只是简单地告诉你做什么,然后它会发生什么事情。现在,我们继续看定时器,并继续带你去了解它的工作原理。 -和 GPIO 控制器一样,定时器也有地址。在本案例中,定时器的基地址在 20003000~16~。阅读手册我们可以找到下面的表: +和 GPIO 控制器一样,定时器也有地址。在本案例中,定时器的基地址在 2000300016。阅读手册我们可以找到下面的表: 表 1.1 GPIO 控制器寄存器 + | 地址 | 大小 / 字节 | 名字 | 描述 | 读或写 | | -------- | ------------ | ---------------- | ---------------------------------------------------------- | ---------------- | | 20003000 | 4 | Control / Status | 用于控制和清除定时器通道比较器匹配的寄存器 | RW | @@ -34,40 +35,33 @@ OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 这个表只告诉我们一部分内容,在手册中描述了更多的字段。手册上解释说,定时器本质上是按每微秒将计数器递增 1 的方式来运行。每次它是这样做的,它将计数器的低 32 位(4 字节)与 4 个比较器寄存器进行比较,如果匹配它们中的任何一个,它更新 `Control/Status` 以反映出其中有一个是匹配的。 -关于bit、字节、位字段bit field、以及数据大小的更多内容如下: +关于bit字节byte位字段bit field、以及数据大小的更多内容如下: > -> 一个位是一个单个的二进制数的名称。你可能还记得,一个单个的二进制数即可能是一个 1,也可能是一个 0。 +> 一个位是一个单个的二进制数的名称。你可能还记得,一个单个的二进制数既可能是一个 1,也可能是一个 0。 > -> 一个字节是一个 8 位集合的名称。由于每个位可能是 1 或 0 这两个值的其中之一,因此,一个字节有 2^8^ = 256 个不同的可能值。我们一般解释一个字节为一个介于 0 到 255(含)之间的二进制数。 +> 一个字节是一个 8 位集合的名称。由于每个位可能是 1 或 0 这两个值的其中之一,因此,一个字节有 2^8 = 256 个不同的可能值。我们一般解释一个字节为一个介于 0 到 255(含)之间的二进制数。 > > ![Diagram of GPIO function select controller register 0.][3] > > 一个位字段是解释二进制的另一种方式。二进制可以解释为许多不同的东西,而不仅仅是一个数字。一个位字段可以将二进制看做为一系列的 1(开) 或 0(关)的开关。对于每个小开关,我们都有一个意义,我们可以使用它们去控制一些东西。我们已经遇到了 GPIO 控制器使用的位字段,使用它设置一个针脚的开或关。位为 1 时 GPIO 针脚将准确地打开或关闭。有时我们需要更多的选项,而不仅仅是开或关,因此我们将几个开关组合到一起,比如 GPIO 控制器的函数设置(如上图),每 3 位为一组控制一个 GPIO 针脚的函数。 -> - 我们的目标是实现一个函数,这个函数能够以一个时间数量为输入来调用它,这个输入的时间数量将作为等待的时间,然后返回。想一想如何去做,想想我们都拥有什么。 我认为这将有两个选择: 1. 从计数器中读取一个值,然后保持分支返回到相同的代码,直到计数器的等待时间数量大于它。 - 2. 从计数器中读取一个值,加时间数量去等待,保存它到比较器寄存器,然后保持分支返回到相同的代码处,直到 `Control / Status` 寄存器更新。 - - -``` -像这样存在被称为"并发问题"的问题,并且几乎无法解决。 -``` + 2. 从计数器中读取一个值,加上要等待的时间数量,将它保存到比较器寄存器,然后保持分支返回到相同的代码处,直到 `Control / Status` 寄存器更新。 这两种策略都工作的很好,但在本教程中,我们将只实现第一个。原因是比较器寄存器更容易出错,因为在增加等待时间并保存它到比较器的寄存器期间,计数器可能已经增加了,并因此可能会不匹配。如果请求的是 1 微秒(或更糟糕的情况是 0 微秒)的等待,这样可能导致非常长的意外延迟。 +> 像这样存在被称为“并发问题”的问题,并且几乎无法解决。 + ### 2、实现 -``` -大型的操作系统通常使用等待函数来抓住机会在后台执行任务。 -``` +我将把这个创建完美的等待方法的挑战基本留给你。我建议你将所有与定时器相关的代码都放在一个名为 `systemTimer.s` 的文件中(理由很明显)。关于这个方法的复杂部分是,计数器是一个 8 字节值,而每个寄存器仅能保存 4 字节。所以,计数器值将分到 2 个寄存器中。 -我将把这个创建完美的等待方法的挑战留给你。我建议你将所有与定时器相关的代码都放在一个名为 `systemTimer.s` 的文件中(理由很明显)。关于这个方法的复杂部分是,计数器是一个 8 字节值,而每个寄存器仅能保存 4 字节。所以,计数器值将分到 2 个寄存器中。 +> 大型的操作系统通常使用等待函数来抓住机会在后台执行任务。 下列的代码块是一个示例。 @@ -75,13 +69,11 @@ OK04 课程在 OK03 的基础上进行构建,它教你如何使用定时器让 ldrd r0,r1,[r2,#4] ``` -```assembly -ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节到寄存器 regLow 和 regHigh 中。 -``` +> `ldrd regLow,regHigh,[src,#val]` 从 `src` 中的数加上 `val` 之和的地址加载 8 字节到寄存器 `regLow` 和 `regHigh` 中。 -上面的代码中你可以发现一个很有用的指令是 `ldrd`。它从两个寄存器中加载 8 字节的内存。在本案例中,这 8 字节内存从寄存器 `r2` 中的地址开始,将被复制进寄存器 `r0` 和 `r1`。这种安排的稍微复杂之处在于 `r1` 实际上只持有了高位 4 字节。换句话说就是,如果如果计数器的值是 999,999,999,999~10~ = 1110100011010100101001010000111111111111~2~ ,那么寄存器 `r1` 中只有 11101000~2~,而寄存器 `r0` 中则是 11010100101001010000111111111111~2~。 +上面的代码中你可以发现一个很有用的指令是 `ldrd`。它加载 8 字节的内存到两个寄存器中。在本案例中,这 8 字节内存从寄存器 `r2` 中的地址 + 4 开始,将被复制进寄存器 `r0` 和 `r1`。这种安排的稍微复杂之处在于 `r1` 实际上只持有了高位 4 字节。换句话说就是,如果如果计数器的值是 999,999,999,99910 = 11101000110101001010010100001111111111112 ,那么寄存器 `r1` 中只有 111010002,而寄存器 `r0` 中则是 110101001010010100001111111111112。 -实现它的更明智的方式应该是,去计算当前计数器值与来自方法启动后的那一个值的差,然后将它与要求的等待时间数量进行比较。除非恰好你希望的等待时间是支持 8 字节的,否则上面示例中寄存器 `r1` 中的值将会丢失,而计数器仅需要使用低位 4 字节。 +实现它的更明智的方式应该是,去计算当前计数器值与来自方法启动后的那一个值的差,然后将它与要求的等待时间数量进行比较。除非恰好你希望的等待时间是占用 8 字节的,否则上面示例中寄存器 `r1` 中的值将会丢弃,而计数器仅需要使用低位 4 字节。 当等待开始时,你应该总是确保使用大于比较,而不是使用等于比较,因为如果你尝试去等待一个时间,而这个时间正好等于方法开始的时间与结束的时间之差,那么你就错过这个值而永远等待下去。 @@ -97,7 +89,7 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节 > mov pc,lr > ``` > -> 另一个被证明非常有用的函数是在寄存器 `r0` 和 `r1` 中返回当前计数器值: +> 另一个被证明非常有用的函数是返回在寄存器 `r0` 和 `r1` 中的当前计数器值: > > ```assembly > .globl GetTimeStamp @@ -110,7 +102,7 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节 > > 这个函数简单地使用了 `GetSystemTimerBase` 函数,并像我们前面学过的那样,使用 `ldrd` 去加载当前计数器值。 > -> 现在,我们可以去写我们的等待方法的代码了。首先,在方法启动后,我们需要知道计数器值,当前计数器值我们现在已经可以使用 `GetTimeStamp` 来取得了。 +> 现在,我们可以去写我们的等待方法的代码了。首先,在该方法启动后,我们需要知道计数器值,我们可以使用 `GetTimeStamp` 来取得。 > > ```assembly > delay .req r2 @@ -121,9 +113,9 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节 > mov start,r0 > ``` > -> 这个代码复制我们的方法的输入,将延迟时间的数量放到寄存器 `r2` 中,然后调用 `GetTimeStamp`,这个函数将会在寄存器 `r0` 和 `r1` 中返回当前计数器值。接着复制计数器值的低位 4 字节到寄存器 `r3` 中。 +> 这个代码复制了我们的方法的输入,将延迟时间的数量放到寄存器 `r2` 中,然后调用 `GetTimeStamp`,这个函数将会返回寄存器 `r0` 和 `r1` 中的当前计数器值。接着复制计数器值的低位 4 字节到寄存器 `r3` 中。 > -> 接下来,我们需要计算当前计数器值与读入的值的差,然后持续这样做,直到它们的差至少是延迟大小为止。 +> 接下来,我们需要计算当前计数器值与读入的值的差,然后持续这样做,直到它们的差至少是 `delay` 的大小为止。 > > ```assembly > loop$: @@ -136,7 +128,7 @@ ldrd regLow,regHigh,[src,#val] 从 src 加上 val 数的地址上加载 8 字节 > bls loop$ > ``` > -> 这个代码将一直等待,一直到等待到传递给它的时间数量为止。它从计数器中读取数值,减去最初从计数器中读取的值,然后与要求的延迟时间进行比较。如果过去的时间数量小于要求的延迟,它切换到 `loop$`。 +> 这个代码将一直等待,一直到等待到传递给它的时间数量为止。它从计数器中读取数值,减去最初从计数器中读取的值,然后与要求的延迟时间进行比较。如果过去的时间数量小于要求的延迟,它切换回 `loop$`。 > > ```assembly > .unreq delay @@ -161,13 +153,13 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html 作者:[Robert Mullins][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: http://www.cl.cam.ac.uk/~rdm34 [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html +[1]: https://linux.cn/article-10519-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/systemTimer.png [3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioControllerFunctionSelect.png [4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html From f6a94b836acc68621f215862808834b8a2f86f4d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Feb 2019 23:44:51 +0800 Subject: [PATCH 063/813] PUB:20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @qhwdw https://linux.cn/article-10526-1.html --- ...20204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md (99%) diff --git a/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/published/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md similarity index 99% rename from translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md rename to published/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md index dd32f12706..e57ac869a6 100644 --- a/translated/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md +++ b/published/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10526-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 4 OK04) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From c0f89aaa213d5b40badb6c33b2890102ab4d64ce Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 Feb 2019 09:29:13 +0800 Subject: [PATCH 064/813] translated --- ...h TaskBoard, a lightweight kanban board.md | 59 ------------------- ...h TaskBoard, a lightweight kanban board.md | 58 ++++++++++++++++++ 2 files changed, 58 insertions(+), 59 deletions(-) delete mode 100644 sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md create mode 100644 translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md diff --git a/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md b/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md deleted file mode 100644 index e083d650e5..0000000000 --- a/sources/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with TaskBoard, a lightweight kanban board) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with TaskBoard, a lightweight kanban board -====== -Check out the ninth tool in our series on open source tools that will make you more productive in 2019. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the ninth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### TaskBoard - -As I wrote in the [second article][1] in this series, [kanban boards][2] are pretty popular these days. And not all kanban boards are created equal. [TaskBoard][3] is a PHP application that is easy to set up on an existing web server and has a set of functions that make it easy to use and manage. - -![](https://opensource.com/sites/default/files/uploads/taskboard-1.png) - -[Installation][4] is as simple as unzipping the files on your web server, running a script or two, and making sure the correct directories are accessible. The first time you start it up, you're presented with a login form, and then it's time to start adding users and making boards. Board creation options include adding the columns you want to use and setting the default color of the cards. You can also assign users to boards so everyone sees only the boards they need to see. - -User management is lightweight, and all accounts are local to the server. You can set a default board for everyone on the server, and users can set their own default boards, too. These options can be useful when someone works on one board more than others. - -![](https://opensource.com/sites/default/files/uploads/taskboard-2.png) - -TaskBoard also allows you to create automatic actions, which are actions taken upon changes to user assignment, columns, or card categories. Although TaskBoard is not as powerful as some other kanban apps, you can set up automatic actions to make cards more visible for board users, clear due dates, and auto-assign new cards to people as needed. For example, in the screenshot below, if a card is assigned to the "admin" user, its color is changed to red, and when a card is assigned to my user, its color is changed to teal. I've also added an action to clear an item's due date if it's added to the "To-Do" column and to auto-assign cards to my user when that happens. - -![](https://opensource.com/sites/default/files/uploads/taskboard-3.png) - -The cards are very straightforward. While they don't have a start date, they do have end dates and a points field. Points can be used for estimating the time needed, effort required, or just general priority. Using points is optional, but if you are using TaskBoard for scrum planning or other agile techniques, it is a really handy feature. You can also filter the view by users and categories. This can be helpful on a team with multiple work streams going on, as it allows a team lead or manager to get status information about progress or a person's workload. - -![](https://opensource.com/sites/default/files/uploads/taskboard-4.png) - -If you need a reasonably lightweight kanban board, check out TaskBoard. It installs quickly, has some nice features, and is very, very easy to use. It's also flexible enough to be used for development teams, personal task tracking, and a whole lot more. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-taskboard - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/19/1/productivity-tool-wekan -[2]: https://en.wikipedia.org/wiki/Kanban -[3]: https://taskboard.matthewross.me/ -[4]: https://taskboard.matthewross.me/docs/ diff --git a/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md b/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md new file mode 100644 index 0000000000..d2490b03da --- /dev/null +++ b/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with TaskBoard, a lightweight kanban board) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用轻量级看板 TaskBoard +====== +了解我们在开源工具系列中的第九个工具,它将帮助你在 2019 年提高工作效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第九个工具来帮助你在 2019 年更有效率。 + +### TaskBoard + +正如我在本系列的[第二篇文章][1]中所写的那样,[看板][2]现在非常受欢迎。并非所有的看板都是相同的。[TaskBoard][3] 是一个易于在现有 Web 服务器上部署的 PHP 应用,它有一些易于使用和管理的功能。 + +![](https://opensource.com/sites/default/files/uploads/taskboard-1.png) + +[安装][4]它只需要解压 Web 服务器上的文件,运行一两个脚本,并确保目录可正常访问。第一次启动时,你会看到一个登录页面,然后可以就可以添加用户和制作看板了。看板创建选项包括添加要使用的列以及设置卡片的默认颜色。你还可以将用户分配给指定看板,这样每个人都只能看到他们需要查看的看板。 + +用户管理是轻量级的,所有帐户都是服务器的本地帐户。你可以为服务器上的每个用户设置默认看板,用户也可以设置自己的默认看板。当有人在多个看板上工作时,这个选项非常有用。 + +![](https://opensource.com/sites/default/files/uploads/taskboard-2.png) + +TaskBoard 还允许你创建自动操作,包括更改用户分配、列或卡片类别这些操作。虽然 TaskBoard 不如其他一些看板应用那么强大,但你可以设置自动操作,使看板用户更容易看到卡片,清除截止日期,并根据需要自动为人们分配新卡片。例如,在下面的截图中,如果将卡片分配给 “admin” 用户,那么它的颜色将更改为红色,并且当将卡片分配给我的用户时,其颜色将更改为蓝绿色。如果项目已添加到“待办事项”列,我还添加了一个操作来清除项目的截止日期,并在发生这种情况时自动将卡片分配给我的用户。 + +![](https://opensource.com/sites/default/files/uploads/taskboard-3.png) + +卡片非常简单。虽然他们没有开始日期,但他们确实有结束日期和点数字段。点数可用于估计所需的时间、所需的工作量或仅是一般优先级。使用点数是可选的,但如果你使用 TaskBoard 进行 scrum 规划或其他敏捷技术,那么这是一个非常方便的功能。你还可以按用户和类别过滤视图。这对于正在进行多个工作流的团队非常有用,因为它允许团队负责人或经理了解进度状态或人员工作量。 + +![](https://opensource.com/sites/default/files/uploads/taskboard-4.png) + +如果你需要一个相当轻便的看板,请看下 TaskBoard。它安装快速,有一些很好的功能,且非常,非常容易使用。它还足够的灵活性,可用于开发团队,个人任务跟踪等等。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-taskboard + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-wekan +[2]: https://en.wikipedia.org/wiki/Kanban +[3]: https://taskboard.matthewross.me/ +[4]: https://taskboard.matthewross.me/docs/ From d67fb54d72d300a71e519fe893725bed5b69a198 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 Feb 2019 09:33:57 +0800 Subject: [PATCH 065/813] translating --- .../tech/20181224 Go on an adventure in your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181224 Go on an adventure in your Linux terminal.md b/sources/tech/20181224 Go on an adventure in your Linux terminal.md index f1b46340bb..1dd9fa3c43 100644 --- a/sources/tech/20181224 Go on an adventure in your Linux terminal.md +++ b/sources/tech/20181224 Go on an adventure in your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9dd4d404454fc1cf95fec15fd84f9d7a5d0a6fc8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 10:44:40 +0800 Subject: [PATCH 066/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190207=2010=20M?= =?UTF-8?q?ethods=20To=20Create=20A=20File=20In=20Linux=20sources/tech/201?= =?UTF-8?q?90207=2010=20Methods=20To=20Create=20A=20File=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...07 10 Methods To Create A File In Linux.md | 325 ++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 sources/tech/20190207 10 Methods To Create A File In Linux.md diff --git a/sources/tech/20190207 10 Methods To Create A File In Linux.md b/sources/tech/20190207 10 Methods To Create A File In Linux.md new file mode 100644 index 0000000000..b74bbacf13 --- /dev/null +++ b/sources/tech/20190207 10 Methods To Create A File In Linux.md @@ -0,0 +1,325 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Methods To Create A File In Linux) +[#]: via: (https://www.2daygeek.com/linux-command-to-create-a-file/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +10 Methods To Create A File In Linux +====== + +As we already know that everything is a file in Linux, that includes device as well. + +Linux admin should be performing the file creation activity multiple times (It may 20 times or 50 times or more than that, it’s depends upon their environment) in a day. + +Navigate to the following URL, if you would like to **[create a file in a specific size in Linux][1]**. + +It’s very important. how efficiently are we creating a file. Why i’m saying efficient? there is a lot of benefit if you know the efficient way to perform an activity. + +It will save you a lot of time. You can spend those valuable time on other important or major tasks, where you want to spend some more time instead of doing that in hurry. + +Here i’m including multiple ways to create a file in Linux. I advise you to choose few which is easy and efficient for you to perform your activity. + +You no need to install any of the following commands because all these commands has been installed as part of Linux core utilities except nano command. + +It can be done using the following 6 methods. + + * **`Redirect Symbol (>):`** Standard redirect symbol allow us to create a 0KB empty file in Linux. + * **`touch:`** touch command can create a 0KB empty file if does not exist. + * **`echo:`** echo command is used to display line of text that are passed as an argument. + * **`printf:`** printf command is used to display the given text on the terminal window. + * **`cat:`** It concatenate files and print on the standard output. + * **`vi/vim:`** Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. + * **`nano:`** nano is a small and friendly editor. It copies the look and feel of Pico, but is free software. + * **`head:`** head is used to print the first part of files.. + * **`tail:`** tail is used to print the last part of files.. + * **`truncate:`** truncate is used to shrink or extend the size of a file to the specified size. + + + +### How To Create A File In Linux Using Redirect Symbol (>)? + +Standard redirect symbol allow us to create a 0KB empty file in Linux. Basically it used to redirect the output of a command to a new file. When you use redirect symbol without a command then it’s create a file. + +But it won’t allow you to input any text while creating a file. However, it’s very simple and will be useful for lazy admins. To do so, simple enter the redirect symbol followed by the filename which you want. + +``` +$ > daygeek.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt +``` + +### How To Create A File In Linux Using touch Command? + +touch command is used to update the access and modification times of each FILE to the current time. + +It’s create a new file if does not exist. Also, touch command doesn’t allow us to enter any text while creating a file. By default it creates a 0KB empty file. + +``` +$ touch daygeek1.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek1.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt +``` + +### How To Create A File In Linux Using echo Command? + +echo is a built-in command found in most operating systems. It is frequently used in scripts, batch files, and as part of individual commands to insert a text. + +This is nice command that allow users to input a text while creating a file. Also, it allow us to append the text in the next time. + +``` +$ echo "2daygeek.com is a best Linux blog to learn Linux" > daygeek2.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek2.txt +-rw-rw-r-- 1 daygeek daygeek 49 Feb 4 02:04 daygeek2.txt +``` + +To view the content from the file, use the cat command. + +``` +$ cat daygeek2.txt +2daygeek.com is a best Linux blog to learn Linux +``` + +If you would like to append the content in the same file, use the double redirect Symbol (>>). + +``` +$ echo "It's FIVE years old blog" >> daygeek2.txt +``` + +You can view the appended content from the file using cat command. + +``` +$ cat daygeek2.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +### How To Create A File In Linux Using printf Command? + +printf command also works in the same way like how echo command works. + +printf command in Linux is used to display the given string on the terminal window. printf can have format specifiers, escape sequences or ordinary characters. + +``` +$ printf "2daygeek.com is a best Linux blog to learn Linux\n" > daygeek3.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek3.txt +-rw-rw-r-- 1 daygeek daygeek 48 Feb 4 02:12 daygeek3.txt +``` + +To view the content from the file, use the cat command. + +``` +$ cat daygeek3.txt +2daygeek.com is a best Linux blog to learn Linux +``` + +If you would like to append the content in the same file, use the double redirect Symbol (>>). + +``` +$ printf "It's FIVE years old blog\n" >> daygeek3.txt +``` + +You can view the appended content from the file using cat command. + +``` +$ cat daygeek3.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +### How To Create A File In Linux Using cat Command? + +cat stands for concatenate. It is very frequently used in Linux to reads data from a file. + +cat is one of the most frequently used commands on Unix-like operating systems. It’s offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file. + +``` +$ cat > daygeek4.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek4.txt +-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:18 daygeek4.txt +``` + +To view the content from the file, use the cat command. + +``` +$ cat daygeek4.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +If you would like to append the content in the same file, use the double redirect Symbol (>>). + +``` +$ cat >> daygeek4.txt +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +You can view the appended content from the file using cat command. + +``` +$ cat daygeek4.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +### How To Create A File In Linux Using vi/vim Command? + +Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs. + +There are a lot of features are available in vim to edit a single file with the command. + +``` +$ vi daygeek5.txt + +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek5.txt +-rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt +``` + +To view the content from the file, use the cat command. + +``` +$ cat daygeek5.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +### How To Create A File In Linux Using nano Command? + +Nano’s is a another editor, an enhanced free Pico clone. nano is a small and friendly editor. It copies the look and feel of Pico, but is free software, and implements several features that Pico lacks, such as: opening multiple files, scrolling per line, undo/redo, syntax coloring, line numbering, and soft-wrapping overlong lines. + +``` +$ nano daygeek6.txt + +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek6.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt +``` + +To view the content from the file, use the cat command. + +``` +$ cat daygeek6.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +### How To Create A File In Linux Using head Command? + +head command is used to output the first part of files. By default it prints the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. + +``` +$ head -c 0K /dev/zero > daygeek7.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek7.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:30 daygeek7.txt +``` + +### How To Create A File In Linux Using tail Command? + +tail command is used to output the last part of files. By default it prints the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. + +``` +$ tail -c 0K /dev/zero > daygeek8.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek8.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:31 daygeek8.txt +``` + +### How To Create A File In Linux Using truncate Command? + +truncate command is used to shrink or extend the size of a file to the specified size. + +``` +$ truncate -s 0K daygeek9.txt +``` + +Use the ls command to check the created file. + +``` +$ ls -lh daygeek9.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:37 daygeek9.txt +``` + +I have performed totally 10 commands in this article to test this. All together in the single output. + +``` +$ ls -lh daygeek* +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt +-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:07 daygeek2.txt +-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:15 daygeek3.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:20 daygeek4.txt +-rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek7.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek8.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:38 daygeek9.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-to-create-a-file/ + +作者:[Vinoth 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.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/ From c28f267a8f33fff5ad39c1bab7ad7c34ffb48f50 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 10:46:42 +0800 Subject: [PATCH 067/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=203=20Wa?= =?UTF-8?q?ys=20to=20Install=20Deb=20Files=20on=20Ubuntu=20Linux=20sources?= =?UTF-8?q?/tech/20190208=203=20Ways=20to=20Install=20Deb=20Files=20on=20U?= =?UTF-8?q?buntu=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ys to Install Deb Files on Ubuntu Linux.md | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md diff --git a/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md b/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md new file mode 100644 index 0000000000..55c1067d12 --- /dev/null +++ b/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Ways to Install Deb Files on Ubuntu Linux) +[#]: via: (https://itsfoss.com/install-deb-files-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +3 Ways to Install Deb Files on Ubuntu Linux +====== + +**This beginner article explains how to install deb packages in Ubuntu. It also shows you how to remove those deb packages afterwards.** + +This is another article in the Ubuntu beginner series. If you are absolutely new to Ubuntu, you might wonder about [how to install applications][1]. + +The easiest way is to use the Ubuntu Software Center. Search for an application by its name and install it from there. + +Life would be too simple if you could find all the applications in the Software Center. But that does not happen, unfortunately. + +Some software are available via DEB packages. These are archived files that end with .deb extension. + +You can think of .deb files as the .exe files in Windows. You double click on the .exe file and it starts the installation procedure in Windows. DEB packages are pretty much the same. + +You can find these DEB packages from the download section of the software provider’s website. For example, if you want to [install Google Chrome on Ubuntu][2], you can download the DEB package of Chrome from its website. + +Now the question arises, how do you install deb files? There are multiple ways of installing DEB packages in Ubuntu. I’ll show them to you one by one in this tutorial. + +![Install deb files in Ubuntu][3] + +### Installing .deb files in Ubuntu and Debian-based Linux Distributions + +You can choose a GUI tool or a command line tool for installing a deb package. The choice is yours. + +Let’s go on and see how to install deb files. + +#### Method 1: Use the default Software Center + +The simplest method is to use the default software center in Ubuntu. You have to do nothing special here. Simply go to the folder where you have downloaded the .deb file (it should be the Downloads folder) and double click on this file. + +![Google Chrome deb file on Ubuntu][4]Double click on the downloaded .deb file to start installation + +It will open the software center and you should see the option to install the software. All you have to do is to hit the install button and enter your login password. + +![Install Google Chrome in Ubuntu Software Center][5]The installation of deb file will be carried out via Software Center + +See, it’s even simple than installing from a .exe files on Windows, isn’t it? + +#### Method 2: Use Gdebi application for installing deb packages with dependencies + +Again, life would be a lot simpler if things always go smooth. But that’s not life as we know it. + +Now that you know that .deb files can be easily installed via Software Center, let me tell you about the dependency error that you may encounter with some packages. + +What happens is that a program may be dependent on another piece of software (libraries). When the developer is preparing the DEB package for you, he/she may assume that your system already has that piece of software on your system. + +But if that’s not the case and your system doesn’t have those required pieces of software, you’ll encounter the infamous ‘dependency error’. + +The Software Center cannot handle such errors on its own so you have to use another tool called [gdebi][6]. + +gdebi is a lightweight GUI application that has the sole purpose of installing deb packages. + +It identifies the dependencies and tries to install these dependencies along with installing the .deb files. + +![gdebi handling dependency while installing deb package][7]Image Credit: [Xmodulo][8] + +Personally, I prefer gdebi over software center for installing deb files. It is a lightweight application so the installation seems quicker. You can read in detail about [using gDebi and making it the default for installing DEB packages][6]. + +You can install gdebi from the software center or using the command below: + +``` +sudo apt install gdebi +``` + +#### Method 3: Install .deb files in command line using dpkg + +If you want to install deb packages in command lime, you can use either apt command or dpkg command. Apt command actually uses [dpkg command][9] underneath it but apt is more popular and easy to use. + +If you want to use the apt command for deb files, use it like this: + +``` +sudo apt install path_to_deb_file +``` + +If you want to use dpkg command for installing deb packages, here’s how to do it: + +``` +sudo dpkg -i path_to_deb_file +``` + +In both commands, you should replace the path_to_deb_file with the path and name of the deb file you have downloaded. + +![Install deb files using dpkg command in Ubuntu][10]Installing deb files using dpkg command in Ubuntu + +If you get a dependency error while installing the deb packages, you may use the following command to fix the dependency issues: + +``` +sudo apt install -f +``` + +### How to remove deb packages + +Removing a deb package is not a big deal as well. And no, you don’t need the original deb file that you had used for installing the program. + +#### Method 1: Remove deb packages using apt commands + +All you need is the name of the program that you have installed and then you can use apt or dpkg to remove that program. + +``` +sudo apt remove program_name +``` + +Now the question comes, how do you find the exact program name that you need to use in the remove command? The apt command has a solution for that as well. + +You can find the list of all installed files with apt command but manually going through this will be a pain. So you can use the grep command to search for your package. + +For example, I installed AppGrid application in the previous section but if I want to know the exact program name, I can use something like this: + +``` +sudo apt list --installed | grep grid +``` + +This will give me all the packages that have grid in their name and from there, I can get the exact program name. + +``` +apt list --installed | grep grid +WARNING: apt does not have a stable CLI interface. Use with caution in scripts. +appgrid/now 0.298 all [installed,local] +``` + +As you can see, a program called appgrid has been installed. Now you can use this program name with the apt remove command. + +#### Method 2: Remove deb packages using dpkg commands + +You can use dpkg to find the installed program’s name: + +``` +dpkg -l | grep grid +``` + +The output will give all the packages installed that has grid in its name. + +``` +dpkg -l | grep grid + +ii appgrid 0.298 all Discover and install apps for Ubuntu +``` + +ii in the above command output means package has been correctly installed. + +Now that you have the program name, you can use dpkg command to remove it: + +``` +dpkg -r program_name +``` + +**Tip: Updating deb packages** +Some deb packages (like Chrome) provide updates through system updates but for most other programs, you’ll have to remove the existing program and install the newer version. + +I hope this beginner guide helped you to install deb packages on Ubuntu. I added the remove part so that you’ll have better control over the programs you installed. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-deb-files-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/remove-install-software-ubuntu/ +[2]: https://itsfoss.com/install-chrome-ubuntu/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/deb-packages-ubuntu.png?resize=800%2C450&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-4.jpeg?resize=800%2C347&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-5.jpeg?resize=800%2C516&ssl=1 +[6]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/gdebi-handling-dependency.jpg?ssl=1 +[8]: http://xmodulo.com +[9]: https://help.ubuntu.com/lts/serverguide/dpkg.html.en +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-deb-file-with-dpkg.png?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/deb-packages-ubuntu.png?fit=800%2C450&ssl=1 From 6ac251d17fdbf872c8cc3feeed72b021d11cbc9f Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 10:50:27 +0800 Subject: [PATCH 068/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=20How=20?= =?UTF-8?q?To=20Install=20And=20Use=20PuTTY=20On=20Linux=20sources/tech/20?= =?UTF-8?q?190208=20How=20To=20Install=20And=20Use=20PuTTY=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...8 How To Install And Use PuTTY On Linux.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20190208 How To Install And Use PuTTY On Linux.md diff --git a/sources/tech/20190208 How To Install And Use PuTTY On Linux.md b/sources/tech/20190208 How To Install And Use PuTTY On Linux.md new file mode 100644 index 0000000000..844d55f040 --- /dev/null +++ b/sources/tech/20190208 How To Install And Use PuTTY On Linux.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install And Use PuTTY On Linux) +[#]: via: (https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Install And Use PuTTY On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-720x340.png) + +**PuTTY** is a free and open source GUI client that supports wide range of protocols including SSH, Telnet, Rlogin and serial for Windows and Unix-like operating systems. Generally, Windows admins use PuTTY as a SSH and telnet client to access the remote Linux servers from their local Windows systems. However, PuTTY is not limited to Windows. It is also popular among Linux users as well. This guide explains how to install PuTTY on Linux and how to access and manage the remote Linux servers using PuTTY. + +### Install PuTTY on Linux + +PuTTY is available in the official repositories of most Linux distributions. For instance, you can install PuTTY on Arch Linux and its variants using the following command: + +``` +$ sudo pacman -S putty +``` + +On Debian, Ubuntu, Linux Mint: + +``` +$ sudo apt install putty +``` + +### How to use PuTTY to access remote Linux systems + +Once PuTTY is installed, launch it from the menu or from your application launcher. Alternatively, you can launch it from the Terminal by running the following command: + +``` +$ putty +``` + +This is how PuTTY default interface looks like. + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-default-interface.png) + +As you can see, most of the options are self-explanatory. On the left pane of the PuTTY interface, you can do/edit/modify various configurations such as, + + 1. PuTTY session logging, + 2. Options for controlling the terminal emulation, control and change effects of keys, + 3. Control terminal bell sounds, + 4. Enable/disable Terminal advanced features, + 5. Set the size of PuTTY window, + 6. Control the scrollback in PuTTY window (Default is 2000 lines), + 7. Change appearance of PuTTY window and cursor, + 8. Adjust windows border, + 9. Change fonts for texts in PuTTY window, + 10. Save login details, + 11. Set proxy details, + 12. Options to control various protocols such as SSH, Telnet, Rlogin, Serial etc. + 13. And more. + + + +All options are categorized under a distinct name for ease of understanding. + +### Access a remote Linux server using PuTTY + +Click on the **Session** tab on the left pane. Enter the hostname (or IP address) of your remote system you want to connect to. Next choose the connection type, for example Telnet, Rlogin, SSH etc. The default port number will be automatically selected depending upon the connection type you choose. For example if you choose SSH, port number 22 will be selected. For Telnet, port number 23 will be selected and so on. If you have changed the default port number, don’t forget to mention it in the **Port** section. I am going to access my remote via SSH, hence I choose SSH connection type. After entering the Hostname or IP address of the system, click **Open**. + +![](http://www.ostechnix.com/wp-content/uploads/2019/02/putty-1.png) + +If this is the first time you have connected to this remote system, PuTTY will display a security alert dialog box that asks whether you trust the host you are connecting to. Click **Accept** to add the remote system’s host key to the PuTTY’s cache: + +![][2] + +Next enter your remote system’s user name and password. Congratulations! You’ve successfully connected to your remote system via SSH using PuTTY. + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-3.png) + +**Access remote systems configured with key-based authentication** + +Some Linux administrators might have configured their remote servers with key-based authentication. For example, when accessing AMS instances from PuTTY, you need to specify the key file’s location. PuTTY supports public key authentication and uses its own key format ( **.ppk** files). + +Enter the hostname or IP address in the Session section. Next, In the **Category** pane, expand **Connection** , expand **SSH** , and then choose **Auth**. Browse the location of the **.ppk** key file and click **Open**. + +![][3] + +Click Accept to add the host key if it is the first time you are connecting to the remote system. Finally, enter the remote system’s passphrase (if the key is protected with a passphrase while generating it) to connect. + +**Save PuTTY sessions** + +Sometimes, you want to connect to the remote system multiple times. If so, you can save the session and load it whenever you want without having to type the hostname or ip address, port number every time. + +Enter the hostname (or IP address) and provide a session name and click **Save**. If you have key file, make sure you have already given the location before hitting the Save button. + +![][4] + +Now, choose session name under the **Saved sessions** tab and click **Load** and click **Open** to launch it. + +**Transferring files to remote systems using the PuTTY Secure Copy Client (pscp) +** + +Usually, the Linux users and admins use **‘scp’** command line tool to transfer files from local Linux system to the remote Linux servers. PuTTY does have a dedicated client named **PuTTY Secure Copy Clinet** ( **PSCP** in short) to do this job. If you’re using windows os in your local system, you may need this tool to transfer files from local system to remote systems. PSCP can be used in both Linux and Windows systems. + +The following command will copy **file.txt** to my remote Ubuntu system from Arch Linux. + +``` +pscp -i test.ppk file.txt sk@192.168.225.22:/home/sk/ +``` + +Here, + + * **-i test.ppk** : Key file to access remote system, + * **file.txt** : file to be copied to remote system, + * **sk@192.168.225.22** : username and ip address of remote system, + * **/home/sk/** : Destination path. + + + +To copy a directory. use **-r** (recursive) option like below: + +``` + pscp -i test.ppk -r dir/ sk@192.168.225.22:/home/sk/ +``` + +To transfer files from Windows to remote Linux server using pscp, run the following command from command prompt: + +``` +pscp -i test.ppk c:\documents\file.txt.txt sk@192.168.225.22:/home/sk/ +``` + +You know now what is PuTTY, how to install and use it to access remote systems. Also, you have learned how to transfer files to the remote systems from the local system using pscp program. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-2.png +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-4.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-5.png From 39d4954aa5f256f555edc86dde860fbdf0785936 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 10:54:56 +0800 Subject: [PATCH 069/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190207=20How=20?= =?UTF-8?q?to=20determine=20how=20much=20memory=20is=20installed,=20used?= =?UTF-8?q?=20on=20Linux=20systems=20sources/tech/20190207=20How=20to=20de?= =?UTF-8?q?termine=20how=20much=20memory=20is=20installed,=20used=20on=20L?= =?UTF-8?q?inux=20systems.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ory is installed, used on Linux systems.md | 227 ++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md diff --git a/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md new file mode 100644 index 0000000000..c6098fa12d --- /dev/null +++ b/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to determine how much memory is installed, used on Linux systems) +[#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to determine how much memory is installed, used on Linux systems +====== +![](https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg) + +There are numerous ways to get information on the memory installed on Linux systems and view how much of that memory is being used. Some commands provide an overwhelming amount of detail, while others provide succinct, though not necessarily easy-to-digest, answers. In this post, we'll look at some of the more useful tools for checking on memory and its usage. + +Before we get into the details, however, let's review a few details. Physical memory and virtual memory are not the same. The latter includes disk space that configured to be used as swap. Swap may include partitions set aside for this usage or files that are created to add to the available swap space when creating a new partition may not be practical. Some Linux commands provide information on both. + +Swap expands memory by providing disk space that can be used to house inactive pages in memory that are moved to disk when physical memory fills up. + +One file that plays a role in memory management is **/proc/kcore**. This file looks like a normal (though extremely large) file, but it does not occupy disk space at all. Instead, it is a virtual file like all of the files in /proc. + +``` +$ ls -l /proc/kcore +-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore +``` + +Interestingly, the two systems queried below do _not_ have the same amount of memory installed, yet the size of /proc/kcore is the same on both. The first of these two systems has 4 GB of memory installed; the second has 6 GB. + +``` +system1$ ls -l /proc/kcore +-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore +system2$ ls -l /proc/kcore +-r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore +``` + +Explanations that claim the size of this file represents the amount of available virtual memory (maybe plus 4K) don't hold much weight. This number would suggest that the virtual memory on these systems is 128 terrabytes! That number seems to represent instead how much memory a 64-bit systems might be capable of addressing — not how much is available on the system. Calculations of what 128 terrabytes and that number, plus 4K would look like are fairly easy to make on the command line: + +``` +$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 +140737488355328 +$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096 +140737488359424 +``` + +Another and more human-friendly command for examining memory is the **free** command. It gives you an easy-to-understand report on memory. + +``` +$ free + total used free shared buff/cache available +Mem: 6102476 812244 4090752 13112 1199480 4984140 +Swap: 2097148 0 2097148 +``` + +With the **-g** option, free reports the values in gigabytes. + +``` +$ free -g + total used free shared buff/cache available +Mem: 5 0 3 0 1 4 +Swap: 1 0 1 +``` + +With the **-t** option, free shows the same values as it does with no options (don't confuse -t with terrabytes!) but by adding a total line at the bottom of its output. + +``` +$ free -t + total used free shared buff/cache available +Mem: 6102476 812408 4090612 13112 1199456 4983984 +Swap: 2097148 0 2097148 +Total: 8199624 812408 6187760 +``` + +And, of course, you can choose to use both options. + +``` +$ free -tg + total used free shared buff/cache available +Mem: 5 0 3 0 1 4 +Swap: 1 0 1 +Total: 7 0 5 +``` + +You might be disappointed in this report if you're trying to answer the question "How much RAM is installed on this system?" This is the same system shown in the example above that was described as having 6GB of RAM. That doesn't mean this report is wrong, but that it's the system's view of the memory it has at its disposal. + +The free command also provides an option to update the display every X seconds (10 in the example below). + +``` +$ free -s 10 + total used free shared buff/cache available +Mem: 6102476 812280 4090704 13112 1199492 4984108 +Swap: 2097148 0 2097148 + + total used free shared buff/cache available +Mem: 6102476 812260 4090712 13112 1199504 4984120 +Swap: 2097148 0 2097148 +``` + +With **-l** , the free command provides high and low memory usage. + +``` +$ free -l + total used free shared buff/cache available +Mem: 6102476 812376 4090588 13112 1199512 4984000 +Low: 6102476 2011888 4090588 +High: 0 0 0 +Swap: 2097148 0 2097148 +``` + +Another option for looking at memory is the **/proc/meminfo** file. Like /proc/kcore, this is a virtual file and one that gives a useful report showing how much memory is installed, free and available. Clearly, free and available do not represent the same thing. MemFree seems to represent unused RAM. MemAvailable is an estimate of how much memory is available for starting new applications. + +``` +$ head -3 /proc/meminfo +MemTotal: 6102476 kB +MemFree: 4090596 kB +MemAvailable: 4984040 kB +``` + +If you only want to see total memory, you can use one of these commands: + +``` +$ awk '/MemTotal/ {print $2}' /proc/meminfo +6102476 +$ grep MemTotal /proc/meminfo +MemTotal: 6102476 kB +``` + +The **DirectMap** entries break information on memory into categories. + +``` +$ grep DirectMap /proc/meminfo +DirectMap4k: 213568 kB +DirectMap2M: 6076416 kB +``` + +DirectMap4k represents the amount of memory being mapped to standard 4k pages, while DirectMap2M shows the amount of memory being mapped to 2MB pages. + +The **getconf** command is one that will provide quite a bit more information than most of us want to contemplate. + +``` +$ getconf -a | more +LINK_MAX 65000 +_POSIX_LINK_MAX 65000 +MAX_CANON 255 +_POSIX_MAX_CANON 255 +MAX_INPUT 255 +_POSIX_MAX_INPUT 255 +NAME_MAX 255 +_POSIX_NAME_MAX 255 +PATH_MAX 4096 +_POSIX_PATH_MAX 4096 +PIPE_BUF 4096 +_POSIX_PIPE_BUF 4096 +SOCK_MAXBUF +_POSIX_ASYNC_IO +_POSIX_CHOWN_RESTRICTED 1 +_POSIX_NO_TRUNC 1 +_POSIX_PRIO_IO +_POSIX_SYNC_IO +_POSIX_VDISABLE 0 +ARG_MAX 2097152 +ATEXIT_MAX 2147483647 +CHAR_BIT 8 +CHAR_MAX 127 +--More-- +``` + +Pare that output down to something specific with a command like the one shown below, and you'll get the same kind of information provided by some of the commands above. + +``` +$ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) total *=$NF} END {print total / 1024" kB"}' +6102476 kB +``` + +That command calculates memory by multiplying the values in the first and last lines of output like this: + +``` +PAGESIZE 4096 <== +_AVPHYS_PAGES 1022511 +_PHYS_PAGES 1525619 <== +``` + +Calculating that independently, we can see how that value is derived. + +``` +$ expr 4096 \* 1525619 / 1024 +6102476 +``` + +Clearly that's one of those commands that deserves to be turned into an alias! + +Another command with very digestible output is **top**. In the first five lines of top's output, you'll see some numbers that show how memory is being used. + +``` +$ top +top - 15:36:38 up 8 days, 2:37, 2 users, load average: 0.00, 0.00, 0.00 +Tasks: 266 total, 1 running, 265 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.2 us, 0.4 sy, 0.0 ni, 99.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 3244.8 total, 377.9 free, 1826.2 used, 1040.7 buff/cache +MiB Swap: 3536.0 total, 3535.7 free, 0.3 used. 1126.1 avail Mem +``` + +And finally a command that will answer the question "So, how much RAM is installed on this system?" in a succinct fashion: + +``` +$ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB"}' +6GB +``` + +Depending on how much detail you want to see, Linux systems provide a lot of options for seeing how much memory is installed on your systems and how much is used and available. + +Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-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.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From 0a56e53ec5ab585844ca13efaef590782bcca960 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 10:55:59 +0800 Subject: [PATCH 070/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=20Which?= =?UTF-8?q?=20programming=20languages=20should=20you=20learn=3F=20sources/?= =?UTF-8?q?talk/20190208=20Which=20programming=20languages=20should=20you?= =?UTF-8?q?=20learn.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... programming languages should you learn.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 sources/talk/20190208 Which programming languages should you learn.md diff --git a/sources/talk/20190208 Which programming languages should you learn.md b/sources/talk/20190208 Which programming languages should you learn.md new file mode 100644 index 0000000000..31cef16f03 --- /dev/null +++ b/sources/talk/20190208 Which programming languages should you learn.md @@ -0,0 +1,46 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Which programming languages should you learn?) +[#]: via: (https://opensource.com/article/19/2/which-programming-languages-should-you-learn) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +Which programming languages should you learn? +====== +Learning a new programming language is a great way to get ahead in your career. But which one? +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_issue_bug_programming.png?itok=XPrh7fa0) + +If you want to get started or get ahead in your programming career, learning a new language is a smart idea. But the huge number of languages in active use invites the question: Which programming language is the best one to know? To answer that, let's start with a simplifying question: What sort of programming do you want to do? + +If you want to do web programming on the client side, then the specialized languages HTML, CSS, and JavaScript—in one of its seemingly infinite dialects—are de rigueur. + +If you want to do web programming on the server side, the options include all of the familiar general-purpose languages: C++, Golang, Java, C#, Node.js, Perl, Python, Ruby, and so on. As a matter of course, server-side programs interact with datastores, such as relational and other databases, which means query languages such as SQL may come into play. + +If you're writing native apps for mobile devices, knowing the target platform is important. For Apple devices, Swift has supplanted Objective C as the language of choice. For Android devices, Java (with dedicated libraries and toolsets) remains the dominant language. There are special languages such as Xamarin, used with C#, that can generate platform-specific code for Apple, Android, and Windows devices. + +What about general-purpose languages? There are various choices within the usual pigeonholes. Among the dynamic or scripting languages (e.g., Perl, Python, and Ruby), there are newer offerings such as Node.js. Java and C#, which are more alike than their fans like to admit, remain the dominant statically compiled languages targeted at a virtual machine (the JVM and CLR, respectively). Among languages that compile into native executables, C++ is still in the mix, along with later arrivals such as Golang and Rust. General-purpose functional languages abound (e.g., Clojure, Haskell, Erlang, F#, Lisp, and Scala), often with passionately devoted communities. It's worth noting that object-oriented languages such as Java and C# have added functional constructs (in particular, lambdas), and the dynamic languages have had functional constructs from the start. + +Let me end with a pitch for C, which is a small, elegant, and extensible language not to be confused with C++. Modern operating systems are written mostly in C, with the rest in assembly language. The standard libraries on any platform are likewise mostly in C. For example, any program that issues the Hello, world! greeting does so through a call to the C library function named **write**. + +C serves as a portable assembly language, exposing details about the underlying system that other high-level languages deliberately hide. To understand C is thus to gain a better grasp of how programs contend for the shared system resources (processors, memory, and I/O devices) required for execution. C is at once high-level and close-to-the-metal, so unrivaled in performance—except, of course, for assembly language. Finally, C is the lingua franca among programming languages, and almost every general-purpose language supports C calls in one form or another. + +For a modern introduction to C, consider my book [C Programming: Introducing Portable Assembler][1]. No matter how you go about it, learn C and you'll learn a lot more than just another programming language. + +What programming languages do you think are important to know? Do you agree or disagree with these recommendations? Let us know in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/which-programming-languages-should-you-learn + +作者:[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://www.amazon.com/dp/1977056954?ref_=pe_870760_150889320 From 94ffbe73f1ea603504f91f2d7bdb70fff824b2b8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 10:58:20 +0800 Subject: [PATCH 071/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190208=207=20st?= =?UTF-8?q?eps=20for=20hunting=20down=20Python=20code=20bugs=20sources/tec?= =?UTF-8?q?h/20190208=207=20steps=20for=20hunting=20down=20Python=20code?= =?UTF-8?q?=20bugs.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...steps for hunting down Python code bugs.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sources/tech/20190208 7 steps for hunting down Python code bugs.md diff --git a/sources/tech/20190208 7 steps for hunting down Python code bugs.md b/sources/tech/20190208 7 steps for hunting down Python code bugs.md new file mode 100644 index 0000000000..63058be4a4 --- /dev/null +++ b/sources/tech/20190208 7 steps for hunting down Python code bugs.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 steps for hunting down Python code bugs) +[#]: via: (https://opensource.com/article/19/2/steps-hunting-code-python-bugs) +[#]: author: (Maria Mckinley https://opensource.com/users/parody) + +7 steps for hunting down Python code bugs +====== +Learn some tricks to minimize the time you spend tracking down the reasons your code fails. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) + +It is 3 pm on a Friday afternoon. Why? Because it is always 3 pm on a Friday when things go down. You get a notification that a customer has found a bug in your software. After you get over your initial disbelief, you contact DevOps to find out what is happening with the logs for your app, because you remember receiving a notification that they were being moved. + +Turns out they are somewhere you can't get to, but they are in the process of being moved to a web application—so you will have this nifty application for searching and reading them, but of course, it is not finished yet. It should be up in a couple of days. I know, totally unrealistic situation, right? Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking. + +OK, so you found the logs or tried the call, and indeed, the customer has found a bug. Maybe you even think you know where the bug is. + +You immediately open the file you think might be the problem and start poking around. + +### 1. Don't touch your code yet + +Go ahead and look at it, maybe even come up with a hypothesis. But before you start mucking about in the code, take that call that creates the bug and turn it into a test. This will be an integration test because although you may have suspicions, you do not yet know exactly where the problem is. + +Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. + +### 2. Write a failing test + +Now that you have a failing test or maybe a test with an error, it is time to troubleshoot. But before you do that, let's do a review of the stack, as this makes troubleshooting easier. + +The stack consists of all of the tasks you have started but not finished. So, if you are baking a cake and adding the flour to the batter, then your stack would be: + + * Make cake + * Make batter + * Add flour + + + +You have started making your cake, you have started making the batter, and you are adding the flour. Greasing the pan is not on the list since you already finished that, and making the frosting is not on the list because you have not started that. + +If you are fuzzy on the stack, I highly recommend playing around on [Python Tutor][1], where you can watch the stack as you execute lines of code. + +Now, if something goes wrong with your Python program, the interpreter helpfully prints out the stack for you. This means that whatever the program was doing at the moment it became apparent that something went wrong is on the bottom. + +### 3. Always check the bottom of the stack first + +Not only is the bottom of the stack where you can see which error occurred, but often the last line of the stack is where you can find the issue. If the bottom doesn't help, and your code has not been linted in a while, it is amazing how helpful it can be to run. I recommend pylint or flake8. More often than not, it points right to where there is an error that I have been overlooking. + +If the error is something that seems obscure, your next move might just be to Google it. You will have better luck if you don't include information that is relevant only to your code, like the name of variables, files, etc. If you are using Python 3 (which you should be), it's helpful to include the 3 in the search; otherwise, Python 2 solutions tend to dominate the top. + +Once upon a time, developers had to troubleshoot without the benefit of a search engine. This was a dark time. Take advantage of all the tools available to you. + +Unfortunately, sometimes the problem occurred earlier and only became apparent during the line executed on the bottom of the stack. Think about how forgetting to add the baking powder becomes obvious when the cake doesn't rise. + +It is time to look up the stack. Chances are quite good that the problem is in your code, and not Python core or even third-party packages, so scan the stack looking for lines in your code first. Plus it is usually much easier to put a breakpoint in your own code. Stick the breakpoint in your code a little further up the stack and look around to see if things look like they should. + +"But Maria," I hear you say, "this is all helpful if I have a stack trace, but I just have a failing test. Where do I start?" + +Pdb, the Python Debugger. + +Find a place in your code where you know this call should hit. You should be able to find at least one place. Stick a pdb break in there. + +#### A digression + +Why not a print statement? I used to depend on print statements. They still come in handy sometimes. But once I started working with complicated code bases, and especially ones making network calls, print just became too slow. I ended up with print statements all over the place, I lost track of where they were and why, and it just got complicated. But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful. + +You follow my advice, and put in a pdb break and run your test. And it whooshes on by and fails again, with no break at all. Leave your breakpoint in, and run a test already in your test suite that does something very similar to the broken test. If you have a decent test suite, you should be able to find a test that is hitting the same code you think your failed test should hit. Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. + +### 4. Change things + +If you still feel lost, try making a new test where you vary something slightly. Can you get the new test to work? What is different? What is the same? Try changing something else. Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.) + +### 5. Take a break + +In all seriousness, when it stops feeling like a fun challenge or game and starts becoming really frustrating, your best course of action is to walk away from the problem. Take a break. I highly recommend going for a walk and trying to think about something else. + +### 6. Write everything down + +When you come back, if you aren't suddenly inspired to try something, write down any information you have about the problem. This should include: + + * Exactly the call that is causing the problem + * Exactly what happened, including any error messages or related log messages + * Exactly what you were expecting to happen + * What you have done so far to find the problem and any clues that you have discovered while troubleshooting + + + +Sometimes this is a lot of information, but trust me, it is really annoying trying to pry information out of someone piecemeal. Try to be concise, but complete. + +### 7. Ask for help + +I often find that just writing down all the information triggers a thought about something I have not tried yet. Sometimes, of course, I realize what the problem is immediately after hitting the submit button. At any rate, if you still have not thought of anything after writing everything down, try sending an email to someone. First, try colleagues or other people involved in your project, then move on to project email lists. Don't be afraid to ask for help. Most people are kind and helpful, and I have found that to be especially true in the Python community. + +Maria McKinley will present [Hunting the Bugs][3] at [PyCascades 2019][4], February 23-24 in Seattle. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/steps-hunting-code-python-bugs + +作者:[Maria Mckinley][a] +选题:[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/parody +[b]: https://github.com/lujun9972 +[1]: http://www.pythontutor.com/ +[2]: https://betterexplained.com/articles/a-visual-guide-to-version-control/ +[3]: https://2019.pycascades.com/talks/hunting-the-bugs +[4]: https://2019.pycascades.com/ From 2f492ddf6877e48f2c1021e1f75036811f3fdfd2 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 11:04:10 +0800 Subject: [PATCH 072/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=20What?= =?UTF-8?q?=20blockchain=20and=20open=20source=20communities=20have=20in?= =?UTF-8?q?=20common=20sources/talk/20190206=20What=20blockchain=20and=20o?= =?UTF-8?q?pen=20source=20communities=20have=20in=20common.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... open source communities have in common.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20190206 What blockchain and open source communities have in common.md diff --git a/sources/talk/20190206 What blockchain and open source communities have in common.md b/sources/talk/20190206 What blockchain and open source communities have in common.md new file mode 100644 index 0000000000..bc4f9464d0 --- /dev/null +++ b/sources/talk/20190206 What blockchain and open source communities have in common.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What blockchain and open source communities have in common) +[#]: via: (https://opensource.com/article/19/2/blockchain-open-source-communities) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +What blockchain and open source communities have in common +====== +Blockchain initiatives can look to open source governance for lessons on establishing trust. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/diversity_flowers_chain.jpg?itok=ns01UPOp) + +One of the characteristics of blockchains that gets a lot of attention is how they enable distributed trust. The topic of trust is a surprisingly complicated one. In fact, there's now an [entire book][1] devoted to the topic by Kevin Werbach. + +But here's what it means in a nutshell. Organizations that wish to work together, but do not fully trust one another, can establish a permissioned blockchain and invite business partners to record their transactions on a shared distributed ledger. Permissioned blockchains can trace assets when transactions are added to the blockchain. A permissioned blockchain implies a degree of trust (again, trust is complicated) among members of a consortium, but no single entity controls the storage and validation of transactions. + +The basic model is that a group of financial institutions or participants in a logistics system can jointly set up a permissioned blockchain that will validate and immutably record transactions. There's no dependence on a single entity, whether it's one of the direct participants or a third-party intermediary who set up the blockchain, to safeguard the integrity of the system. The blockchain itself does so through a variety of cryptographic mechanisms. + +Here's the rub though. It requires that competitors work together cooperatively—a relationship often called [coopetition][2]. The term dates back to the early 20th century, but it grew into widespread use when former Novell CEO Ray Noorda started using the term to describe the company's business strategy in the 1990s. Novell was then planning to get into the internet portal business, which required it to seek partnerships with some of the search engine providers and other companies it would also be competing against. In 1996, coopetition became the subject of a bestselling [book][3]. + +Coopetition can be especially difficult when a blockchain network initiative appears to be driven by a dominant company. And it's hard for the dominant company not to exert outsize influence over the initiative, just as a natural consequence of how big it is. For example, the IBM-Maersk joint venture has [struggled to sign up rival shipping companies][4], in part because Maersk is the world's largest carrier by capacity, a position that makes rivals wary. + +We see this same dynamic in open source communities. The original creators of a project need to not only let go; they need to put governance structures in place that give competing companies confidence that there's a level playing field. + +For example, Sarah Novotny, now head of open source strategy at Google Cloud Platform, [told me in a 2017 interview][5] about the [Kubernetes][6] project that it isn't always easy to give up control, even when people buy into doing what is best for a project. + +> Google turned Kubernetes over to the Cloud Native Computing Foundation (CNCF), which sits under the Linux Foundation umbrella. As [CNCF executive director Dan Kohn puts it][7]: "One of the things they realized very early on is that a project with a neutral home is always going to achieve a higher level of collaboration. They really wanted to find a home for it where a number of different companies could participate." +> +> Defaulting to public may not be either natural or comfortable. "Early on, my first six, eight, or 12 weeks at Google, I think half my electrons in email were spent on: 'Why is this discussion not happening on a public mailing list? Is there a reason that this is specific to GKE [Google Container Engine]? No, there's not a reason,'" said Novotny. + +To be sure, some grumble that open source foundations have become too common and that many are too dominated by paying corporate members. Simon Phipps, currently the president of the Open Source Initiative, gave a talk at OSCON way back in 2015 titled ["Enough Foundations Already!"][8] in which he argued that "before we start another open source foundation, let's agree that what we need protected is software freedom and not corporate politics." + +Nonetheless, while not appropriate for every project, foundations with business, legal, and technical governance are increasingly the model for open source projects that require extensive cooperation among competing companies. A [2017 analysis of GitHub data by the Linux Foundation][9] found a number of different governance models in use by the highest-velocity open source projects. Unsurprisingly, quite a few remained under the control of the company that created or acquired them. However, about a third were under the auspices of a foundation. + +Is there a lesson here for blockchain? Quite possibly. Open source projects can be sponsored by a company while still putting systems and governance in place that are welcoming to outside contributors. However, there's a great deal of history to suggest that doing so is hard because it's hard not to exert control and leverage when you can. Furthermore, even if you make a successful case for being truly open to equal participation to outsiders today, it will be hard to allay suspicions that you might not be as welcoming tomorrow. + +To the degree that we can equate blockchain consortiums with open source communities, this suggests that business blockchain initiatives should look to open source governance for lessons. Dominant players in the ecosystem need to forgo control, and they need to have conversations with partners and potential partners about what types of structures would make participating easier. + +Many blockchain infrastructure software projects are already under foundations such as Hyperledger. But perhaps some specific production deployments of blockchain aimed at specific industries and ecosystems will benefit from formal governance structures as well. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/blockchain-open-source-communities + +作者:[Gordon Haff][a] +选题:[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/ghaff +[b]: https://github.com/lujun9972 +[1]: https://mitpress.mit.edu/books/blockchain-and-new-architecture-trust +[2]: https://en.wikipedia.org/wiki/Coopetition +[3]: https://en.wikipedia.org/wiki/Co-opetition_(book) +[4]: https://www.theregister.co.uk/2018/10/30/ibm_struggles_to_sign_up_shipping_carriers_to_blockchain_supply_chain_platform_reports/ +[5]: https://opensource.com/article/17/4/podcast-kubernetes-sarah-novotny +[6]: https://kubernetes.io/ +[7]: http://bitmason.blogspot.com/2017/02/podcast-cloud-native-computing.html +[8]: https://www.oreilly.com/ideas/enough-foundations-already +[9]: https://www.linuxfoundation.org/blog/2017/08/successful-open-source-projects-common/ From 80b657a2803d2b4186a4cccef6561b1e3bcfd24c Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 11:06:18 +0800 Subject: [PATCH 073/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=20And,?= =?UTF-8?q?=20Ampersand,=20and=20&=20in=20Linux=20sources/tech/20190206=20?= =?UTF-8?q?And,=20Ampersand,=20and=20-=20in=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190206 And, Ampersand, and - in Linux.md | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 sources/tech/20190206 And, Ampersand, and - in Linux.md diff --git a/sources/tech/20190206 And, Ampersand, and - in Linux.md b/sources/tech/20190206 And, Ampersand, and - in Linux.md new file mode 100644 index 0000000000..88a0458539 --- /dev/null +++ b/sources/tech/20190206 And, Ampersand, and - in Linux.md @@ -0,0 +1,211 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (And, Ampersand, and & in Linux) +[#]: via: (https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +And, Ampersand, and & in Linux +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand.png?itok=7GdFO36Y) + +Take a look at the tools covered in the [three][1] [previous][2] [articles][3], and you will see that understanding the glue that joins them together is as important as recognizing the tools themselves. Indeed, tools tend to be simple, and understanding what _mkdir_ , _touch_ , and _find_ do (make a new directory, update a file, and find a file in the directory tree, respectively) in isolation is easy. + +But understanding what + +``` +mkdir test_dir 2>/dev/null || touch images.txt && find . -iname "*jpg" > backup/dir/images.txt & +``` + +does, and why we would write a command line like that is a whole different story. + +It pays to look more closely at the sign and symbols that live between the commands. It will not only help you better understand how things work, but will also make you more proficient in chaining commands together to create compound instructions that will help you work more efficiently. + +In this article and the next, we'll be looking at the the ampersand (`&`) and its close friend, the pipe (`|`), and see how they can mean different things in different contexts. + +### Behind the Scenes + +Let's start simple and see how you can use `&` as a way of pushing a command to the background. The instruction: + +``` +cp -R original/dir/ backup/dir/ +``` + +Copies all the files and subdirectories in _original/dir/_ into _backup/dir/_. So far so simple. But if that turns out to be a lot of data, it could tie up your terminal for hours. + +However, using: + +``` +cp -R original/dir/ backup/dir/ & +``` + +pushes the process to the background courtesy of the final `&`. This frees you to continue working on the same terminal or even to close the terminal and still let the process finish up. Do note, however, that if the process is asked to print stuff out to the standard output (like in the case of `echo` or `ls`), it will continue to do so, even though it is being executed in the background. + +When you push a process into the background, Bash will print out a number. This number is the PID or the _Process' ID_. Every process running on your Linux system has a unique process ID and you can use this ID to pause, resume, and terminate the process it refers to. This will become useful later. + +In the meantime, there are a few tools you can use to manage your processes as long as you remain in the terminal from which you launched them: + + * `jobs` shows you the processes running in your current terminal, whether be it in the background or foreground. It also shows you a number associated with each job (different from the PID) that you can use to refer to each process: + +``` + $ jobs +[1]- Running cp -i -R original/dir/* backup/dir/ & +[2]+ Running find . -iname "*jpg" > backup/dir/images.txt & +``` + + * `fg` brings a job from the background to the foreground so you can interact with it. You tell `fg` which process you want to bring to the foreground with a percentage symbol (`%`) followed by the number associated with the job that `jobs` gave you: + +``` + $ fg %1 # brings the cp job to the foreground +cp -i -R original/dir/* backup/dir/ +``` + +If the job was stopped (see below), `fg` will start it again. + + * You can stop a job in the foreground by holding down [Ctrl] and pressing [Z]. This doesn't abort the action, it pauses it. When you start it again with (`fg` or `bg`) it will continue from where it left off... + +...Except for [`sleep`][4]: the time a `sleep` job is paused still counts once `sleep` is resumed. This is because `sleep` takes note of the clock time when it was started, not how long it was running. This means that if you run `sleep 30` and pause it for more than 30 seconds, once you resume, `sleep` will exit immediately. + + * The `bg` command pushes a job to the background and resumes it again if it was paused: + +``` + $ bg %1 +[1]+ cp -i -R original/dir/* backup/dir/ & +``` + + + + +As mentioned above, you won't be able to use any of these commands if you close the terminal from which you launched the process or if you change to another terminal, even though the process will still continue working. + +To manage background processes from another terminal you need another set of tools. For example, you can tell a process to stop from a a different terminal with the [`kill`][5] command: + +``` +kill -s STOP +``` + +And you know the PID because that is the number Bash gave you when you started the process with `&`, remember? Oh! You didn't write it down? No problem. You can get the PID of any running process with the `ps` (short for _processes_ ) command. So, using + +``` +ps | grep cp +``` + +will show you all the processes containing the string " _cp_ ", including the copying job we are using for our example. It will also show you the PID: + +``` +$ ps | grep cp +14444 pts/3 00:00:13 cp +``` + +In this case, the PID is _14444_. and it means you can stop the background copying with: + +``` +kill -s STOP 14444 +``` + +Note that `STOP` here does the same thing as [Ctrl] + [Z] above, that is, it pauses the execution of the process. + +To start the paused process again, you can use the `CONT` signal: + +``` +kill -s CONT 14444 +``` + +There is a good list of many of [the main signals you can send a process here][6]. According to that, if you wanted to terminate the process, not just pause it, you could do this: + +``` +kill -s TERM 14444 +``` + +If the process refuses to exit, you can force it with: + +``` +kill -s KILL 14444 +``` + +This is a bit dangerous, but very useful if a process has gone crazy and is eating up all your resources. + +In any case, if you are not sure you have the correct PID, add the `x` option to `ps`: + +``` +$ ps x| grep cp +14444 pts/3 D 0:14 cp -i -R original/dir/Hols_2014.mp4 +  original/dir/Hols_2015.mp4 original/dir/Hols_2016.mp4 +  original/dir/Hols_2017.mp4 original/dir/Hols_2018.mp4 backup/dir/ +``` + +And you should be able to see what process you need. + +Finally, there is nifty tool that combines `ps` and `grep` all into one: + +``` +$ pgrep cp +8 +18 +19 +26 +33 +40 +47 +54 +61 +72 +88 +96 +136 +339 +6680 +13735 +14444 +``` + +Lists all the PIDs of processes that contain the string " _cp_ ". + +In this case, it isn't very helpful, but this... + +``` +$ pgrep -lx cp +14444 cp +``` + +... is much better. + +In this case, `-l` tells `pgrep` to show you the name of the process and `-x` tells `pgrep` you want an exact match for the name of the command. If you want even more details, try `pgrep -ax command`. + +### Next time + +Putting an `&` at the end of commands has helped us explain the rather useful concept of processes working in the background and foreground and how to manage them. + +One last thing before we leave: processes running in the background are what are known as _daemons_ in UNIX/Linux parlance. So, if you had heard the term before and wondered what they were, there you go. + +As usual, there are more ways to use the ampersand within a command line, many of which have nothing to do with pushing processes into the background. To see what those uses are, we'll be back next week with more on the matter. + +Read more: + +[Linux Tools: The Meaning of Dot][1] + +[Understanding Angle Brackets in Bash][2] + +[More About Angle Brackets in Bash][3] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux + +作者:[Paul 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://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash +[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash +[4]: https://ss64.com/bash/sleep.html +[5]: https://bash.cyberciti.biz/guide/Sending_signal_to_Processes +[6]: https://www.computerhope.com/unix/signals.htm From 33a1e33944aa609a65bd4ad97a92c2a122666345 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 11:08:04 +0800 Subject: [PATCH 074/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=207=20pr?= =?UTF-8?q?edictions=20for=20artificial=20intelligence=20in=202019=20sourc?= =?UTF-8?q?es/talk/20190205=207=20predictions=20for=20artificial=20intelli?= =?UTF-8?q?gence=20in=202019.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ons for artificial intelligence in 2019.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/talk/20190205 7 predictions for artificial intelligence in 2019.md diff --git a/sources/talk/20190205 7 predictions for artificial intelligence in 2019.md b/sources/talk/20190205 7 predictions for artificial intelligence in 2019.md new file mode 100644 index 0000000000..2e1b047a15 --- /dev/null +++ b/sources/talk/20190205 7 predictions for artificial intelligence in 2019.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 predictions for artificial intelligence in 2019) +[#]: via: (https://opensource.com/article/19/2/predictions-artificial-intelligence) +[#]: author: (Salil Sethi https://opensource.com/users/salilsethi) + +7 predictions for artificial intelligence in 2019 +====== + +While 2018 was a big year for AI, the stage is set for it to make an even deeper impact in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/robot_arm_artificial_ai.png?itok=8CUU3U_7) + +Without question, 2018 was a big year for artificial intelligence (AI) as it pushed even further into the mainstream, successfully automating more functionality than ever before. Companies are increasingly exploring applications for AI, and the general public has grown accustomed to interacting with the technology on a daily basis. + +The stage is set for AI to continue transforming the world as we know it. In 2019, not only will the technology continue growing in global prevalence, but it will also spawn deeper conversations around important topics, fuel innovative business models, and impact society in new ways, including the following seven. + +### 1\. Machine learning as a service (MLaaS) will be deployed more broadly + +In 2018, we witnessed major strides in MLaaS with technology powerhouses like Google, Microsoft, and Amazon leading the way. Prebuilt machine learning solutions and capabilities are becoming more attractive in the market, especially to smaller companies that don't have the necessary in-house resources or talent. For those that have the technical know-how and experience, there is a significant opportunity to sell and deploy packaged solutions that can be easily implemented by others. + +Today, MLaaS is sold primarily on a subscription or usage basis by cloud-computing providers. For example, Microsoft Azure's ML Studio provides developers with a drag-and-drop environment to develop powerful machine learning models. Google Cloud's Machine Learning Engine also helps developers build large, sophisticated algorithms for a variety of applications. In 2017, Amazon jumped into the realm of AI and launched Amazon SageMaker, another platform that developers can use to build, train, and deploy custom machine learning models. + +In 2019 and beyond, be prepared to see MLaaS offered on a much broader scale. Transparency Market Research predicts it will grow to US$20 billion at an alarming 40% CAGR by 2025. + +### 2\. More explainable or "transparent" AI will be developed + +Although there are already many examples of how AI is impacting our world, explaining the outputs and rationale of complex machine learning models remains a challenge. + +Unfortunately, AI continues to carry the "black box" burden, posing a significant limitation in situations where humans want to understand the rationale behind AI-supported decision making. + +AI democratization has been led by a plethora of open source tools and libraries, such as Scikit Learn, TensorFlow, PyTorch, and more. The open source community will lead the charge to build explainable, or "transparent," AI that can clearly document its logic, expose biases in data sets, and provide answers to follow-up questions. + +Before AI is widely adopted, humans need to know that the technology can perform effectively and explain its reasoning under any circumstance. + +### 3\. AI will impact the global political landscape + +In 2019, AI will play a bigger role on the global stage, impacting relationships between international superpowers that are investing in the technology. Early adopters of AI, such as the US and [China][1], will struggle to balance self-interest with collaborative R&D. Countries that have AI talent and machine learning capabilities will experience tremendous growth in areas like predictive analytics, creating a wider global technology gap. + +Additionally, more conversations will take place around the ethical use of AI. Naturally, different countries will approach this topic differently, which will affect political relationships. Overall, AI's impact will be small relative to other international issues, but more noticeable than before. + +### 4\. AI will create more jobs than it eliminates + +Over the long term, many jobs will be eliminated as a result of AI-enabled automation. Roles characterized by repetitive, manual tasks are being outsourced to AI more and more every day. However, in 2019, AI will create more jobs than it replaces. + +Rather than eliminating the need for humans entirely, AI is augmenting existing systems and processes. As a result, a new type of role is emerging. Humans are needed to support AI implementation and oversee its application. Next year, more manual labor will transition to management-type jobs that work alongside AI, a trend that will continue to 2020. Gartner predicts that in two years, [AI will create 2.3 million jobs while only eliminating 1.8 million.][2] + +### 5\. AI assistants will become more pervasive and useful + +AI assistants are nothing new to the modern world. Apple's Siri and Amazon's Alexa have been supporting humans on the road and in their homes for years. In 2019, we will see AI assistants continue to grow in their sophistication and capabilities. As they collect more behavioral data, AI assistants will become better at responding to requests and completing tasks. With advances in natural language processing and speech recognition, humans will have smoother and more useful interactions with AI assistants. + +In 2018, we saw companies launch promising new AI assistants. Recently, Google began rolling out its voice-enabled reservation booking service, Duplex, which can call and book appointments on behalf of users. Technology company X.ai has built two AI personal assistants, Amy and Andrew, who can interact with humans and schedule meetings for their employers. Amazon also recently announced Echo Auto, a device that enables drivers to integrate Alexa into their vehicles. However, humans will continue to place expectations ahead of reality and be disappointed at the technology's limitations. + +### 6\. AI/ML governance will gain importance + +With so many companies investing in AI, much more energy will be put towards developing effective AI governance structures. Frameworks are needed to guide data collection and management, appropriate AI use, and ethical applications. Successful and appropriate AI use involves many different stakeholders, highlighting the need for reliable and consistent governing bodies. + +In 2019, more organizations will create governance structures and more clearly define how AI progress and implementation are managed. Given the current gap in explainability, these structures will be tremendously important as humans continue to turn to AI to support decision-making. + +### 7\. AI will help companies solve AI talent shortages + +A [shortage of AI and machine learning talent][3] is creating an innovation bottleneck. A [survey][4] released last year from O'Reilly revealed that the biggest challenge companies are facing related to using AI is a lack of available talent. And as technological advancement continues to accelerate, it is becoming harder for companies to develop talent that can lead large-scale enterprise AI efforts. + +To combat this, organizations will—ironically—use AI and machine learning to help address the talent gap in 2019. For example, Google Cloud's AutoML includes machine learning products that help developers train machine learning models without having any prior AI coding experience. Amazon Personalize is another machine learning service that helps developers build sophisticated personalization systems that can be implemented in many ways by different kinds of companies. In addition, companies will use AI to find talent and fill job vacancies and propel innovation forward. + +### AI In 2019: bigger and better with a tighter leash + +Over the next year, AI will grow more prevalent and powerful than ever. Expect to see new applications and challenges and be ready for an increased emphasis on checks and balances. + +What do you think? How might AI impact the world in 2019? Please share your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/predictions-artificial-intelligence + +作者:[Salil Sethi][a] +选题:[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/salilsethi +[b]: https://github.com/lujun9972 +[1]: https://www.turingtribe.com/story/china-is-achieving-ai-dominance-by-relying-on-young-blue-collar-workers-rLMsmWqLG4fGFwisQ +[2]: https://www.gartner.com/en/newsroom/press-releases/2017-12-13-gartner-says-by-2020-artificial-intelligence-will-create-more-jobs-than-it-eliminates +[3]: https://www.turingtribe.com/story/tencent-says-there-are-only-bTpNm9HKaADd4DrEi +[4]: https://www.forbes.com/sites/bernardmarr/2018/06/25/the-ai-skills-crisis-and-how-to-close-the-gap/#19bafcf631f3 From f71321d877dfdf647aa1eed997db6d99e8f7bca4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 11:28:21 +0800 Subject: [PATCH 075/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=20Gettin?= =?UTF-8?q?g=20started=20with=20Vim=20visual=20mode=20sources/tech/2019020?= =?UTF-8?q?6=20Getting=20started=20with=20Vim=20visual=20mode.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...06 Getting started with Vim visual mode.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20190206 Getting started with Vim visual mode.md diff --git a/sources/tech/20190206 Getting started with Vim visual mode.md b/sources/tech/20190206 Getting started with Vim visual mode.md new file mode 100644 index 0000000000..e6b9b1da9b --- /dev/null +++ b/sources/tech/20190206 Getting started with Vim visual mode.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Vim visual mode) +[#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode) +[#]: author: (Susan Lauber https://opensource.com/users/susanlauber) + +Getting started with Vim visual mode +====== +Visual mode makes it easier to highlight and manipulate text in Vim. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +Ansible playbook files are text files in a YAML format. People who work regularly with them have their favorite editors and plugin extensions to make the formatting easier. + +When I teach Ansible with the default editor available in most Linux distributions, I use Vim's visual mode a lot. It allows me to highlight my actions on the screen—what I am about to edit and the text manipulation task I'm doing—to make it easier for my students to learn. + +### Vim's visual mode + +When editing text with Vim, visual mode can be extremely useful for identifying chunks of text to be manipulated. + +Vim's visual mode has three versions: character, line, and block. The keystrokes to enter each mode are: + + * Character mode: **v** (lower-case) + * Line mode: **V** (upper-case) + * Block mode: **Ctrl+v** + + + +Here are some ways to use each mode to simplify your work. + +### Character mode + +Character mode can highlight a sentence in a paragraph or a phrase in a sentence. Then the visually identified text can be deleted, copied, changed, or modified with any other Vim editing command. + +#### Move a sentence + +To move a sentence from one place to another, start by opening the file and moving the cursor to the first character in the sentence you want to move. + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png) + + * Press the **v** key to enter visual character mode. The word **VISUAL** will appear at the bottom of the screen. + * Use the Arrow keys to highlight the desired text. You can use other navigation commands, such as **w** to highlight to the beginning of the next word or **$** to include the rest of the line. + * Once the text is highlighted, press the **d** key to delete the text. + * If you deleted too much or not enough, press **u** to undo and start again. + * Move your cursor to the new location and press **p** to paste the text. + + + +#### Change a phrase + +You can also highlight a chunk of text that you want to replace. + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png) + + * Place the cursor at the first character you want to change. + * Press **v** to enter visual character mode. + * Use navigation commands, such as the Arrow keys, to highlight the phrase. + * Press **c** to change the highlighted text. + * The highlighted text will disappear, and you will be in Insert mode where you can add new text. + * After you finish typing the new text, press **Esc** to return to command mode and save your work. + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png) + +### Line mode + +When working with Ansible playbooks, the order of tasks can matter. Use visual line mode to move a task to a different location in the playbook. + +#### Manipulate multiple lines of text + +![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png) + + * Place your cursor anywhere on the first or last line of the text you want to manipulate. + * Press **Shift+V** to enter line mode. The words **VISUAL LINE** will appear at the bottom of the screen. + * Use navigation commands, such as the Arrow keys, to highlight multiple lines of text. + * Once the desired text is highlighted, use commands to manipulate it. Press **d** to delete, then move the cursor to the new location, and press **p** to paste the text. + * **y** (yank) can be used instead of **d** (delete) if you want to copy the task. + + + +#### Indent a set of lines + +When working with Ansible playbooks or YAML files, indentation matters. A highlighted block can be shifted right or left with the **>** and **<** keys. + +![]9https://opensource.com/sites/default/files/uploads/vim-visual-line2.png + + * Press **>** to increase the indentation of all the lines. + * Press **<** to decrease the indentation of all the lines. + + + +Try other Vim commands to apply them to the highlighted text. + +### Block mode + +The visual block mode is useful for manipulation of specific tabular data files, but it can also be extremely helpful as a tool to verify indentation of an Ansible playbook. + +Tasks are a list of items and in YAML each list item starts with a dash followed by a space. The dashes must line up in the same column to be at the same indentation level. This can be difficult to see with just the human eye. Indentation of other lines within the task is also important. + +#### Verify tasks lists are indented the same + +![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png) + + * Place your cursor on the first character of the list item. + * Press **Ctrl+v** to enter visual block mode. The words **VISUAL BLOCK** will appear at the bottom of the screen. + * Use the Arrow keys to highlight the single character column. You can verify that each task is indented the same amount. + * Use the Arrow keys to expand the block right or left to check whether the other indentation is correct. + +![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png) + +Even though I am comfortable with other Vim editing shortcuts, I still like to use visual mode to sort out what text I want to manipulate. When I demo other concepts during a presentation, my students see a tool to highlight text and hit delete in this "new to them" text only editor. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/getting-started-vim-visual-mode + +作者:[Susan Lauber][a] +选题:[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/susanlauber +[b]: https://github.com/lujun9972 From 4b4a117265f06cbf1449fa913886a47038052edc Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 11:29:28 +0800 Subject: [PATCH 076/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=204=20st?= =?UTF-8?q?eps=20to=20becoming=20an=20awesome=20agile=20developer=20source?= =?UTF-8?q?s/talk/20190206=204=20steps=20to=20becoming=20an=20awesome=20ag?= =?UTF-8?q?ile=20developer.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... to becoming an awesome agile developer.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/talk/20190206 4 steps to becoming an awesome agile developer.md diff --git a/sources/talk/20190206 4 steps to becoming an awesome agile developer.md b/sources/talk/20190206 4 steps to becoming an awesome agile developer.md new file mode 100644 index 0000000000..bad4025aef --- /dev/null +++ b/sources/talk/20190206 4 steps to becoming an awesome agile developer.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 steps to becoming an awesome agile developer) +[#]: via: (https://opensource.com/article/19/2/steps-agile-developer) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +4 steps to becoming an awesome agile developer +====== +There's no magical way to do it, but these practices will put you well on your way to embracing agile in application development, testing, and debugging. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk) + +Enterprises are rushing into their DevOps journey through [agile][1] software development with cloud-native technologies such as [Linux containers][2], [Kubernetes][3], and [serverless][4]. Continuous integration helps enterprise developers reduce bugs, unexpected errors, and improve the quality of their code deployed in production. + +However, this doesn't mean all developers in DevOps automatically embrace agile for their daily work in application development, testing, and debugging. There is no magical way to do it, but the following four practical steps and best practices will put you well on your way to becoming an awesome agile developer. + +### Start with design thinking agile practices + +There are many opportunities to learn about using agile software development practices in your DevOps initiatives. Agile practices inspire people with new ideas and experiences for improving their daily work in application development with team collaboration. More importantly, those practices will help you discover the answers to questions such as: Why am I doing this? What kind of problems am I trying to solve? How do I measure the outcomes? + +A [domain-driven design][5] approach will help you start discovery sooner and easier. For example, the [Start At The End][6] practice helps you redesign your application and explore potential business outcomes—such as, what would happen if your application fails in production? You might also be interested in [Event Storming][7] for interactive and rapid discovery or [Impact Mapping][8] for graphical and strategic design as part of domain-driven design practices. + +### Use a predictive approach first + +In agile software development projects, enterprise developers are mainly focused on adapting to rapidly changing app development environments such as reactive runtimes, cloud-native frameworks, Linux container packaging, and the Kubernetes platform. They believe this is the best way to become an agile developer in their organization. However, this type of adaptive approach typically makes it harder for developers to understand and report what they will do in the next sprint. Developers might know the ultimate goal and, at best, the app features for a release about four months from the current sprint. + +In contrast, the predictive approach places more emphasis on analyzing known risks and planning future sprints in detail. For example, predictive developers can accurately report the functions and tasks planned for the entire development process. But it's not a magical way to make your agile projects succeed all the time because the predictive team depends totally on effective early-stage analysis. If the analysis does not work very well, it may be difficult for the project to change direction once it gets started. + +To mitigate this risk, I recommend that senior agile developers increase the predictive capabilities with a plan-driven method, and junior agile developers start with the adaptive methods for value-driven development. + +### Continuously improve code quality + +Don't hesitate to engage in [continuous integration][9] (CI) practices for improving your application before deploying code into production. To adopt modern application frameworks, such as cloud-native architecture, Linux container packaging, and hybrid cloud workloads, you have to learn about automated tools to address complex CI procedures. + +[Jenkins][10] is the standard CI tool for many organizations; it allows developers to build and test applications in many projects in an automated fashion. Its most important function is detecting unexpected errors during CI to prevent them from happening in production. This should increase business outcomes through better customer satisfaction. + +Automated CI enables agile developers to not only improve the quality of their code but their also application development agility through learning and using open source tools and patterns such as [behavior-driven development][11], [test-driven development][12], [automated unit testing][13], [pair programming][14], [code review][15], and [design pattern][16]. + +### Never stop exploring communities + +Never settle, even if you already have a great reputation as an agile developer. You have to continuously take on bigger challenges to make great software in an agile way. + +By participating in the very active and growing open source community, you will not only improve your skills as an agile developer, but your actions can also inspire other developers who want to learn agile practices. + +How do you get involved in specific communities? It depends on your interests and what you want to learn. It might mean presenting specific topics at conferences or local meetups, writing technical blog posts, publishing practical guidebooks, committing code, or creating pull requests to open source projects' Git repositories. It's worth exploring open source communities for agile software development, as I've found it is a great way to share your expertise, knowledge, and practices with other brilliant developers and, along the way, help each other. + +### Get started + +These practical steps can give you a shorter path to becoming an awesome agile developer. Then you can lead junior developers in your team and organization to become more flexible, valuable, and predictive using agile principles. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/steps-agile-developer + +作者:[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/article/18/10/what-agile +[2]: https://opensource.com/resources/what-are-linux-containers +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://opensource.com/article/18/11/open-source-serverless-platforms +[5]: https://en.wikipedia.org/wiki/Domain-driven_design +[6]: https://openpracticelibrary.com/practice/start-at-the-end/ +[7]: https://openpracticelibrary.com/practice/event-storming/ +[8]: https://openpracticelibrary.com/practice/impact-mapping/ +[9]: https://en.wikipedia.org/wiki/Continuous_integration +[10]: https://jenkins.io/ +[11]: https://en.wikipedia.org/wiki/Behavior-driven_development +[12]: https://en.wikipedia.org/wiki/Test-driven_development +[13]: https://en.wikipedia.org/wiki/Unit_testing +[14]: https://en.wikipedia.org/wiki/Pair_programming +[15]: https://en.wikipedia.org/wiki/Code_review +[16]: https://en.wikipedia.org/wiki/Design_pattern From 4d8b049aba9a1fb4356e5749ee12b81b0411340d Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 11 Feb 2019 12:20:06 +0800 Subject: [PATCH 077/813] hankchow translating --- sources/tech/20190131 Will quantum computing break security.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190131 Will quantum computing break security.md b/sources/tech/20190131 Will quantum computing break security.md index a4cd9d29de..af374408dc 100644 --- a/sources/tech/20190131 Will quantum computing break security.md +++ b/sources/tech/20190131 Will quantum computing break security.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f589ef1d1a8fa202eb8a0db144f21262804a29ce Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 12:39:37 +0800 Subject: [PATCH 078/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190204=207=20Be?= =?UTF-8?q?st=20VPN=20Services=20For=202019=20sources/tech/20190204=207=20?= =?UTF-8?q?Best=20VPN=20Services=20For=202019.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190204 7 Best VPN Services For 2019.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20190204 7 Best VPN Services For 2019.md diff --git a/sources/tech/20190204 7 Best VPN Services For 2019.md b/sources/tech/20190204 7 Best VPN Services For 2019.md new file mode 100644 index 0000000000..e72d7de3df --- /dev/null +++ b/sources/tech/20190204 7 Best VPN Services For 2019.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Best VPN Services For 2019) +[#]: via: (https://www.ostechnix.com/7-best-opensource-vpn-services-for-2019/) +[#]: author: (Editor https://www.ostechnix.com/author/editor/) + +7 Best VPN Services For 2019 +====== + +At least 67 percent of global businesses in the past three years have faced data breaching. The breaching has been reported to expose hundreds of millions of customers. Studies show that an estimated 93 percent of these breaches would have been avoided had data security fundamentals been considered beforehand. + +Understand that poor data security can be extremely costly, especially to a business and could quickly lead to widespread disruption and possible harm to your brand reputation. Although some businesses can pick up the pieces the hard way, there are still those that fail to recover. Today however, you are fortunate to have access to data and network security software. + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/vpn-1.jpeg) + +As you start 2019, keep off cyber-attacks by investing in a **V** irtual **P** rivate **N** etwork commonly known as **VPN**. When it comes to online privacy and security, there are many uncertainties. There are hundreds of different VPN providers, and picking the right one means striking just the right balance between pricing, services, and ease of use. + +If you are looking for a solid 100 percent tested and secure VPN, you might want to do your due diligence and identify the best match. Here are the top 7 Best tried and tested VPN services For 2019. + +### 1. Vpnunlimitedapp + +With VPN Unlimited, you have total security. This VPN allows you to use any WIFI without worrying that your personal data can be leaked. With AES-256, your data is encrypted and protected against prying third-parties and hackers. This VPN ensures you stay anonymous and untracked on all websites no matter the location. It offers a 7-day trial and a variety of protocol options: OpenVPN, IKEv2, and KeepSolid Wise. Demanding users are entitled to special extras such as a personal server, lifetime VPN subscription, and personal IP options. + +### 2. VPN Lite + +VPN Lite is an easy-to-use and **free VPN service** that allows you to browse the internet at no charges. You remain anonymous and your privacy is protected. It obscures your IP and encrypts your data meaning third parties are not able to track your activities on all online platforms. You also get to access all online content. With VPN Lite, you get to access blocked sites in your state. You can also gain access to public WIFI without the worry of having sensitive information tracked and hacked by spyware and hackers. + +### 3. HotSpot Shield + +Launched in 2005, this is a popular VPN embraced by the majority of users. The VPN protocol here is integrated by at least 70 percent of the largest security companies globally. It is also known to have thousands of servers across the globe. It comes with two free options. One is completely free but supported by online advertisements, and the second one is a 7-day trial which is the flagship product. It contains military grade data encryption and protects against malware. HotSpot Shield guaranteed secure browsing and offers lightning-fast speeds. + +### 4. TunnelBear + +This is the best way to start if you are new to VPNs. It comes to you with a user-friendly interface complete with animated bears. With the help of TunnelBear, users are able to connect to servers in at least 22 countries at great speeds. It uses **AES 256-bit encryption** guaranteeing no data logging meaning your data stays protected. You also get unlimited data for up to five devices. + +### 5. ProtonVPN + +This VPN offers you a strong premium service. You may suffer from reduced connection speeds, but you also get to enjoy its unlimited data. It features an intuitive interface easy to use, and comes with a multi-platform compatibility. Proton’s servers are said to be specifically optimized for torrenting and thus cannot give access to Netflix. You get strong security features such as protocols and encryptions meaning your browsing activities remain secure. + +### 6. ExpressVPN + +This is known as the best offshore VPN for unblocking and privacy. It has gained recognition for being the top VPN service globally resulting from solid customer support and fast speeds. It offers routers that come with browser extensions and custom firmware. ExpressVPN also has an admirable scope of quality apps, plenty of servers, and can only support up to three devices. + +It’s not entirely free, and happens to be one of the most expensive VPNs on the market today because it is fully packed with the most advanced features. With it comes a 30-day money-back guarantee, meaning you can freely test this VPN for a month. Good thing is; it is completely risk-free. If you need a VPN for a short duration to bypass online censorship for instance, this could, be your go-to solution. You don’t want to give trials to a spammy, slow, free program. + +It is also one of the best ways to enjoy online streaming as well as outdoor security. Should you need to continue using it, you only have to renew or cancel your free trial if need be. Express VPN has over 2000 servers across 90 countries, unblocks Netflix, gives lightning fast connections, and gives users total privacy. + +### 7. PureVPN + +While this VPN may not be completely free, it falls under the most budget-friendly services on this list. Users can sign up for a free seven days trial and later choose one of its paid plans. With this VPN, you get to access 750-plus servers in at least 140 countries. There is also access to easy installation on almost all devices. All its paid features can still be accessed within the free trial window. That includes unlimited data transfers, IP leakage protection, and ISP invisibility. The supproted operating systems are iOS, Android, Windows, Linux, and macOS. + +### Summary + +With the large variety of available freemium VPN services today, why not take that opportunity to protect yourself and your customers? Understand that there are some great VPN services. Even the most secure free service however, cannot be touted as risk free. You might want to upgrade to a premium one for increased protection. Premium VPN allows you to test freely offering risk-free money-back guarantee. Whether you plan to sign up for a paid VPN or commit to a free one, it is highly advisable to have a VPN. + +**About the author:** + +**Renetta K. Molina** is a tech enthusiast and fitness enthusiast. She writes about technology, apps, WordPress and a variety of other topics. In her free time, she likes to play golf and read books. She loves to learn and try new things. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/7-best-opensource-vpn-services-for-2019/ + +作者:[Editor][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 From 1a3f4f1e6ac4b283e3027ddfe6c630399ac5f630 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 12:42:51 +0800 Subject: [PATCH 079/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20Instal?= =?UTF-8?q?ling=20Kali=20Linux=20on=20VirtualBox:=20Quickest=20&=20Safest?= =?UTF-8?q?=20Way=20sources/tech/20190205=20Installing=20Kali=20Linux=20on?= =?UTF-8?q?=20VirtualBox-=20Quickest=20-=20Safest=20Way.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux on VirtualBox- Quickest - Safest Way.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md diff --git a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md new file mode 100644 index 0000000000..54e4ce314c --- /dev/null +++ b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) +[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Installing Kali Linux on VirtualBox: Quickest & Safest Way +====== + +**This tutorial shows you how to install Kali Linux on Virtual Box in Windows and Linux in the quickest way possible.** + +[Kali Linux][1] is one of the [best Linux distributions for hacking][2] and security enthusiasts. + +Since it deals with a sensitive topic like hacking, it’s like a double-edged sword. We have discussed it in the detailed Kali Linux review in the past so I am not going to bore you with the same stuff again. + +While you can install Kali Linux by replacing the existing operating system, using it via a virtual machine would be a better and safer option. + +With Virtual Box, you can use Kali Linux as a regular application in your Windows/Linux system. It’s almost the same as running VLC or a game in your system. + +Using Kali Linux in a virtual machine is also safe. Whatever you do inside Kali Linux will NOT impact your ‘host system’ (i.e. your original Windows or Linux operating system). Your actual operating system will be untouched and your data in the host system will be safe. + +![Kali Linux on Virtual Box][3] + +### How to install Kali Linux on VirtualBox + +I’ll be using [VirtualBox][4] here. It is a wonderful open source virtualization solution for just about anyone (professional or personal use). It’s available free of cost. + +In this tutorial, we will talk about Kali Linux in particular but you can install almost any other OS whose ISO file exists or a pre-built virtual machine save file is available. + +**Note:** The same steps apply for Windows/Linux running VirtualBox. + +As I already mentioned, you can have either Windows or Linux installed as your host. But, in this case, I have Windows 10 installed (don’t hate me!) where I try to install Kali Linux in VirtualBox step by step. + +And, the best part is – even if you happen to use a Linux distro as your primary OS, the same steps will be applicable! + +Wondering, how? Let’s see… + +### Step by Step Guide to install Kali Linux on VirtualBox + +We are going to use a custom Kali Linux image made for VirtualBox specifically. You can also download the ISO file for Kali Linux and create a new virtual machine – but why do that when you have an easy alternative? + +#### 1\. Download and install VirtualBox + +The first thing you need to do is to download and install VirtualBox from Oracle’s official website. + +[Download VirtualBox](https://www.virtualbox.org/wiki/Downloads) + +Once you download the installer, just double click on it to install VirtualBox. It’s the same for installing VirtualBox on Ubuntu/Fedora Linux as well. + +#### 2\. Download ready-to-use virtual image of Kali Linux + +After installing it successfully, head to [Offensive Security’s download page][5] to download the VM image for VirtualBox. If you change your mind to utilize [VMware][6], that is available too. + +![Kali Linux Virtual Box Image][7] + +As you can see the file size is well over 3 GB, you should either use the torrent option or download it using a [download manager][8]. + +#### 3\. Install Kali Linux on Virtual Box + +Once you have installed VirtualBox and downloaded the Kali Linux image, you just need to import it to VirtualBox in order to make it work. + +Here’s how to import the VirtualBox image for Kali Linux: + +**Step 1** : Launch VirtualBox. You will notice an **Import** button – click on it + +![virtualbox import][9] Click on Import button + +**Step 2:** Next, browse the file you just downloaded and choose it to be imported (as you can see in the image below). The file name should start with ‘kali linux‘ and end with . **ova** extension. + +![virtualbox import file][10] Importing Kali Linux image + +**S** Once selected, proceed by clicking on **Next**. + +**Step 3** : Now, you will be shown the settings for the virtual machine you are about to import. So, you can customize them or not – that is your choice. It is okay if you go with the default settings. + +You need to select a path where you have sufficient storage available. I would never recommend the **C:** drive on Windows. + +![virtualbox kali linux settings][11] Import hard drives as VDI + +Here, the hard drives as VDI refer to virtually mount the hard drives by allocating the storage space set. + +After you are done with the settings, hit **Import** and wait for a while. + +**Step 4:** You will now see it listed. So, just hit **Start** to launch it. + +You might get an error at first for USB port 2.0 controller support, you can disable it to resolve it or just follow the on-screen instruction of installing an additional package to fix it. And, you are done! + +![kali linux on windows virtual box][12]Kali Linux running in VirtualBox + +I hope this guide helps you easily install Kali Linux on Virtual Box. Of course, Kali Linux has a lot of useful tools in it for penetration testing – good luck with that! + +**Tip** : Both Kali Linux and Ubuntu are Debian-based. If you face any issues or error with Kali Linux, you may follow the tutorials intended for Ubuntu or Debian on the internet. + +### Bonus: Free Kali Linux Guide Book + +If you are just starting with Kali Linux, it will be a good idea to know how to use Kali Linux. + +Offensive Security, the company behind Kali Linux, has created a guide book that explains the basics of Linux, basics of Kali Linux, configuration, setups. It also has a few chapters on penetration testing and security tools. + +Basically, it has everything you need to get started with Kali Linux. And the best thing is that the book is available to download for free. + +Let us know in the comments below if you face an issue or simply share your experience with Kali Linux on VirtualBox. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kali-linux-virtualbox + +作者:[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://itsfoss.com/linux-hacking-penetration-testing/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ +[6]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 +[8]: https://itsfoss.com/4-best-download-managers-for-linux/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?fit=800%2C450&ssl=1 From 6378fea196e9ef86f90b4d6754f320e36adb18f7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 12:45:08 +0800 Subject: [PATCH 080/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20DNS=20?= =?UTF-8?q?and=20Root=20Certificates=20sources/tech/20190205=20DNS=20and?= =?UTF-8?q?=20Root=20Certificates.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190205 DNS and Root Certificates.md | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 sources/tech/20190205 DNS and Root Certificates.md diff --git a/sources/tech/20190205 DNS and Root Certificates.md b/sources/tech/20190205 DNS and Root Certificates.md new file mode 100644 index 0000000000..3934a414b7 --- /dev/null +++ b/sources/tech/20190205 DNS and Root Certificates.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DNS and Root Certificates) +[#]: via: (https://lushka.al/dns-and-certificates/) +[#]: author: (Anxhelo Lushka https://lushka.al/) + +DNS and Root Certificates +====== + +Due to recent events we (as in we from the Privacy Today group) felt compelled to write an impromptu article on this matter. It’s intended for all audiences so it will be kept simple - technical details may be posted later. + +### What Is DNS And Why Does It Concern You? + +DNS stands for Domain Name System and you encounter it daily. Whenever your web browser or any other application connects to the internet, it will most likely do so using a domain. A domain is simply the address you type: i.e. [duckduckgo.com][1]. Your computer needs to know where this leads to and will ask a DNS resolver for help. It will return an IP like [176.34.155.23][2]; the public network address you need to know to connect. This process is called a DNS lookup. + +There are certain implications for both your privacy and your security as well as your liberty: + +#### Privacy + +Since you ask the resolver for an IP for a domain name, it knows exactly which sites you’re visiting and, thanks to the “Internet Of Things”, often abbreviated as IoT, even which appliances you use at home. + +#### Security + +You’re trusting the resolver that the IP it returns is correct. There are certain checks to ensure it is so, under normal circumstances, that is not a common source of issues. These can be undermined though and that’s why this article is important. If the IP is not correct, you can be fooled into connecting to malicious 3rd parties - even without ever noticing any difference. In this case, your privacy is in much greater danger because, not only are the sites you visit tracked, but the contents as well. 3rd parties can see exactly what you’re looking at, collect personal information you enter (such as passwords), and a lot more. Your whole identity can be taken over with ease. + +#### Liberty + +Censorship is commonly enforced via DNS. It’s not the most effective way to do so but it is extremely widespread. Even in western countries, it’s routinely used by corporations and governments. They use the same methods as potential attackers; they will not return the correct IP when you ask. They could act as if the domain doesn’t exist or direct you elsewhere entirely. + +### Ways DNS lookups can happen + +#### 3rd Party DNS Resolvers Hosted By Your ISP + +Most people are using 3rd party resolvers hosted by their Internet Service Provider. When you connect your modem, they will automatically be fetched and you might never bother with it at all. + +#### 3rd Party DNS Resolver Of Your Choice + +If you already knew what DNS means then you might have decided to use another DNS resolver of your choice. This might improve the situation since it makes it harder for your ISP to track you and you can avoid some forms of censorship. Both are still possible though, but the methods required are not as widely used. + +#### Your Own (local) DNS Resolver + +You can run your own and avoid some of the possible perils of using others’. If you’re interested in more information drop us a line. + +### Root Certificates + +#### What Is A Root Certificate? + +Whenever you visit a website starting with https, you communicate with it using a certificate it sends. It enables your browser to encrypt the communication and ensures that nobody listening in can snoop. That’s why everybody has been told to look out for the https (rather than http) when logging into websites. The certificate itself only verifies that it has been generated for a certain domain. There’s more though: + +That’s where the root certificate comes in. Think of it as the next higher level that makes sure the levels below are correct. It verifies that the certificate sent to you has been authorized by a certificate authority. This authority ensures that the person creating the certificate is actually the real operator. + +This is also referred to as the chain of trust. Your operating system includes a set of these root certificates by default so that the chain of trust can be guaranteed. + +#### Abuse + +We now know that: + + * DNS resolvers send you an IP address when you send a domain name + * Certificates allow encrypting your communication and verify they have been generated for the domain you visit + * Root certificates verify that the certificate is legitimate and has been created by the real site operator + + + +**How can it be abused?** + + * A malicious DNS resolver can send you a wrong IP for the purpose of censorship as said before. They can also send you to a completely different site. + * This site can send you a fake certificate. + * A malicious root certificate can “verify” this fake certificate. + + + +This site will look absolutely fine to you; it has https in the URL and, if you click it, it will say verified. All just like you learned, right? **No!** + +It now receives all the communication you intended to send to the original. This bypasses the checks created to avoid it. You won’t receive error messages, your browser won’t complain. + +**All your data is compromised!** + +### Conclusion + +#### Risks + + * Using a malicious DNS resolver can always compromise your privacy but your security will be unharmed as long as you look out for the https. + * Using a malicious DNS resolver and a malicious root certificate, your privacy and security are fully compromised. + + + +#### Actions To Take + +**Do not ever install a 3rd party root certificate!** There are very few exceptions why you would want to do so and none of them are applicable to general end users. + +**Do not fall for clever marketing that ensures “ad blocking”, “military grade security”, or something similar**. There are methods of using DNS resolvers on their own to enhance your privacy but installing a 3rd party root certificate never makes sense. You are opening yourself up to extreme abuse. + +### Seeing It Live + +**WARNING** + +A friendly sysadmin provided a live demo so you can see for yourself in realtime. This is real. + +**DO NOT ENTER PRIVATE DATA! REMOVE THE CERT AND DNS AFTERWARDS!** + +If you do not know how to, don’t install it in the first place. While we trust our friend you still wouldn’t want to have the root certificate of a random and unknown 3rd party installed. + +#### Live Demo + +Here is the link: + + * Set the provided DNS resolver + * Install the provided root certificate + * Visit and enter random login data + * Your data will show up on the website + + + +### Further Information + +If you are interested in more technical details, let us know. If there is enough interest, we might write an article but, for now, the important part is sharing the basics so you can make an informed decision and not fall for marketing and straight up fraud. Feel free to suggest other topics that are important to you. + +This post is mirrored from [Privacy Today channel][3]. [Privacy Today][4] is a group about all things privacy, open source, libre philosophy and more! + +All content is licensed under CC BY-NC-SA 4.0. ([Attribution-NonCommercial-ShareAlike 4.0 International][5]). + +-------------------------------------------------------------------------------- + +via: https://lushka.al/dns-and-certificates/ + +作者:[Anxhelo Lushka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://lushka.al/ +[b]: https://github.com/lujun9972 +[1]: https://duckduckgo.com +[2]: http://176.34.155.23 +[3]: https://t.me/privacytoday +[4]: https://t.me/joinchat/Awg5A0UW-tzOLX7zMoTDog +[5]: https://creativecommons.org/licenses/by-nc-sa/4.0/ From 7149e6e9866d2111b6a9cbf06a5a1a5d028e1be4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 12:52:28 +0800 Subject: [PATCH 081/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20Instal?= =?UTF-8?q?l=20Apache,=20MySQL,=20PHP=20(LAMP)=20Stack=20On=20Ubuntu=2018.?= =?UTF-8?q?04=20LTS=20sources/tech/20190205=20Install=20Apache,=20MySQL,?= =?UTF-8?q?=20PHP=20(LAMP)=20Stack=20On=20Ubuntu=2018.04=20LTS.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...L, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md | 443 ++++++++++++++++++ 1 file changed, 443 insertions(+) create mode 100644 sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md diff --git a/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md b/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md new file mode 100644 index 0000000000..7ce1201c4f --- /dev/null +++ b/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md @@ -0,0 +1,443 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS) +[#]: via: (https://www.ostechnix.com/install-apache-mysql-php-lamp-stack-on-ubuntu-18-04-lts/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/lamp-720x340.jpg) + +**LAMP** stack is a popular, open source web development platform that can be used to run and deploy dynamic websites and web-based applications. Typically, LAMP stack consists of Apache webserver, MariaDB/MySQL databases, PHP/Python/Perl programming languages. LAMP is the acronym of **L** inux, **M** ariaDB/ **M** YSQL, **P** HP/ **P** ython/ **P** erl. This tutorial describes how to install Apache, MySQL, PHP (LAMP stack) in Ubuntu 18.04 LTS server. + +### Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS + +For the purpose of this tutorial, we will be using the following Ubuntu testbox. + + * **Operating System** : Ubuntu 18.04.1 LTS Server Edition + * **IP address** : 192.168.225.22/24 + + + +#### 1. Install Apache web server + +First of all, update Ubuntu server using commands: + +``` +$ sudo apt update + +$ sudo apt upgrade +``` + +Next, install Apache web server: + +``` +$ sudo apt install apache2 +``` + +Check if Apache web server is running or not: + +``` +$ sudo systemctl status apache2 +``` + +Sample output would be: + +``` +● apache2.service - The Apache HTTP Server + Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: en + Drop-In: /lib/systemd/system/apache2.service.d + └─apache2-systemd.conf + Active: active (running) since Tue 2019-02-05 10:48:03 UTC; 1min 5s ago + Main PID: 2025 (apache2) + Tasks: 55 (limit: 2320) + CGroup: /system.slice/apache2.service + ├─2025 /usr/sbin/apache2 -k start + ├─2027 /usr/sbin/apache2 -k start + └─2028 /usr/sbin/apache2 -k start + +Feb 05 10:48:02 ubuntuserver systemd[1]: Starting The Apache HTTP Server... +Feb 05 10:48:03 ubuntuserver apachectl[2003]: AH00558: apache2: Could not reliably +Feb 05 10:48:03 ubuntuserver systemd[1]: Started The Apache HTTP Server. +``` + +Congratulations! Apache service is up and running!! + +##### 1.1 Adjust firewall to allow Apache web server + +By default, the apache web browser can’t be accessed from remote systems if you have enabled the UFW firewall in Ubuntu 18.04 LTS. You must allow the http and https ports by following the below steps. + +First, list out the application profiles available on your Ubuntu system using command: + +``` +$ sudo ufw app list +``` + +Sample output: + +``` +Available applications: +Apache +Apache Full +Apache Secure +OpenSSH +``` + +As you can see, Apache and OpenSSH applications have installed UFW profiles. You can list out information about each profile and its included rules using “ **ufw app info “Profile Name”** command. + +Let us look into the **“Apache Full”** profile. To do so, run: + +``` +$ sudo ufw app info "Apache Full" +``` + +Sample output: + +``` +Profile: Apache Full +Title: Web Server (HTTP,HTTPS) +Description: Apache v2 is the next generation of the omnipresent Apache web +server. + +Ports: +80,443/tcp +``` + +As you see, “Apache Full” profile has included the rules to enable traffic to the ports **80** and **443** : + +Now, run the following command to allow incoming HTTP and HTTPS traffic for this profile: + +``` +$ sudo ufw allow in "Apache Full" +Rules updated +Rules updated (v6) +``` + +If you don’t want to allow https traffic, but only http (80) traffic, run: + +``` +$ sudo ufw app info "Apache" +``` + +##### 1.2 Test Apache Web server + +Now, open your web browser and access Apache test page by navigating to **** or ****. + +![](https://www.ostechnix.com/wp-content/uploads/2016/06/apache-2.png) + +If you are see a screen something like above, you are good to go. Apache server is working! + +#### 2. Install MySQL + +To install MySQL On Ubuntu, run: + +``` +$ sudo apt install mysql-server +``` + +Verify if MySQL service is running or not using command: + +``` +$ sudo systemctl status mysql +``` + +**Sample output:** + +``` +● mysql.service - MySQL Community Server +Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enab +Active: active (running) since Tue 2019-02-05 11:07:50 UTC; 17s ago +Main PID: 3423 (mysqld) +Tasks: 27 (limit: 2320) +CGroup: /system.slice/mysql.service +└─3423 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid + +Feb 05 11:07:49 ubuntuserver systemd[1]: Starting MySQL Community Server... +Feb 05 11:07:50 ubuntuserver systemd[1]: Started MySQL Community Server. +``` + +Mysql is running! + +##### 2.1 Setup database administrative user (root) password + +By default, MySQL **root** user password is blank. You need to secure your MySQL server by running the following script: + +``` +$ sudo mysql_secure_installation +``` + +You will be asked whether you want to setup **VALIDATE PASSWORD plugin** or not. This plugin allows the users to configure strong password for database credentials. If enabled, It will automatically check the strength of the password and enforces the users to set only those passwords which are secure enough. **It is safe to leave this plugin disabled**. However, you must use a strong and unique password for database credentials. If don’t want to enable this plugin, just press any key to skip the password validation part and continue the rest of the steps. + +If your answer is **Yes** , you will be asked to choose the level of password validation. + +``` +Securing the MySQL server deployment. + +Connecting to MySQL using a blank password. + +VALIDATE PASSWORD PLUGIN can be used to test passwords +and improve security. It checks the strength of password +and allows the users to set only those passwords which are +secure enough. Would you like to setup VALIDATE PASSWORD plugin? + +Press y|Y for Yes, any other key for No y +``` + +The available password validations are **low** , **medium** and **strong**. Just enter the appropriate number (0 for low, 1 for medium and 2 for strong password) and hit ENTER key. + +``` +There are three levels of password validation policy: + +LOW Length >= 8 +MEDIUM Length >= 8, numeric, mixed case, and special characters +STRONG Length >= 8, numeric, mixed case, special characters and dictionary file + +Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: +``` + +Now, enter the password for MySQL root user. Please be mindful that you must use password for mysql root user depending upon the password policy you choose in the previous step. If you didn’t enable the plugin, just use any strong and unique password of your choice. + +``` +Please set the password for root here. + +New password: + +Re-enter new password: + +Estimated strength of the password: 50 +Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y +``` + +Once you entered the password twice, you will see the password strength (In our case it is **50** ). If it is OK for you, press Y to continue with the provided password. If not satisfied with password length, press any other key and set a strong password. I am OK with my current password, so I chose **y**. + +For the rest of questions, just type **y** and hit ENTER. This will remove anonymous user, disallow root user login remotely and remove test database. + +``` +Remove anonymous users? (Press y|Y for Yes, any other key for No) : y +Success. + +Normally, root should only be allowed to connect from +'localhost'. This ensures that someone cannot guess at +the root password from the network. + +Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y +Success. + +By default, MySQL comes with a database named 'test' that +anyone can access. This is also intended only for testing, +and should be removed before moving into a production +environment. + +Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y +- Dropping test database... +Success. + +- Removing privileges on test database... +Success. + +Reloading the privilege tables will ensure that all changes +made so far will take effect immediately. + +Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y +Success. + +All done! +``` + +That’s it. Password for MySQL root user has been set. + +##### 2.2 Change authentication method for MySQL root user + +By default, MySQL root user is set to authenticate using the **auth_socket** plugin in MySQL 5.7 and newer versions on Ubuntu. Even though it enhances the security, it will also complicate things when you access your database server using any external programs, for example phpMyAdmin. To fix this issue, you need to change authentication method from **auth_socket** to **mysql_native_password**. To do so, login to your MySQL prompt using command: + +``` +$ sudo mysql +``` + +Run the following command at the mysql prompt to find the current authentication method for all mysql user accounts: + +``` +SELECT user,authentication_string,plugin,host FROM mysql.user; +``` + +**Sample output:** + +``` ++------------------|-------------------------------------------|-----------------------|-----------+ +| user | authentication_string | plugin | host | ++------------------|-------------------------------------------|-----------------------|-----------+ +| root | | auth_socket | localhost | +| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost | +| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost | +| debian-sys-maint | *F126737722832701DD3979741508F05FA71E5BA0 | mysql_native_password | localhost | ++------------------|-------------------------------------------|-----------------------|-----------+ +4 rows in set (0.00 sec) +``` + +![][2] + +As you see, mysql root user uses `auth_socket` plugin for authentication. + +To change this authentication to **mysql_native_password** method, run the following command at mysql prompt. Don’t forget to replace **“password”** with a strong and unique password of your choice. If you have enabled VALIDATION plugin, make sure you have used a strong password based on the current policy requirements. + +``` +ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; +``` + +Update the changes using command: + +``` +FLUSH PRIVILEGES; +``` + +Now check again if the authentication method is changed or not using command: + +``` +SELECT user,authentication_string,plugin,host FROM mysql.user; +``` + +Sample output: + +![][3] + +Good! Now the myql root user can authenticate using password to access mysql shell. + +Exit from the mysql prompt: + +``` +exit +``` + +#### 3\. Install PHP + +To install PHP, run: + +``` +$ sudo apt install php libapache2-mod-php php-mysql +``` + +After installing PHP, create **info.php** file in the Apache root document folder. Usually, the apache root document folder will be **/var/www/html/** or **/var/www/** in most Debian based Linux distributions. In Ubuntu 18.04 LTS, it is **/var/www/html/**. + +Let us create **info.php** file in the apache root folder: + +``` +$ sudo vi /var/www/html/info.php +``` + +Add the following lines: + +``` + +``` + +Press ESC key and type **:wq** to save and quit the file. Restart apache service to take effect the changes. + +``` +$ sudo systemctl restart apache2 +``` + +##### 3.1 Test PHP + +Open up your web browser and navigate to **** URL. + +You will see the php test page now. + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/php-test-page.png) + +Usually, when a user requests a directory from the web server, Apache will first look for a file named **index.html**. If you want to change Apache to serve php files rather than others, move **index.php** to first position in the **dir.conf** file as shown below + +``` +$ sudo vi /etc/apache2/mods-enabled/dir.conf +``` + +Here is the contents of the above file. + +``` + +DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet +``` + +Move the “index.php” file to first. Once you made the changes, your **dir.conf** file will look like below. + +``` + +DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet +``` + +Press **ESC** key and type **:wq** to save and close the file. Restart Apache service to take effect the changes. + +``` +$ sudo systemctl restart apache2 +``` + +##### 3.2 Install PHP modules + +To improve the functionality of PHP, you can install some additional PHP modules. + +To list the available PHP modules, run: + +``` +$ sudo apt-cache search php- | less +``` + +**Sample output:** + +![][4] + +Use the arrow keys to go through the result. To exit, type **q** and hit ENTER key. + +To find the details of any particular php module, for example **php-gd** , run: + +``` +$ sudo apt-cache show php-gd +``` + +To install a php module run: + +``` +$ sudo apt install php-gd +``` + +To install all modules (not necessary though), run: + +``` +$ sudo apt-get install php* +``` + +Do not forget to restart Apache service after installing any php module. To check if the module is loaded or not, open info.php file in your browser and check if it is present. + +Next, you might want to install any database management tools to easily manage databases via a web browser. If so, install phpMyAdmin as described in the following link. + +Congratulations! We have successfully setup LAMP stack in Ubuntu 18.04 LTS server. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/install-apache-mysql-php-lamp-stack-on-ubuntu-18-04-lts/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/mysql-1.png +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/mysql-2.png +[4]: http://www.ostechnix.com/wp-content/uploads/2016/06/php-modules.png From c31136b8755a7105c46800367288b65f970b56ea Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 12:55:29 +0800 Subject: [PATCH 082/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190204=20Top=20?= =?UTF-8?q?5=20open=20source=20network=20monitoring=20tools=20sources/tech?= =?UTF-8?q?/20190204=20Top=205=20open=20source=20network=20monitoring=20to?= =?UTF-8?q?ols.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 5 open source network monitoring tools.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/tech/20190204 Top 5 open source network monitoring tools.md diff --git a/sources/tech/20190204 Top 5 open source network monitoring tools.md b/sources/tech/20190204 Top 5 open source network monitoring tools.md new file mode 100644 index 0000000000..5b6e7f1bfa --- /dev/null +++ b/sources/tech/20190204 Top 5 open source network monitoring tools.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 open source network monitoring tools) +[#]: via: (https://opensource.com/article/19/2/network-monitoring-tools) +[#]: author: (Paul Bischoff https://opensource.com/users/paulbischoff) + +Top 5 open source network monitoring tools +====== +Keep an eye on your network to avoid downtime with these monitoring tools. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mesh_networking_dots_connected.png?itok=ovINTRR3) + +Maintaining a live network is one of a system administrator's most essential tasks, and keeping a watchful eye over connected systems is essential to keeping a network functioning at its best. + +There are many different ways to keep tabs on a modern network. Network monitoring tools are designed for the specific purpose of monitoring network traffic and response times, while application performance management solutions use agents to pull performance data from the application stack. If you have a live network, you need network monitoring to make sure you aren't vulnerable to an attacker. Likewise, if you rely on lots of different applications to run your daily operations, you will need an [application performance management][1] solution as well. + +This article will focus on open source network monitoring tools. These tools help monitor individual nodes and applications for signs of poor performance. Through one window, you can view the performance of an entire network and even get alerts to keep you in the loop if you're away from your desk. + +Before we get into the top five network monitoring tools, let's look more closely at the reasons you need to use one. + +### Why do I need a network monitoring tool? + +Network monitoring tools are vital to maintaining networks because they allow you to keep an eye on devices connected to the network from a central location. These tools help flag devices with subpar performance so you can step in and run troubleshooting to get to the root of the problem. + +Running in-depth troubleshooting can minimize performance problems and prevent security breaches. In practical terms, this keeps the network online and eliminates the risk of falling victim to unnecessary downtime. Regular network maintenance can also help prevent outages that could take thousands of users offline. + +A network monitoring tool enables you to: + + * Autodiscover devices connected to your network + * View live and historic performance data for a range of devices and applications + * Configure alerts to notify you of unusual activity + * Generate graphs and reports to analyze network activity in greater depth + +### The top 5 open source network monitoring tools + +Now, that you know why you need a network monitoring tool, take a look at the top 5 open source tools to see which might best meet your needs. + +#### Cacti + +![](https://opensource.com/sites/default/files/uploads/cacti_network-monitoring-tools.png) + +If you know anything about open source network monitoring tools, you've probably heard of [Cacti][2]. It's a graphing solution that acts as an addition to [RRDTool][3] and is used by many network administrators to collect performance data in LANs. Cacti comes with Simple Network Management Protocol (SNMP) support on Windows and Linux to create graphs of traffic data. + +Cacti typically works by using data sourced from user-created scripts that ping hosts on a network. The values returned by the scripts are stored in a MySQL database, and this data is used to generate graphs. + +This sounds complicated, but Cacti has templates to help speed the process along. You can also create a graph or data source template that can be used for future monitoring activity. If you'd like to try it out, [download Cacti][4] for free on Linux and Windows. + +#### Nagios Core + +![](https://opensource.com/sites/default/files/uploads/nagioscore_network-monitoring-tools.png) + +[Nagios Core][5] is one of the most well-known open source monitoring tools. It provides a network monitoring experience that combines open source extensibility with a top-of-the-line user interface. With Nagios Core, you can auto-discover devices, monitor connected systems, and generate sophisticated performance graphs. + +Support for customization is one of the main reasons Nagios Core has become so popular. For example, [Nagios V-Shell][6] was added as a PHP web interface built in AngularJS, searchable tables and a RESTful API designed with CodeIgniter. + +If you need more versatility, you can check the Nagios Exchange, which features a range of add-ons that can incorporate additional features into your network monitoring. These range from the strictly cosmetic to monitoring enhancements like [nagiosgraph][7]. You can try it out by [downloading Nagios Core][8] for free. + +#### Icinga 2 + +![](https://opensource.com/sites/default/files/uploads/icinga2_network-monitoring-tools.png) + +[Icinga 2][9] is another widely used open source network monitoring tool. It builds on the groundwork laid by Nagios Core. It has a flexible RESTful API that allows you to enter your own configurations and view live performance data through the dashboard. Dashboards are customizable, so you can choose exactly what information you want to monitor in your network. + +Visualization is an area where Icinga 2 performs particularly well. It has native support for Graphite and InfluxDB, which can turn performance data into full-featured graphs for deeper performance analysis. + +Icinga2 also allows you to monitor both live and historical performance data. It offers excellent alerts capabilities for live monitoring, and you can configure it to send notifications of performance problems by email or text. You can [download Icinga 2][10] for free for Windows, Debian, DHEL, SLES, Ubuntu, Fedora, and OpenSUSE. + +#### Zabbix + +![](https://opensource.com/sites/default/files/uploads/zabbix_network-monitoring-tools.png) + +[Zabbix][11] is another industry-leading open source network monitoring tool, used by companies from Dell to Salesforce on account of its malleable network monitoring experience. Zabbix does network, server, cloud, application, and services monitoring very well. + +You can track network information such as network bandwidth usage, network health, and configuration changes, and weed out problems that need to be addressed. Performance data in Zabbix is connected through SNMP, Intelligent Platform Management Interface (IPMI), and IPv6. + +Zabbix offers a high level of convenience compared to other open source monitoring tools. For instance, you can automatically detect devices connected to your network before using an out-of-the-box template to begin monitoring your network. You can [download Zabbix][12] for free for CentOS, Debian, Oracle Linux, Red Hat Enterprise Linux, Ubuntu, and Raspbian. + +#### Prometheus + +![](https://opensource.com/sites/default/files/uploads/promethius_network-monitoring-tools.png) + +[Prometheus][13] is an open source network monitoring tool with a large community following. It was built specifically for monitoring time-series data. You can identify time-series data by metric name or key-value pairs. Time-series data is stored on local disks so that it's easy to access in an emergency. + +Prometheus' [Alertmanager][14] allows you to view notifications every time it raises an event. Alertmanager can send notifications via email, PagerDuty, or OpsGenie, and you can silence alerts if necessary. + +Prometheus' visual elements are excellent and allow you to switch from the browser to the template language and Grafana integration. You can also integrate various third-party data sources into Prometheus from Docker, StatsD, and JMX to customize your Prometheus experience. + +As a network monitoring tool, Prometheus is suitable for organizations of all sizes. The onboard integrations and the easy-to-use Alertmanager make it capable of handling any workload, regardless of its size. You can [download Prometheus][15] for free. + +### Which are best? + +No matter what industry you're working in, if you rely on a network to do business, you need to implement some form of network monitoring. Network monitoring tools are an invaluable resource that help provide you with the visibility to keep your systems online. Monitoring your systems will give you the best chance to keep your equipment in working order. + +As the tools on this list show, you don't need to spend an exorbitant amount of money to reap the rewards of network monitoring. Of the five, I believe Icinga 2 and Zabbix are the best options for providing you with everything you need to start monitoring your network to keep it online. Staying vigilant will help to minimize the change of being caught off-guard by performance issues. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/network-monitoring-tools + +作者:[Paul Bischoff][a] +选题:[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/paulbischoff +[b]: https://github.com/lujun9972 +[1]: https://www.comparitech.com/net-admin/application-performance-management/ +[2]: https://www.cacti.net/index.php +[3]: https://en.wikipedia.org/wiki/RRDtool +[4]: https://www.cacti.net/download_cacti.php +[5]: https://www.nagios.org/projects/nagios-core/ +[6]: https://exchange.nagios.org/directory/Addons/Frontends-%28GUIs-and-CLIs%29/Web-Interfaces/Nagios-V-2DShell/details +[7]: https://exchange.nagios.org/directory/Addons/Graphing-and-Trending/nagiosgraph/details#_ga=2.79847774.890594951.1545045715-2010747642.1545045715 +[8]: https://www.nagios.org/downloads/nagios-core/ +[9]: https://icinga.com/products/icinga-2/ +[10]: https://icinga.com/download/ +[11]: https://www.zabbix.com/ +[12]: https://www.zabbix.com/download +[13]: https://prometheus.io/ +[14]: https://prometheus.io/docs/alerting/alertmanager/ +[15]: https://prometheus.io/download/ From a3be4e50a858da321a30e8056832fba19f40435c Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 12:58:12 +0800 Subject: [PATCH 083/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190201=20Top=20?= =?UTF-8?q?5=20Linux=20Distributions=20for=20New=20Users=20sources/tech/20?= =?UTF-8?q?190201=20Top=205=20Linux=20Distributions=20for=20New=20Users.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Top 5 Linux Distributions for New Users.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20190201 Top 5 Linux Distributions for New Users.md diff --git a/sources/tech/20190201 Top 5 Linux Distributions for New Users.md b/sources/tech/20190201 Top 5 Linux Distributions for New Users.md new file mode 100644 index 0000000000..6b6985bf0a --- /dev/null +++ b/sources/tech/20190201 Top 5 Linux Distributions for New Users.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Distributions for New Users) +[#]: via: (https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +Top 5 Linux Distributions for New Users +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin-main.jpg?itok=ASgr0mOP) + +Linux has come a long way from its original offering. But, no matter how often you hear how easy Linux is now, there are still skeptics. To back up this claim, the desktop must be simple enough for those unfamiliar with Linux to be able to make use of it. And, the truth is that plenty of desktop distributions make this a reality. + +### No Linux knowledge required + +It might be simple to misconstrue this as yet another “best user-friendly Linux distributions” list. That is not what we’re looking at here. What’s the difference? For my purposes, the defining line is whether or not Linux actually plays into the usage. In other words, could you set a user in front of a desktop operating system and have them be instantly at home with its usage? No Linux knowledge required. + +Believe it or not, some distributions do just that. I have five I’d like to present to you here. You’ve probably heard of all of them. They might not be your distribution of choice, but you can guarantee that they slide Linux out of the spotlight and place the user front and center. + +Let’s take a look at the chosen few. + +### Elementary OS + +The very philosophy of Elementary OS is centered around how people actually use their desktops. The developers and designers have gone out of their way to create a desktop that is as simple as possible. In the process, they’ve de-Linux’d Linux. That is not to say they’ve removed Linux from the equation. No. Instead, what they’ve done is create an operating system that is about as neutral as you’ll find. Elementary OS is streamlined in such a way as to make sure everything is perfectly logical. From the single Dock to the clear-to-anyone Applications menu, this is a desktop that doesn’t say to the user, “You’re using Linux!” In fact, the layout itself is reminiscent of Mac, but with the addition of a simple app menu (Figure 1). + +![Elementary OS Juno][2] + +Figure 1: The Elementary OS Juno Application menu in action. + +[Used with permission][3] + +Another important aspect of Elementary OS that places it on this list is that it’s not nearly as flexible as some other desktop distributions. Sure, some users would balk at that, but having a desktop that doesn’t throw every bell and whistle at the user makes for a very familiar environment -- one that neither requires or allows a lot of tinkering. That aspect of the OS goes a long way to make the platform familiar to new users. + +And like any modern Linux desktop distribution, Elementary OS includes and App Store, called AppCenter, where users can install all the applications they need, without ever having to touch the command line. + +### Deepin + +Deepin not only gets my nod for one of the most beautiful desktops on the market, it’s also just as easy to adopt as any desktop operating system available. With a very simplistic take on the desktop interface, there’s very little in the way of users with zero Linux experience getting up to speed on its usage. In fact, you’d be hard-pressed to find a user who couldn’t instantly start using the Deepin desktop. The only possible hitch in that works might be the sidebar control center (Figure 2). + +![][5] + +Figure 2: The Deepin sidebar control panel. + +[Used with permission][3] + +But even that sidebar control panel is as intuitive as any other configuration tool on the market. And anyone that has used a mobile device will be instantly at home with the layout. As for opening applications, Deepin takes a macOS Launchpad approach with the Launcher. This button is in the usual far right position on the desktop dock, so users will immediately gravitate to that, understanding that it is probably akin to the standard “Start” menu. + +In similar fashion as Elementary OS (and most every Linux distribution on the market), Deepin includes an app store (simply called “Store”), where plenty of apps can be installed with ease. + +### Ubuntu + +You knew it was coming. Ubuntu is most often ranked at the top of most user-friendly Linux lists. Why? Because it’s one of the chosen few where a knowledge of Linux simply isn’t necessary to get by on the desktop. Prior to the adoption of GNOME (and the ousting of Unity), that wouldn’t have been the case. Why? Because Unity often needed a bit of tweaking to get it to the point where a tiny bit of Linux knowledge wasn’t necessary (Figure 3). Now that Ubuntu has adopted GNOME, and tweaked it to the point where an understanding of GNOME isn’t even necessary, this desktop makes Linux take a back seat to simplicity and usability. + +![Ubuntu 18.04][7] + +Figure 3: The Ubuntu 18.04 desktop is instantly familiar. + +[Used with permission][3] + +Unlike Elementary OS, Ubuntu doesn’t hold the user back. So anyone who wants more from their desktop, can have it. However, the out of the box experience is enough for just about any user type. Anyone looking for a desktop that makes the user unaware as to just how much power they have at their fingertips, could certainly do worse than Ubuntu. + +### Linux Mint + +I will preface this by saying I’ve never been the biggest fan of Linux Mint. It’s not that I don’t respect what the developers are doing, it’s more an aesthetic. I prefer modern-looking desktop environments. But that old school desktop metaphor (found in the default Cinnamon desktop) is perfectly familiar to nearly anyone who uses it. With a taskbar, start button, system tray, and desktop icons (Figure 4), Linux Mint offers an interface that requires zero learning curve. In fact, some users might be initially fooled into thinking they are working with a Windows 7 clone. Even the updates warning icon will look instantly familiar to users. + +![Linux Mint ][9] + +Figure 4: The Linux Mint Cinnamon desktop is very Windows 7-ish. + +[Used with permission][3] + +Because Linux Mint benefits from being based on Ubuntu, it’ll not only enjoy an immediate familiarity, but a high usability. No matter if you have even the slightest understanding of the underlying platform, users will feel instantly at home on Linux Mint. + +### Ubuntu Budgie + +Our list concludes with a distribution that also does a fantastic job of making the user forget they are using Linux, and makes working with the usual tools a simple, beautiful thing. Melding the Budgie Desktop with Ubuntu makes for an impressively easy to use distribution. And although the layout of the desktop (Figure 5) might not be the standard fare, there is no doubt the acclimation takes no time. In fact, outside of the Dock defaulting to the left side of the desktop, Ubuntu Budgie has a decidedly Elementary OS look to it. + +![Budgie][11] + +Figure 5: The Budgie desktop is as beautiful as it is simple. + +[Used with permission][3] + +The System Tray/Notification area in Ubuntu Budgie offers a few more features than the usual fare: Features such as quick access to Caffeine (a tool to keep your desktop awake), a Quick Notes tool (for taking simple notes), Night Lite switch, a Places drop-down menu (for quick access to folders), and of course the Raven applet/notification sidebar (which is similar to, but not quite as elegant as, the Control Center sidebar in Deepin). Budgie also includes an application menu (top left corner), which gives users access to all of their installed applications. Open an app and the icon will appear in the Dock. Right-click that app icon and select Keep in Dock for even quicker access. + +Everything about Ubuntu Budgie is intuitive, so there’s practically zero learning curve involved. It doesn’t hurt that this distribution is as elegant as it is easy to use. + +### Give One A Chance + +And there you have it, five Linux distributions that, each in their own way, offer a desktop experience that any user would be instantly familiar with. Although none of these might be your choice for top distribution, it’s hard to argue their value when it comes to users who have no familiarity with Linux. + +Learn more about Linux through the free ["Introduction to Linux" ][12]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users + +作者:[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.linux.com/files/images/elementaryosjpg-2 +[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/elementaryos_0.jpg?itok=KxgNUvMW (Elementary OS Juno) +[3]: https://www.linux.com/licenses/category/used-permission +[4]: https://www.linux.com/files/images/deepinjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin.jpg?itok=VV381a9f +[6]: https://www.linux.com/files/images/ubuntujpg-1 +[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntu_1.jpg?itok=bax-_Tsg (Ubuntu 18.04) +[8]: https://www.linux.com/files/images/linuxmintjpg +[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/linuxmint.jpg?itok=8sPon0Cq (Linux Mint ) +[10]: https://www.linux.com/files/images/budgiejpg-0 +[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/budgie_0.jpg?itok=zcf-AHmj (Budgie) +[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From d487a21b6d51d42d0696d5ac35c4c893fe502436 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:00:22 +0800 Subject: [PATCH 084/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190206=204=20co?= =?UTF-8?q?ol=20new=20projects=20to=20try=20in=20COPR=20for=20February=202?= =?UTF-8?q?019=20sources/tech/20190206=204=20cool=20new=20projects=20to=20?= =?UTF-8?q?try=20in=20COPR=20for=20February=202019.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ojects to try in COPR for February 2019.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md diff --git a/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md b/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md new file mode 100644 index 0000000000..dc424f9625 --- /dev/null +++ b/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for February 2019) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/) +[#]: author: (Dominik Turecek https://fedoramagazine.org) + +4 cool new projects to try in COPR for February 2019 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) + +COPR is a [collection][1] of personal repositories for software that isn’t carried in Fedora. Some software doesn’t conform to standards that allow easy packaging. Or it may not meet other Fedora standards, despite being free and open source. COPR can offer these projects outside the Fedora set of packages. Software in COPR isn’t supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software. + +Here’s a set of new and interesting projects in COPR. + +### CryFS + +[CryFS][2] is a cryptographic filesystem. It is designed for use with cloud storage, mainly Dropbox, although it works with other storage providers as well. CryFS encrypts not only the files in the filesystem, but also metadata, file sizes and directory structure. + +#### Installation instructions + +The repo currently provides CryFS for Fedora 28 and 29, and for EPEL 7. To install CryFS, use these commands: + +``` +sudo dnf copr enable fcsm/cryfs +sudo dnf install cryfs +``` + +### Cheat + +[Cheat][3] is a utility for viewing various cheatsheets in command-line, aiming to help remind usage of programs that are used only occasionally. For many Linux utilities, cheat provides cheatsheets containing condensed information from man pages, focusing mainly on the most used examples. In addition to the built-in cheatsheets, cheat allows you to edit the existing ones or creating new ones from scratch. + +![][4] + +#### Installation instructions + +The repo currently provides cheat for Fedora 28, 29 and Rawhide, and for EPEL 7. To install cheat, use these commands: + +``` +sudo dnf copr enable tkorbar/cheat +sudo dnf install cheat +``` + +### Setconf + +[Setconf][5] is a simple program for making changes in configuration files, serving as an alternative for sed. The only thing setconf does is that it finds the key in the specified file and changes its value. Setconf provides only a few options to change its behavior — for example, uncommenting the line that is being changed. + +#### Installation instructions + +The repo currently provides setconf for Fedora 27, 28 and 29. To install setconf, use these commands: + +``` +sudo dnf copr enable jamacku/setconf +sudo dnf install setconf +``` + +### Reddit Terminal Viewer + +[Reddit Terminal Viewer][6], or rtv, is an interface for browsing Reddit from terminal. It provides the basic functionality of Reddit, so you can log in to your account, view subreddits, comment, upvote and discover new topics. Rtv currently doesn’t, however, support Reddit tags. + +![][7] + +#### Installation instructions + +The repo currently provides Reddit Terminal Viewer for Fedora 29 and Rawhide. To install Reddit Terminal Viewer, use these commands: + +``` +sudo dnf copr enable tc01/rtv +sudo dnf install rtv +``` + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/ + +作者:[Dominik Turecek][a] +选题:[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 +[b]: https://github.com/lujun9972 +[1]: https://copr.fedorainfracloud.org/ +[2]: https://www.cryfs.org/ +[3]: https://github.com/chrisallenlane/cheat +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/cheat.png +[5]: https://setconf.roboticoverlords.org/ +[6]: https://github.com/michael-lazar/rtv +[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/rtv.png From a2f3c032f77a4e293851cc1929364e636ee4f924 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:02:02 +0800 Subject: [PATCH 085/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190204=20Config?= =?UTF-8?q?=20management=20is=20dead:=20Long=20live=20Config=20Management?= =?UTF-8?q?=20Camp=20sources/talk/20190204=20Config=20management=20is=20de?= =?UTF-8?q?ad-=20Long=20live=20Config=20Management=20Camp.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... dead- Long live Config Management Camp.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/talk/20190204 Config management is dead- Long live Config Management Camp.md diff --git a/sources/talk/20190204 Config management is dead- Long live Config Management Camp.md b/sources/talk/20190204 Config management is dead- Long live Config Management Camp.md new file mode 100644 index 0000000000..679ac9033b --- /dev/null +++ b/sources/talk/20190204 Config management is dead- Long live Config Management Camp.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Config management is dead: Long live Config Management Camp) +[#]: via: (https://opensource.com/article/19/2/configuration-management-camp) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Config management is dead: Long live Config Management Camp +====== + +CfgMgmtCamp '19 co-organizers share their take on ops, DevOps, observability, and the rise of YoloOps and YAML engineers. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) + +Everyone goes to [FOSDEM][1] in Brussels to learn from its massive collection of talk tracks, colloquially known as developer rooms, that run the gauntlet of curiosities, covering programming languages like Rust, Go, and Python, to special topics ranging from community, to legal, to privacy. After two days of nonstop activity, many FOSDEM attendees move on to Ghent, Belgium, to join hundreds for Configuration Management Camp ([CfgMgmtCamp][2]). + +Kris Buytaert and Toshaan Bharvani run the popular post-FOSDEM show centered around infrastructure management, featuring hackerspaces, training, workshops, and keynotes. It's a deeply technical exploration of the who, what, and how of building resilient infrastructure. It started in 2013 as a PuppetCamp but expanded to include more communities and tools in 2014. + +I spoke with Kris and Toshaan, who both have a healthy sense of humor, about CfgMgmtCamp's past, present, and future. Our interview has been edited for length and clarity. + +**Matthew: Your opening[keynote][3] is called "CfgMgmtCamp is dead." Is config management dead? Will it live on, or will something take its place?** + +**Kris:** We've noticed people are jumping on the hype of containers, trying to solve the same problems in a different way. But they are still managing config, only in different ways and with other tools. Over the past couple of years, we've evolved from a conference with a focus on infrastructure-as-code tooling, such as Puppet, Chef, CFEngine, Ansible, Juju, and Salt, to a more open source infrastructure automation conference in general. So, config management is definitely not dead. Infrastructure-as-code is also not dead, but it all is evolving. + +**Toshaan:** We see people changing tools, jumping on hype, and communities changing; however, the basic ideas and concepts remain the same. + +**Matthew: It's great to see[observability as the topic][4] of one of your keynotes. Why should those who care about configuration management also care about monitoring and observability?** + +**Kris:** While the name of the conference hasn't changed, the tools have evolved and we have expanded our horizon. Ten years ago, [Devopsdays][5] was just #devopsdays, but it evolved to focus on culture—the C of [CAMS][6] in the DevOps' core principles of Culture, Automation, Measurement, and Sharing. + +![](https://opensource.com/sites/default/files/uploads/cams.png) + +[Monitorama][7] filled the gap on monitoring and metrics (tackling the M in CAMS). Config Management Camp is about open source Automation, the A. Since they are all open source conferences, they fulfill the Sharing part, completing the CAMS concept. + +Observability sits on the line between Automation and Measurement. To go one step further, in some of my talks about open source monitoring, I describe the evolution of monitoring tools from #monitoringsucks to #monitoringlove; for lots of people (including me), the love for monitoring returned because we tied it to automation. We started to provision a service and automatically adapted the monitoring of that service to its state. Gone were the days where the monitoring tool was out of sync with reality. + +Looking at it from the other side, when you have an infrastructure or application so complex that you need observability in it, you'd better not be deploying manually; you will need some form of automation at that level of complexity. So, observability and infrastructure automation are tied together. + +**Toshaan:** Yes, while in the past we focused on configuration management, we will be looking to expand that into all types of infrastructure management. Last year, we played with this idea, and we were able to have a lot of cross-tool presentations. This year, we've taken this a step further by having more differentiated content. + +**Matthew: Some of my virtualization and Linux admin friends push back, saying observability is a developer's responsibility. How would you respond without just saying "DevOps?"** + +**Kris:** What you describe is what I call "Ooops Devs." This is a trend where the people who run the platform don't really care what they run; as long as port 80 is listening and the node pings, they are happy. It's equally bad as "Dev Ooops." "Ooops Devs" is where the devs rant about the ops folks because they are slow, not agile, and not responsive. But, to me, your job as an ops person or as a Linux admin is to keep a service running, and the only way to do that is to take on that task is as a team—with your colleagues who have different roles and insights, people who write code, people who design, etc. It is a shared responsibility. And hiding behind "that is someone else's responsibility," doesn't smell like collaboration going on. + +**Toshaan:** Even in the dark ages of silos, I believe a true sysadmin should have cared about observability, monitoring, and automation. I believe that the DevOps movement has made this much more widespread, and that it has become easier to get this information and expose it. On the other hand, I believe that pure operators or sysadmins have learned to be team players (or, they may have died out). I like the analogy of an army unit composed of different specialty soldiers who work together to complete a mission; we have engineers who work to deliver products or services. + +**Matthew: In a[Devopsdays Zurich talk][8], Kris offered an opinion that Americans build software for acquisition and Europeans build for resilience. In that light, what are the best skills for someone who wants to build meaningful infrastructure?** + +**Toshaan:** I believe still some people don't understand the complexity of code sprawl, and they believe that some new hype will solve this magically. + +**Kris:** This year, we invited [Steve Traugott][9], co-author of the 1998 USENIX paper "[Bootstrapping an Infrastructure][10]" that helped kickstart our community. So many people never read [Infrastructures.org][11], never experienced the pain of building images and image sprawl, and don't understand the evolution we went through that led us to build things the way we build them from source code. + +People should study topics such as idempotence, resilience, reproducibility, and surviving the tenth floor test. (As explained in "Bootstrapping an Infrastructure": "The test we used when designing infrastructures was 'Can I grab a random machine and throw it out the tenth-floor window without adversely impacting users for more than 10 minutes?' If the answer to this was 'yes,' then we knew we were doing things right.") But only after they understand the service they are building—the service is the absolute priority—can they begin working on things like: how can we run this, how can we make sure it keeps running, how can it fail and how can we prevent that, and if it disappears, how can we spin it up again fast, unnoticed by the end user. + +**Toshaan:** 100% uptime. + +**Kris:** The challenge we have is that lots of people don't have that experience yet. We've seen the rise of [YoloOps][12]—just spin it up once, fire, and forget—which results in security problems, stability problems, data loss, etc., and they often grasp onto the solutions in YoloOps, the easy way to do something quickly and move on. But understanding how things will eventually fail takes time, it's called experience. + +**Toshaan:** Well, when I was a student and manned the CentOS stand at FOSDEM, I remember a guy coming up to the stand and complaining that he couldn't do consulting because of the "fire once and forgot" policy of CentOS, and that it just worked too well. I like to call this ZombieOps, but YoloOps works also. + +**Matthew: I see you're leading the second year of YamlCamp as well. Why does a markup language need its own camp?** + +**Kris:** [YamlCamp][13] is a parody, it's a joke. Last year, Bob Walker ([@rjw1][14]) gave a talk titled "Are we all YAML engineers now?" that led to more jokes. We've had a discussion for years about rebranding CfgMgmtCamp; the problem is that people know our name, we have a large enough audience to keep going, and changing the name would mean effort spent on logos, website, DNS, etc. We won't change the name, but we joked that we could rebrand to YamlCamp, because for some weird reason, a lot of the talks are about YAML. :) + +**Matthew: Do you think systems engineers should list YAML as a skill or a language on their CV? Should companies be hiring YAML engineers, or do you have "Long live all YAML engineers" on the website in jest?** + +**Toshaan:** Well, the real question is whether people are willing to call themselves YAML engineers proudly, because we already have enough DevOps engineers. + +**Matthew: What FOSS software helps you manage the event?** + +**Toshaan:** I re-did the website in Hugo CMS because we were spending too much time maintaining the website manually. I chose Hugo, because I was learning Golang, and because it has been successfully used for other conferences and my own website. I also wanted a static website and iCalendar output, so we could use calendar tooling such as Giggity to have a good scheduling tool. + +The website now builds quite nicely, and while I still have some ideas on improvements, maintenance is now much easier. + +For the call for proposals (CFP), we now use [OpenCFP][15]. We want to optimize the submission, voting, selection, and extraction to be as automated as possible, while being easy and comfortable for potential speakers, reviewers, and ourselves to use. OpenCFP seems to be the tool that works; while we still have some feature requirements, I believe that, once we have some time to contribute back to OpenCFP, we'll have a fully functional and easy tool to run CFPs with. + +Last, we switched from EventBrite to Pretix because I wanted to be GDPR compliant and have the ability to run our questions, vouchers, and extra features. Pretix allows us to control registration of attendees, speakers, sponsors, and organizers and have a single overview of all the people coming to the event. + +### Wrapping up + +The beauty of Configuration Management Camp to me is that it continues to evolve with its audience. Configuration management is certainly at the heart of the work, but it's in service to resilient infrastructure. Keep your eyes open for the talk recordings to learn from the [line up of incredible speakers][16], and thank you to the team for running this (free) show! + +You can follow Kris [@KrisBuytaert][17] and Toshaan [@toshywoshy][18]. You can also see Kris' past articles [on his blog][19]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/configuration-management-camp + +作者:[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://fosdem.org/2019/ +[2]: https://cfgmgmtcamp.eu/ +[3]: https://cfgmgmtcamp.eu/schedule/monday/intro00/ +[4]: https://cfgmgmtcamp.eu/schedule/monday/keynote0/ +[5]: https://www.devopsdays.org/ +[6]: http://devopsdictionary.com/wiki/CAMS +[7]: http://monitorama.com/ +[8]: https://vimeo.com/272519813 +[9]: https://cfgmgmtcamp.eu/schedule/tuesday/keynote1/ +[10]: http://www.infrastructures.org/papers/bootstrap/bootstrap.html +[11]: http://www.infrastructures.org/ +[12]: https://gist.githubusercontent.com/mariozig/5025613/raw/yolo +[13]: https://twitter.com/yamlcamp +[14]: https://twitter.com/rjw1 +[15]: https://github.com/opencfp/opencfp +[16]: https://cfgmgmtcamp.eu/speaker/ +[17]: https://twitter.com/KrisBuytaert +[18]: https://twitter.com/toshywoshy +[19]: https://krisbuytaert.be/index.shtml From f32e85599ff06184094ef0c8e0dabf865fce5cc1 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:03:31 +0800 Subject: [PATCH 086/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=2012=20M?= =?UTF-8?q?ethods=20To=20Check=20The=20Hard=20Disk=20And=20Hard=20Drive=20?= =?UTF-8?q?Partition=20On=20Linux=20sources/tech/20190205=2012=20Methods?= =?UTF-8?q?=20To=20Check=20The=20Hard=20Disk=20And=20Hard=20Drive=20Partit?= =?UTF-8?q?ion=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Disk And Hard Drive Partition On Linux.md | 435 ++++++++++++++++++ 1 file changed, 435 insertions(+) create mode 100644 sources/tech/20190205 12 Methods To Check The Hard Disk And Hard Drive Partition On Linux.md diff --git a/sources/tech/20190205 12 Methods To Check The Hard Disk And Hard Drive Partition On Linux.md b/sources/tech/20190205 12 Methods To Check The Hard Disk And Hard Drive Partition On Linux.md new file mode 100644 index 0000000000..ef8c8dc460 --- /dev/null +++ b/sources/tech/20190205 12 Methods To Check The Hard Disk And Hard Drive Partition On Linux.md @@ -0,0 +1,435 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 Methods To Check The Hard Disk And Hard Drive Partition On Linux) +[#]: via: (https://www.2daygeek.com/linux-command-check-hard-disks-partitions/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +12 Methods To Check The Hard Disk And Hard Drive Partition On Linux +====== + +Usually Linux admins check the available hard disk and it’s partitions whenever they want to add a new disks or additional partition in the system. + +We used to check the partition table of our hard disk to view the disk partitions. + +This will help you to view how many partitions were already created on the disk. Also, it allow us to verify whether we have any free space or not. + +In general hard disks can be divided into one or more logical disks called partitions. + +Each partitions can be used as a separate disk with its own file system and partition information is stored in a partition table. + +It’s a 64-byte data structure. The partition table is part of the master boot record (MBR), which is a small program that is executed when a computer boots. + +The partition information are saved in the 0 the sector of the disk. Make a note, all the partitions must be formatted with an appropriate file system before files can be written to it. + +This can be verified using the following 12 methods. + + * **`fdisk:`** manipulate disk partition table + * **`sfdisk:`** display or manipulate a disk partition table + * **`cfdisk:`** display or manipulate a disk partition table + * **`parted:`** a partition manipulation program + * **`lsblk:`** lsblk lists information about all available or the specified block devices. + * **`blkid:`** locate/print block device attributes. + * **`hwinfo:`** hwinfo stands for hardware information tool is another great utility that used to probe for the hardware present in the system. + * **`lshw:`** lshw is a small tool to extract detailed information on the hardware configuration of the machine. + * **`inxi:`** inxi is a command line system information script built for for console and IRC. + * **`lsscsi:`** list SCSI devices (or hosts) and their attributes + * **`cat /proc/partitions:`** + * **`ls -lh /dev/disk/:`** The directory contains Disk manufacturer name, serial number, partition ID and real block device files, Those were symlink with real block device files. + + + +### How To Check Hard Disk And Hard Drive Partition In Linux Using fdisk Command? + +**[fdisk][1]** stands for fixed disk or format disk is a cli utility that allow users to perform following actions on disks. It allows us to view, create, resize, delete, move and copy the partitions. + +``` +# fdisk -l + +Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xeab59449 + +Device Boot Start End Sectors Size Id Type +/dev/sda1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 20973568 62914559 41940992 20G 83 Linux + + +Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x8cc8f9e5 + +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended +/dev/sdc5 6295552 8392703 2097152 1G 83 Linux + + +Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sde: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using sfdisk Command? + +sfdisk is a script-oriented tool for partitioning any block device. sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder-Head-Sector) addressing. + +``` +# sfdisk -l + +Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xeab59449 + +Device Boot Start End Sectors Size Id Type +/dev/sda1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 20973568 62914559 41940992 20G 83 Linux + + +Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0x8cc8f9e5 + +Device Boot Start End Sectors Size Id Type +/dev/sdc1 2048 2099199 2097152 1G 83 Linux +/dev/sdc3 4196352 6293503 2097152 1G 83 Linux +/dev/sdc4 6293504 20971519 14678016 7G 5 Extended +/dev/sdc5 6295552 8392703 2097152 1G 83 Linux + + +Disk /dev/sdd: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes + + +Disk /dev/sde: 10 GiB, 10737418240 bytes, 20971520 sectors +Units: sectors of 1 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using cfdisk Command? + +cfdisk is a curses-based program for partitioning any block device. The default device is /dev/sda. It provides basic partitioning functionality with a user-friendly interface. + +``` +# cfdisk /dev/sdc + Disk: /dev/sdc + Size: 10 GiB, 10737418240 bytes, 20971520 sectors + Label: dos, identifier: 0x8cc8f9e5 + + Device Boot Start End Sectors Size Id Type +>> /dev/sdc1 2048 2099199 2097152 1G 83 Linux + Free space 2099200 4196351 2097152 1G + /dev/sdc3 4196352 6293503 2097152 1G 83 Linux + /dev/sdc4 6293504 20971519 14678016 7G 5 Extended + ├─/dev/sdc5 6295552 8392703 2097152 1G 83 Linux + └─Free space 8394752 20971519 12576768 6G + + + + ┌───────────────────────────────────────────────────────────────────────────────┐ + │ Partition type: Linux (83) │ + │Filesystem UUID: d17e3c31-e2c9-4f11-809c-94a549bc43b7 │ + │ Filesystem: ext2 │ + │ Mountpoint: /part1 (mounted) │ + └───────────────────────────────────────────────────────────────────────────────┘ + [Bootable] [ Delete ] [ Quit ] [ Type ] [ Help ] [ Write ] + [ Dump ] + + Quit program without writing changes +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using parted Command? + +**[parted][2]** is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS and GPT. It is useful for creating space for new operating systems, reorganising disk usage, and copying data to new hard disks. + +``` +# parted -l + +Model: ATA VBOX HARDDISK (scsi) +Disk /dev/sda: 32.2GB +Sector size (logical/physical): 512B/512B +Partition Table: msdos +Disk Flags: + +Number Start End Size Type File system Flags + 1 10.7GB 32.2GB 21.5GB primary ext4 boot + + +Model: ATA VBOX HARDDISK (scsi) +Disk /dev/sdb: 10.7GB +Sector size (logical/physical): 512B/512B +Partition Table: msdos +Disk Flags: + +Model: ATA VBOX HARDDISK (scsi) +Disk /dev/sdc: 10.7GB +Sector size (logical/physical): 512B/512B +Partition Table: msdos +Disk Flags: + +Number Start End Size Type File system Flags + 1 1049kB 1075MB 1074MB primary ext2 + 3 2149MB 3222MB 1074MB primary ext4 + 4 3222MB 10.7GB 7515MB extended + 5 3223MB 4297MB 1074MB logical + + +Model: ATA VBOX HARDDISK (scsi) +Disk /dev/sdd: 10.7GB +Sector size (logical/physical): 512B/512B +Partition Table: msdos +Disk Flags: + +Model: ATA VBOX HARDDISK (scsi) +Disk /dev/sde: 10.7GB +Sector size (logical/physical): 512B/512B +Partition Table: msdos +Disk Flags: +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using lsblk Command? + +lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. + +If the udev db is not available or lsblk is compiled without udev support than it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary. The command prints all block devices (except RAM disks) in a tree-like format by default. + +``` +# lsblk +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +sda 8:0 0 30G 0 disk +└─sda1 8:1 0 20G 0 part / +sdb 8:16 0 10G 0 disk +sdc 8:32 0 10G 0 disk +├─sdc1 8:33 0 1G 0 part /part1 +├─sdc3 8:35 0 1G 0 part /part2 +├─sdc4 8:36 0 1K 0 part +└─sdc5 8:37 0 1G 0 part +sdd 8:48 0 10G 0 disk +sde 8:64 0 10G 0 disk +sr0 11:0 1 1024M 0 rom +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using blkid Command? + +blkid is a command-line utility to locate/print block device attributes. It uses libblkid library to get disk partition UUID in Linux system. + +``` +# blkid +/dev/sda1: UUID="d92fa769-e00f-4fd7-b6ed-ecf7224af7fa" TYPE="ext4" PARTUUID="eab59449-01" +/dev/sdc1: UUID="d17e3c31-e2c9-4f11-809c-94a549bc43b7" TYPE="ext2" PARTUUID="8cc8f9e5-01" +/dev/sdc3: UUID="ca307aa4-0866-49b1-8184-004025789e63" TYPE="ext4" PARTUUID="8cc8f9e5-03" +/dev/sdc5: PARTUUID="8cc8f9e5-05" +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using hwinfo Command? + +**[hwinfo][3]** stands for hardware information tool is another great utility that used to probe for the hardware present in the system and display detailed information about varies hardware components in human readable format. + +``` +# hwinfo --block --short +disk: + /dev/sdd VBOX HARDDISK + /dev/sdb VBOX HARDDISK + /dev/sde VBOX HARDDISK + /dev/sdc VBOX HARDDISK + /dev/sda VBOX HARDDISK +partition: + /dev/sdc1 Partition + /dev/sdc3 Partition + /dev/sdc4 Partition + /dev/sdc5 Partition + /dev/sda1 Partition +cdrom: + /dev/sr0 VBOX CD-ROM +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using lshw Command? + +**[lshw][4]** (stands for Hardware Lister) is a small nifty tool that generates detailed reports about various hardware components on the machine such as memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, usb, network card, graphics cards, multimedia, printers, bus speed, etc. + +``` +# lshw -short -class disk -class volume +H/W path Device Class Description +=================================================== +/0/3/0.0.0 /dev/cdrom disk CD-ROM +/0/4/0.0.0 /dev/sda disk 32GB VBOX HARDDISK +/0/4/0.0.0/1 /dev/sda1 volume 19GiB EXT4 volume +/0/5/0.0.0 /dev/sdb disk 10GB VBOX HARDDISK +/0/6/0.0.0 /dev/sdc disk 10GB VBOX HARDDISK +/0/6/0.0.0/1 /dev/sdc1 volume 1GiB Linux filesystem partition +/0/6/0.0.0/3 /dev/sdc3 volume 1GiB EXT4 volume +/0/6/0.0.0/4 /dev/sdc4 volume 7167MiB Extended partition +/0/6/0.0.0/4/5 /dev/sdc5 volume 1GiB Linux filesystem partition +/0/7/0.0.0 /dev/sdd disk 10GB VBOX HARDDISK +/0/8/0.0.0 /dev/sde disk 10GB VBOX HARDDISK +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using inxi Command? + +**[inxi][5]** is a nifty tool to check hardware information on Linux and offers wide range of option to get all the hardware information on Linux system that i never found in any other utility which are available in Linux. It was forked from the ancient and mindbendingly perverse yet ingenius infobash, by locsmif. + +``` +# inxi -Dp +Drives: HDD Total Size: 75.2GB (22.3% used) + ID-1: /dev/sda model: VBOX_HARDDISK size: 32.2GB + ID-2: /dev/sdb model: VBOX_HARDDISK size: 10.7GB + ID-3: /dev/sdc model: VBOX_HARDDISK size: 10.7GB + ID-4: /dev/sdd model: VBOX_HARDDISK size: 10.7GB + ID-5: /dev/sde model: VBOX_HARDDISK size: 10.7GB +Partition: ID-1: / size: 20G used: 16G (85%) fs: ext4 dev: /dev/sda1 + ID-3: /part1 size: 1008M used: 1.3M (1%) fs: ext2 dev: /dev/sdc1 + ID-4: /part2 size: 976M used: 2.6M (1%) fs: ext4 dev: /dev/sdc3 +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using lsscsi Command? + +Uses information in sysfs (Linux kernel series 2.6 and later) to list SCSI devices (or hosts) currently attached to the system. Options can be used to control the amount and form of information provided for each device. + +By default in this utility device node names (e.g. “/dev/sda” or “/dev/root_disk”) are obtained by noting the major and minor numbers for the listed device obtained from sysfs + +``` +# lsscsi +[0:0:0:0] cd/dvd VBOX CD-ROM 1.0 /dev/sr0 +[2:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sda +[3:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sdb +[4:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sdc +[5:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sdd +[6:0:0:0] disk ATA VBOX HARDDISK 1.0 /dev/sde +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using ProcFS? + +The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information. + +It’s sometimes referred to as a process information pseudo-file system. It doesn’t contain ‘real’ files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc). + +``` +# cat /proc/partitions +major minor #blocks name + + 11 0 1048575 sr0 + 8 0 31457280 sda + 8 1 20970496 sda1 + 8 16 10485760 sdb + 8 32 10485760 sdc + 8 33 1048576 sdc1 + 8 35 1048576 sdc3 + 8 36 1 sdc4 + 8 37 1048576 sdc5 + 8 48 10485760 sdd + 8 64 10485760 sde +``` + +### How To Check Hard Disk And Hard Drive Partition In Linux Using /dev/disk Path? + +This directory contains four directories, it’s by-id, by-uuid, by-path and by-partuuid. Each directory contains some useful information and it’s symlinked with real block device files. + +``` +# ls -lh /dev/disk/by-id +total 0 +lrwxrwxrwx 1 root root 9 Feb 2 23:08 ata-VBOX_CD-ROM_VB0-01f003f6 -> ../../sr0 +lrwxrwxrwx 1 root root 9 Feb 3 00:14 ata-VBOX_HARDDISK_VB26e827b5-668ab9f4 -> ../../sda +lrwxrwxrwx 1 root root 10 Feb 3 00:14 ata-VBOX_HARDDISK_VB26e827b5-668ab9f4-part1 -> ../../sda1 +lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VB3774c742-fb2b3e4e -> ../../sdd +lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e -> ../../sdc +lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part1 -> ../../sdc1 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part3 -> ../../sdc3 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part4 -> ../../sdc4 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 ata-VBOX_HARDDISK_VBe72672e5-029a918e-part5 -> ../../sdc5 +lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VBed1cf451-9f51c5f6 -> ../../sdb +lrwxrwxrwx 1 root root 9 Feb 2 23:39 ata-VBOX_HARDDISK_VBf242dbdd-49a982eb -> ../../sde +``` + +Output of by-uuid + +``` +# ls -lh /dev/disk/by-uuid +total 0 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 ca307aa4-0866-49b1-8184-004025789e63 -> ../../sdc3 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 d17e3c31-e2c9-4f11-809c-94a549bc43b7 -> ../../sdc1 +lrwxrwxrwx 1 root root 10 Feb 3 00:14 d92fa769-e00f-4fd7-b6ed-ecf7224af7fa -> ../../sda1 +``` + +Output of by-path + +``` +# ls -lh /dev/disk/by-path +total 0 +lrwxrwxrwx 1 root root 9 Feb 2 23:08 pci-0000:00:01.1-ata-1 -> ../../sr0 +lrwxrwxrwx 1 root root 9 Feb 3 00:14 pci-0000:00:0d.0-ata-1 -> ../../sda +lrwxrwxrwx 1 root root 10 Feb 3 00:14 pci-0000:00:0d.0-ata-1-part1 -> ../../sda1 +lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-2 -> ../../sdb +lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-3 -> ../../sdc +lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part1 -> ../../sdc1 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part3 -> ../../sdc3 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part4 -> ../../sdc4 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 pci-0000:00:0d.0-ata-3-part5 -> ../../sdc5 +lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-4 -> ../../sdd +lrwxrwxrwx 1 root root 9 Feb 2 23:39 pci-0000:00:0d.0-ata-5 -> ../../sde +``` + +Output of by-partuuid + +``` +# ls -lh /dev/disk/by-partuuid +total 0 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-01 -> ../../sdc1 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-03 -> ../../sdc3 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-04 -> ../../sdc4 +lrwxrwxrwx 1 root root 10 Feb 2 23:39 8cc8f9e5-05 -> ../../sdc5 +lrwxrwxrwx 1 root root 10 Feb 3 00:14 eab59449-01 -> ../../sda1 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-check-hard-disks-partitions/ + +作者:[Vinoth 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.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-fdisk-command-to-manage-disk-partitions/ +[2]: https://www.2daygeek.com/how-to-manage-disk-partitions-using-parted-command/ +[3]: https://www.2daygeek.com/hwinfo-check-display-detect-system-hardware-information-linux/ +[4]: https://www.2daygeek.com/lshw-find-check-system-hardware-information-details-linux/ +[5]: https://www.2daygeek.com/inxi-system-hardware-information-on-linux/ From d796876056ce9fa6999aa9ef92d202ef12fa8ddc Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:05:56 +0800 Subject: [PATCH 087/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=20CFS:?= =?UTF-8?q?=20Completely=20fair=20process=20scheduling=20in=20Linux=20sour?= =?UTF-8?q?ces/tech/20190205=20CFS-=20Completely=20fair=20process=20schedu?= =?UTF-8?q?ling=20in=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...letely fair process scheduling in Linux.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20190205 CFS- Completely fair process scheduling in Linux.md diff --git a/sources/tech/20190205 CFS- Completely fair process scheduling in Linux.md b/sources/tech/20190205 CFS- Completely fair process scheduling in Linux.md new file mode 100644 index 0000000000..be44e75fea --- /dev/null +++ b/sources/tech/20190205 CFS- Completely fair process scheduling in Linux.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (CFS: Completely fair process scheduling in Linux) +[#]: via: (https://opensource.com/article/19/2/fair-scheduling-linux) +[#]: author: (Marty kalin https://opensource.com/users/mkalindepauledu) + +CFS: Completely fair process scheduling in Linux +====== +CFS gives every task a fair share of processor resources in a low-fuss but highly efficient way. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh) + +Linux takes a modular approach to processor scheduling in that different algorithms can be used to schedule different process types. A scheduling class specifies which scheduling policy applies to which type of process. Completely fair scheduling (CFS), which became part of the Linux 2.6.23 kernel in 2007, is the scheduling class for normal (as opposed to real-time) processes and therefore is named **SCHED_NORMAL**. + +CFS is geared for the interactive applications typical in a desktop environment, but it can be configured as **SCHED_BATCH** to favor the batch workloads common, for example, on a high-volume web server. In any case, CFS breaks dramatically with what might be called "classic preemptive scheduling." Also, the "completely fair" claim has to be seen with a technical eye; otherwise, the claim might seem like an empty boast. + +Let's dig into the details of what sets CFS apart from—indeed, above—other process schedulers. Let's start with a quick review of some core technical terms. + +### Some core concepts + +Linux inherits the Unix view of a process as a program in execution. As such, a process must contend with other processes for shared system resources: memory to hold instructions and data, at least one processor to execute instructions, and I/O devices to interact with the external world. Process scheduling is how the operating system (OS) assigns tasks (e.g., crunching some numbers, copying a file) to processors—a running process then performs the task. A process has one or more threads of execution, which are sequences of machine-level instructions. To schedule a process is to schedule one of its threads on a processor. + +In a simplifying move, Linux turns process scheduling into thread scheduling by treating a scheduled process as if it were single-threaded. If a process is multi-threaded with N threads, then N scheduling actions would be required to cover the threads. Threads within a multi-threaded process remain related in that they share resources such as memory address space. Linux threads are sometimes described as lightweight processes, with the lightweight underscoring the sharing of resources among the threads within a process. + +Although a process can be in various states, two are of particular interest in scheduling. A blocked process is awaiting the completion of some event such as an I/O event. The process can resume execution only after the event completes. A runnable process is one that is not currently blocked. + +A process is processor-bound (aka compute-bound) if it consumes mostly processor as opposed to I/O resources, and I/O-bound in the opposite case; hence, a processor-bound process is mostly runnable, whereas an I/O-bound process is mostly blocked. As examples, crunching numbers is processor-bound, and accessing files is I/O-bound. Although an entire process might be characterized as either processor-bound or I/O-bound, a given process may be one or the other during different stages of its execution. Interactive desktop applications, such as browsers, tend to be I/O-bound. + +A good process scheduler has to balance the needs of processor-bound and I/O-bound tasks, especially in an operating system such as Linux that thrives on so many hardware platforms: desktop machines, embedded devices, mobile devices, server clusters, supercomputers, and more. + +### Classic preemptive scheduling versus CFS + +Unix popularized classic preemptive scheduling, which other operating systems including VAX/VMS, Windows NT, and Linux later adopted. At the center of this scheduling model is a fixed timeslice, the amount of time (e.g., 50ms) that a task is allowed to hold a processor until preempted in favor of some other task. If a preempted process has not finished its work, the process must be rescheduled. This model is powerful in that it supports multitasking (concurrency) through processor time-sharing, even on the single-CPU machines of yesteryear. + +The classic model typically includes multiple scheduling queues, one per process priority: Every process in a higher-priority queue gets scheduled before any process in a lower-priority queue. As an example, VAX/VMS uses 32 priority queues for scheduling. + +CFS dispenses with fixed timeslices and explicit priorities. The amount of time for a given task on a processor is computed dynamically as the scheduling context changes over the system's lifetime. Here is a sketch of the motivating ideas and technical details: + + * Imagine a processor, P, which is idealized in that it can execute multiple tasks simultaneously. For example, tasks T1 and T2 can execute on P at the same time, with each receiving 50% of P's magical processing power. This idealization describes perfect multitasking, which CFS strives to achieve on actual as opposed to idealized processors. CFS is designed to approximate perfect multitasking. + + * The CFS scheduler has a target latency, which is the minimum amount of time—idealized to an infinitely small duration—required for every runnable task to get at least one turn on the processor. If such a duration could be infinitely small, then each runnable task would have had a turn on the processor during any given timespan, however small (e.g., 10ms, 5ns, etc.). Of course, an idealized infinitely small duration must be approximated in the real world, and the default approximation is 20ms. Each runnable task then gets a 1/N slice of the target latency, where N is the number of tasks. For example, if the target latency is 20ms and there are four contending tasks, then each task gets a timeslice of 5ms. By the way, if there is only a single task during a scheduling event, this lucky task gets the entire target latency as its slice. The fair in CFS comes to the fore in the 1/N slice given to each task contending for a processor. + + * The 1/N slice is, indeed, a timeslice—but not a fixed one because such a slice depends on N, the number of tasks currently contending for the processor. The system changes over time. Some processes terminate and new ones are spawned; runnable processes block and blocked processes become runnable. The value of N is dynamic and so, therefore, is the 1/N timeslice computed for each runnable task contending for a processor. The traditional **nice** value is used to weight the 1/N slice: a low-priority **nice** value means that only some fraction of the 1/N slice is given to a task, whereas a high-priority **nice** value means that a proportionately greater fraction of the 1/N slice is given to a task. In summary, **nice** values do not determine the slice, but only modify the 1/N slice that represents fairness among the contending tasks. + + * The operating system incurs overhead whenever a context switch occurs; that is, when one process is preempted in favor of another. To keep this overhead from becoming unduly large, there is a minimum amount of time (with a typical setting of 1ms to 4ms) that any scheduled process must run before being preempted. This minimum is known as the minimum granularity. If many tasks (e.g., 20) are contending for the processor, then the minimum granularity (assume 4ms) might be more than the 1/N slice (in this case, 1ms). If the minimum granularity turns out to be larger than the 1/N slice, the system is overloaded because there are too many tasks contending for the processor—and fairness goes out the window. + + * When does preemption occur? CFS tries to minimize context switches, given their overhead: time spent on a context switch is time unavailable for other tasks. Accordingly, once a task gets the processor, it runs for its entire weighted 1/N slice before being preempted in favor of some other task. Suppose task T1 has run for its weighted 1/N slice, and runnable task T2 currently has the lowest virtual runtime (vruntime) among the tasks contending for the processor. The vruntime records, in nanoseconds, how long a task has run on the processor. In this case, T1 would be preempted in favor of T2. + + * The scheduler tracks the vruntime for all tasks, runnable and blocked. The lower a task's vruntime, the more deserving the task is for time on the processor. CFS accordingly moves low-vruntime tasks towards the front of the scheduling line. Details are forthcoming because the line is implemented as a tree, not a list. + + * How often should the CFS scheduler reschedule? There is a simple way to determine the scheduling period. Suppose that the target latency (TL) is 20ms and the minimum granularity (MG) is 4ms: + +`TL / MG = (20 / 4) = 5 ## five or fewer tasks are ok` + +In this case, five or fewer tasks would allow each task a turn on the processor during the target latency. For example, if the task number is five, each runnable task has a 1/N slice of 4ms, which happens to equal the minimum granularity; if the task number is three, each task gets a 1/N slice of almost 7ms. In either case, the scheduler would reschedule in 20ms, the duration of the target latency. + +Trouble occurs if the number of tasks (e.g., 10) exceeds TL / MG because now each task must get the minimum time of 4ms instead of the computed 1/N slice, which is 2ms. In this case, the scheduler would reschedule in 40ms: + +`(number of tasks) core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated MG = (10 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 4) = 40ms ## period = 40ms` + + + + +Linux schedulers that predate CFS use heuristics to promote the fair treatment of interactive tasks with respect to scheduling. CFS takes a quite different approach by letting the vruntime facts speak mostly for themselves, which happens to support sleeper fairness. An interactive task, by its very nature, tends to sleep a lot in the sense that it awaits user inputs and so becomes I/O-bound; hence, such a task tends to have a relatively low vruntime, which tends to move the task towards the front of the scheduling line. + +### Special features + +CFS supports symmetrical multiprocessing (SMP) in which any process (whether kernel or user) can execute on any processor. Yet configurable scheduling domains can be used to group processors for load balancing or even segregation. If several processors share the same scheduling policy, then load balancing among them is an option; if a particular processor has a scheduling policy different from the others, then this processor would be segregated from the others with respect to scheduling. + +Configurable scheduling groups are another CFS feature. As an example, consider the Nginx web server that's running on my desktop machine. At startup, this server has a master process and four worker processes, which act as HTTP request handlers. For any HTTP request, the particular worker that handles the request is irrelevant; it matters only that the request is handled in a timely manner, and so the four workers together provide a pool from which to draw a task-handler as requests come in. It thus seems fair to treat the four Nginx workers as a group rather than as individuals for scheduling purposes, and a scheduling group can be used to do just that. The four Nginx workers could be configured to have a single vruntime among them rather than individual vruntimes. Configuration is done in the traditional Linux way, through files. For vruntime-sharing, a file named **cpu.shares** , with the details given through familiar shell commands, would be created. + +As noted earlier, Linux supports scheduling classes so that different scheduling policies, together with their implementing algorithms, can coexist on the same platform. A scheduling class is implemented as a code module in C. CFS, the scheduling class described so far, is **SCHED_NORMAL**. There are also scheduling classes specifically for real-time tasks, **SCHED_FIFO** (first in, first out) and **SCHED_RR** (round robin). Under **SCHED_FIFO** , tasks run to completion; under **SCHED_RR** , tasks run until they exhaust a fixed timeslice and are preempted. + +### CFS implementation + +CFS requires efficient data structures to track task information and high-performance code to generate the schedules. Let's begin with a central term in scheduling, the runqueue. This is a data structure that represents a timeline for scheduled tasks. Despite the name, the runqueue need not be implemented in the traditional way, as a FIFO list. CFS breaks with tradition by using a time-ordered red-black tree as a runqueue. The data structure is well-suited for the job because it is a self-balancing binary search tree, with efficient **insert** and **remove** operations that execute in **O(log N)** time, where N is the number of nodes in the tree. Also, a tree is an excellent data structure for organizing entities into a hierarchy based on a particular property, in this case a vruntime. + +In CFS, the tree's internal nodes represent tasks to be scheduled, and the tree as a whole, like any runqueue, represents a timeline for task execution. Red-black trees are in wide use beyond scheduling; for example, Java uses this data structure to implement its **TreeMap**. + +Under CFS, every processor has a specific runqueue of tasks, and no task occurs at the same time in more than one runqueue. Each runqueue is a red-black tree. The tree's internal nodes represent tasks or task groups, and these nodes are indexed by their vruntime values so that (in the tree as a whole or in any subtree) the internal nodes to the left have lower vruntime values than the ones to the right: + +``` +    25     ## 25 is a task vruntime +    /\ +  17  29   ## 17 roots the left subtree, 29 the right one +  /\  ... + 5  19     ## and so on +...  \ +     nil   ## leaf nodes are nil +``` + +In summary, tasks with the lowest vruntime—and, therefore, the greatest need for a processor—reside somewhere in the left subtree; tasks with relatively high vruntimes congregate in the right subtree. A preempted task would go into the right subtree, thus giving other tasks a chance to move leftwards in the tree. A task with the smallest vruntime winds up in the tree's leftmost (internal) node, which is thus the front of the runqueue. + +The CFS scheduler has an instance, the C **task_struct** , to track detailed information about each task to be scheduled. This structure embeds a **sched_entity** structure, which in turn has scheduling-specific information, in particular, the vruntime per task or task group: + +``` +struct task_struct {       /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var info on a task **/ +  ... +  struct sched_entity se;  /** vruntime, etc. **/ +  ... +}; +``` + +The red-black tree is implemented in familiar C fashion, with a premium on pointers for efficiency. A **cfs_rq** structure instance embeds a **rb_root** field named **tasks_timeline** , which points to the root of a red-black tree. Each of the tree's internal nodes has pointers to the parent and the two child nodes; the leaf nodes have nil as their value. + +CFS illustrates how a straightforward idea—give every task a fair share of processor resources—can be implemented in a low-fuss but highly efficient way. It's worth repeating that CFS achieves fair and efficient scheduling without traditional artifacts such as fixed timeslices and explicit task priorities. The pursuit of even better schedulers goes on, of course; for the moment, however, CFS is as good as it gets for general-purpose processor scheduling. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/fair-scheduling-linux + +作者:[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 From 1cd1fb519a7b5762d747fdeee929c53f1143a125 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:13:20 +0800 Subject: [PATCH 088/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=204=20co?= =?UTF-8?q?nfusing=20open=20source=20license=20scenarios=20and=20how=20to?= =?UTF-8?q?=20navigate=20them=20sources/talk/20190131=204=20confusing=20op?= =?UTF-8?q?en=20source=20license=20scenarios=20and=20how=20to=20navigate?= =?UTF-8?q?=20them.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ense scenarios and how to navigate them.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/talk/20190131 4 confusing open source license scenarios and how to navigate them.md diff --git a/sources/talk/20190131 4 confusing open source license scenarios and how to navigate them.md b/sources/talk/20190131 4 confusing open source license scenarios and how to navigate them.md new file mode 100644 index 0000000000..fd93cdd9a6 --- /dev/null +++ b/sources/talk/20190131 4 confusing open source license scenarios and how to navigate them.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 confusing open source license scenarios and how to navigate them) +[#]: via: (https://opensource.com/article/19/1/open-source-license-scenarios) +[#]: author: (P.Kevin Nelson https://opensource.com/users/pkn4645) + +4 confusing open source license scenarios and how to navigate them +====== + +Before you begin using a piece of software, make sure you fully understand the terms of its license. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_openisopen.png?itok=FjmDxIaL) + +As an attorney running an open source program office for a Fortune 500 corporation, I am often asked to look into a product or component where there seems to be confusion as to the licensing model. Under what terms can the code be used, and what obligations run with such use? This often happens when the code or the associated project community does not clearly indicate availability under a [commonly accepted open source license][1]. The confusion is understandable as copyright owners often evolve their products and services in different directions in response to market demands. Here are some of the scenarios I commonly discover and how you can approach each situation. + +### Multiple licenses + +The product is truly open source with an [Open Source Initiative][2] (OSI) open source-approved license, but has changed licensing models at least once if not multiple times throughout its lifespan. This scenario is fairly easy to address; the user simply has to decide if the latest version with its attendant features and bug fixes is worth the conditions to be compliant with the current license. If so, great. If not, then the user can move back in time to a version released under a more palatable license and start from that fork, understanding that there may not be an active community for support and continued development. + +### Old open source + +This is a variation on the multiple licenses model with the twist that current licensing is proprietary only. You have to use an older version to take advantage of open source terms and conditions. Most often, the product was released under a valid open source license up to a certain point in its development, but then the copyright holder chose to evolve the code in a proprietary fashion and offer new releases only under proprietary commercial licensing terms. So, if you want the newest capabilities, you have to purchase a proprietary license, and you most likely will not get a copy of the underlying source code. Most often the open source community that grew up around the original code line falls away once the members understand there will be no further commitment from the copyright holder to the open source branch. While this scenario is understandable from the copyright holder's perspective, it can be seen as "burning a bridge" to the open source community. It would be very difficult to again leverage the benefits of the open source contribution models once a project owner follows this path. + +### Open core + +By far the most common discovery is that a product has both an open source-licensed "community edition" and a proprietary-licensed commercial offering, commonly referred to as open core. This is often encouraging to potential consumers, as it gives them a "try before you buy" option or even a chance to influence both versions of the product by becoming an active member of the community. I usually encourage clients to begin with the community version, get involved, and see what they can achieve. Then, if the product becomes a crucial part of their business plan, they have the option to upgrade to the proprietary level at any time. + +### Freemium + +The component is not open source at all, but instead it is released under some version of the "freemium" model. A version with restricted or time-limited functionality can be downloaded with no immediate purchase required. However, since the source code is usually not provided and its accompanying license does not allow perpetual use, the creation of derivative works, nor further distribution, it is definitely not open source. In this scenario, it is usually best to pass unless you are prepared to purchase a proprietary license and accept all attendant terms and conditions of use. Users are often the most disappointed in this outcome as it has somewhat of a deceptive feel. + +### OSI compliant + +Of course, the happy path I haven't mentioned is to discover the project has a single, clear, OSI-compliant license. In those situations, open source software is as easy as downloading and going forward within appropriate use. + +Each of the more complex scenarios described above can present problems to potential development projects, but consultation with skilled procurement or intellectual property professionals with regard to licensing lineage can reveal excellent opportunities. + +An earlier version of this article was published on [OSS Law][3] and is republished with the author's permission. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/open-source-license-scenarios + +作者:[P.Kevin 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://opensource.com/users/pkn4645 +[b]: https://github.com/lujun9972 +[1]: https://opensource.org/licenses +[2]: https://opensource.org/licenses/category +[3]: http://www.pknlaw.com/2017/06/i-thought-that-was-open-source.html From 0ae9206eb8bdde54bd67534d66d15d96987292fc Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:14:40 +0800 Subject: [PATCH 089/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=20Will?= =?UTF-8?q?=20quantum=20computing=20break=20security=3F=20sources/tech/201?= =?UTF-8?q?90131=20Will=20quantum=20computing=20break=20security.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 Will quantum computing break security.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20190131 Will quantum computing break security.md diff --git a/sources/tech/20190131 Will quantum computing break security.md b/sources/tech/20190131 Will quantum computing break security.md new file mode 100644 index 0000000000..a4cd9d29de --- /dev/null +++ b/sources/tech/20190131 Will quantum computing break security.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Will quantum computing break security?) +[#]: via: (https://opensource.com/article/19/1/will-quantum-computing-break-security) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +Will quantum computing break security? +====== + +Do you want J. Random Hacker to be able to pretend they're your bank? + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +Over the past few years, a new type of computer has arrived on the block: the quantum computer. It's arguably the sixth type of computer: + + 1. **Humans:** Before there were artificial computers, people used, well, people. And people with this job were called "computers." + + 2. **Mechanical analogue:** These are devices such as the [Antikythera mechanism][1], astrolabes, or slide rules. + + 3. **Mechanical digital:** In this category, I'd count anything that allowed discrete mathematics but didn't use electronics for the actual calculation: the abacus, Babbage's Difference Engine, etc. + + 4. **Electronic analogue:** Many of these were invented for military uses such as bomb sights, gun aiming, etc. + + 5. **Electronic digital:** I'm going to go out on a limb here and characterise Colossus as the first electronic digital computer1: these are basically what we use today for anything from mobile phones to supercomputers. + + 6. **Quantum computers:** These are coming and are fundamentally different from all of the previous generations. + + + + +### What is quantum computing? + +Quantum computing uses concepts from quantum mechanics to allow very different types of calculations from what we're used to in "classical computing." I'm not even going to try to explain, because I know I'd do a terrible job, so I suggest you try something like [Wikipedia's definition][2] as a starting point. What's important for our purposes is to understand that quantum computers use qubits to do calculations, and for quite a few types of mathematical algorithms—and therefore computing operations––they can solve problems much faster than classical computers. + +What's "much faster"? Much, much faster: orders of magnitude faster. A calculation that might take years or decades with a classical computer could, in certain circumstances, take seconds. Impressive, yes? And scary. Because one of the types of problems that quantum computers should be good at solving is decrypting encrypted messages, even without the keys. + +This means that someone with a sufficiently powerful quantum computer should be able to read all of your current and past messages, decrypt any stored data, and maybe fake digital signatures. Is this a big thing? Yes. Do you want J. Random Hacker to be able to pretend they're your bank?2 Do you want that transaction on the blockchain where you were sold a 10 bedroom mansion in Mayfair to be "corrected" to be a bedsit in Weston-super-Mare?3 + +### Some good news + +This is all scary stuff, but there's good news of various types. + +The first is that, in order to make any of this work at all, you need a quantum computer with a good number of qubits operating, and this is turning out to be hard.4 The general consensus is that we've got a few years before anybody has a "big" enough quantum computer to do serious damage to classical encryption algorithms. + +The second is that, even with a sufficient number of qubits to attacks our existing algorithms, you still need even more to allow for error correction. + +The third is that, although there are theoretical models to show how to attack some of our existing algorithms, actually making them work is significantly harder than you or I5 might expect. In fact, some of the attacks may turn out to be infeasible or just take more years to perfect than we worry about. + +The fourth is that there are clever people out there who are designing quantum-computation-resistant algorithms (sometimes referred to as "post-quantum algorithms") that we can use, at least for new encryption, once they've been tested and become widely available. + +All in all, in fact, there's a strong body of expert opinion that says we shouldn't be overly worried about quantum computing breaking our encryption in the next five or even 10 years. + +### And some bad news + +It's not all rosy, however. Two issues stick out to me as areas of concern. + + 1. People are still designing and rolling out systems that don't consider the issue. If you're coming up with a system that is likely to be in use for 10 or more years or will be encrypting or signing data that must remain confidential or attributable over those sorts of periods, then you should be considering the possible impact of quantum computing on your system. + + 2. Some of the new, quantum-computing-resistant algorithms are proprietary. This means that when you and I want to start implementing systems that are designed to be quantum-computing resistant, we'll have to pay to do so. I'm a big proponent of open source, and particularly of [open source cryptography][3], and my big worry is that we just won't be able to open source these things, and worse, that when new protocol standards are created––either de-facto or through standards bodies––they will choose proprietary algorithms that exclude the use of open source, whether on purpose, through ignorance, or because few good alternatives are available. + + + + +### What to do? + +Luckily, there are things you can do to address both of the issues above. The first is to think and plan when designing a system about what the impact of quantum computing might be on it. Often—very often—you won't need to implement anything explicit now (and it could be hard to, given the current state of the art), but you should at least embrace [the concept of crypto-agility][4]: designing protocols and systems so you can swap out algorithms if required.7 + +The second is a call to arms: Get involved in the open source movement and encourage everybody you know who has anything to do with cryptography to rally for open standards and for research into non-proprietary, quantum-computing-resistant algorithms. This is something that's very much on my to-do list, and an area where pressure and lobbying is just as important as the research itself. + +1\. I think it's fair to call it the first electronic, programmable computer. I know there were earlier non-programmable ones, and that some claim ENIAC, but I don't have the space or the energy to argue the case here. + +2\. No. + +3\. See 2. Don't get me wrong, by the way—I grew up near Weston-super-Mare, and it's got things going for it, but it's not Mayfair. + +4\. And if a quantum physicist says something's hard, then to my mind, it's hard. + +5\. And I'm assuming that neither of us is a quantum physicist or mathematician.6 + +6\. I'm definitely not. + +7\. And not just for quantum-computing reasons: There's a good chance that some of our existing classical algorithms may just fall to other, non-quantum attacks such as new mathematical approaches. + +This article was originally published on [Alice, Eve, and Bob][5] and is reprinted with the author's permission. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/will-quantum-computing-break-security + +作者:[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://en.wikipedia.org/wiki/Antikythera_mechanism +[2]: https://en.wikipedia.org/wiki/Quantum_computing +[3]: https://opensource.com/article/17/10/many-eyes +[4]: https://aliceevebob.com/2017/04/04/disbelieving-the-many-eyes-hypothesis/ +[5]: https://aliceevebob.com/2019/01/08/will-quantum-computing-break-security/ From f6ea544ebffd31d8fe0f3c136d0c90346fda281c Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:21:51 +0800 Subject: [PATCH 090/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190129=20A=20sm?= =?UTF-8?q?all=20notebook=20for=20a=20system=20administrator=20sources/tec?= =?UTF-8?q?h/20190129=20A=20small=20notebook=20for=20a=20system=20administ?= =?UTF-8?q?rator.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...all notebook for a system administrator.md | 552 ++++++++++++++++++ 1 file changed, 552 insertions(+) create mode 100644 sources/tech/20190129 A small notebook for a system administrator.md diff --git a/sources/tech/20190129 A small notebook for a system administrator.md b/sources/tech/20190129 A small notebook for a system administrator.md new file mode 100644 index 0000000000..45d6ba50eb --- /dev/null +++ b/sources/tech/20190129 A small notebook for a system administrator.md @@ -0,0 +1,552 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A small notebook for a system administrator) +[#]: via: (https://habr.com/en/post/437912/) +[#]: author: (sukhe https://habr.com/en/users/sukhe/) + +A small notebook for a system administrator +====== + +I am a system administrator, and I need a small, lightweight notebook for every day carrying. Of course, not just to carry it, but for use it to work. + +I already have a ThinkPad x200, but it’s heavier than I would like. And among the lightweight notebooks, I did not find anything suitable. All of them imitate the MacBook Air: thin, shiny, glamorous, and they all critically lack ports. Such notebook is suitable for posting photos on Instagram, but not for work. At least not for mine. + +After not finding anything suitable, I thought about how a notebook would turn out if it were developed not with design, but the needs of real users in mind. System administrators, for example. Or people serving telecommunications equipment in hard-to-reach places — on roofs, masts, in the woods, literally in the middle of nowhere. + +The results of my thoughts are presented in this article. + + +[![Figure to attract attention][1]][2] + +Of course, your understanding of the admin notebook does not have to coincide with mine. But I hope you will find a couple of interesting thoughts here. + +Just keep in mind that «system administrator» is just the name of my position. And in fact, I have to work as a network engineer, and installer, and perform a significant part of other work related to hardware. Our company is tiny, we are far from large settlements, so all of us have to be universal specialist. + +In order not to constantly clarify «this notebook», later in the article I will call it the “adminbook”. Although it can be useful not only to administrators, but also to all who need a small, lightweight notebook with a lot of connectors. In fact, even large laptops don’t have as many connectors. + +So let's get started… + +### 1\. Dimensions and weight + +Of course, you want it smaller and more lightweight, but the keyboard with the screen should not be too small. And there has to be space for connectors, too. + +In my opinion, a suitable option is a notebook half the size of an x200. That is, approximately the size of a sheet of A5 paper (210x148mm). In addition, the side pockets of many bags and backpacks are designed for this size. This means that the adminbook doesn’t even have to be carried in the main compartment. + +Though I couldn’t fit everything I wanted into 210mm. To make a comfortable keyboard, the width had to be increased to 230mm. + +In the illustrations the adminbook may seem too thick. But that’s only an optical illusion. In fact, its thickness is 25mm (28mm taking the rubber feet into account). + +Its size is close to the usual hardcover book, 300-350 pages thick. + +It’s lightweight, too — about 800 grams (half the weight of the ThinkPad). + +The case of the adminbook is made of mithril aluminum. It’s a lightweight, durable metal with good thermal conductivity. + +### 2\. Keyboard and trackpoint + +A quality keyboard is very important for me. “Quality” there means the fastest possible typing and hotkey speed. It needs to be so “matter-of-fact” I don’t have to think about it at all, as if it types seemingly by force of thought. + +This is possible if the keys are normal size and in their typical positions. But the adminbook is too small for that. In width, it is even smaller than the main block of keys of a desktop keyboard. So, you have to work around that somehow. + +After a long search and numerous tests, I came up with what you see in the picture: + +![](https://habrastorage.org/webt/2-/mh/ag/2-mhagvoofl7vgqiadv3rcnclb0.jpeg) +Fig.2.1 — Adminbook keyboard + +This keyboard has the same vertical key distance as on a regular keyboard. A horizontal distance decreased just only 2mm (17 instead of 19). + +You can even type blindly on this keyboard! To do this, some keys have small bumps for tactile orientation. + +However, if you do not sit at a table, the main input method will be to press the keys “at a glance”. And here the muscle memory does not help — you have to look at the keys with your eyes. + +To hit the buttons faster, different key colors are used. + +For example, the numeric row is specifically colored gray to visually separate it from the QWERTY row, and NumLock is mapped to the “6” key, colored black to stand out. + +To the right of NumLock, gray indicates the area of the numeric keypad. These (and neighboring) buttons work like a numeric keypad in NumLock mode or when you press Fn. I must say, this is a useful feature for the admin computer — some users come up with passwords on the numpad in the form of a “cross”, “snake”, “spiral”, etc. I want to be able to type them that way too. + +As for the function keys. I don’t know about you, but it annoys me when, in a 15-inch laptop, this row is half-height and only accessible through pressing Fn. Given that there’s a lot free space around the keyboard! + +The adminbook doesn’t have free space at all. But the function keys can be pressed without Fn. These are separate keys that are even divided into groups of 4 using color coding and location. + +By the way, have you seen which key is to the right of AltGr on modern ThinkPads? I don’t know what they were thinking, but now they have PrintScreen there! + +Where? Where, I ask, is the context menu key that I use every day? It’s not there. + +So the adminbook has it. Two, even! You can put it up by pressing Fn + Alt. Sorry, I couldn’t map it to a separate key due to lack of space. Just in case, I added the “Right Win” key as Fn + CtrlR. Maybe some people use it for something. + +However, the adminbook allows you to customize the keyboard to your liking. The keyboard is fully reprogrammable. You can assign the scan codes you need to the keys. Setting the keyboard parameters is done via the “KEY” button (Fn + F3). + +Of course, the adminbook has a keyboard backlight. It is turned on with Fn + B (below the trackpoint, you can even find it in the dark). The backlight here is similar to the ThinkPad ThinkLight. That is, it’s an LED above the display, illuminating the keyboard from the top. In this case, it is better than a backlight from below, because it allows you to distinguish the color of the keys. In addition, keys have several characters printed on them, while only English letters are usually made translucent to the backlight. + +Since we’re on the topic of characters… Red letters are Ukrainian and Russian. I specifically drew them to show that keys have space for several alphabets: after all, English is not a native language for most of humanity. + +Since there isn’t enough space for a full touchpad, the trackpoint is used as the positioning device. If you have no experience working with it — don’t worry, it’s actually quite handy. The mouse cursor moves with slight inclines of the trackpoint, like an analog joystick, and its three buttons (under the spacebar) work the same as on the mouse. + +To the left of the trackpoint keys is a fingerprint scanner. That makes it possible to login by fingerprint. It’s very convenient in most cases. + +The space bar has an NFC antenna location mark. You can simply read data from devices equipped with NFC, and you can make it to lock the system while not in use. For example, if you wear an NFC-equipped ring, it looks like this: when you remove hands from the keyboard, the computer locks after a certain time, and unlocks when you put hands on the keyboard again. + +And now the unexpected part. The keyboard and the trackpoint can work as a USB keyboard and mouse for an external computer! For this, there are USB Type C and MicroUSB connectors on the back, labeled «OTG». You can connect to an external computer using a standard USB cable from a phone (which is usually always with you). + +![](https://habrastorage.org/webt/e2/wa/m5/e2wam5d1bbckfdxpvqwl-i6aqle.jpeg) +Fig.2.2 — On the right: the power connector 5.5x2.5mm, the main LAN connector, POE indicator, USB 3.0 Type A, USB Type C (with alternate HDMI mode), microSD card reader and two «magic» buttons + +Switching to the external keyboard mode is done with the «K» button on the right side of the adminbook. And there are actually three modes, since the keyboard+trackpoint combo can also work as a Bluetooth keyboard/mouse! + +Moreover: to save energy, the keyboard and trackpoint can work autonomously from the rest of the adminbook. When the adminbook is turned off, pressing «K» can turn on only the keyboard and trackpoint to use them by connecting to another computer. + +Of course, the keyboard is water-resistant. Excess water is drained down through the drainage holes. + +### 3\. Video subsystem + +There are some devices that normally do not need a monitor and keyboard. For example, industrial computers, servers or DVRs. And since the monitor is «not needed», it is, in most cases, absent. + +And when there is a need to configure such a device from the console, it can be a big surprise that the entire office is working on laptops and there is not a single stationary monitor within reach. Therefore, in some cases you have to take a monitor with you. + +But you don’t need to worry about this if you have the adminbook. + +The fact is that the video outputs of the adminbook can switch «in the opposite direction» and work as video inputs by displaying the incoming image on the built-in screen. So, the adminbook can also replace the monitor (in addition to replace the mouse and keyboard). + +![](https://habrastorage.org/webt/4a/qr/f-/4aqrf-1sgstwwffhx-n4wr0p7ws.jpeg) +Fig.3.1 — On the left side of the adminbook, there are Mini DisplayPort, USB Type C (with alternate DisplayPort mode), SD card reader, USB 3.0 Type A connectors, HDMI, four audio connectors, VGA and power button + +Switching modes between input and output is done by pressing the «M» button on the right side of the adminbook. + +The video subsystem, as well as the keyboard, can work autonomously — that is, when used as a monitor, the other parts of the adminbook remain disabled. To turn on to this mode also uses the «M» button. + +Detailed screen adjustment (contrast, geometry, video input selection, etc.) is performed using the menu, brought up with the «SCR» button (Fn + F4). + +The adminbook has HDMI, MiniDP, VGA and USB Type C connectors (with DisplayPort and HDMI alternate mode) for video input / output. The integrated GPU can display the image simultaneously in three directions (including the integrated display). + +The adminbook display is FullHD (1920x1080), 9.5’’, matte screen. The brightness is sufficient for working outside during the day. And to do it better, the set includes folding blinds for protection from sunlight. + +![](https://habrastorage.org/webt/k-/nc/rh/k-ncrhphspvcoimfds1wurnzk3i.jpeg) +Fig.3.2 — Blinds to protect from sunlight + +In addition to video output via these connectors, the adminbook can use wireless transmission via WiDi or Miracast protocols. + +### 4\. Emulation of external drives + +One of the options for installing the operating system is to install it from a CD / DVD, but now very few computers have optical drives. USB connectors are everywhere, though. Therefore, the adminbook can pretend to be an external optical drive connected via USB. + +That allows connecting it to any computer to install an operating system on it, while also running boot discs with test programs or antiviruses. + +To connect, it uses the same USB cable that’s used for connecting it to a desktop as an external keyboard/mouse. + +The “CD” button (Fn + F2) controls the drive emulation — select a disc image (in an .iso file) and mount / unmount it. + +If you need to copy data from a computer or to it, the adminbook can emulate an external hard drive connected via the same USB cable. HDD emulation is also enabled by the “CD” button. + +This button also turns on the emulation of bootable USB flash drives. They are now used to install operating systems almost more often than CDs. Therefore, the adminbook can pretend to be a bootable flash drive. + +The .iso files are located on a separate partition of the hard disk. This allows you to use them regardless of the operating system. Moreover, in the emulation menu you can connect a virtual drive to one of the USB interfaces of the adminbook. This makes it possible to install an operating system on the adminbook using itself as an installation disc drive. + +By the way, the adminbook is designed to work under Windows 10 and Debian / Kali / Ubuntu. The menu system called via function buttons with Fn works autonomously on a separate microcontroller. + +### 5\. Rear connectors + +First, a classic DB-9 connector for RS-232. Any admin notebook simply has to have it. We have it here, too, and galvanically isolated from the rest of the notebook. + +In addition to RS-232, RS-485 widely used in industrial automation is supported. It has a two-wire and four-wire version, with a terminating resistor and without, with the ability to enable a protective offset. It can also work in RS-422 and UART modes. + +All these protocols are configured in the on-screen menu, called by the «COM» button (Fn + F8). + +Since there are multiple protocols, it is possible to accidentally connect the equipment to a wrong connector and break it. + +To prevent this from happening, when you turn off the computer (or go into sleep mode, or close the display lid), the COM port switches to the default mode. This may be a “port disabled” state, or enabling one of the protocols. + +![](https://habrastorage.org/webt/uz/ii/ig/uziiig_yr86yzdcnivkbapkbbgi.jpeg) +Fig.5.1 — The rear connectors: DB-9, SATA + SATA Power, HD Mini SAS, the second wired LAN connector, two USB 3.0 Type A connectors, two USB 2.0 MicroB connectors, three USB Type C connectors, a USIM card tray, a PBD-12 pin connector (jack) + +The adminbook has one more serial port. But if the first one uses the hardware UART chipset, the second one is connected to the USB 2.0 line through the FT232H converter. + +Thanks to this, via COM2, you can exchange data via I2C, SMBus, SPI, JTAG, UART protocols or use it as 8 outputs for Bit-bang / GPIO. These protocols are used when working with microcontrollers, flashing firmware on routers and debugging any other electronics. For this purpose, pin connectors are usually used with a 2.54mm pitch. Therefore, COM2 is made to look like one of these connectors. + +![](https://habrastorage.org/webt/qd/rc/ln/qdrclnoljgnlohthok4hgjb0be4.jpeg) +Fig.5.2 — USB to UART adapter replaced by COM2 port + +There is also a secondary LAN interface at the back. Like the main one, it is gigabit-capable, with support for VLAN. Both interfaces are able to test the integrity of the cable (for pair length and short circuits), the presence of connected devices, available communication speeds, the presence of POE voltage. With the using a wiremap adapter on the other side (see chapter 17) it is possible to determine how the cable is connected to crimps. + +The network interface menu is called with the “LAN” button (Fn + F6). + +The adminbook has a combined SATA + SATA Power connector, connected directly to the chipset. That makes it possible to perform low-level tests of hard drives that do not work through USB-SATA adapters. Previously, you had to do it through ExpressCards-type adapters, but the adminbook can do without them because it has a true SATA output. + +![](https://habrastorage.org/webt/dr/si/in/drsiinbafiyz8ztzwrowtvi0lk8.jpeg) +Fig.5.3 — USB to SATA/IDE and ExpressCard to SATA adapters + +The adminbook also has a connector that no other laptops have — HD Mini SAS (SFF-8643). PCIe x4 is routed outside through this connector. Thus, it's possible to connect an external U.2 (directly) or M.2 type (through an adapter) drives. Or even a typical desktop PCIe expansion card (like a graphics card). + +![](https://habrastorage.org/webt/ud/ph/86/udph860bshazyd6lvuzvwgymwnk.jpeg) +Fig.5.4 — HD Mini SAS (SFF-8643) to U.2 cable + +![](https://habrastorage.org/webt/kx/dd/99/kxdd99krcllm5ooz67l_egcttym.jpeg) +Fig.5.5 — U.2 drive + +![](https://habrastorage.org/webt/xn/de/gx/xndegxy5i1g7h2lwefs2jt1scpq.jpeg) +Fig.5.6 — U.2 to M.2 adapter + +![](https://habrastorage.org/webt/z2/dd/hd/z2ddhdoioezdwov_nv9e3b0egsa.jpeg) +Fig.5.7 — Combined adapter from U.2 to M.2 and PCIe (sample M.2 22110 drive is installed) + +Unfortunately, the limitations of the chipset don’t allow arbitrary use of PCIe lanes. In addition, the processor uses the same data lanes for PCIe and SATA. Therefore, the rear connectors can only work in two ways: +— all four PCIe lanes go to the Mini SAS connector (the second network interface and SATA don’t work) +— two PCIe lanes go to the Mini SAS, and two lanes to the second network interface and SATA connector + +On the back there are also two USB connectors (usual and Type C), which are constantly powered. That allows you to charge other devices from your notebook, even when the notebook is turned off. + +### 6\. Power Supply + +The adminbook is designed to work in difficult and unpredictable conditions, therefore, it is able to receive power in various ways. + +**Method number one** is Power Delivery. The power supply cable can be connected to any USB Type C connector (except the one marked “OTG”). + +**The second option** is from a normal 5V phone charger with a microUSB or USB Type C connector. At the same time, if you connect to the ports labeled QC 3.0, the QuickCharge fast charging standard will be supported. + +**The third option** — from any source of 12-60V DC power. To connect, use a coaxial ( also known as “barrel”) 5.5x2.5mm power connector, often found in laptop power supplies. + +For greater safety, the 12-60V power supply is galvanically isolated from the rest of the notebook. In addition, there’s reverse polarity protection. In fact, the adminbook can receive energy even if positive and negative ends are mismatched. + +![](https://habrastorage.org/webt/ju/xo/c3/juxoc3lxi7urqwgegyd6ida5h_8.jpeg) +Fig.6.1 — The cable, connecting the power supply to the adminbook (terminated with 5.5x2.5mm connectors) + +Adapters for a car cigarette lighter and crocodile clips are included in the box. + +![](https://habrastorage.org/webt/l6/-v/gv/l6-vgvqjrssirnvyi14czhi0mrc.jpeg) +Fig.6.2 — Adapter from 5.5x2.5mm coaxial connector to crocodile clips + +![](https://habrastorage.org/webt/zw/an/gs/zwangsvfdvoievatpbfxqvxrszg.png) +Fig.6.3 — Adapter to a car cigarette lighter + +**The fourth option** — Power Over Ethernet (POE) through the main network adapter. Supported options are 802.3af, 802.3at and Passive POE. Input voltage from 12 to 60V. This method is convenient if you have to work on the roof or on the tower, setting up Wi-Fi antennas. Power to them comes through Ethernet cables, and there is no other electricity on the tower. + +POE electricity can be used in three ways: + + * power the notebook only + * forward to a second network adapter and power the notebook from batteries + * power the notebook and the antenna at the same time + + + +To prevent equipment damage, if one of the Ethernet cables is disconnected, the power to the second network interface is terminated. The power can only be turned on manually through the corresponding menu item. + +When using the 802.3af / at protocols, you can set the power class that the adminbook will request from the power supply device. This and other POE properties are configured from the menu called with the “LAN” button (Fn + F6). + +By the way, you can remotely reset Ubiquity access points (which is done by closing certain wires in the cable) with the second network interface. + +The indicator next to the main network interface shows the presence and type of POE: green — 802.3af / at, red — Passive POE. + +**The last, fifth** power supply is the battery. Here it’s a LiPol, 42W/hour battery. + +In case the external power supply does not provide sufficient power, the missing power can be drawn from the battery. Thus, it can draw power from the battery and external sources at the same time. + +### 7\. Display unit + +The display can tilt 180 degrees, and it’s locked with latches while closed (opens with a button on the front side). When the display is closed, adminbook doesn’t react to pressing any external buttons. + +In addition to the screen, the notebook lid contains: + + * front and rear cameras with lights, microphones, activity LEDs and mechanical curtains + * LED of the upper backlight of the keyboard (similar to ThinkLight) + * LED indicators for Wi-Fi, Bluetooth, HDD and others + * wireless protocol antennas (in the blue plastic insert) + * photo sensors and LEDs for the infrared remote + * gyroscope, accelerometer, magnetometer + + + +The plastic insert for the antennas does not reach the corners of the display lid. This is done because in the «traveling» notebooks the corners are most affected by impacts, and it's desirable that they be made of metal. + +### 8\. Webcams + +The notebook has 2 webcams. The front-facing one is 8MP (4K / UltraHD), while the “selfie” one is 2MP (FullHD). Both cameras have a backlight controlled by separate buttons (Fn + G and Fn + H). Each camera has a mechanical curtain and an activity LED. The shifted mechanical curtain also turns off the microphones of the corresponding side (configurable). + +The external camera has two quick launch buttons — Fn + 1 takes an instant photo, Fn + 2 turns on video recording. The internal camera has a combination of Fn + Q and Fn + W. + +You can configure cameras and microphones from the menu called up by the “CAM” button (Fn + F10). + +### 9\. Indicator row + +It has the following indicators: Microphone, NumLock, ScrollLock, hard drive access, battery charge, external power connection, sleep mode, mobile connection, WiFi, Bluetooth. + +Three indicators are made to shine through the back side of the display lid, so that they can be seen while the lid is closed: external power connection, battery charge, sleep mode. + +Indicators are color-coded. + +Microphone — lights up red when all microphones are muted + +Battery charge: more than 60% is green, 30-60% is yellow, less than 30% is red, less than 10% is blinking red. + +External power: green — power is supplied, the battery is charged; yellow — power is supplied, the battery is charging; red — there is not enough external power to operate, the battery is drained + +Mobile: 4G (LTE) — green, 3G — yellow, EDGE / GPRS — red, blinking red — on, but no connection + +Wi-Fi: green — connected to 5 GHz, yellow — to 2.4 GHz, red — on, but not connected + +You can configure the indication with the “IND” button (Fn + F9) + +### 10\. Infrared remote control + +Near the indicators (on the front and back of the display lid) there are infrared photo sensors and LEDs to recording and playback commands from IR remotes. You can set it up, as well as emulate a remote control by pressing the “IR” button (Fn + F5). + +### 11\. Wireless interfaces + +WiFi — dual-band, 802.11a/b/g/n/ac with support for Wireless Direct, Intel WI-Di / Miracast, Wake On Wireless LAN. + +You ask, why is Miracast here? Because is already embedded in many WiFi chips, so its presence does not lead to additional costs. But you can transfer the image wirelessly to TVs, projectors and TV set-top boxes, that already have Miracast built in. + +Regarding Bluetooth, there’s nothing special. It’s version 4.2 or newest. By the way, the keyboard and trackpoint have a separate Bluetooth module. This is much easier than connect them to the system-wide module. + +Of course, the adminbook has a built-in cellular modem for 4G (LTE) / 3G / EDGE / GPRS, as well as a GPS / GLONASS / Galileo / Beidou receiver. This receiver also doesn’t cost much, because it’s already built into the 4G modem. + +There is also an NFC communication module, with the antenna under the spacebar. Antennas of all other wireless interfaces are in a plastic insert above the display. + +You can configure wireless interfaces with the «WRLS» button (Fn + F7). + +### 12\. USB connectors + +In total, four USB 3.0 Type A connectors and four USB 3.1 Type C connectors are built into the adminbook. Peripherals are connected to the adminbook through these. + +One more Type C and MicroUSB are allocated only for keyboard / mouse / drive emulation (denoted as “OTG”). + +«QC 3.0» labeled MicroUSB connector can not only be used for power, but it can switch to normal USB 2.0 port mode, except using MicroB instead of normal Type A. Why is it necessary? Because to flash some electronics you sometimes need non-standard USB A to USB A cables. + +In order to not make adapters outselves, you can use a regular phone charging cable by plugging it into this Micro B connector. Or use an USB A to USB Type C cable (if you have one). + +![](https://habrastorage.org/webt/0p/90/7e/0p907ezbunekqwobeogjgs5fgsa.jpeg) +Fig.12.1 — Homemade USB A to USB A cable + +Since USB Type C supports alternate modes, it makes sense to use it. Alternate modes are when the connector works as HDMI or DisplayPort video outputs. Though you’ll need adapters to connect it to a TV or monitor. Or appropriate cables that have Type C on one end and HDMI / DP on the other. However, USB Type C to USB Type C cables might soon become the most common video transfer cable. + +The Type C connector on the left side of the adminbook supports an alternate Display Port mode, and on the right side, HDMI. Like the other video outputs of the adminbook, they can work as both input and output. + +The one thing left to say is that Type C is bidirectional in regard to power delivery — it can both take in power as well as output it. + +### 13\. Other + +On the left side there are four audio connectors: Line In, Line Out, Microphone and the combo headset jack (headphones + microphone). Supports simple stereo, quad and 5.1 mode output. + +Audio outputs are specially placed next to the video connectors, so that when connected to any equipment, the wires are on one side. + +Built-in speakers are on the sides. Outside, they are covered with grills and acoustic fabric with water-repellent impregnation. + +There are also two slots for memory cards — full-size SD and MicroSD. If you think that the first slot is needed only for copying photos from the camera — you are mistaken. Now, both single-board computers like Raspberry Pi and even rack-mount servers are loaded from SD cards. MicroSD cards are also commonly found outside of phones. In general, you need both card slots. + +Sensors more familiar to phones — a gyroscope, an accelerometer and a magnetometer — are built into the lid of the notebook. Thanks to this, one can determine where the notebook cameras are directed and use this for augmented reality, as well as navigation. Sensors are controlled via the menu using the “SNSR” button (Fn + F11). + +Among the function buttons with Fn, F1 (“MAN”) and F12 (“ETC”) I haven’t described yet. The first is a built-in guide on connectors, modes and how to use the adminbook. The second is the settings of non-standard subsystems that have not separate buttons. + +### 14\. What's inside + +The adminbook is based on the Core i5-7Y57 CPU (Kaby Lake architecture). Although it’s less of a CPU, but more of a real SOC (System On a Chip). That is, almost the entire computer (without peripherals) fits in one chip the size of a thumb nail (2x1.6 cm). + +It emits from 3.5W to 7W of heat (depends on the frequency). So, a passive cooling system is adequate in this case. + +8GB of RAM are installed by default, expandable up to 16GB. + +A 256GB M.2 2280 SSD, connected with two PCIe lanes, is used as the hard drive. + +Wi-Fi + Bluetooth and WWAN + GNSS adapters are also designed as M.2 modules. + +RAM, the hard drive and wireless adapters are located on the top of the motherboard and can be replaced by the user — just unscrew and lift the keyboard. + +The battery is assembled from four LP545590 cells and can also be replaced. + +SOC and other irreplaceable hardware are located on the bottom of the motherboard. The heating components for cooling are pressed directly against the case. + +External connectors are located on daughter boards connected to the motherboard via ribbon cables. That allows to release different versions of the adminbook based on the same motherboard. + +For example, one of the possible version: + +![](https://habrastorage.org/webt/j9/sw/vq/j9swvqfi1-ituc4u9nr6-ijv3nq.jpeg) +Fig.14.1 — Adminbook A4 (front view) + +![](https://habrastorage.org/webt/pw/fq/ag/pwfqagvrluf1dbnmcd0rt-0eyc0.jpeg) +Fig.14.2 — Adminbook A4 (back view) + +![](https://habrastorage.org/webt/mn/ir/8i/mnir8in1pssve0m2tymevz2sue4.jpeg) +Fig.14.3 — Adminbook A4 (keyboard) + +This is an adminbook with a 12.5” display, its overall dimensions are 210x297mm (A4 paper format). The keyboard is full-size, with a standard key size (only the top row is a bit narrower). All the standard keys are there, except for the numpad and the Right Win, available with Fn keys. And trackpad added. + +### 15\. The underside of the adminbook + +Not expecting anything interesting from the bottom? But there is! + +First I will say a few words about the rubber feet. On my ThinkPad, they sometimes fall away and lost. I don't know if it's a bad glue, or a backpack is not suitable for a notebook, but it happens. + +Therefore, in the adminbook, the rubber feet are screwed in (the screws are slightly buried in rubber, so as not to scratch the tables). The feet are sufficiently streamlined so that they cling less to other objects. + +On the bottom there are visible drainage holes marked with a water drop. + +And the four threaded holes for connecting the adminbook with fasteners. + +![](https://habrastorage.org/webt/3d/q9/ku/3dq9kus6t7ql3rh5mbpfo3_xqng.jpeg) +Fig.15.1 — The underside of the adminbook + +Large hole in the center has a tripod thread. + +![](https://habrastorage.org/webt/t5/e5/ps/t5e5ps3iasu2j-22uc2rgl_5x_y.jpeg) +Fig.15.2 — Camera clamp mount + +Why is it necessary? Because sometimes you have to hang on high, holding the mast with one hand, holding the notebook with the second, and typing something on the third… Unfortunately, I am not Shiva, so these tricks are not easy for me. And you can just screw the adminbook by a camera mount to any protruding part of the structure and free your hands! + +No protruding parts? No problem. A plate with neodymium magnets is screwed to three other holes and the adminbook is magnetised to any steel surface — even vertical! As you see, opening the display by 180° is pretty useful. + +![](https://habrastorage.org/webt/ua/28/ub/ua28ubhpyrmountubiqjegiibem.jpeg) +Fig.15.3 — Fastening with magnets and shaped holes for nails / screws + +And if there is no metal? For example, working on the roof, and next to only a wooden wall. Then you can screw 1-2 screws in the wall and hang the adminbook on them. To do this, there are special slots in the mount, plus an eyelet on the handle. + +For especially difficult cases, there’s an arm mount. This is not very convenient, but better than nothing. Besides, it allows you to navigate even with a working notebook. + +![](https://habrastorage.org/webt/tp/fo/0y/tpfo0y_8gku4bmlbeqwfux1j4me.jpeg) +Fig.15.4 — Arm mount + +In general, these three holes use a regular metric thread, specifically so that you can make some DIY fastening and fasten it with ordinary screws. + +Except fasteners, an additional radiator can be screwed to these holes, so that you can work for a long time under high load or at high ambient temperature. + +![](https://habrastorage.org/webt/k4/jo/eq/k4joeqhmaxgvzhnxno6z3alg5go.jpeg) +Fig.15.5 — Adminbook with additional radiator + +### 16\. Accessories + +The adminbook has some unique features, and some of them are implemented using equipment designed specifically for the adminbook. Therefore, these accessories are immediately included. However, non-unique accessories are also available immediately. + +Here is a complete list of both: + + * fasteners with magnets + * arm mount + * heatsink + * screen blinds covering it from sunlight + * HD Mini SAS to U.2 cable + * combined adapter from U.2 to M.2 and PCIe + * power cable, terminated by coaxial 5.5x2.5mm connectors + * adapter from power cable to cigarette lighter + * adapter from power cable to crocodile clips + * different adapters from the power cable to coaxial connectors + * universal power supply and power cord from it into the outlet + + + +### 17\. Power supply + +Since this is a power supply for a system administrator's notebook, it would be nice to make it universal, capable of powering various electronic devices. Fortunately, the vast majority of devices are connected via coaxial connectors or USB. I mean devices with external power supplies: routers, switches, notebooks, nettops, single-board computers, DVRs, IPTV set top boxes, satellite tuners and more. + +![](https://habrastorage.org/webt/jv/zs/ve/jvzsveqavvi2ihuoajjnsr1xlp0.jpeg) +Fig.17.1 — Adapters from 5.5x2.5mm coaxial connector to other types of connectors + +There aren’t many connector types, which allows to get by with an adjustable-voltage PSU and adapters for the necessary connectors. It also needs to support various power delivery standards. + +In our case, the power supply supports the following modes: + + * Power Delivery — displayed as **[pd]** + * Quick Charge **[qc]** + * 802.3af/at **[at]** + * voltage from 5 to 54 volts in 0.5V increments (displayed voltage) + + + +![](https://habrastorage.org/webt/fj/jm/qv/fjjmqvdhezywuyh9ew3umy9wgmg.jpeg) +Fig.17.2 — Mode display on the 7-segment indicator (1.9. = 19.5V) + +![](https://habrastorage.org/webt/h9/zg/u0/h9zgu0ngl01rvhgivlw7fb49gpq.jpeg) +Fig.17.3 — Front and top sides of power supply + +USB outputs on the power supply (5V 2A) are always on. On the other outputs the voltage is applied by pressing the ON/OFF button. + +The desired mode is selected with the MODE button and this selection is remembered even when the power is turned off. The modes are listed like this: pd, qc, at, then a series of voltages. + +Voltage increases by pressing and holding the MODE button, decreases by short pressing. Step to the right — 1 Volt, step to the left — 0.5 Volt. Half a volt is needed because some equipment requires, for example, 19.5 volts. These half volts are displayed on the display with decimal points (19V -> **[19]** , 19.5V -> **[1.9.]** ). + +When power is on, the green LED is on. When a short-circuit or overcurrent protection is triggered, **[SH]** is displayed, and the LED lights up red. + +In the Power Delivery and Quick Charge modes, voltage is applied to the USB outputs (Type A and Type C). Only one of them can be used at one time. + +In 802.3af/at modes, the power supply acts as an injector, combining the supply voltage with data from the LAN connector and supplying it to the POE connector. Power is supplied only if a device with 802.3af or 802.3at support is plugged into the POE connector. + +But in the simple voltage supply mode, electricity throu the POE connector is issued immediately, without any checks. This is the so-called Passive POE — positive charge goes to conductors 4 and 5, and negative charge to conductors 7 and 8. At the same time, the voltage is applied to the coaxial connector. Adapters for various types of connectors are used in this mode. + +The power supply unit has a built-in button to remotely reset Ubiquity access points. This is a very useful feature that allows you to reset the antenna to factory settings without having to climb on the mast. I don’t know — is any other manufacturers support a feature like this? + +The power supply also has the passive wiremap adapter, which allows you to determine the correct Ethernet cable crimping. The active part is located in the Ethernet ports of the adminbook. + +![](https://habrastorage.org/webt/pp/bm/ws/ppbmws4g1o5j05eyqqulnwuuwge.jpeg) +Fig.17.4 — Back side and wiremap adapter + +Of course, the network cable tester built into the adminbook will not replace a professional OTDR, but for most tasks it will be enough. + +To prevent overheating, part of the PSU’s body acts as an aluminum heatsink. Power supply power — 65 watts, size 10x5x4cm. + +### 18\. Afterword + +“It won’t fit into such a small case!” — the sceptics will probably say. To be frank, I also sometimes think that way when re-reading what I wrote above. + +And then I open the 3D model and see, that all parts fits. Of course, I am not an electronic engineer, and for sure I miss some important things. But, I hope that if there are mistakes, they are “overcorrections”. That is, real engineers would fit all of that into a case even smaller. + +By and large, the adminbook can be divided into 5 functional parts: + + * the usual part, as in all notebooks — processor, memory, hard drive, etc. + * keyboard and trackpoint that can work separately + * autonomous video subsystem + * subsystem for managing non-standard features (enable / disable POE, infrared remote control, PCIe mode switching, LAN testing, etc.) + * power subsystem + + + +If we consider them separately, then everything looks quite feasible. + +The **SOC Kaby Lake** contains a CPU, a graphics accelerator, a memory controller, PCIe, SATA controller, USB controller for 6 USB3 and 10 USB2 outputs, Gigabit Ethernet controller, 4 lanes to connect webcams, integrated audio and etc. + +All that remains is to trace the lanes to connectors and supply power to it. + +**Keyboard and trackpoint** is a separate module that connects via USB to the adminbook or to an external connector. Nothing complicated here: USB and Bluetooth keyboards are very widespread. In our case, in addition, needs to make a rewritable table of scan codes and transfer non-standard keys over a separate interface other than USB. + +**The video subsystem** receives the video signal from the adminbook or from external connectors. In fact, this is a regular monitor with a video switchboard plus a couple of VGA converters. + +**Non-standard features** are managed independently of the operating system. The easiest way to do it with via a separate microcontroller which receives codes for pressing non-standard keys (those that are pressed with Fn) and performs the corresponding actions. + +Since you have to display a menu to change the settings, the microcontroller has a video output, connected to the adminbook for the duration of the setup. + +**The internal PSU** is galvanically isolated from the rest of the system. Why not? On habr.com there was an article about making a 100W, 9.6mm thickness planar transformer! And it only costs $0.5. + +So the electronic part of the adminbook is quite feasible. There is the programming part, and I don’t know which part will harder. + +This concludes my fairly long article. It long, even though I simplified, shortened and threw out minor details. + +The ideal end of the article was a link to an online store where you can buy an adminbook. But it's not yet designed and released. Since this requires money. + +Unfortunately, I have no experience with Kickstarter or Indigogo. Maybe you have this experience? Let's do it together! + +### Update + +Many people asked for a simplified version. Ok. Done. Sorry — just a 3d model, without render. + +Deleted: second LAN adapter, micro SD card reader, one USB port Type C, second camera, camera lights and camera curtines, display latch, unnecessary audio connectors. + +Also in this version there will be no infrared remote control, a reprogrammable keyboard, QC 3.0 charging standard, and getting power by POE. + +![](https://habrastorage.org/webt/3l/lg/vm/3llgvmv4pebiruzgldqckab0uyc.jpeg) +![](https://habrastorage.org/webt/sp/x6/rv/spx6rvmn6zlumbwg46xwfmjnako.jpeg) +![](https://habrastorage.org/webt/sm/g0/xz/smg0xzdspfm3vr3gep__6bcqae8.jpeg) + + +-------------------------------------------------------------------------------- + +via: https://habr.com/en/post/437912/ + +作者:[sukhe][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://habr.com/en/users/sukhe/ +[b]: https://github.com/lujun9972 +[1]: https://habrastorage.org/webt/_1/mp/vl/_1mpvlyujldpnad0cvvzvbci50y.jpeg +[2]: https://habrastorage.org/webt/mr/m6/d3/mrm6d3szvghhpghfchsl_-lzgb4.jpeg From cd9926480e4605e5fd793f58fc2648bcbb977598 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 13:22:40 +0800 Subject: [PATCH 091/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190130=20Olive?= =?UTF-8?q?=20is=20a=20new=20Open=20Source=20Video=20Editor=20Aiming=20to?= =?UTF-8?q?=20Take=20On=20Biggies=20Like=20Final=20Cut=20Pro=20sources/tec?= =?UTF-8?q?h/20190130=20Olive=20is=20a=20new=20Open=20Source=20Video=20Edi?= =?UTF-8?q?tor=20Aiming=20to=20Take=20On=20Biggies=20Like=20Final=20Cut=20?= =?UTF-8?q?Pro.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...g to Take On Biggies Like Final Cut Pro.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md diff --git a/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md new file mode 100644 index 0000000000..989cd0d60f --- /dev/null +++ b/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro) +[#]: via: (https://itsfoss.com/olive-video-editor) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro +====== + +[Olive][1] is a new open source video editor under development. This non-linear video editor aims to provide a free alternative to high-end professional video editing software. Too high an aim? I think so. + +If you have read our [list of best video editors for Linux][2], you might have noticed that most of the ‘professional-grade’ video editors such as [Lightworks][3] or DaVinciResolve are neither free nor open source. + +[Kdenlive][4] and Shotcut are there but they don’t often meet the standards of professional video editing (that’s what many Linux users have expressed). + +This gap between the hobbyist and professional video editors prompted the developer(s) of Olive to start this project. + +![Olive Video Editor][5]Olive Video Editor Interface + +There is a detailed [review of Olive on Libre Graphics World][6]. Actually, this is where I came to know about Olive first. You should read the article if you are interested in knowing more about it. + +### Installing Olive Video Editor in Linux + +Let me remind you. Olive is in the early stages of development. You’ll find plenty of bugs and missing/incomplete features. You should not treat it as your main video editor just yet. + +If you want to test Olive, there are several ways to install it on Linux. + +#### Install Olive in Ubuntu-based distributions via PPA + +You can install Olive via its official PPA in Ubuntu, Mint and other Ubuntu-based distributions. + +``` +sudo add-apt-repository ppa:olive-editor/olive-editor +sudo apt-get update +sudo apt-get install olive-editor +``` + +#### Install Olive via Snap + +If your Linux distribution supports Snap, you can use the command below to install it. + +``` +sudo snap install --edge olive-editor +``` + +#### Install Olive via Flatpak + +If your [Linux distribution supports Flatpak][7], you can install Olive video editor via Flatpak. + +#### Use Olive via AppImage + +Don’t want to install it? Download the [AppImage][8] file, set it as executable and run it. + +Both 32-bit and 64-bit AppImage files are available. You should download the appropriate file. + +Olive is also available for Windows and macOS. You can get it from their [download page][9]. + +### Want to support the development of Olive video editor? + +If you like what Olive is trying to achieve and want to support it, here are a few ways you can do that. + +If you are testing Olive and find some bugs, please report it on their GitHub repository. + +If you are a programmer, go and check out the source code of Olive and see if you could help the project with your coding skills. + +Contributing to projects financially is another way you can help the development of open source software. You can support Olive monetarily by becoming a patron. + +If you don’t have either the money or coding skills to support Olive, you could still help it. Share this article or Olive’s website on social media or in Linux/software related forums and groups you frequent. A little word of mouth should help it indirectly. + +### What do you think of Olive? + +It’s too early to judge Olive. I hope that the development continues rapidly and we have a stable release of Olive by the end of the year (if I am not being overly optimistic). + +What do you think of Olive? Do you agree with the developer’s aim of targeting the pro-users? What features would you like Olive to have? + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/olive-video-editor + +作者:[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.olivevideoeditor.org/ +[2]: https://itsfoss.com/best-video-editing-software-linux/ +[3]: https://www.lwks.com/ +[4]: https://kdenlive.org/en/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?resize=800%2C450&ssl=1 +[6]: http://libregraphicsworld.org/blog/entry/introducing-olive-new-non-linear-video-editor +[7]: https://itsfoss.com/flatpak-guide/ +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://www.olivevideoeditor.org/download.php +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?fit=800%2C450&ssl=1 From 1dcb50dabbb3225c7bb1354ac338caa3694b2be0 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 11 Feb 2019 14:24:40 +0800 Subject: [PATCH 092/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=20OOP=20?= =?UTF-8?q?Before=20OOP=20with=20Simula=20sources/talk/20190131=20OOP=20Be?= =?UTF-8?q?fore=20OOP=20with=20Simula.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190131 OOP Before OOP with Simula.md | 203 ++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 sources/talk/20190131 OOP Before OOP with Simula.md diff --git a/sources/talk/20190131 OOP Before OOP with Simula.md b/sources/talk/20190131 OOP Before OOP with Simula.md new file mode 100644 index 0000000000..cae9d9bd3a --- /dev/null +++ b/sources/talk/20190131 OOP Before OOP with Simula.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (OOP Before OOP with Simula) +[#]: via: (https://twobithistory.org/2019/01/31/simula.html) +[#]: author: (Sinclair Target https://twobithistory.org) + +OOP Before OOP with Simula +====== + +Imagine that you are sitting on the grassy bank of a river. Ahead of you, the water flows past swiftly. The afternoon sun has put you in an idle, philosophical mood, and you begin to wonder whether the river in front of you really exists at all. Sure, large volumes of water are going by only a few feet away. But what is this thing that you are calling a “river”? After all, the water you see is here and then gone, to be replaced only by more and different water. It doesn’t seem like the word “river” refers to any fixed thing in front of you at all. + +In 2009, Rich Hickey, the creator of Clojure, gave [an excellent talk][1] about why this philosophical quandary poses a problem for the object-oriented programming paradigm. He argues that we think of an object in a computer program the same way we think of a river—we imagine that the object has a fixed identity, even though many or all of the object’s properties will change over time. Doing this is a mistake, because we have no way of distinguishing between an object instance in one state and the same object instance in another state. We have no explicit notion of time in our programs. We just breezily use the same name everywhere and hope that the object is in the state we expect it to be in when we reference it. Inevitably, we write bugs. + +The solution, Hickey concludes, is that we ought to model the world not as a collection of mutable objects but a collection of processes acting on immutable data. We should think of each object as a “river” of causally related states. In sum, you should use a functional language like Clojure. + +![][2] +The author, on a hike, pondering the ontological commitments +of object-oriented programming. + +Since Hickey gave his talk in 2009, interest in functional programming languages has grown, and functional programming idioms have found their way into the most popular object-oriented languages. Even so, most programmers continue to instantiate objects and mutate them in place every day. And they have been doing it for so long that it is hard to imagine that programming could ever look different. + +I wanted to write an article about Simula and imagined that it would mostly be about when and how object-oriented constructs we are familiar with today were added to the language. But I think the more interesting story is about how Simula was originally so unlike modern object-oriented programming languages. This shouldn’t be a surprise, because the object-oriented paradigm we know now did not spring into existence fully formed. There were two major versions of Simula: Simula I and Simula 67. Simula 67 brought the world classes, class hierarchies, and virtual methods. But Simula I was a first draft that experimented with other ideas about how data and procedures could be bundled together. The Simula I model is not a functional model like the one Hickey proposes, but it does focus on processes that unfold over time rather than objects with hidden state that interact with each other. Had Simula 67 stuck with more of Simula I’s ideas, the object-oriented paradigm we know today might have looked very different indeed—and that contingency should teach us to be wary of assuming that the current paradigm will dominate forever. + +### Simula 0 Through 67 + +Simula was created by two Norwegians, Kristen Nygaard and Ole-Johan Dahl. + +In the late 1950s, Nygaard was employed by the Norwegian Defense Research Establishment (NDRE), a research institute affiliated with the Norwegian military. While there, he developed Monte Carlo simulations used for nuclear reactor design and operations research. These simulations were at first done by hand and then eventually programmed and run on a Ferranti Mercury. Nygaard soon found that he wanted a higher-level way to describe these simulations to a computer. + +The kind of simulation that Nygaard commonly developed is known as a “discrete event model.” The simulation captures how a sequence of events change the state of a system over time—but the important property here is that the simulation can jump from one event to the next, since the events are discrete and nothing changes in the system between events. This kind of modeling, according to a paper that Nygaard and Dahl presented about Simula in 1966, was increasingly being used to analyze “nerve networks, communication systems, traffic flow, production systems, administrative systems, social systems, etc.” So Nygaard thought that other people might want a higher-level way to describe these simulations too. He began looking for someone that could help him implement what he called his “Simulation Language” or “Monte Carlo Compiler.” + +Dahl, who had also been employed by NDRE, where he had worked on language design, came aboard at this point to play Wozniak to Nygaard’s Jobs. Over the next year or so, Nygaard and Dahl worked to develop what has been called “Simula 0.” This early version of the language was going to be merely a modest extension to ALGOL 60, and the plan was to implement it as a preprocessor. The language was then much less abstract than what came later. The primary language constructs were “stations” and “customers.” These could be used to model certain discrete event networks; Nygaard and Dahl give an example simulating airport departures. But Nygaard and Dahl eventually came up with a more general language construct that could represent both “stations” and “customers” and also model a wider range of simulations. This was the first of two major generalizations that took Simula from being an application-specific ALGOL package to a general-purpose programming language. + +In Simula I, there were no “stations” or “customers,” but these could be recreated using “processes.” A process was a bundle of data attributes associated with a single action known as the process’ operating rule. You might think of a process as an object with only a single method, called something like `run()`. This analogy is imperfect though, because each process’ operating rule could be suspended or resumed at any time—the operating rules were a kind of coroutine. A Simula I program would model a system as a set of processes that conceptually all ran in parallel. Only one process could actually be “current” at any time, but once a process suspended itself the next queued process would automatically take over. As the simulation ran, behind the scenes, Simula would keep a timeline of “event notices” that tracked when each process should be resumed. In order to resume a suspended process, Simula needed to keep track of multiple call stacks. This meant that Simula could no longer be an ALGOL preprocessor, because ALGOL had only once call stack. Nygaard and Dahl were committed to writing their own compiler. + +In their paper introducing this system, Nygaard and Dahl illustrate its use by implementing a simulation of a factory with a limited number of machines that can serve orders. The process here is the order, which starts by looking for an available machine, suspends itself to wait for one if none are available, and then runs to completion once a free machine is found. There is a definition of the order process that is then used to instantiate several different order instances, but no methods are ever called on these instances. The main part of the program just creates the processes and sets them running. + +The first Simula I compiler was finished in 1965. The language grew popular at the Norwegian Computer Center, where Nygaard and Dahl had gone to work after leaving NDRE. Implementations of Simula I were made available to UNIVAC users and to Burroughs B5500 users. Nygaard and Dahl did a consulting deal with a Swedish company called ASEA that involved using Simula to run job shop simulations. But Nygaard and Dahl soon realized that Simula could be used to write programs that had nothing to do with simulation at all. + +Stein Krogdahl, a professor at the University of Oslo that has written about the history of Simula, claims that “the spark that really made the development of a new general-purpose language take off” was [a paper called “Record Handling”][3] by the British computer scientist C.A.R. Hoare. If you read Hoare’s paper now, this is easy to believe. I’m surprised that you don’t hear Hoare’s name more often when people talk about the history of object-oriented languages. Consider this excerpt from his paper: + +> The proposal envisages the existence inside the computer during the execution of the program, of an arbitrary number of records, each of which represents some object which is of past, present or future interest to the programmer. The program keeps dynamic control of the number of records in existence, and can create new records or destroy existing ones in accordance with the requirements of the task in hand. + +> Each record in the computer must belong to one of a limited number of disjoint record classes; the programmer may declare as many record classes as he requires, and he associates with each class an identifier to name it. A record class name may be thought of as a common generic term like “cow,” “table,” or “house” and the records which belong to these classes represent the individual cows, tables, and houses. + +Hoare does not mention subclasses in this particular paper, but Dahl credits him with introducing Nygaard and himself to the concept. Nygaard and Dahl had noticed that processes in Simula I often had common elements. Using a superclass to implement those common elements would be convenient. This also raised the possibility that the “process” idea itself could be implemented as a superclass, meaning that not every class had to be a process with a single operating rule. This then was the second great generalization that would make Simula 67 a truly general-purpose programming language. It was such a shift of focus that Nygaard and Dahl briefly considered changing the name of the language so that people would know it was not just for simulations. But “Simula” was too much of an established name for them to risk it. + +In 1967, Nygaard and Dahl signed a contract with Control Data to implement this new version of Simula, to be known as Simula 67. A conference was held in June, where people from Control Data, the University of Oslo, and the Norwegian Computing Center met with Nygaard and Dahl to establish a specification for this new language. This conference eventually led to a document called the [“Simula 67 Common Base Language,”][4] which defined the language going forward. + +Several different vendors would make Simula 67 compilers. The Association of Simula Users (ASU) was founded and began holding annual conferences. Simula 67 soon had users in more than 23 different countries. + +### 21st Century Simula + +Simula is remembered now because of its influence on the languages that have supplanted it. You would be hard-pressed to find anyone still using Simula to write application programs. But that doesn’t mean that Simula is an entirely dead language. You can still compile and run Simula programs on your computer today, thanks to [GNU cim][5]. + +The cim compiler implements the Simula standard as it was after a revision in 1986. But this is mostly the Simula 67 version of the language. You can write classes, subclass, and virtual methods just as you would have with Simula 67. So you could create a small object-oriented program that looks a lot like something you could easily write in Python or Ruby: + +``` +! dogs.sim ; +Begin + Class Dog; + ! The cim compiler requires virtual procedures to be fully specified ; + Virtual: Procedure bark Is Procedure bark;; + Begin + Procedure bark; + Begin + OutText("Woof!"); + OutImage; ! Outputs a newline ; + End; + End; + + Dog Class Chihuahua; ! Chihuahua is "prefixed" by Dog ; + Begin + Procedure bark; + Begin + OutText("Yap yap yap yap yap yap"); + OutImage; + End; + End; + + Ref (Dog) d; + d :- new Chihuahua; ! :- is the reference assignment operator ; + d.bark; +End; +``` + +You would compile and run it as follows: + +``` +$ cim dogs.sim +Compiling dogs.sim: +gcc -g -O2 -c dogs.c +gcc -g -O2 -o dogs dogs.o -L/usr/local/lib -lcim +$ ./dogs +Yap yap yap yap yap yap +``` + +(You might notice that cim compiles Simula to C, then hands off to a C compiler.) + +This was what object-oriented programming looked like in 1967, and I hope you agree that aside from syntactic differences this is also what object-oriented programming looks like in 2019. So you can see why Simula is considered a historically important language. + +But I’m more interested in showing you the process model that was central to Simula I. That process model is still available in Simula 67, but only when you use the `Process` class and a special `Simulation` block. + +In order to show you how processes work, I’ve decided to simulate the following scenario. Imagine that there is a village full of villagers next to a river. The river has lots of fish, but between them the villagers only have one fishing rod. The villagers, who have voracious appetites, get hungry every 60 minutes or so. When they get hungry, they have to use the fishing rod to catch a fish. If a villager cannot use the fishing rod because another villager is waiting for it, then the villager queues up to use the fishing rod. If a villager has to wait more than five minutes to catch a fish, then the villager loses health. If a villager loses too much health, then that villager has starved to death. + +This is a somewhat strange example and I’m not sure why this is what first came to mind. But there you go. We will represent our villagers as Simula processes and see what happens over a day’s worth of simulated time in a village with four villagers. + +The full program is [available here as a Gist][6]. + +The last lines of my output look like the following. Here we are seeing what happens in the last few hours of the day: + +``` +1299.45: John is hungry and requests the fishing rod. +1299.45: John is now fishing. +1311.39: John has caught a fish. +1328.96: Betty is hungry and requests the fishing rod. +1328.96: Betty is now fishing. +1331.25: Jane is hungry and requests the fishing rod. +1340.44: Betty has caught a fish. +1340.44: Jane went hungry waiting for the rod. +1340.44: Jane starved to death waiting for the rod. +1369.21: John is hungry and requests the fishing rod. +1369.21: John is now fishing. +1379.33: John has caught a fish. +1409.59: Betty is hungry and requests the fishing rod. +1409.59: Betty is now fishing. +1419.98: Betty has caught a fish. +1427.53: John is hungry and requests the fishing rod. +1427.53: John is now fishing. +1437.52: John has caught a fish. +``` + +Poor Jane starved to death. But she lasted longer than Sam, who didn’t even make it to 7am. Betty and John sure have it good now that only two of them need the fishing rod. + +What I want you to see here is that the main, top-level part of the program does nothing but create the four villager processes and get them going. The processes manipulate the fishing rod object in the same way that we would manipulate an object today. But the main part of the program does not call any methods or modify and properties on the processes. The processes have internal state, but this internal state only gets modified by the process itself. + +There are still fields that get mutated in place here, so this style of programming does not directly address the problems that pure functional programming would solve. But as Krogdahl observes, “this mechanism invites the programmer of a simulation to model the underlying system as a set of processes, each describing some natural sequence of events in that system.” Rather than thinking primarily in terms of nouns or actors—objects that do things to other objects—here we are thinking of ongoing processes. The benefit is that we can hand overall control of our program off to Simula’s event notice system, which Krogdahl calls a “time manager.” So even though we are still mutating processes in place, no process makes any assumptions about the state of another process. Each process interacts with other processes only indirectly. + +It’s not obvious how this pattern could be used to build, say, a compiler or an HTTP server. (On the other hand, if you’ve ever programmed games in the Unity game engine, this should look familiar.) I also admit that even though we have a “time manager” now, this may not have been exactly what Hickey meant when he said that we need an explicit notion of time in our programs. (I think he’d want something like the superscript notation [that Ada Lovelace used][7] to distinguish between the different values a variable assumes through time.) All the same, I think it’s really interesting that right there at the beginning of object-oriented programming we can find a style of programming that is not all like the object-oriented programming we are used to. We might take it for granted that object-oriented programming simply works one way—that a program is just a long list of the things that certain objects do to other objects in the exact order that they do them. Simula I’s process system shows that there are other approaches. Functional languages are probably a better thought-out alternative, but Simula I reminds us that the very notion of alternatives to modern object-oriented programming should come as no surprise. + +If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][8] on Twitter or subscribe to the [RSS feed][9] to make sure you know when a new post is out. + +Previously on TwoBitHistory… + +> Hey everyone! I sadly haven't had time to do any new writing but I've just put up an updated version of my history of RSS. This version incorporates interviews I've since done with some of the key people behind RSS like Ramanathan Guha and Dan Libby. +> +> — TwoBitHistory (@TwoBitHistory) [December 18, 2018][10] + + + +-------------------------------------------------------------------------------- + +1. Jan Rune Holmevik, “The History of Simula,” accessed January 31, 2019, http://campus.hesge.ch/daehne/2004-2005/langages/simula.htm. ↩ + +2. Ole-Johan Dahl and Kristen Nygaard, “SIMULA—An ALGOL-Based Simulation Langauge,” Communications of the ACM 9, no. 9 (September 1966): 671, accessed January 31, 2019, http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.95.384&rep=rep1&type=pdf. ↩ + +3. Stein Krogdahl, “The Birth of Simula,” 2, accessed January 31, 2019, http://heim.ifi.uio.no/~steinkr/papers/HiNC1-webversion-simula.pdf. ↩ + +4. ibid. ↩ + +5. Ole-Johan Dahl and Kristen Nygaard, “The Development of the Simula Languages,” ACM SIGPLAN Notices 13, no. 8 (August 1978): 248, accessed January 31, 2019, https://hannemyr.com/cache/knojd_acm78.pdf. ↩ + +6. Dahl and Nygaard (1966), 676. ↩ + +7. Dahl and Nygaard (1978), 257. ↩ + +8. Krogdahl, 3. ↩ + +9. Ole-Johan Dahl, “The Birth of Object-Orientation: The Simula Languages,” 3, accessed January 31, 2019, http://www.olejohandahl.info/old/birth-of-oo.pdf. ↩ + +10. Dahl and Nygaard (1978), 265. ↩ + +11. Holmevik. ↩ + +12. Krogdahl, 4. ↩ + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/01/31/simula.html + +作者:[Sinclair Target][a] +选题:[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]: https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey +[2]: /images/river.jpg +[3]: https://archive.computerhistory.org/resources/text/algol/ACM_Algol_bulletin/1061032/p39-hoare.pdf +[4]: http://web.eah-jena.de/~kleine/history/languages/Simula-CommonBaseLanguage.pdf +[5]: https://www.gnu.org/software/cim/ +[6]: https://gist.github.com/sinclairtarget/6364cd521010d28ee24dd41ab3d61a96 +[7]: https://twobithistory.org/2018/08/18/ada-lovelace-note-g.html +[8]: https://twitter.com/TwoBitHistory +[9]: https://twobithistory.org/feed.xml +[10]: https://twitter.com/TwoBitHistory/status/1075075139543449600?ref_src=twsrc%5Etfw From c8d054199f60d9c8dfb5ad903373b7d1127e1da9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Feb 2019 15:16:33 +0800 Subject: [PATCH 093/813] PRF:20190108 Hacking math education with Python.md @HankChow --- .../20190108 Hacking math education with Python.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/translated/talk/20190108 Hacking math education with Python.md b/translated/talk/20190108 Hacking math education with Python.md index 120e56c521..825b2e30ed 100644 --- a/translated/talk/20190108 Hacking math education with Python.md +++ b/translated/talk/20190108 Hacking math education with Python.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Hacking math education with Python) @@ -9,6 +9,7 @@ 将 Python 结合到数学教育中 ====== + > 身兼教师、开发者、作家数职的 Peter Farrell 来讲述为什么使用 Python 来讲数学课会比传统方法更加好。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl) @@ -19,11 +20,11 @@ Peter 的灵感来源于 Logo 语言之父 [Seymour Papert][2],他的 Logo 语言现在还存在于 Python 的 [Turtle 模块][3]中。Logo 语言中的海龟形象让 Peter 喜欢上了 Python,并且进一步将 Python 应用到数学教学中。 -Peter 在他的新书《[Python 数学奇遇记Math Adventures with Python][5]》中分享了他的方法:“图文并茂地指导如何用代码探索数学”。因此我最近对他进行了一次采访,向他了解更多这方面的情况。 +Peter 在他的新书《[Python 数学奇遇记][5]Math Adventures with Python》中分享了他的方法:“图文并茂地指导如何用代码探索数学”。因此我最近对他进行了一次采访,向他了解更多这方面的情况。 -**Don Watkins(译者注:本文作者):** 你的教学背景是什么? +**Don Watkins(LCTT 译注:本文作者):** 你的教学背景是什么? -**Peter Farrell:** 我曾经当过八年的数学老师,之后又教了十年的数学。我还在当老师的时候,就阅读过 Papert 的 《[头脑风暴Mindstorms][6]》并从中受到了启发,将 Logo 语言和海龟引入到了我所有的数学课上。 +**Peter Farrell:** 我曾经当过八年的数学老师,之后又做了十年的数学私教。我还在当老师的时候,就阅读过 Papert 的 《[头脑风暴][6]Mindstorms》并从中受到了启发,将 Logo 语言和海龟引入到了我所有的数学课上。 **DW:** 你为什么开始使用 Python 呢? @@ -68,7 +69,7 @@ via: https://opensource.com/article/19/1/hacking-math 作者:[Don Watkins][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 6678a9a3d9c9b6f13e2a8260a3eaa44eb7657066 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Feb 2019 15:17:35 +0800 Subject: [PATCH 094/813] PUB:20190108 Hacking math education with Python.md @HankChow https://linux.cn/article-10527-1.html --- .../20190108 Hacking math education with Python.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190108 Hacking math education with Python.md (99%) diff --git a/translated/talk/20190108 Hacking math education with Python.md b/published/20190108 Hacking math education with Python.md similarity index 99% rename from translated/talk/20190108 Hacking math education with Python.md rename to published/20190108 Hacking math education with Python.md index 825b2e30ed..0ab5baca72 100644 --- a/translated/talk/20190108 Hacking math education with Python.md +++ b/published/20190108 Hacking math education with Python.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10527-1.html) [#]: subject: (Hacking math education with Python) [#]: via: (https://opensource.com/article/19/1/hacking-math) [#]: author: (Don Watkins https://opensource.com/users/don-watkins) From 82e45d05224be84c2102c0f17110084d90dd8246 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Mon, 11 Feb 2019 16:10:59 +0800 Subject: [PATCH 095/813] =?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 --- sources/talk/20190110 Toyota Motors and its Linux Journey.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190110 Toyota Motors and its Linux Journey.md b/sources/talk/20190110 Toyota Motors and its Linux Journey.md index 1d76ffe0b6..fc2f44f72e 100644 --- a/sources/talk/20190110 Toyota Motors and its Linux Journey.md +++ b/sources/talk/20190110 Toyota Motors and its Linux Journey.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jdh8383) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e3f094a872b0cc919398a317201ed6adc71cda7c Mon Sep 17 00:00:00 2001 From: guevaraya Date: Mon, 11 Feb 2019 16:13:30 +0800 Subject: [PATCH 096/813] Translating By Guevaraya MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领翻译文章 20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md --- ...616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md index 9040162a97..0fddb05f10 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md @@ -1,3 +1,5 @@ +Translating By Guevaraya + [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) From 9b6c265d105847f1e15c9354b14c3eff70ec26e1 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Mon, 11 Feb 2019 18:10:50 +0800 Subject: [PATCH 097/813] Update 20190110 Toyota Motors and its Linux Journey.md --- sources/talk/20190110 Toyota Motors and its Linux Journey.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sources/talk/20190110 Toyota Motors and its Linux Journey.md b/sources/talk/20190110 Toyota Motors and its Linux Journey.md index fc2f44f72e..ef3afd38a0 100644 --- a/sources/talk/20190110 Toyota Motors and its Linux Journey.md +++ b/sources/talk/20190110 Toyota Motors and its Linux Journey.md @@ -7,12 +7,11 @@ [#]: via: (https://itsfoss.com/toyota-motors-linux-journey) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Toyota Motors and its Linux Journey +丰田汽车的Linux之旅 ====== -**This is a community submission from It’s FOSS reader Malcolm Dean.** - I spoke with Brian R Lyons of TMNA Toyota Motor Corp North America about the implementation of Linux in Toyota and Lexus infotainment systems. I came to find out there is an Automotive Grade Linux (AGL) being used by several autmobile manufacturers. +我之前跟丰田汽车北美分公司的Brian.R.Lyons聊过天,话题是关于Linux在丰田和雷克萨斯汽车的信息娱乐系统上的实施方案。我发现一些汽车制造商使用了Automotive Grade Linux (AGL)。 I put together a short article comprising of my discussion with Brian about Toyota and its tryst with Linux. I hope that Linux enthusiasts will like this quick little chat. From de6a8999d809b0a72aeff27f9e5fa60971ab4e03 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Feb 2019 08:53:43 +0800 Subject: [PATCH 098/813] translated --- ...imple and useful GNOME Shell extensions.md | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) rename {sources => translated}/tech/20190128 3 simple and useful GNOME Shell extensions.md (52%) diff --git a/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md b/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md similarity index 52% rename from sources/tech/20190128 3 simple and useful GNOME Shell extensions.md rename to translated/tech/20190128 3 simple and useful GNOME Shell extensions.md index d7384030c5..7ef3efd956 100644 --- a/sources/tech/20190128 3 simple and useful GNOME Shell extensions.md +++ b/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md @@ -7,57 +7,56 @@ [#]: via: (https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/) [#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) -3 simple and useful GNOME Shell extensions +3 个简单实用的 GNOME Shell 扩展 ====== - ![](https://fedoramagazine.org/wp-content/uploads/2019/01/3simple-816x345.png) -The default desktop of Fedora Workstation — GNOME Shell — is known and loved by many users for its minimal, clutter-free user interface. It is also known for the ability to add to the stock interface using extensions. In this article, we cover 3 simple, and useful extensions for GNOME Shell. These three extensions provide a simple extra behaviour to your desktop; simple tasks that you might do every day. +Fedora Workstation 的默认桌面 GNOME Shell,因其最小化,整洁的用户界面而闻名并深受许多用户的喜爱。它还以可使用扩展添加到 stock 界面的能力而闻名。在本文中,我们将介绍 GNOME Shell 的 3 个简单且有用的扩展。这三个扩展为你的桌面提供了简单的,你可能每天都会做的行为。 +### 安装扩展程序 -### Installing Extensions - -The quickest and easiest way to install GNOME Shell extensions is with the Software Application. Check out the previous post here on the Magazine for more details: +安装 GNOME Shell 扩展的最快捷最简单的方法是使用软件应用。有关详细信息,请查看 Magazine 中的上一篇文章: ![](https://fedoramagazine.org/wp-content/uploads/2018/11/installing-extensions-768x325.jpg) ### Removable Drive Menu ![][1] -Removable Drive Menu extension on Fedora 29 -First up is the [Removable Drive Menu][2] extension. It is a simple tool that adds a small widget in the system tray if you have a removable drive inserted into your computer. This allows you easy access to open Files for your removable drive, or quickly and easily eject the drive for safe removal of the device. +Fedora 29 中的 Removable Drive Menu 扩展 + +首先是 [Removable Drive Menu][2] 扩展。如果你的计算机中有可移动驱动器,那么它是一个可在系统托盘中添加一个 widget 的简单工具。它可以使你轻松打开可移动驱动器中的文件,或者快速方便地弹出驱动器以安全移除设备。 ![][3] -Removable Drive Menu in the Software application -### Extensions Extension. +软件应用中的 Removable Drive Menu + +### Extensions 扩展 ![][4] -The [Extensions][5] extension is super useful if you are always installing and trying out new extensions. It provides a list of all the installed extensions, allowing you to enable or disable them. Additionally, if an extension has settings, it allows quick access to the settings dialog for each one. +如果你一直在安装和尝试新扩展,那么 [Extensions][5] 扩展非常有用。它提供了所有已安装扩展的列表,允许你启用或禁用它们。此外,如果扩展有设置,那么可以快速打开每个扩展的设置对话框。 ![][6] -the Extensions extension in the Software application + +软件中的 Extensions 扩展 ### Frippery Move Clock ![][7] -Finally, there is the simplest extension in the list. [Frippery Move Clock][8], simply moves the position of the clock from the center of the top bar to the right, next to the status area. +最后的是列表中最简单的扩展。[Frippery Move Clock][8],只是将时钟位置从顶部栏的中心向右移动,位于状态区旁边。 ![][9] - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/ 作者:[Ryan Lerch][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) - 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://fedoramagazine.org/introducing-flatpak/ From 18c8edff914d1bc670cb707ee427982035ec561b Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Feb 2019 08:57:28 +0800 Subject: [PATCH 099/813] translating --- ...0130 Get started with Budgie Desktop, a Linux environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md b/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md index 1c2389693f..9dceb60f1d 100644 --- a/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md +++ b/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c301a98f453e7b6a21c2a0ee06e9ae167e319da1 Mon Sep 17 00:00:00 2001 From: guevaraya Date: Tue, 12 Feb 2019 10:08:27 +0800 Subject: [PATCH 100/813] Update 20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md --- ...6 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md index 0fddb05f10..b5ad1a7e86 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md @@ -1,7 +1,5 @@ -Translating By Guevaraya - [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Guevaraya) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 73ab6dcabf1773e4d3a8c8f9f56573289bde8c7c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 11:59:20 +0800 Subject: [PATCH 101/813] PRF:20190129 More About Angle Brackets in Bash.md @HankChow --- ...90129 More About Angle Brackets in Bash.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190129 More About Angle Brackets in Bash.md b/translated/tech/20190129 More About Angle Brackets in Bash.md index de4f8331ca..66f6713112 100644 --- a/translated/tech/20190129 More About Angle Brackets in Bash.md +++ b/translated/tech/20190129 More About Angle Brackets in Bash.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (More About Angle Brackets in Bash) @@ -9,6 +9,7 @@ Bash 中尖括号的更多用法 ====== +> 在这篇文章,我们继续来深入探讨尖括号的更多其它用法。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/bash-angles.png?itok=mVFnxPzF) @@ -22,19 +23,20 @@ Bash 中尖括号的更多用法 diff <(ls /original/dir/) <(ls /backup/dir/) ``` -[`diff`][2] 命令是一个逐行比较两个文件之间差异的工具。在上面的例子中,就使用了 `<` 让 `diff` 认为两个 `ls` 命令输出的结果都是文件,从而能够比较它们之间的差异。 +[diff][2] 命令是一个逐行比较两个文件之间差异的工具。在上面的例子中,就使用了 `<` 让 `diff` 认为两个 `ls` 命令输出的结果都是文件,从而能够比较它们之间的差异。 要注意,在 `<` 和 `(...)` 之间是没有空格的。 我尝试在我的图片目录和它的备份目录执行上面的命令,输出的是以下结果: ``` -diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) 5d4 < Dv7bIIeUUAAD1Fc.jpg:large.jpg +diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) +5d4 < Dv7bIIeUUAAD1Fc.jpg:large.jpg ``` 输出结果中的 `<` 表示 `Dv7bIIeUUAAD1Fc.jpg:large.jpg` 这个文件存在于左边的目录(`/My/Pictures`)但不存在于右边的目录(`/My/backup/Pictures`)中。也就是说,在备份过程中可能发生了问题,导致这个文件没有被成功备份。如果 `diff` 没有显示出任何输出结果,就表明两个目录中的文件是一致的。 -看到这里你可能会想到,既然可以通过 `<` 将一些命令行的输出内容作为一个文件,提供给一个需要接受文件格式的命令,那么在上一篇文章的“最喜欢的演员排序”例子中,就可以省去中间的一些步骤,直接对输出内容执行 `sort` 操作了。 +看到这里你可能会想到,既然可以通过 `<` 将一些命令行的输出内容作为一个文件提供给一个需要接受文件格式的命令,那么在上一篇文章的“最喜欢的演员排序”例子中,就可以省去中间的一些步骤,直接对输出内容执行 `sort` 操作了。 确实如此,这个例子可以简化成这样: @@ -42,7 +44,7 @@ diff <(ls /My/Pictures/) <(ls /My/backup/Pictures/) 5d4 < Dv7bIIeUUAAD1Fc.jpg:la sort -r <(while read -r name surname films;do echo $films $name $surname ; done < CBactors) ``` -### Here string +### Here 字符串 除此以外,尖括号的重定向功能还有另一种使用方式。 @@ -52,9 +54,9 @@ sort -r <(while read -r name surname films;do echo $films $name $surname ; done myvar="Hello World" echo $myvar | tr '[:lower:]' '[:upper:]' HELLO WORLD ``` -[`tr`][3] 命令可以将一个字符串转换为某种格式。在上面的例子中,就使用了 `tr` 将字符串中的所有小写字母都转换为大写字母。 +[tr][3] 命令可以将一个字符串转换为某种格式。在上面的例子中,就使用了 `tr` 将字符串中的所有小写字母都转换为大写字母。 -要理解的是,这个传递过程的重点不是变量,而是变量的值,也就是字符串 `Hello World`。这样的字符串叫做 here string,含义是“这就是我们要处理的字符串”。但对于上面的例子,还可以用更直观的方式的处理,就像下面这样: +要理解的是,这个传递过程的重点不是变量,而是变量的值,也就是字符串 `Hello World`。这样的字符串叫做 HERE 字符串,含义是“这就是我们要处理的字符串”。但对于上面的例子,还可以用更直观的方式的处理,就像下面这样: ``` tr '[:lower:]' '[:upper:]' <<< $myvar @@ -75,13 +77,13 @@ via: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash 作者:[Paul Brown][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://www.linux.com/users/bro66 [b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash +[1]: https://linux.cn/article-10502-1.html [2]: https://linux.die.net/man/1/diff [3]: https://linux.die.net/man/1/tr From e9ff3f64f5aa4b09cabf806117e61bc7cbd7bc1a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 11:59:53 +0800 Subject: [PATCH 102/813] PUB:20190129 More About Angle Brackets in Bash.md @HankChow https://linux.cn/article-10529-1.html --- .../20190129 More About Angle Brackets in Bash.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190129 More About Angle Brackets in Bash.md (98%) diff --git a/translated/tech/20190129 More About Angle Brackets in Bash.md b/published/20190129 More About Angle Brackets in Bash.md similarity index 98% rename from translated/tech/20190129 More About Angle Brackets in Bash.md rename to published/20190129 More About Angle Brackets in Bash.md index 66f6713112..a34d4fc963 100644 --- a/translated/tech/20190129 More About Angle Brackets in Bash.md +++ b/published/20190129 More About Angle Brackets in Bash.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10529-1.html) [#]: subject: (More About Angle Brackets in Bash) [#]: via: (https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From d17107c73dea92827fce49fa7e0a640308394452 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 12:30:42 +0800 Subject: [PATCH 103/813] PRF:20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @oska874 --- ...aboratory - Raspberry Pi- Lesson 5 OK05.md | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md index 912d4c348c..2934ab5d42 100644 --- a/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md +++ b/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -1,26 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (oska874) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 5 OK05) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -translating by ezio - -树莓派计算机实验室 课程 5 OK05 +计算机实验室之树莓派:课程 5 OK05 ====== -OK05 课程构建于课程 OK04 的基础,使用更多代码方式烧、保存写莫尔斯码的 SOS 序列(`...---...`)。这里假设你已经有了 [课程 4: OK04][1] 操作系统的代码基础。 +OK05 课程构建于课程 OK04 的基础,使用它来闪烁摩尔斯电码的 SOS 序列(`...---...`)。这里假设你已经有了 [课程 4:OK04][1] 操作系统的代码作为基础。 -### 1 数据 +### 1、数据 -到目前为止,我们与操作系统有关的所有内容都提供了遵循的说明。然而有时候,说明只是一半。我们的操作系统可能需要数据 +到目前为止,我们与操作系统有关的所有内容提供的都是指令。然而有时候,指令只是完成了一半的工作。我们的操作系统可能还需要数据。 -> 一些早期的操作系统确实只允许特定文件中的特定类型的数据,但是这通常被认为太严格了。现代方法确实使程序变得复杂的多。 +> 一些早期的操作系统确实只允许特定文件中的特定类型的数据,但是这通常被认为限制太多了。现代方法确实可以使程序变得复杂的多。 -通常,只是数据的值很重要。你可能经过训练,认为数据是指定类型,比如,一个文本文件包含文章,一个图像文件包含一幅图片,等等。说实话,这只是一个理想罢了。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会将一个闪灯序列作为数据保存下来。 +通常,数据就是些很重要的值。你可能接受过培训,认为数据就是某种类型的,比如,文本文件包含文本,图像文件包含图片,等等。说实话,这只是你的想法而已。计算机上的全部数据都是二进制数字,重要的是我们选择用什么来解释这些数据。在这个例子中,我们会用一个闪灯序列作为数据保存下来。 在 `main.s` 结束处复制下面的代码: @@ -31,21 +29,19 @@ pattern: %定义整形变量 .int 0b11111111101010100010001000101010 ``` ->`.align num` 保证下一行代码的地址是 `2^num` 的整数倍。 +> `.align num` 确保下一行代码的地址是 2^num 的整数倍。 ->`.int val` 输出数值 `val`。 +> `.int val` 输出数值 `val`。 -要区分数据和代码,我们将数据都放在 `.data` 区域。我已经将该区域包含在操作系统的内存布局图。我已经选择将数据放到代码后面。将我们的指令和数据分开保存的原因是,如果最后我们在自己的操作系统上实现一些安全措施,我们就需要知道代码的那些部分是可以执行的,而那些部分是不行的。 +要区分数据和代码,我们将数据都放在 `.data` 区域。我已经将该区域包含在操作系统的内存布局图。我选择将数据放到代码后面。将我们的指令和数据分开保存的原因是,如果最后我们在自己的操作系统上实现一些安全措施,我们就需要知道代码的那些部分是可以执行的,而那些部分是不行的。 -我在这里使用了两个新命令 `.align` 和 `.int`。`.align` 保证下来的数据是按照 2 的乘方对齐的。在这个里,我使用 `.align 2` ,意味着数据最终存放的地址是 `2^2=4` 的整数倍。这个操作是很重要的,因为我们用来读取内寸的指令 `ldr` 要求内存地址是 4 的倍数。 +我在这里使用了两个新命令 `.align` 和 `.int`。`.align` 保证接下来的数据是按照 2 的乘方对齐的。在这个里,我使用 `.align 2` ,意味着数据最终存放的地址是 2^2=4 的整数倍。这个操作是很重要的,因为我们用来读取内存的指令 `ldr` 要求内存地址是 4 的倍数。 -The .int command copies the constant after it into the output directly. That means that 111111111010101000100010001010102 will be placed into the output, and so the label pattern actually labels this piece of data as pattern. +命令 `.int` 直接复制它后面的常量到输出。这意味着 111111111010101000100010001010102 将会被存放到输出,所以该标签模式实际是将这段数据标识为模式。 -命令 `.int` 直接复制它后面的常量到输出。这意味着 `11111111101010100010001000101010`(二进制数) 将会被存放到输出,所以标签模式实际将标记这段数据作为模式。 +> 关于数据的一个挑战是寻找一个高效和有用的展示形式。这种保存一个开、关的时间单元的序列的方式,运行起来很容易,但是将很难编辑,因为摩尔斯电码的 `-` 或 `.` 样式丢失了。 -> 关于数据的一个挑战是寻找一个高效和有用的展示形式。这种保存一个开、关的时间单元的序列的方式,运行起来很容易,但是将很难编辑,因为摩尔斯的原理 `-` 或 `.` 丢失了。 - -如我提到的,数据可以意味这你想要的所有东西。在这里我编码了摩尔斯代码 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。这样,我们可以像这样编写一些代码在数据中显示一个序列,然后要显示不同序列,我们所有需要做的就是修改这段数据。下面是一个非常简单的例子,操作系统必须一直执行这段程序,解释和展示数据。 +如我提到的,数据可以代表你想要的所有东西。在这里我编码了摩尔斯电码的 SOS 序列,对于不熟悉的人,就是 `...---...`。我使用 0 表示一个时间单元的 LED 灭灯,而 1 表示一个时间单元的 LED 亮。这样,我们可以像这样编写一些代码在数据中显示一个序列,然后要显示不同序列,我们所有需要做的就是修改这段数据。下面是一个非常简单的例子,操作系统必须一直执行这段程序,解释和展示数据。 复制下面几行到 `main.s` 中的标记 `loop$` 之前。 @@ -57,9 +53,9 @@ seq .req r5 %重命名 r5 为 seq mov seq,#0 %seq 赋值为 0 ``` -这段代码加载 `pattrern` 到寄存器 `r4`,并加载 0 到寄存器 `r5`。`r5` 将是我们的序列位置,所以我们可以追踪有多少 `pattern` 我们已经展示了。 +这段代码加载 `pattrern` 到寄存器 `r4`,并加载 0 到寄存器 `r5`。`r5` 将是我们的序列位置,所以我们可以追踪我们已经展示了多少个 `pattern`。 -下面的代码将非零值放入 `r1` ,如果仅仅是如果,这里有个 1 在当前位置的 `pattern`。 +如果 `pattern` 的当前位置是 1 且仅有一个 1,下面的代码将非零值放入 `r1`。 ``` mov r1,#1 %加载1到 r1 @@ -67,23 +63,24 @@ lsl r1,seq %对r1 的值逻辑左移 seq 次 and r1,ptrn %按位与 ``` -这段代码对你调用 `SetGpio` 很有用,它必须有一个非零值来关掉 LED,而一个0值会打开 LED。 +这段代码对你调用 `SetGpio` 很有用,它必须有一个非零值来关掉 LED,而一个 0 值会打开 LED。 -现在修改 `main.s` 中全部你的代码,这样代码中每次循环会根据当前的序列数设置 LED,等待 250000 毫秒(或者其他合适的延时),然后增加序列数。当这个序列数到达 32 就需要返回 0.看看你是否能实现这个功能,作为额外的挑战,也可以试着只使用一条指令。 +现在修改 `main.s` 中你的全部代码,这样代码中每次循环会根据当前的序列数设置 LED,等待 250000 毫秒(或者其他合适的延时),然后增加序列数。当这个序列数到达 32 就需要返回 0。看看你是否能实现这个功能,作为额外的挑战,也可以试着只使用一条指令。 -### 2 Time Flies When You're Having Fun... 当你玩得开心时,过得很快 +### 2、当你玩得开心时,时间过得很快 -你现在准备好在树莓派上实验。应该闪烁一串包含 3 个短脉冲,3 个长脉冲,然后 3 个更短脉冲的序列。在一次延时之后,这种模式应该重复。如果这部工作,请查看我们的问题页。 +你现在准备好在树莓派上实验。应该闪烁一串包含 3 个短脉冲,3 个长脉冲,然后 3 个短脉冲的序列。在一次延时之后,这种模式应该重复。如果这不工作,请查看我们的问题页。 -一旦它工作,祝贺你已经达到 OK 系列教程的结束。 +一旦它工作,祝贺你已经抵达 OK 系列教程的结束点。 -在这个谢列我们学习了汇编代码,GPIO 控制器和系统定时器。我们已经学习了函数和 ABI,以及几个基础的操作系统原理,和关于数据的知识。 +在这个系列我们学习了汇编代码,GPIO 控制器和系统定时器。我们已经学习了函数和 ABI,以及几个基础的操作系统原理,已经关于数据的知识。 + +你现在已经可以准备学习下面几个更高级的课程的某一个。 -你现在已经准备好下面几个更高级的课程的某一个。 * [Screen][2] 系列是接下来的,会教你如何通过汇编代码使用屏幕。 * [Input][3] 系列教授你如何使用键盘和鼠标。 -到现在,你已经有了足够的信息来制作操作系统,用其它方法和 GPIO 交互。如果你有任何机器人工具,你可能会想尝试编写一个通过 GPIO 管教控制的机器人操作系统。 +到现在,你已经有了足够的信息来制作操作系统,用其它方法和 GPIO 交互。如果你有任何机器人工具,你可能会想尝试编写一个通过 GPIO 管脚控制的机器人操作系统。 -------------------------------------------------------------------------------- @@ -92,12 +89,12 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html 作者:[Robert Mullins][a] 选题:[lujun9972][b] 译者:[ezio](https://github.com/oska874) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: http://www.cl.cam.ac.uk/~rdm34 [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html +[1]: https://linux.cn/article-10526-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html [3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html From 8c9ade8213cd1aaa1bd85fa6dc50a41ba8572b5e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 12:31:14 +0800 Subject: [PATCH 104/813] PUB:20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @oska874 https://linux.cn/article-10530-1.html --- ...20205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md (98%) diff --git a/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/published/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md similarity index 98% rename from translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md rename to published/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md index 2934ab5d42..48fe3eee37 100644 --- a/translated/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md +++ b/published/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (oska874) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10530-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 5 OK05) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From c6dbe31bf40b59590bdadd4ce3bb6a285f690a8f Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 12 Feb 2019 12:55:10 +0800 Subject: [PATCH 105/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=205=20St?= =?UTF-8?q?reaming=20Audio=20Players=20for=20Linux=20sources/tech/20190205?= =?UTF-8?q?=205=20Streaming=20Audio=20Players=20for=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...205 5 Streaming Audio Players for Linux.md | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 sources/tech/20190205 5 Streaming Audio Players for Linux.md diff --git a/sources/tech/20190205 5 Streaming Audio Players for Linux.md b/sources/tech/20190205 5 Streaming Audio Players for Linux.md new file mode 100644 index 0000000000..1ddd4552f5 --- /dev/null +++ b/sources/tech/20190205 5 Streaming Audio Players for Linux.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Streaming Audio Players for Linux) +[#]: via: (https://www.linux.com/blog/2019/2/5-streaming-audio-players-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +5 Streaming Audio Players for Linux +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/music-main.png?itok=bTxfvadR) + +As I work, throughout the day, music is always playing in the background. Most often, that music is in the form of vinyl spinning on a turntable. But when I’m not in purist mode, I’ll opt to listen to audio by way of a streaming app. Naturally, I’m on the Linux platform, so the only tools I have at my disposal are those that play well on my operating system of choice. Fortunately, plenty of options exist for those who want to stream audio to their Linux desktops. + +In fact, Linux offers a number of solid offerings for music streaming, and I’ll highlight five of my favorite tools for this task. A word of warning, not all of these players are open source. But if you’re okay running a proprietary app on your open source desktop, you have some really powerful options. Let’s take a look at what’s available. + +### Spotify + +Spotify for Linux isn’t some dumb-downed, half-baked app that crashes every other time you open it, and doesn’t offer the full-range of features found on the macOS and Windows equivalent. In fact, the Linux version of Spotify is exactly the same as you’ll find on other platforms. With the Spotify streaming client you can listen to music and podcasts, create playlists, discover new artists, and so much more. And the Spotify interface (Figure 1) is quite easy to navigate and use. + +![Spotify][2] + +Figure 1: The Spotify interface makes it easy to find new music and old favorites. + +[Used with permission][3] + +You can install Spotify either using snap (with the command sudo snap install spotify), or from the official repository, with the following commands: + + * sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90 + + * sudo echo deb stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list + + * sudo apt-get update + + * sudo apt-get install spotify-client + + + + +Once installed, you’ll want to log into your Spotify account, so you can start streaming all of the great music to help motivate you to get your work done. If you have Spotify installed on other devices (and logged into the same account), you can dictate to which device the music should stream (by clicking the Devices Available icon near the bottom right corner of the Spotify window). + +### Clementine + +Clementine one of the best music players available to the Linux platform. Clementine not only allows user to play locally stored music, but to connect to numerous streaming audio services, such as: + + * Amazon Cloud Drive + + * Box + + * Dropbox + + * Icecast + + * Jamendo + + * Magnatune + + * RockRadio.com + + * Radiotunes.com + + * SomaFM + + * SoundCloud + + * Spotify + + * Subsonic + + * Vk.com + + * Or internet radio streams + + + + +There are two caveats to using Clementine. The first is you must be using the most recent version (as the build available in some repositories is out of date and won’t install the necessary streaming plugins). Second, even with the most recent build, some streaming services won’t function as expected. For example, with Spotify, you’ll only have available to you the Top Tracks (and not your playlist … or the ability to search for songs). + +With Clementine Internet radio streaming, you’ll find musicians and bands you’ve never heard of (Figure 2), and plenty of them to tune into. + +![Clementine][5] + +Figure 2: Clementine Internet radio is a great way to find new music. + +[Used with permission][3] + +### Odio + +Odio is a cross-platform, proprietary app (available for Linux, MacOS, and Windows) that allows you to stream internet music stations of all genres. Radio stations are curated from [www.radio-browser.info][6] and the app itself does an incredible job of presenting the streams for you (Figure 3). + + +![Odio][8] + +Figure 3: The Odio interface is one of the best you’ll find. + +[Used with permission][3] + +Odio makes it very easy to find unique Internet radio stations and even add those you find and enjoy to your library. Currently, the only way to install Odio on Linux is via Snap. If your distribution supports snap packages, install this streaming app with the command: + +sudo snap install odio + +Once installed, you can open the app and start using it. There is no need to log into (or create) an account. Odio is very limited in its settings. In fact, it only offers the choice between a dark or light theme in the settings window. However, as limited as it might be, Odio is one of your best bets for playing Internet radio on Linux. + +Streamtuner2 is an outstanding Internet radio station GUI tool. With it you can stream music from the likes of: + + * Internet radio stations + + * Jameno + + * MyOggRadio + + * Shoutcast.com + + * SurfMusic + + * TuneIn + + * Xiph.org + + * YouTube + + +### StreamTuner2 + +Streamtuner2 offers a nice (if not slightly outdated) interface, that makes it quite easy to find and stream your favorite music. The one caveat with StreamTuner2 is that it’s really just a GUI for finding the streams you want to hear. When you find a station, double-click on it to open the app associated with the stream. That means you must have the necessary apps installed, in order for the streams to play. If you don’t have the proper apps, you can’t play the streams. Because of this, you’ll spend a good amount of time figuring out what apps to install for certain streams (Figure 4). + +![Streamtuner2][10] + +Figure 4: Configuring Streamtuner2 isn’t for the faint of heart. + +[Used with permission][3] + +### VLC + +VLC has been, for a very long time, dubbed the best media playback tool for Linux. That’s with good reason, as it can play just about anything you throw at it. Included in that list is streaming radio stations. Although you won’t find VLC connecting to the likes of Spotify, you can head over to Internet-Radio, click on a playlist and have VLC open it without a problem. And considering how many internet radio stations are available at the moment, you won’t have any problem finding music to suit your tastes. VLC also includes tools like visualizers, equalizers (Figure 5), and more. + +![VLC ][12] + +Figure 5: The VLC visualizer and equalizer features in action. + +[Used with permission][3] + +The only caveat to VLC is that you do have to have a URL for the Internet Radio you wish you hear, as the tool itself doesn’t curate. But with those links in hand, you won’t find a better media player than VLC. + +### Always More Where That Came From + +If one of these five tools doesn’t fit your needs, I suggest you open your distribution’s app store and search for one that will. There are plenty of tools to make streaming music, podcasts, and more not only possible on Linux, but easy. + +Learn more about Linux through the free ["Introduction to Linux" ][13] course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/2019/2/5-streaming-audio-players-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 +[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/spotify_0.jpg?itok=8-Ym-R61 (Spotify) +[3]: https://www.linux.com/licenses/category/used-permission +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/clementine_0.jpg?itok=5oODJO3b (Clementine) +[6]: http://www.radio-browser.info +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/odio.jpg?itok=sNPTSS3c (Odio) +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/streamtuner2.jpg?itok=1MSbafWj (Streamtuner2) +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/vlc_0.jpg?itok=QEOsq7Ii (VLC ) +[13]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From c54db1502c58637fa0bdf33fea71ef58bff60d64 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 12 Feb 2019 12:56:27 +0800 Subject: [PATCH 106/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20Introd?= =?UTF-8?q?ucing=20kids=20to=20computational=20thinking=20with=20Python=20?= =?UTF-8?q?sources/talk/20190211=20Introducing=20kids=20to=20computational?= =?UTF-8?q?=20thinking=20with=20Python.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s to computational thinking with Python.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/talk/20190211 Introducing kids to computational thinking with Python.md diff --git a/sources/talk/20190211 Introducing kids to computational thinking with Python.md b/sources/talk/20190211 Introducing kids to computational thinking with Python.md new file mode 100644 index 0000000000..542b2291e7 --- /dev/null +++ b/sources/talk/20190211 Introducing kids to computational thinking with Python.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing kids to computational thinking with Python) +[#]: via: (https://opensource.com/article/19/2/break-down-stereotypes-python) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Introducing kids to computational thinking with Python +====== +Coding program gives low-income students the skills, confidence, and knowledge to break free from economic and societal disadvantages. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa) + +When the [Parkman Branch][1] of the Detroit Public Library was flooded with bored children taking up all the computers during summer break, the library saw it not as a problem, rather an opportunity. They started a coding club, the [Parkman Coders][2], led by [Qumisha Goss][3], a librarian who is leveraging the power of Python to introduce disadvantaged children to computational thinking. + +When she started the Parkman Coders program about four years ago, "Q" (as she is known) didn't know much about coding. Since then, she's become a specialist in library instruction and technology and a certified Raspberry Pi instructor. + +The program began by using [Scratch][4], but the students got bored with the block coding interface, which they regarded as "baby stuff." She says, "I knew we need to make a change to something that was still beginner friendly, but that would be more challenging for them to continue to hold their attention." At this point, she started teaching them Python. + +Q first saw Python while playing a game with dungeons and skeleton monsters on [Code.org][5]. She began to learn Python by reading books like [Python Programming: An Introduction to Computer Science][6] and [Python for Kids][7]. She also recommends [Automate the Boring Stuff with Python][8] and [Lauren Ipsum: A Story about Computer Science and Other Improbable Things][9]. + +### Setting up a Raspberry Pi makerspace + +Q decided to use [Raspberry Pi][10] computers to avoid the possibility that the students might be able to hack into the library system's computers, which weren't arranged in a way conducive to a makerspace anyway. The Pi's affordability, plus its flexibility and the included free software, lent more credibility to her decision. + +While the coder program was the library's effort keep the peace and create a learning space that would engage the children, it quickly grew so popular that it ran out of space, computers, and adequate electrical outlets in a building built in 1921. They started with 10 Raspberry Pi computers shared among 20 children, but the library obtained funding from individuals, companies including Microsoft, the 4H, and the Detroit Public Library Foundation to get more equipment and expand the program. + +Currently, about 40 children participate in each session and they have enough Raspberry Pi's for one device per child and some to give away. Many of the Parkman Coders come from low socio-economic backgrounds and don't have a computer at home, so the library provides them with donated Chromebooks. + +Q says, "when kids demonstrate that they have a good understanding of how to use a Raspberry Pi or a [Microbit][11] and have been coming to programs regularly, we give them equipment to take home with them. This process is very challenging, however, because [they may not] have internet access at home [or] all the peripheral things they need like monitors, keyboards, and mice." + +### Learning life skills and breaking stereotypes with Python + +Q says, "I believe that the mainstays of learning computer science are learning critical thinking and problem-solving skills. My hope is that these lessons will stay with the kids as they grow and pursue futures in whatever field they choose. In addition, I'm hoping to inspire some pride in creatorship. It's a very powerful feeling to know 'I made this thing,' and once they've had these successes early, I hope they will approach new challenges with zeal." + +She also says, "in learning to program, you have to learn to be hyper-vigilant about spelling and capitalization, and for some of our kids, reading is an issue. To make sure that the program is inclusive, we spell aloud during our lessons, and we encourage kids to speak up if they don't know a word or can't spell it correctly." + +Q also tries to give extra attention to children who need it. She says, "if I recognize that someone has a more severe problem, we try to get them paired with a tutor at our library outside of program time, but still allow them to come to the program. We want to help them without discouraging them from participating." + +Most importantly, the Parkman Coders program seeks to help every child realize that each has a unique skill set and abilities. Most of the children are African-American and half are girls. Q says, "we live in a world where we grow up with societal stigmas that frequently limit our own belief of what we can accomplish." She believes that children need a nonjudgmental space where "they can try new things, mess up, and discover." + +The environment Q and the Parkman Coders program creates helps the participants break away from economic and societal disadvantages. She says that the secret sauce is to "make sure you have a welcoming space so anyone can come and that your space is forgiving and understanding. Let people come as they are, and be prepared to teach and to learn; when people feel comfortable and engaged, they want to stay." + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/break-down-stereotypes-python + +作者:[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://detroitpubliclibrary.org/locations/parkman +[2]: https://www.dplfound.org/single-post/2016/05/15/Parkman-Branch-Coders +[3]: https://www.linkedin.com/in/qumisha-goss-b3bb5470 +[4]: https://scratch.mit.edu/ +[5]: http://Code.org +[6]: https://www.amazon.com/Python-Programming-Introduction-Computer-Science/dp/1887902996 +[7]: https://nostarch.com/pythonforkids +[8]: https://automatetheboringstuff.com/ +[9]: https://nostarch.com/laurenipsum +[10]: https://www.raspberrypi.org/ +[11]: https://microbit.org/guide/ From 308b77cd3c79216e4a07242130db00620a228542 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 12 Feb 2019 12:57:56 +0800 Subject: [PATCH 107/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20How=20?= =?UTF-8?q?To=20Remove/Delete=20The=20Empty=20Lines=20In=20A=20File=20In?= =?UTF-8?q?=20Linux=20sources/tech/20190211=20How=20To=20Remove-Delete=20T?= =?UTF-8?q?he=20Empty=20Lines=20In=20A=20File=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lete The Empty Lines In A File In Linux.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md diff --git a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md new file mode 100644 index 0000000000..a7b2c06a16 --- /dev/null +++ b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) +[#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Remove/Delete The Empty Lines In A File In Linux +====== + +Some times you may wants to remove or delete the empty lines in a file in Linux. + +If so, you can use the one of the below method to achieve it. + +It can be done in many ways but i have listed simple methods in the article. + +You may aware of that grep, awk and sed commands are specialized for textual data manipulation. + +Navigate to the following URL, if you would like to read more about these kind of topics. For **[creating a file in specific size in Linux][1]** multiple ways, for **[creating a file in Linux][2]** multiple ways and for **[removing a matching string from a file in Linux][3]**. + +These are fall in advanced commands category because these are used in most of the shell script to do required things. + +It can be done using the following 5 methods. + + * **`sed Command:`** Stream editor for filtering and transforming text. + * **`grep Command:`** Print lines that match patterns. + * **`cat Command:`** It concatenate files and print on the standard output. + * **`tr Command:`** Translate or delete characters. + * **`awk Command:`** The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. + * **`perl Command:`** Perl is a programming language specially designed for text editing. + + + +To test this, i had already created the file called `2daygeek.txt` with some texts and empty lines. The details are below. + +``` +$ cat 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. + +It's FIVE years old blog. + +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. + +He got two GIRL babys. + +Her names are Tanisha & Renusha. +``` + +Now everything is ready and i’m going to test this in multiple ways. + +### How To Remove/Delete The Empty Lines In A File In Linux Using sed Command? + +Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). + +``` +$ sed '/^$/d' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +Details are follow: + + * **`sed:`** It’s a command + * **`//:`** It holds the searching string. + * **`^:`** Matches start of string. + * **`$:`** Matches end of string. + * **`d:`** Delete the matched string. + * **`2daygeek.txt:`** Source file name. + + + +### How To Remove/Delete The Empty Lines In A File In Linux Using grep Command? + +grep searches for PATTERNS in each FILE. PATTERNS is one or patterns separated by newline characters, and grep prints each line that matches a pattern. + +``` +$ grep . 2daygeek.txt +or +$ grep -Ev "^$" 2daygeek.txt +or +$ grep -v -e '^$' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +Details are follow: + + * **`grep:`** It’s a command + * **`.:`** Replaces any character. + * **`^:`** matches start of string. + * **`$:`** matches end of string. + * **`E:`** For extended regular expressions pattern matching. + * **`e:`** For regular expressions pattern matching. + * **`v:`** To select non-matching lines from the file. + * **`2daygeek.txt:`** Source file name. + + + +### How To Remove/Delete The Empty Lines In A File In Linux Using awk Command? + +The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. An awk program is a sequence of patterns and corresponding actions. + +``` +$ awk NF 2daygeek.txt +or +$ awk '!/^$/' 2daygeek.txt +or +$ awk '/./' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +Details are follow: + + * **`awk:`** It’s a command + * **`//:`** It holds the searching string. + * **`^:`** matches start of string. + * **`$:`** matches end of string. + * **`.:`** Replaces any character. + * **`!:`** Delete the matched string. + * **`2daygeek.txt:`** Source file name. + + + +### How To Delete The Empty Lines In A File In Linux using Combination of cat And tr Command? + +cat stands for concatenate. It is very frequently used in Linux to reads data from a file. + +cat is one of the most frequently used commands on Unix-like operating systems. It’s offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file. + +Translate, squeeze, and/or delete characters from standard input, writing to standard output. + +``` +$ cat 2daygeek.txt | tr -s '\n' +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +Details are follow: + + * **`cat:`** It’s a command + * **`tr:`** It’s a command + * **`|:`** Pipe symbol. It pass first command output as a input to another command. + * **`s:`** Replace each sequence of a repeated character that is listed in the last specified SET. + * **`\n:`** To add a new line. + * **`2daygeek.txt:`** Source file name. + + + +### How To Remove/Delete The Empty Lines In A File In Linux Using perl Command? + +Perl stands in for “Practical Extraction and Reporting Language”. Perl is a programming language specially designed for text editing. It is now widely used for a variety of purposes including Linux system administration, network programming, web development, etc. + +``` +$ perl -ne 'print if /\S/' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-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/create-a-file-in-specific-certain-size-linux/ +[2]: https://www.2daygeek.com/linux-command-to-create-a-file/ +[3]: https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/ From b6009578a95655bf3bfb99d9f7ecc2619da38360 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 12 Feb 2019 13:00:02 +0800 Subject: [PATCH 108/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20How=20?= =?UTF-8?q?does=20rootless=20Podman=20work=3F=20sources/tech/20190211=20Ho?= =?UTF-8?q?w=20does=20rootless=20Podman=20work.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190211 How does rootless Podman work.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20190211 How does rootless Podman work.md diff --git a/sources/tech/20190211 How does rootless Podman work.md b/sources/tech/20190211 How does rootless Podman work.md new file mode 100644 index 0000000000..a085ae9014 --- /dev/null +++ b/sources/tech/20190211 How does rootless Podman work.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How does rootless Podman work?) +[#]: via: (https://opensource.com/article/19/2/how-does-rootless-podman-work) +[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) + +How does rootless Podman work? +====== +Learn how Podman takes advantage of user namespaces to run in rootless mode. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82) + +In my [previous article][1] on user namespace and [Podman][2], I discussed how you can use Podman commands to launch different containers with different user namespaces giving you better separation between containers. Podman also takes advantage of user namespaces to be able to run in rootless mode. Basically, when a non-privileged user runs Podman, the tool sets up and joins a user namespace. After Podman becomes root inside of the user namespace, Podman is allowed to mount certain filesystems and set up the container. Note there is no privilege escalation here other then additional UIDs available to the user, explained below. + +### How does Podman create the user namespace? + +#### shadow-utils + +Most current Linux distributions include a version of shadow-utils that uses the **/etc/subuid** and **/etc/subgid** files to determine what UIDs and GIDs are available for a user in a user namespace. + +``` +$ cat /etc/subuid +dwalsh:100000:65536 +test:165536:65536 +$ cat /etc/subgid +dwalsh:100000:65536 +test:165536:65536 +``` + +The useradd program automatically allocates 65536 UIDs for each user added to the system. If you have existing users on a system, you would need to allocate the UIDs yourself. The format of these files is **username:STARTUID:TOTALUIDS**. Meaning in my case, dwalsh is allocated UIDs 100000 through 165535 along with my default UID, which happens to be 3265 defined in /etc/passwd. You need to be careful when allocating these UID ranges that they don't overlap with any **real** UID on the system. If you had a user listed as UID 100001, now I (dwalsh) would be able to become this UID and potentially read/write/execute files owned by the UID. + +Shadow-utils also adds two setuid programs (or setfilecap). On Fedora I have: + +``` +$ getcap /usr/bin/newuidmap +/usr/bin/newuidmap = cap_setuid+ep +$ getcap /usr/bin/newgidmap +/usr/bin/newgidmap = cap_setgid+ep +``` + +Podman executes these files to set up the user namespace. You can see the mappings by examining /proc/self/uid_map and /proc/self/gid_map from inside of the rootless container. + +``` +$ podman run alpine cat /proc/self/uid_map /proc/self/gid_map +        0       3267            1 +        1       100000          65536 +        0       3267            1 +        1       100000          65536 +``` + +As seen above, Podman defaults to mapping root in the container to your current UID (3267) and then maps ranges of allocated UIDs/GIDs in /etc/subuid and /etc/subgid starting at 1. Meaning in my example, UID=1 in the container is UID 100000, UID=2 is UID 100001, all the way up to 65536, which is 165535. + +Any item from outside of the user namespace that is owned by a UID or GID that is not mapped into the user namespace appears to belong to the user configured in the **kernel.overflowuid** sysctl, which by default is 35534, which my /etc/passwd file says has the name **nobody**. Since your process can't run as an ID that isn't mapped, the owner and group permissions don't apply, so you can only access these files based on their "other" permissions. This includes all files owned by **real** root on the system running the container, since root is not mapped into the user namespace. + +The [Buildah][3] command has a cool feature, [**buildah unshare**][4]. This puts you in the same user namespace that Podman runs in, but without entering the container's filesystem, so you can list the contents of your home directory. + +``` +$ ls -ild /home/dwalsh +8193 drwx--x--x. 290 dwalsh dwalsh 20480 Jan 29 07:58 /home/dwalsh +$ buildah unshare ls -ld /home/dwalsh +drwx--x--x. 290 root root 20480 Jan 29 07:58 /home/dwalsh +``` + +Notice that when listing the home dir attributes outside the user namespace, the kernel reports the ownership as dwalsh, while inside the user namespace it reports the directory as owned by root. This is because the home directory is owned by 3267, and inside the user namespace we are treating that UID as root. + +### What happens next in Podman after the user namespace is set up? + +Podman uses [containers/storage][5] to pull the container image, and containers/storage is smart enough to map all files owned by root in the image to the root of the user namespace, and any other files owned by different UIDs to their user namespace UIDs. By default, this content gets written to ~/.local/share/containers/storage. Container storage works in rootless mode with either the vfs mode or with Overlay. Note: Overlay is supported only if the [fuse-overlayfs][6] executable is installed. + +The kernel only allows user namespace root to mount certain types of filesystems; at this time it allows mounting of procfs, sysfs, tmpfs, fusefs, and bind mounts (as long as the source and destination are owned by the user running Podman. OverlayFS is not supported yet, although the kernel teams are working on allowing it). + +Podman then mounts the container's storage if it is using fuse-overlayfs; if the storage driver is using vfs, then no mounting is required. Podman on vfs requires a lot of space though, since each container copies the entire underlying filesystem. + +Podman then mounts /proc and /sys along with a few tmpfs and creates the devices in the container. + +In order to use networking other than the host networking, Podman uses the [slirp4netns][7] program to set up **User mode networking for unprivileged network namespace**. Slirp4netns allows Podman to expose ports within the container to the host. Note that the kernel still will not allow a non-privileged process to bind to ports less than 1024. Podman-1.1 or later is required for binding to ports. + +Rootless Podman can use user namespace for container separation, but you only have access to the UIDs defined in the /etc/subuid file. + +### Conclusion + +The Podman tool is enabling people to build and use containers without sacrificing the security of the system; you can give your developers the access they need without giving them root. + +And when you put your containers into production, you can take advantage of the extra security provided by the user namespace to keep the workloads isolated from each other. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/how-does-rootless-podman-work + +作者:[Daniel J Walsh][a] +选题:[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/rhatdan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/podman-and-user-namespaces +[2]: https://podman.io/ +[3]: https://buildah.io/ +[4]: https://github.com/containers/buildah/blob/master/docs/buildah-unshare.md +[5]: https://github.com/containers/storage +[6]: https://github.com/containers/fuse-overlayfs +[7]: https://github.com/rootless-containers/slirp4netns From 4ff9e5cc65793ae52fc1c17573f139a054550a18 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 12 Feb 2019 13:03:36 +0800 Subject: [PATCH 109/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190211=20What's?= =?UTF-8?q?=20the=20right=20amount=20of=20swap=20space=20for=20a=20modern?= =?UTF-8?q?=20Linux=20system=3F=20sources/tech/20190211=20What-s=20the=20r?= =?UTF-8?q?ight=20amount=20of=20swap=20space=20for=20a=20modern=20Linux=20?= =?UTF-8?q?system.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...of swap space for a modern Linux system.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20190211 What-s the right amount of swap space for a modern Linux system.md diff --git a/sources/tech/20190211 What-s the right amount of swap space for a modern Linux system.md b/sources/tech/20190211 What-s the right amount of swap space for a modern Linux system.md new file mode 100644 index 0000000000..c04d47e5ca --- /dev/null +++ b/sources/tech/20190211 What-s the right amount of swap space for a modern Linux system.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's the right amount of swap space for a modern Linux system?) +[#]: via: (https://opensource.com/article/19/2/swap-space-poll) +[#]: author: (David Both https://opensource.com/users/dboth) + +What's the right amount of swap space for a modern Linux system? +====== +Complete our survey and voice your opinion on how much swap space to allocate. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0) + +Swap space is one of those things that everyone seems to have an idea about, and I am no exception. All my sysadmin friends have their opinions, and most distributions make recommendations too. + +Many years ago, the rule of thumb for the amount of swap space that should be allocated was 2X the amount of RAM installed in the computer. Of course that was when a typical computer's RAM was measured in KB or MB. So if a computer had 64KB of RAM, a swap partition of 128KB would be an optimum size. + +This took into account the fact that RAM memory sizes were typically quite small, and allocating more than 2X RAM for swap space did not improve performance. With more than twice RAM for swap, most systems spent more time thrashing than performing useful work. + +RAM memory has become quite inexpensive and many computers now have RAM in the tens of gigabytes. Most of my newer computers have at least 4GB or 8GB of RAM, two have 32GB, and my main workstation has 64GB. When dealing with computers with huge amounts of RAM, the limiting performance factor for swap space is far lower than the 2X multiplier. As a consequence, recommended swap space is considered a function of system memory workload, not system memory. + +Table 1 provides the Fedora Project's recommended size for a swap partition, depending on the amount of RAM in your system and whether you want enough memory for your system to hibernate. To allow for hibernation, you need to edit the swap space in the custom partitioning stage. The "recommended" swap partition size is established automatically during a default installation, but I usually find it's either too large or too small for my needs. + +The [Fedora 28 Installation Guide][1] defines current thinking about swap space allocation. Note that other versions of Fedora and other Linux distributions may differ slightly, but this is the same table Red Hat Enterprise Linux uses for its recommendations. These recommendations have not changed since Fedora 19. + +| Amount of RAM installed in system | Recommended swap space | Recommended swap space with hibernation | +| --------------------------------- | ---------------------- | --------------------------------------- | +| ≤ 2GB | 2X RAM | 3X RAM | +| 2GB – 8GB | = RAM | 2X RAM | +| 8GB – 64GB | 4G to 0.5X RAM | 1.5X RAM | +| >64GB | Minimum 4GB | Hibernation not recommended | + +Table 1: Recommended system swap space in Fedora 28's documentation. + +Table 2 contains my recommendations based on my experiences in multiple environments over the years. +| Amount of RAM installed in system | Recommended swap space | +| --------------------------------- | ---------------------- | +| ≤ 2GB | 2X RAM | +| 2GB – 8GB | = RAM | +| > 8GB | 8GB | + +Table 2: My recommended system swap space. + +It's possible that neither of these tables will work for your environment, but they will give you a place to start. The main consideration is that as the amount of RAM increases, adding more swap space simply leads to thrashing well before the swap space comes close to being filled. If you have too little virtual memory, you should add more RAM, if possible, rather than more swap space. + +In order to test the Fedora (and RHEL) swap space recommendations, I used its recommendation of **0.5*RAM** on my two largest systems (the ones with 32GB and 64GB of RAM). Even when running four or five VMs, multiple documents in LibreOffice, Thunderbird, the Chrome web browser, several terminal emulator sessions, the Xfe file manager, and a number of other background applications, the only time I see any use of swap is during backups I have scheduled for every morning at about 2am. Even then, swap usage is no more than 16MB—yes megabytes. These results are for my system with my loads and do not necessarily apply to your real-world environment. + +I recently had a conversation about swap space with some of the other Community Moderators here at [Opensource.com][2], and Chris Short, one of my friends in that illustrious and talented group, pointed me to an old [article][3] where he recommended using 1GB for swap space. This article was written in 2003, and he told me later that he now recommends zero swap space. + +So, we wondered, what you think? What do you recommend or use on your systems for swap space? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/swap-space-poll + +作者:[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://docs.fedoraproject.org/en-US/fedora/f28/install-guide/ +[2]: http://Opensource.com +[3]: https://chrisshort.net/moving-to-linux-partitioning/ From 2802f7e4b306aa2d755c06fec18f1407ebecdebe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 20:06:22 +0800 Subject: [PATCH 110/813] PRF:20190128 Using more to view text files at the Linux command line.md @dianbanjiu --- ...ew text files at the Linux command line.md | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/translated/tech/20190128 Using more to view text files at the Linux command line.md b/translated/tech/20190128 Using more to view text files at the Linux command line.md index f10ac248fc..35367e7fd5 100644 --- a/translated/tech/20190128 Using more to view text files at the Linux command line.md +++ b/translated/tech/20190128 Using more to view text files at the Linux command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using more to view text files at the Linux command line) @@ -9,15 +9,16 @@ 在 Linux 命令行使用 more 查看文本文件 ====== -文本文件和 Linux 一直是携手并进的。或者说看起来如此。那你又是依靠哪些让你使用起来很舒服的工具来查看这些文本文件的呢? + +> 文本文件和 Linux 一直是携手并进的。或者说看起来如此。那你又是依靠哪些让你使用起来很舒服的工具来查看这些文本文件的呢? ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE) -Linux 下有很多实用工具可以让你在终端界面查看文本文件。其中一个就是 [**more**][1]。 +Linux 下有很多实用工具可以让你在终端界面查看文本文件。其中一个就是 [more][1]。 -**more** 跟我之前另一篇文章里写到的工具 —— **[less][2]** 很相似。它们之间的主要不同点在于 **more** 只允许你向前查看文件。 +`more` 跟我之前另一篇文章里写到的工具 —— [less][2] 很相似。它们之间的主要不同点在于 `more` 只允许你向前查看文件。 -尽管它能提供的功能看起来很有限,不过它依旧有很多有用的特性值得你去了解。下面让我们来快速浏览一下 **more** 可以做什么,以及如何使用它吧。 +尽管它能提供的功能看起来很有限,不过它依旧有很多有用的特性值得你去了解。下面让我们来快速浏览一下 `more` 可以做什么,以及如何使用它吧。 ### 基础使用 @@ -35,9 +36,9 @@ $ more jekyll-article.md ![](https://opensource.com/sites/default/files/uploads/more-viewing-file.png) -使用空格键可以向下翻页,输入 **q** 可以退出。 +使用空格键可以向下翻页,输入 `q` 可以退出。 -如果你想在这个文件中搜索一些文本,输入 **/** 字符并在其后加上你想要查找的文字。例如你要查看的字段是 terminal,只需输入: +如果你想在这个文件中搜索一些文本,输入 `/` 字符并在其后加上你想要查找的文字。例如你要查看的字段是 “terminal”,只需输入: ``` /terminal @@ -45,12 +46,13 @@ $ more jekyll-article.md ![](https://opensource.com/sites/default/files/uploads/more-searching.png) -搜索的内容是区分大小写的,所以输入 /terminal 跟 /Terminal 会出现不同的结果。 +搜索的内容是区分大小写的,所以输入 `/terminal` 跟 `/Terminal` 会出现不同的结果。 ### 和其他实用工具组合使用 -你可以通过管道将其他命令行工具得到的文本传输到 **more**。你问为什么这样做?因为有时这些工具获取的文本会超过终端一页可以显示的限度。 -想要做到这个,先输入你想要使用的完整命令,后面跟上管道符(**|**),管道符后跟 **more**。假设现在有一个有很多文件的目录。你就可以组合 **more** 跟 **ls** 命令完整查看这个目录当中的内容。 +你可以通过管道将其他命令行工具得到的文本传输到 `more`。你问为什么这样做?因为有时这些工具获取的文本会超过终端一页可以显示的限度。 + +想要做到这个,先输入你想要使用的完整命令,后面跟上管道符(`|`),管道符后跟 `more`。假设现在有一个有很多文件的目录。你就可以组合 `more` 跟 `ls` 命令完整查看这个目录当中的内容。 ```shell $ ls | more @@ -58,7 +60,7 @@ $ ls | more ![](https://opensource.com/sites/default/files/uploads/more-with_ls_cmd.png) -你可以组合 **more** 和 **grep** 命令,从而实现在多个文件中找到指定的文本。下面是我在多篇文章的源文件中查找 productivity 的例子。 +你可以组合 `more` 和 `grep` 命令,从而实现在多个文件中找到指定的文本。下面是我在多篇文章的源文件中查找 “productivity” 的例子。 ```shell $ grep ‘productivity’ core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md | more @@ -66,17 +68,17 @@ $ grep ‘productivity’ core.md Dict.md lctt2014.md lctt2016.md lctt2018.md RE ![](https://opensource.com/sites/default/files/uploads/more-with_grep_cmd.png) -另外一个可以和 **more** 组合的实用工具是 **ps**(列出你系统上正在运行的进程)。当你的系统上运行了很多的进程,你现在想要查看他们的时候,这个组合将会派上用场。例如你想找到一个你需要杀死的进程,只需输入下面的命令: +另外一个可以和 `more` 组合的实用工具是 `ps`(列出你系统上正在运行的进程)。当你的系统上运行了很多的进程,你现在想要查看他们的时候,这个组合将会派上用场。例如你想找到一个你需要杀死的进程,只需输入下面的命令: ```shell $ ps -u scott | more ``` -注意用你的用户名替换掉 scott。 +注意用你的用户名替换掉 “scott”。 ![](https://opensource.com/sites/default/files/uploads/more-with_ps_cmd.png) -就像我文章开篇提到的, **more** 很容易使用。尽管不如它的双胞胎兄弟 **less** 那般灵活,但是仍然值得了解一下。 +就像我文章开篇提到的, `more` 很容易使用。尽管不如它的双胞胎兄弟 `less` 那般灵活,但是仍然值得了解一下。 -------------------------------------------------------------------------------- @@ -85,7 +87,7 @@ via: https://opensource.com/article/19/1/more-text-files-linux 作者:[Scott Nesbitt][a] 选题:[lujun9972][b] 译者:[dianbanjiu](https://github.com/dianbanjiu) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6545cf5f274a7cae2ed9296b19a8943ac66e8c34 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 20:07:23 +0800 Subject: [PATCH 111/813] PUB:20190128 Using more to view text files at the Linux command line.md @dianbanjiu https://linux.cn/article-10531-1.html --- ...Using more to view text files at the Linux command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190128 Using more to view text files at the Linux command line.md (98%) diff --git a/translated/tech/20190128 Using more to view text files at the Linux command line.md b/published/20190128 Using more to view text files at the Linux command line.md similarity index 98% rename from translated/tech/20190128 Using more to view text files at the Linux command line.md rename to published/20190128 Using more to view text files at the Linux command line.md index 35367e7fd5..9929654a94 100644 --- a/translated/tech/20190128 Using more to view text files at the Linux command line.md +++ b/published/20190128 Using more to view text files at the Linux command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10531-1.html) [#]: subject: (Using more to view text files at the Linux command line) [#]: via: (https://opensource.com/article/19/1/more-text-files-linux) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) From 207a636391b743c5bc9f641c74c5ccc46266c920 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Tue, 12 Feb 2019 21:22:01 +0800 Subject: [PATCH 112/813] Update 20190110 Toyota Motors and its Linux Journey.md --- ...110 Toyota Motors and its Linux Journey.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sources/talk/20190110 Toyota Motors and its Linux Journey.md b/sources/talk/20190110 Toyota Motors and its Linux Journey.md index ef3afd38a0..e3d4f582a8 100644 --- a/sources/talk/20190110 Toyota Motors and its Linux Journey.md +++ b/sources/talk/20190110 Toyota Motors and its Linux Journey.md @@ -10,39 +10,39 @@ 丰田汽车的Linux之旅 ====== -I spoke with Brian R Lyons of TMNA Toyota Motor Corp North America about the implementation of Linux in Toyota and Lexus infotainment systems. I came to find out there is an Automotive Grade Linux (AGL) being used by several autmobile manufacturers. -我之前跟丰田汽车北美分公司的Brian.R.Lyons聊过天,话题是关于Linux在丰田和雷克萨斯汽车的信息娱乐系统上的实施方案。我发现一些汽车制造商使用了Automotive Grade Linux (AGL)。 +**这篇文章来自 It's FOSS 的读者 Malcolm Dean的投递。** -I put together a short article comprising of my discussion with Brian about Toyota and its tryst with Linux. I hope that Linux enthusiasts will like this quick little chat. +我之前跟丰田汽车北美分公司的 Brian.R.Lyons(丰田发言人)聊了聊,话题是关于Linux在丰田和雷克萨斯汽车的信息娱乐系统上的实施方案。我了解到一些汽车制造商使用了 Automotive Grade Linux (AGL)。 -All [Toyota vehicles and Lexus vehicles are going to use Automotive Grade Linux][1] (AGL) majorly for the infotainment system. This is instrumental in Toyota Motor Corp because as per Mr. Lyons “As a technology leader, Toyota realized that adopting open source development methodology is the best way to keep up with the rapid pace of new technologies”. +然后我写了一篇短文,记录了我和 Brian 的讨论内容,就是丰田和 Linux 的一些渊源。希望 Linux 的狂热粉丝们能够喜欢这次对话。 -Toyota among other automotive companies thought, going with a Linux based operating system might be cheaper and quicker when it comes to updates, and upgrades compared to using proprietary software. +全部[丰田和雷克萨斯汽车都将会使用 Automotive Grade Linux][1] (AGL),主要是用于车载信息娱乐系统。这项措施对于丰田集团来说是至关重要的,因为据 Lyons 先生所说:“作为技术的引领者之一,丰田认识到,赶上科技快速进步最好的方法就是拥抱开源理念”。 -Wow! Finally Linux in a vehicle. I use Linux every day on my desktop; what a great way to expand the use of this awesome software to a completely different industry. +丰田和众多汽车制造公司都认为,与使用非自由软件相比,采用基于 Linux 的操作系统在更新和升级方面会更加廉价和快捷。 -I was curious when Toyota decided to use the [Automotive Grade Linux][2] (AGL). According to Mr. Lyons, it goes back to 2011. +这简直太棒了! Linux 终于跟汽车结合起来了。我每天都在电脑上使用 Linux;能看到这个优秀的软件在一个完全不同的产业领域里大展拳脚真是太好了。 -> “Toyota has been an active member and contributor to AGL since its launch more than five years ago, collaborating with other OEMs, Tier 1s and suppliers to develop a robust, Linux-based platform with increased security and capabilities” +我很好奇丰田是什么时候开始使用 [Automotive Grade Linux][2](AGL) 的。按照 Lyons 先生的说法,这要追溯到 2011 年。 -![Toyota Infotainment][3] +>“自 AGL 项目在五年前启动之始,作为活跃的会员和贡献者,丰田与其他顶级制造商和供应商展开合作,着手开发一个基于 Linux 的强大平台,并不断地增强其功能和安全性。” -In 2011, [Toyota joined the Linux Foundation][4] and started discussions about IVI (In-Vehicle Infotainment) software with other car OEMs and software companies. As a result, in 2012, Automotive Grade Linux working group was formed in the Linux Foundation. +![丰田信息娱乐系统][3] -What Toyota did at first in AGL group was to take “code first” approach as normal as in the open source domains, and then start the conversation about the initial direction by specifying requirement specifications which had been discussed among car OEMs, IVI Tier-1 companies, software companies, and so on. +[丰田于2011年加入了 Linux 基金会][4],与其他汽车制造商和软件公司就 IVI(车内信息娱乐系统)展开讨论,最终在 2012 年,Linux 基金会内部成立了 Automotive Grade Linux 工作组。 -Toyota had already realized that sharing the software code among Tier1 companies was going to essential at the time when it joined the Linux Foundation. This was because the cost of maintaining such a huge software was very costly and was no longer differentiation by Tier1 companies. Toyota and its Tier1 supplier companies wanted to spend more resources n new functions and new user experiences rather than maintaining conventional code all by themselves. +丰田在 AGL 工作组里首先提出了“代码优先”的策略,这在开源领域是很常见的做法。然后丰田和其他汽车制造商、IVI 一线厂家,软件公司等各方展开对话,根据各方的技术需求详细制定了初始方向。 -This is a huge thing as automotive companies have gone in together to further their cooperation. Many companies have adopted this after finding proprietary software to be expensive. +在加入 Linux 基金会的时候,丰田就已经意识到,在一线公司之间共享软件代码将会是至关重要的。因为要维护如此复杂的软件系统,对于任何一家顶级厂商都是一笔不小的开销。丰田和它的一级供货商想把更多的资源用在开发新功能和新的用户体验上,而不是用在维护各自的代码上。 -Today, AGL is used for all Toyota and Lexus vehicles and is used in all markets where vehicles are sold. +各个汽车公司联合起来深入合作是一件大事。许多公司都达成了这样的共识,因为他们都发现开发维护私有软件其实更费钱。 -As someone who has sold cars for Lexus, I think this is a huge step forward. I and other sales associates had many customers who would come back to speak with a technology specialist to learn about the full capabilities of their infotainment system. +今天,在全球市场上,丰田和雷克萨斯的全部车型都使用了 AGL。 -I see this as a huge step forward for the Linux community, and users. The operating system we use on a daily basis is being put to use right in front of us albeit in a modified form but is there none-the-less. +身为雷克萨斯的销售人员,我认为这是一大进步。我和其他销售顾问都曾接待过很多回来找技术专员的客户,他们想更多的了解自己车上的信息娱乐系统到底都能做些什么。 -Where does this lead? Hopefully a better user-friendly and less glitchy experience for consumers. +这件事本身对于 Linux 社区和用户是个重大利好。虽然那个我们每天都在使用的操作系统变了模样,被推到了更广阔的舞台上,但它仍然是那个 Linux,简单、包容而强大。 +未来将会如何发展呢?我希望它能少出差错,为消费者带来更佳的用户体验。 -------------------------------------------------------------------------------- @@ -50,7 +50,7 @@ via: https://itsfoss.com/toyota-motors-linux-journey 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/jdh8383) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f22e7c930866a1afe22e18efc4f029d396cc5df6 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Tue, 12 Feb 2019 21:37:22 +0800 Subject: [PATCH 113/813] Update 20190110 Toyota Motors and its Linux Journey.md --- sources/talk/20190110 Toyota Motors and its Linux Journey.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20190110 Toyota Motors and its Linux Journey.md b/sources/talk/20190110 Toyota Motors and its Linux Journey.md index e3d4f582a8..b4ae8074a3 100644 --- a/sources/talk/20190110 Toyota Motors and its Linux Journey.md +++ b/sources/talk/20190110 Toyota Motors and its Linux Journey.md @@ -22,7 +22,7 @@ 这简直太棒了! Linux 终于跟汽车结合起来了。我每天都在电脑上使用 Linux;能看到这个优秀的软件在一个完全不同的产业领域里大展拳脚真是太好了。 -我很好奇丰田是什么时候开始使用 [Automotive Grade Linux][2](AGL) 的。按照 Lyons 先生的说法,这要追溯到 2011 年。 +我很好奇丰田是什么时候开始使用 [Automotive Grade Linux][2] (AGL) 的。按照 Lyons 先生的说法,这要追溯到 2011 年。 >“自 AGL 项目在五年前启动之始,作为活跃的会员和贡献者,丰田与其他顶级制造商和供应商展开合作,着手开发一个基于 Linux 的强大平台,并不断地增强其功能和安全性。” @@ -50,7 +50,7 @@ via: https://itsfoss.com/toyota-motors-linux-journey 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/jdh8383) +译者:[jdh8383](https://github.com/jdh8383) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3185e6626008b0375900445666147e7bb92f3592 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Tue, 12 Feb 2019 21:40:46 +0800 Subject: [PATCH 114/813] Rename sources/talk/20190110 Toyota Motors and its Linux Journey.md to translated/talk/20190110 Toyota Motors and its Linux Journey.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成,提交 --- .../talk/20190110 Toyota Motors and its Linux Journey.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20190110 Toyota Motors and its Linux Journey.md (100%) diff --git a/sources/talk/20190110 Toyota Motors and its Linux Journey.md b/translated/talk/20190110 Toyota Motors and its Linux Journey.md similarity index 100% rename from sources/talk/20190110 Toyota Motors and its Linux Journey.md rename to translated/talk/20190110 Toyota Motors and its Linux Journey.md From f6c5040d95c6114f60f60d4358f64cb5e2569846 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 22:59:35 +0800 Subject: [PATCH 115/813] PRF:20190125 PyGame Zero- Games without boilerplate.md @bestony --- ... PyGame Zero- Games without boilerplate.md | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/translated/tech/20190125 PyGame Zero- Games without boilerplate.md b/translated/tech/20190125 PyGame Zero- Games without boilerplate.md index 417e7ade02..dab7873d5c 100644 --- a/translated/tech/20190125 PyGame Zero- Games without boilerplate.md +++ b/translated/tech/20190125 PyGame Zero- Games without boilerplate.md @@ -1,26 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (bestony) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (PyGame Zero: Games without boilerplate) [#]: via: (https://opensource.com/article/19/1/pygame-zero) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) -PyGame Zero: 从 0 开始的游戏 +PyGame Zero: 无需模板的游戏开发 ====== -在你的游戏开发过程中有了 PyGame Zero,和枯燥的模板说再见吧。 +> 在你的游戏开发过程中有了 PyGame Zero,和枯燥的模板说再见吧。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3) -Python 说一个很好的入门编程语言。并且,游戏是一个很好的入门项目:它们是可视化的,自驱动的,并且可以很愉快的与朋友和家人分享。虽然,绝大多数的 Python 写就的库,比如 [PyGame][1] ,会让初学者因为忘记微小的细节很容易导致什么都没渲染而感到困扰 +Python 是一个很好的入门级编程语言。并且,游戏是一个很好的入门项目:它们是可视化的,自驱动的,并且可以很愉快的与朋友和家人分享。虽然,绝大多数的 Python 写就的库,比如 [PyGame][1] ,会让初学者因为忘记微小的细节很容易导致什么都没渲染而感到困扰。 -在人们理解所有部分的原因前,他们将其中的许多部分都视为“无意识的样板文件”——需要复制和粘贴到程序中才能使其工作的神奇段落。 +在理解所有部分的作用之前,他们会将其中的许多部分都视为“无意识的模板文件”——需要复制和粘贴到程序中才能使其工作的神奇段落。 -[PyGame Zero][2] 试图通过在 PyGame 上放置一个抽象的层来弥合这一差距,因此它实际上并不需要模板。 +[PyGame Zero][2] 试图通过在 PyGame 上放置一个抽象层来弥合这一差距,因此它字面上并不需要模板。 -我们在字面上说的,就是我们的意思 +我们在说的“字面”,就是在指字面。 这是一个合格的 PyGame Zero 文件: @@ -28,17 +28,17 @@ Python 说一个很好的入门编程语言。并且,游戏是一个很好的 # This comment is here for clarity reasons ``` -我们可以将它放在一个 **game.py** 文件里,并运行: +我们可以将它放在一个 `game.py` 文件里,并运行: ``` $ pgzrun game.py ``` -这将会展示一个可以通过关闭窗口或按下**CTRL-C**中断的窗口,并在后台运行一个游戏循环 , +这将会展示一个窗口,并运行一个可以通过关闭窗口或按下 `CTRL-C` 中断的游戏循环。 遗憾的是,这将是一场无聊的游戏。什么都没发生。 -为了让他更有趣一点,我们可以画一个不同的背景: +为了让它更有趣一点,我们可以画一个不同的背景: ``` def draw(): @@ -59,10 +59,9 @@ def update(): 这将会让窗口从黑色开始,逐渐变亮,直到变为亮红色,再返回黑色,一遍一遍循环。 -**update** 函数更新了 **draw** 渲染这个游戏所需的这些参数的值。 +`update` 函数更新了参数的值,而 `draw` 基于这些参数渲染这个游戏。 -即使是这样,这里也没有任何方式给玩家与这个游戏的交互的方式。 -让我们试试其他一些事情: +即使是这样,这里也没有任何方式给玩家与这个游戏的交互的方式。让我们试试其他一些事情: ``` colors = [0, 0, 0] @@ -77,7 +76,7 @@ def on_key_down(key, mod, unicode):     colors[1] = (colors[1] + 1) % 256 ``` -现在,按下按钮来提升亮度。 +现在,按下按键来提升亮度。 这些包括游戏循环的三个重要部分:响应用户输入,更新参数和重新渲染屏幕。 @@ -92,7 +91,7 @@ via: https://opensource.com/article/19/1/pygame-zero 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[bestony](https://github.com/bestony) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4d4666a64bd546de5bafd6962b53b7adf10dc71c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Feb 2019 23:01:18 +0800 Subject: [PATCH 116/813] PUB:20190125 PyGame Zero- Games without boilerplate.md @bestony https://linux.cn/article-10532-1.html --- .../20190125 PyGame Zero- Games without boilerplate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190125 PyGame Zero- Games without boilerplate.md (97%) diff --git a/translated/tech/20190125 PyGame Zero- Games without boilerplate.md b/published/20190125 PyGame Zero- Games without boilerplate.md similarity index 97% rename from translated/tech/20190125 PyGame Zero- Games without boilerplate.md rename to published/20190125 PyGame Zero- Games without boilerplate.md index dab7873d5c..523c7e4561 100644 --- a/translated/tech/20190125 PyGame Zero- Games without boilerplate.md +++ b/published/20190125 PyGame Zero- Games without boilerplate.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (bestony) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10532-1.html) [#]: subject: (PyGame Zero: Games without boilerplate) [#]: via: (https://opensource.com/article/19/1/pygame-zero) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 3a5f0b48ff57b1206a73176390547f59e798b573 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 Feb 2019 08:58:27 +0800 Subject: [PATCH 117/813] translated --- ...dstorm, an open source web app platform.md | 58 ------------------- ...dstorm, an open source web app platform.md | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 sources/tech/20190115 Getting started with Sandstorm, an open source web app platform.md create mode 100644 translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md diff --git a/sources/tech/20190115 Getting started with Sandstorm, an open source web app platform.md b/sources/tech/20190115 Getting started with Sandstorm, an open source web app platform.md deleted file mode 100644 index 2389a5d243..0000000000 --- a/sources/tech/20190115 Getting started with Sandstorm, an open source web app platform.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Sandstorm, an open source web app platform) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-sandstorm) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Getting started with Sandstorm, an open source web app platform -====== -Learn about Sandstorm, the third in our series on open source tools that will make you more productive in 2019. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the third of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Sandstorm - -Being productive isn't just about to-do lists and keeping things organized. Often it requires a suite of tools linked to make a workflow go smoothly. - -![](https://opensource.com/sites/default/files/uploads/sandstorm_1.png) - -[Sandstorm][1] is an open source collection of packaged apps, all accessible from a single web interface and managed from a central console. You can host it yourself or use the [Sandstorm Oasis][2] service—for a per-user fee. - -![](https://opensource.com/sites/default/files/uploads/sandstorm_2.png) - -Sandstorm has a marketplace that makes it simple to install the apps that are available. It includes apps for productivity, finance, note taking, task tracking, chat, games, and a whole lot more. You can also package your own apps and upload them by following the application-packaging guidelines in the [developer documentation][3]. - -![](https://opensource.com/sites/default/files/uploads/sandstorm_3.png) - -Once installed, a user can create [grains][4]—basically containerized instances of app data. Grains are private by default and can be shared with other Sandstorm users. This means they are secure by default, and users can chose what to share with others. - -![](https://opensource.com/sites/default/files/uploads/sandstorm_4.png) - -Sandstorm can authenticate from several different external sources as well as use a "passwordless" email-based authentication. Using an external service means you don't have to manage yet another set of credentials if you already use one of the supported services. - -In the end, Sandstorm makes installing and using supported collaborative apps quick, easy, and secure. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-sandstorm - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://sandstorm.io/ -[2]: https://oasis.sandstorm.io -[3]: https://docs.sandstorm.io/en/latest/developing/ -[4]: https://sandstorm.io/how-it-works diff --git a/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md b/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md new file mode 100644 index 0000000000..4a98d7fb4f --- /dev/null +++ b/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Sandstorm, an open source web app platform) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-sandstorm) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 Sandstorm,一个开源 Web 应用平台 +====== +了解 Sandstorm,这是我们在开源工具系列中的第三篇,它将在 2019 年提高你的工作效率。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第三个工具来帮助你在 2019 年更有效率。 + +### Sandstorm + +保持高效不仅仅需要待办事项以及让事情有组织。通常它需要一组工具以使工作流程顺利进行。 + +![](https://opensource.com/sites/default/files/uploads/sandstorm_1.png) + +[Sandstorm][1]是打包的开源应用集合,它们都可从一个 Web 界面访问,也可在中央控制台进行管理。你可以自己托管或使用 [Sandstorm Oasis][2] 服务。它按用户收费。 + +![](https://opensource.com/sites/default/files/uploads/sandstorm_2.png) + +Sandstorm 有一个市场,在这里可以轻松安装应用。应用包括效率类、财务、笔记、任务跟踪、聊天、游戏等等。你还可以按照[开发人员文档][3]中的应用打包指南打包自己的应用并上传它们。 + +![](https://opensource.com/sites/default/files/uploads/sandstorm_3.png) + +安装后,用户可以创建 [grain][4] - 容器化后的应用数据实例。默认情况下,grain 是私有的,它可以与其他 Sandstorm 用户共享。这意味着它们默认是安全的,用户可以选择与他人共享的内容。 + +![](https://opensource.com/sites/default/files/uploads/sandstorm_4.png) + +Sandstorm 可以从几个不同的外部源进行身份验证,也可以使用无需密码的基于电子邮件的身份验证。使用外部服务意味着如果你已使用其中一种受支持的服务,那么就无需管理另一组凭据。 + +最后,Sandstorm 使安装和使用支持的协作应用变得快速,简单和安全。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-sandstorm + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://sandstorm.io/ +[2]: https://oasis.sandstorm.io +[3]: https://docs.sandstorm.io/en/latest/developing/ +[4]: https://sandstorm.io/how-it-works From 03cb817fce9086aae74ef00d1db0166bf45295d4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 Feb 2019 10:05:37 +0800 Subject: [PATCH 118/813] translating --- ...0206 4 cool new projects to try in COPR for February 2019.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md b/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md index dc424f9625..b63cf4da75 100644 --- a/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md +++ b/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d73e0ab435621c26fba663af83610298c14d1b99 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 10:29:56 +0800 Subject: [PATCH 119/813] APL:20190205 DNS and Root Certificates.md --- sources/tech/20190205 DNS and Root Certificates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190205 DNS and Root Certificates.md b/sources/tech/20190205 DNS and Root Certificates.md index 3934a414b7..f48bf89f84 100644 --- a/sources/tech/20190205 DNS and Root Certificates.md +++ b/sources/tech/20190205 DNS and Root Certificates.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 21fc95cc947fac54ed55f8c1f9022a17c7e32bf2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 12:49:15 +0800 Subject: [PATCH 120/813] TSL:20190205 DNS and Root Certificates.md --- .../20190205 DNS and Root Certificates.md | 139 +++++++++--------- 1 file changed, 67 insertions(+), 72 deletions(-) diff --git a/sources/tech/20190205 DNS and Root Certificates.md b/sources/tech/20190205 DNS and Root Certificates.md index f48bf89f84..82bea13daa 100644 --- a/sources/tech/20190205 DNS and Root Certificates.md +++ b/sources/tech/20190205 DNS and Root Certificates.md @@ -7,120 +7,115 @@ [#]: via: (https://lushka.al/dns-and-certificates/) [#]: author: (Anxhelo Lushka https://lushka.al/) -DNS and Root Certificates +DNS 和根证书 ====== -Due to recent events we (as in we from the Privacy Today group) felt compelled to write an impromptu article on this matter. It’s intended for all audiences so it will be kept simple - technical details may be posted later. +> 关于 DNS 和根证书你需要了解的内容。 -### What Is DNS And Why Does It Concern You? +由于最近发生的事件,我们(来自 Privacy Today 组织)感到有必要写一篇关于此事的即兴文章。它适用于所有读者,因此它将保持简单 —— 技术细节可能会在稍后发布。 -DNS stands for Domain Name System and you encounter it daily. Whenever your web browser or any other application connects to the internet, it will most likely do so using a domain. A domain is simply the address you type: i.e. [duckduckgo.com][1]. Your computer needs to know where this leads to and will ask a DNS resolver for help. It will return an IP like [176.34.155.23][2]; the public network address you need to know to connect. This process is called a DNS lookup. +### 什么是 DNS,为什么它与你有关? -There are certain implications for both your privacy and your security as well as your liberty: +DNS 的意思是域名系统Domain Name System,你每天都会接触到它。每当你的 Web 浏览器或任何其他应用程序连接到互联网时,它很可能会使用域名。域名简单来说就是你键入的地址:例如 [duckduckgo.com][1]。你的计算机需要知道它所导向的地方,会向 DNS 解析器寻求帮助。而它将返回类似 [176.34.155.23][2] 的 IP —— 这就是连接时所需要知道的公开的网络地址。 此过程称为 DNS 查找。 -#### Privacy +这对你的隐私和安全以及你的自由都有一定的影响: -Since you ask the resolver for an IP for a domain name, it knows exactly which sites you’re visiting and, thanks to the “Internet Of Things”, often abbreviated as IoT, even which appliances you use at home. +#### 隐私 -#### Security +由于你要求解析器获取域名的 IP,因此它会确切地知道你正在访问哪些站点,并且由于“物联网”(通常缩写为 IoT),甚至还知道是你在家中使用的哪个设备。 -You’re trusting the resolver that the IP it returns is correct. There are certain checks to ensure it is so, under normal circumstances, that is not a common source of issues. These can be undermined though and that’s why this article is important. If the IP is not correct, you can be fooled into connecting to malicious 3rd parties - even without ever noticing any difference. In this case, your privacy is in much greater danger because, not only are the sites you visit tracked, but the contents as well. 3rd parties can see exactly what you’re looking at, collect personal information you enter (such as passwords), and a lot more. Your whole identity can be taken over with ease. +#### 安全 -#### Liberty +你相信解析器返回的 IP 是正确的。有一些检查可以确保如此,在正常情况下这一般不是问题。但这些可能会被破坏,这就是本文重要的原因。如果返回的 IP 不正确,你可能会被欺骗引向了恶意的第三方 —— 甚至你都不会注意到任何差异。在这种情况下,你的隐私会受到更大的危害,因为不仅会被跟踪你访问了什么网站,甚至你访问的内容也会被跟踪。第三方可以准确地看到你正在查看的内容,收集你输入的个人信息(例如密码)等等。你的整个身份可以轻松接管。 -Censorship is commonly enforced via DNS. It’s not the most effective way to do so but it is extremely widespread. Even in western countries, it’s routinely used by corporations and governments. They use the same methods as potential attackers; they will not return the correct IP when you ask. They could act as if the domain doesn’t exist or direct you elsewhere entirely. +#### 自由 -### Ways DNS lookups can happen - -#### 3rd Party DNS Resolvers Hosted By Your ISP - -Most people are using 3rd party resolvers hosted by their Internet Service Provider. When you connect your modem, they will automatically be fetched and you might never bother with it at all. - -#### 3rd Party DNS Resolver Of Your Choice - -If you already knew what DNS means then you might have decided to use another DNS resolver of your choice. This might improve the situation since it makes it harder for your ISP to track you and you can avoid some forms of censorship. Both are still possible though, but the methods required are not as widely used. - -#### Your Own (local) DNS Resolver - -You can run your own and avoid some of the possible perils of using others’. If you’re interested in more information drop us a line. - -### Root Certificates - -#### What Is A Root Certificate? - -Whenever you visit a website starting with https, you communicate with it using a certificate it sends. It enables your browser to encrypt the communication and ensures that nobody listening in can snoop. That’s why everybody has been told to look out for the https (rather than http) when logging into websites. The certificate itself only verifies that it has been generated for a certain domain. There’s more though: - -That’s where the root certificate comes in. Think of it as the next higher level that makes sure the levels below are correct. It verifies that the certificate sent to you has been authorized by a certificate authority. This authority ensures that the person creating the certificate is actually the real operator. - -This is also referred to as the chain of trust. Your operating system includes a set of these root certificates by default so that the chain of trust can be guaranteed. - -#### Abuse - -We now know that: - - * DNS resolvers send you an IP address when you send a domain name - * Certificates allow encrypting your communication and verify they have been generated for the domain you visit - * Root certificates verify that the certificate is legitimate and has been created by the real site operator +审查通常是通过 DNS 实施的。这不是最有效的方法,但它非常普遍。即使在西方国家,它也经常被公司和政府使用。他们使用与潜在攻击者相同的方法;当你查询 IP 地址时,他们不会返回正确的 IP。他们可以表现得就好像某个域名不存在,或完全将访问指向别处。 +### DNS 查询的方式 -**How can it be abused?** +#### 由你的 ISP 提供的第三方 DNS 解析器 - * A malicious DNS resolver can send you a wrong IP for the purpose of censorship as said before. They can also send you to a completely different site. - * This site can send you a fake certificate. - * A malicious root certificate can “verify” this fake certificate. +大多数人都在使用由其互联网接入服务提供商提供的第三方解析器。当你连接调制解调器时(LCTT 译注:或宽带路由器),这些 DNS 就会被自动取出,你可能从来没注意过它。 +#### 你自己选择的第三方 DNS 解析器 +如果你已经知道 DNS 意味着什么,那么你可能决定使用你选择的另一个 DNS 解析器。这可能会改善这种情况,因为它使你的 ISP 更难以跟踪你,并且你可以避免某些形式的审查。尽管仍然是可能的,但这种追踪和审查所需的方法并没有被广泛使用。 -This site will look absolutely fine to you; it has https in the URL and, if you click it, it will say verified. All just like you learned, right? **No!** +#### 你自己(本地)的 DNS 解析器 -It now receives all the communication you intended to send to the original. This bypasses the checks created to avoid it. You won’t receive error messages, your browser won’t complain. +你可以自己动手,避免使用别人的 DNS 解析器的一些危险。如果你对此感兴趣,请告诉我们。 -**All your data is compromised!** +### 根证书 -### Conclusion +#### 什么是根证书? -#### Risks +每当你访问以 https 开头的网站时,你都会使用它发送的证书与之通信。它使你的浏览器能够加密通信并确保没有人可以窥探。这就是为什么每个人都被告知在登录网站时要注意 https(而不是 http)。证书本身仅验证是否为某个域所生成。以及: - * Using a malicious DNS resolver can always compromise your privacy but your security will be unharmed as long as you look out for the https. - * Using a malicious DNS resolver and a malicious root certificate, your privacy and security are fully compromised. +这就是根证书的来源。可以其视为一个更高的级别,以确保其下的级别是正确的。它验证发送给你的证书是否已由证书颁发机构授权。此权限确保创建证书的人实际上是真正的运营者。 +这也被称为信任链。默认情况下,你的操作系统包含一组这些根证书,以确保该信任链的存在。 +#### 滥用 -#### Actions To Take +我们现在知道: -**Do not ever install a 3rd party root certificate!** There are very few exceptions why you would want to do so and none of them are applicable to general end users. +* DNS 解析器在你发送域名时向你发送 IP 地址 +* 证书允许加密你的通信,并验证它们是否为你访问的域生成 +* 根证书验证证书是否合法,并且是由真实站点运营者创建的 -**Do not fall for clever marketing that ensures “ad blocking”, “military grade security”, or something similar**. There are methods of using DNS resolvers on their own to enhance your privacy but installing a 3rd party root certificate never makes sense. You are opening yourself up to extreme abuse. +**怎么会被滥用呢?** -### Seeing It Live +* 如前所述,恶意 DNS 解析器可能会向你发送错误的 IP 以进行审查。他们还可以将你导向完全不同的网站。 +* 这个网站可以向你发送假的证书。 +* 恶意的根证书可以“验证”此假证书。 -**WARNING** +对你来说,这个网站看起来绝对没问题;它在网址中有 https,如果你点击它,它会说已经通过验证。就像你学到的一样,对吗? **不对!** -A friendly sysadmin provided a live demo so you can see for yourself in realtime. This is real. +它现在可以接收你要发送给原站点的所有通信。这会绕过想要避免被滥用而创建的检查。你不会收到错误消息,你的浏览器不会抱怨。 -**DO NOT ENTER PRIVATE DATA! REMOVE THE CERT AND DNS AFTERWARDS!** +**而你所有数据都受到了损害!** -If you do not know how to, don’t install it in the first place. While we trust our friend you still wouldn’t want to have the root certificate of a random and unknown 3rd party installed. +### 结论 -#### Live Demo +#### 风险 -Here is the link: +* 使用恶意 DNS 解析器总是会损害你的隐私,但只要你注意 https,你的安全性就不会受到损害。 +* 使用恶意 DNS 解析程序和恶意根证书,你的隐私和安全性完全受到损害。 - * Set the provided DNS resolver - * Install the provided root certificate - * Visit and enter random login data - * Your data will show up on the website +#### 可以采取的动作 +**不要安装第三方根证书!**只有非常少的例外情况才需要这样做,并且它们都不适用于一般最终用户。 +**不要被那些“广告拦截”、“军事级安全”或类似的东西营销噱头所吸引**。有一些方法可以自行使用 DNS 解析器来增强你的隐私,但安装第三方根证书永远不会有意义。你正在将自己置身于陷阱之中。 -### Further Information +### 实际看看 -If you are interested in more technical details, let us know. If there is enough interest, we might write an article but, for now, the important part is sharing the basics so you can make an informed decision and not fall for marketing and straight up fraud. Feel free to suggest other topics that are important to you. +**警告** -This post is mirrored from [Privacy Today channel][3]. [Privacy Today][4] is a group about all things privacy, open source, libre philosophy and more! +有一个友好的系统管理员提供了一个现场演示,你可以实时看到自己。这是真事。 -All content is licensed under CC BY-NC-SA 4.0. ([Attribution-NonCommercial-ShareAlike 4.0 International][5]). +**千万不要输入私人数据!之后务必删除证书和该 DNS!** + +如果你不知道如何操作,那就不要安装它。虽然我们相信我们的朋友,但你不要随便安装随机和未知第三方的根证书。 + +#### 实际演示 + +链接在这里: + +* 设置所提供的 DNS 解析程序 +* 安装所提供的根证书 +* 访问 并输入随机登录数据 +* 你的数据将显示在该网站上 + +### 延伸信息 + +如果你对更多技术细节感兴趣,请告诉我们。如果有足够的兴趣,我们可能会写一篇文章,但是目前最重要的部分是分享基础知识,这样你就可以做出明智的决定,而不会因为营销和欺诈而陷入陷阱。请随时提出对你很关注的其他主题。 + +这篇文章来自 [Privacy Today 频道][3]。[Privacy Today][4] 是一个关于隐私、开源、自由哲学等所有事物的组织! + +所有内容均根据 CC BY-NC-SA 4.0 获得许可。([署名 - 非商业性使用 - 共享 4.0 国际][5])。 -------------------------------------------------------------------------------- @@ -128,7 +123,7 @@ via: https://lushka.al/dns-and-certificates/ 作者:[Anxhelo Lushka][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 cf9aaf11c32cd10c30bea3430ab4b91c04ccc8da Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 13:06:11 +0800 Subject: [PATCH 121/813] PRF:20190205 DNS and Root Certificates.md @wxy --- .../20190205 DNS and Root Certificates.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sources/tech/20190205 DNS and Root Certificates.md b/sources/tech/20190205 DNS and Root Certificates.md index 82bea13daa..c143dedbc7 100644 --- a/sources/tech/20190205 DNS and Root Certificates.md +++ b/sources/tech/20190205 DNS and Root Certificates.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (DNS and Root Certificates) @@ -12,36 +12,35 @@ DNS 和根证书 > 关于 DNS 和根证书你需要了解的内容。 -由于最近发生的事件,我们(来自 Privacy Today 组织)感到有必要写一篇关于此事的即兴文章。它适用于所有读者,因此它将保持简单 —— 技术细节可能会在稍后发布。 +由于最近发生的一些事件,我们(Privacy Today 组织)感到有必要写一篇关于此事的短文。它适用于所有读者,因此它将保持简单 —— 技术细节可能会在稍后的文章发布。 ### 什么是 DNS,为什么它与你有关? -DNS 的意思是域名系统Domain Name System,你每天都会接触到它。每当你的 Web 浏览器或任何其他应用程序连接到互联网时,它很可能会使用域名。域名简单来说就是你键入的地址:例如 [duckduckgo.com][1]。你的计算机需要知道它所导向的地方,会向 DNS 解析器寻求帮助。而它将返回类似 [176.34.155.23][2] 的 IP —— 这就是连接时所需要知道的公开的网络地址。 此过程称为 DNS 查找。 +DNS 的意思是域名系统Domain Name System,你每天都会接触到它。每当你的 Web 浏览器或任何其他应用程序连接到互联网时,它就很可能会使用域名。简单来说,域名就是你键入的地址:例如 [duckduckgo.com][1]。你的计算机需要知道它所导向的地方,会向 DNS 解析器寻求帮助。而它将返回类似 [176.34.155.23][2] 这样的 IP —— 这就是连接时所需要知道的公开网络地址。 此过程称为 DNS 查找。 -这对你的隐私和安全以及你的自由都有一定的影响: +这对你的隐私、安全以及你的自由都有一定的影响: #### 隐私 -由于你要求解析器获取域名的 IP,因此它会确切地知道你正在访问哪些站点,并且由于“物联网”(通常缩写为 IoT),甚至还知道是你在家中使用的哪个设备。 +由于你要求解析器获取域名的 IP,因此它会确切地知道你正在访问哪些站点,并且由于“物联网”(通常缩写为 IoT),甚至它还知道你在家中使用的是哪个设备。 #### 安全 -你相信解析器返回的 IP 是正确的。有一些检查可以确保如此,在正常情况下这一般不是问题。但这些可能会被破坏,这就是本文重要的原因。如果返回的 IP 不正确,你可能会被欺骗引向了恶意的第三方 —— 甚至你都不会注意到任何差异。在这种情况下,你的隐私会受到更大的危害,因为不仅会被跟踪你访问了什么网站,甚至你访问的内容也会被跟踪。第三方可以准确地看到你正在查看的内容,收集你输入的个人信息(例如密码)等等。你的整个身份可以轻松接管。 +你可以相信解析器返回的 IP 是正确的。有一些检查措施可以确保如此,在正常情况下这一般不是问题。但这些可能措施会被破坏,这就是写作本文的原因。如果返回的 IP 不正确,你可能会被欺骗引向了恶意的第三方 —— 甚至你都不会注意到任何差异。在这种情况下,你的隐私会受到更大的危害,因为不仅会被跟踪你访问了什么网站,甚至你访问的内容也会被跟踪。第三方可以准确地看到你正在查看的内容,收集你输入的个人信息(例如密码)等等。你的整个身份可以轻松接管。 #### 自由 审查通常是通过 DNS 实施的。这不是最有效的方法,但它非常普遍。即使在西方国家,它也经常被公司和政府使用。他们使用与潜在攻击者相同的方法;当你查询 IP 地址时,他们不会返回正确的 IP。他们可以表现得就好像某个域名不存在,或完全将访问指向别处。 - ### DNS 查询的方式 #### 由你的 ISP 提供的第三方 DNS 解析器 -大多数人都在使用由其互联网接入服务提供商提供的第三方解析器。当你连接调制解调器时(LCTT 译注:或宽带路由器),这些 DNS 就会被自动取出,你可能从来没注意过它。 +大多数人都在使用由其互联网接入提供商(ISP)提供的第三方解析器。当你连接调制解调器时(LCTT 译注:或宽带路由器),这些 DNS 解析器就会被自动取出,而你可能从来没注意过它。 #### 你自己选择的第三方 DNS 解析器 -如果你已经知道 DNS 意味着什么,那么你可能决定使用你选择的另一个 DNS 解析器。这可能会改善这种情况,因为它使你的 ISP 更难以跟踪你,并且你可以避免某些形式的审查。尽管仍然是可能的,但这种追踪和审查所需的方法并没有被广泛使用。 +如果你已经知道 DNS 意味着什么,那么你可能会决定使用你选择的另一个 DNS 解析器。这可能会改善这种情况,因为它使你的 ISP 更难以跟踪你,并且你可以避免某些形式的审查。尽管追踪和审查仍然是可能的,但这种方法并没有被广泛使用。 #### 你自己(本地)的 DNS 解析器 @@ -51,9 +50,9 @@ DNS 的意思是域名系统Domain Name System,你每天 #### 什么是根证书? -每当你访问以 https 开头的网站时,你都会使用它发送的证书与之通信。它使你的浏览器能够加密通信并确保没有人可以窥探。这就是为什么每个人都被告知在登录网站时要注意 https(而不是 http)。证书本身仅验证是否为某个域所生成。以及: +每当你访问以 https 开头的网站时,你都会使用它发送的证书与之通信。它使你的浏览器能够加密通信并确保没有人可以窥探。这就是为什么每个人都被告知在登录网站时要注意 https(而不是 http)。证书本身仅用于验证是否为某个域所生成。以及: -这就是根证书的来源。可以其视为一个更高的级别,以确保其下的级别是正确的。它验证发送给你的证书是否已由证书颁发机构授权。此权限确保创建证书的人实际上是真正的运营者。 +这就是根证书的来源。可以其视为一个更高的级别,用来确保其下的级别是正确的。它验证发送给你的证书是否已由证书颁发机构授权。此权限确保创建证书的人实际上是真正的运营者。 这也被称为信任链。默认情况下,你的操作系统包含一组这些根证书,以确保该信任链的存在。 @@ -63,26 +62,26 @@ DNS 的意思是域名系统Domain Name System,你每天 * DNS 解析器在你发送域名时向你发送 IP 地址 * 证书允许加密你的通信,并验证它们是否为你访问的域生成 -* 根证书验证证书是否合法,并且是由真实站点运营者创建的 +* 根证书验证该证书是否合法,并且是由真实站点运营者创建的 **怎么会被滥用呢?** -* 如前所述,恶意 DNS 解析器可能会向你发送错误的 IP 以进行审查。他们还可以将你导向完全不同的网站。 +* 如前所述,恶意 DNS 解析器可能会向你发送错误的 IP 以进行审查。它们还可以将你导向完全不同的网站。 * 这个网站可以向你发送假的证书。 * 恶意的根证书可以“验证”此假证书。 -对你来说,这个网站看起来绝对没问题;它在网址中有 https,如果你点击它,它会说已经通过验证。就像你学到的一样,对吗? **不对!** +对你来说,这个网站看起来绝对没问题;它在网址中有 https,如果你点击它,它会说已经通过验证。就像你了解到的一样,对吗?**不对!** -它现在可以接收你要发送给原站点的所有通信。这会绕过想要避免被滥用而创建的检查。你不会收到错误消息,你的浏览器不会抱怨。 +它现在可以接收你要发送给原站点的所有通信。这会绕过想要避免被滥用而创建的检查。你不会收到错误消息,你的浏览器也不会发觉。 -**而你所有数据都受到了损害!** +**而你所有的数据都会受到损害!** ### 结论 #### 风险 * 使用恶意 DNS 解析器总是会损害你的隐私,但只要你注意 https,你的安全性就不会受到损害。 -* 使用恶意 DNS 解析程序和恶意根证书,你的隐私和安全性完全受到损害。 +* 使用恶意 DNS 解析程序和恶意根证书,你的隐私和安全性将完全受到损害。 #### 可以采取的动作 @@ -94,24 +93,24 @@ DNS 的意思是域名系统Domain Name System,你每天 **警告** -有一个友好的系统管理员提供了一个现场演示,你可以实时看到自己。这是真事。 +有位友好的系统管理员提供了一个现场演示,你可以实时看到自己。这是真事。 **千万不要输入私人数据!之后务必删除证书和该 DNS!** -如果你不知道如何操作,那就不要安装它。虽然我们相信我们的朋友,但你不要随便安装随机和未知第三方的根证书。 +如果你不知道如何操作,那就不要安装它。虽然我们相信我们的朋友,但你不要随便安装随机和未知的第三方根证书。 #### 实际演示 链接在这里: -* 设置所提供的 DNS 解析程序 +* 设置所提供的 DNS 解析器 * 安装所提供的根证书 * 访问 并输入随机登录数据 * 你的数据将显示在该网站上 ### 延伸信息 -如果你对更多技术细节感兴趣,请告诉我们。如果有足够的兴趣,我们可能会写一篇文章,但是目前最重要的部分是分享基础知识,这样你就可以做出明智的决定,而不会因为营销和欺诈而陷入陷阱。请随时提出对你很关注的其他主题。 +如果你对更多技术细节感兴趣,请告诉我们。如果有足够多感兴趣的人,我们可能会写一篇文章,但是目前最重要的部分是分享基础知识,这样你就可以做出明智的决定,而不会因为营销和欺诈而陷入陷阱。请随时提出对你很关注的其他主题。 这篇文章来自 [Privacy Today 频道][3]。[Privacy Today][4] 是一个关于隐私、开源、自由哲学等所有事物的组织! @@ -124,7 +123,7 @@ via: https://lushka.al/dns-and-certificates/ 作者:[Anxhelo Lushka][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 5f192381c07147758a104754b4ca58457bb1c053 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 13:07:16 +0800 Subject: [PATCH 122/813] PUB:20190205 DNS and Root Certificates.md @wxy https://linux.cn/article-10533-1.html --- .../tech => published}/20190205 DNS and Root Certificates.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {sources/tech => published}/20190205 DNS and Root Certificates.md (99%) diff --git a/sources/tech/20190205 DNS and Root Certificates.md b/published/20190205 DNS and Root Certificates.md similarity index 99% rename from sources/tech/20190205 DNS and Root Certificates.md rename to published/20190205 DNS and Root Certificates.md index c143dedbc7..3a921def35 100644 --- a/sources/tech/20190205 DNS and Root Certificates.md +++ b/published/20190205 DNS and Root Certificates.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10533-1.html) [#]: subject: (DNS and Root Certificates) [#]: via: (https://lushka.al/dns-and-certificates/) [#]: author: (Anxhelo Lushka https://lushka.al/) From 2ae82f2004fc88f9a923af383e919d64700f62ac Mon Sep 17 00:00:00 2001 From: guevaraya Date: Wed, 13 Feb 2019 17:54:06 +0800 Subject: [PATCH 123/813] Update and rename sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md to translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 --- ...atory - Raspberry Pi- Lesson 11 Input02.md | 911 ------------------ ...atory - Raspberry Pi- Lesson 11 Input02.md | 911 ++++++++++++++++++ 2 files changed, 911 insertions(+), 911 deletions(-) delete mode 100644 sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md create mode 100644 translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md deleted file mode 100644 index b5ad1a7e86..0000000000 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md +++ /dev/null @@ -1,911 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Guevaraya) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 11 Input02) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html) -[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) - -Computer Laboratory – Raspberry Pi: Lesson 11 Input02 -====== - -The Input02 lesson builds on Input01, by building a simple command line interface where the user can type commands and the computer interprets and displays them. It is assumed you have the code for the [Lesson 11: Input01][1] operating system as a basis. - -### 1 Terminal 1 - -``` -In the early days of computing, there would usually be one large computer in a building, and many 'terminals' which sent commands to it. The computer would take it in turns to execute different incoming commands. -``` - -Almost every operating system starts life out as a text terminal. This is typically a black screen with white writing, where you type commands for the computer to execute on the keyboard, and it explains how you've mistyped them, or very occasionally, does what you want. This approach has two main advantages: it provides a simple, robust control mechanism for the computer using only a keyboard and monitor, and it is done by almost every operating system, so is widely understood by system administrators. - -Let's analyse what we want to do precisely: - - 1. Computer turns on, displays some sort of welcome message - 2. Computer indicates its ready for input - 3. User types a command, with parameters, on the keyboard - 4. User presses return or enter to commit the command - 5. Computer interprets command and performs actions if command is acceptable - 6. Computer displays messages to indicate if command was successful, and also what happened - 7. Loop back to 2 - - - -One defining feature of such terminals is that they are unified for both input and output. The same screen is used to enter inputs as is used to print outputs. This means it is useful to build an abstraction of a character based display. In a character based display, the smallest unit is a character, not a pixel. The screen is divided into a fixed number of characters which have varying colours. We can build this on top of our existing screen code, by storing the characters and their colours, and then using the DrawCharacter method to push them to the screen. Once we have a character based display, drawing text becomes a matter of drawing a line of characters. - -In a new file called terminal.s copy the following code: -``` -.section .data -.align 4 -terminalStart: -.int terminalBuffer -terminalStop: -.int terminalBuffer -terminalView: -.int terminalBuffer -terminalColour: -.byte 0xf -.align 8 -terminalBuffer: -.rept 128*128 -.byte 0x7f -.byte 0x0 -.endr -terminalScreen: -.rept 1024/8 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 768/16 -.byte 0x7f -.byte 0x0 -.endr -``` -This sets up the data we need for the text terminal. We have two main storages: terminalBuffer and terminalScreen. terminalBuffer is storage for all of the text we have displayed. It stores up to 128 lines of text (each containing 128 characters). Each character consists of an ASCII character code and a colour, all of which are initially set to 0x7f (ASCII delete) and 0 (black on a black background). terminalScreen stores the characters that are currently displayed on the screen. It is 128 by 48 characters, similarly initialised. You may think that we only need this terminalScreen, not the terminalBuffer, but storing the buffer has 2 main advantages: - - 1. We can easily see which characters are different, so we only have to draw those. - 2. We can 'scroll' back through the terminal's history because it is stored (to a limit). - - - -You should always try to design systems that do the minimum amount of work, as they run much faster for things which don't often change. - -The differing trick is really common on low power Operating Systems. Drawing the screen is a slow operation, and so we only want to draw thing that we absolutely have to. In this system, we can freely alter the terminalBuffer, and then call a method which copies the bits that change to the screen. This means we don't have to draw each character as we go along, which may save time in the long run on very long sections of text that span many lines. - -The other values in the .data section are as follows: - - * terminalStart - The first character which has been written in terminalBuffer. - * terminalStop - The last character which has been written in terminalBuffer. - * terminalView - The first character on the screen at present. We can use this to scroll the screen. - * temrinalColour - The colour to draw new characters with. - - - -``` -Circular buffers are an example of an **data structure**. These are just ideas we have for organising data, that we sometimes implement in software. -``` - -![Diagram showing hellow world being inserted into a circular buffer of size 5.][2] -The reason why terminalStart needs to be stored is because termainlBuffer should be a circular buffer. This means that when the buffer is completely full, the end 'wraps' round to the start, and so the character after the very last one is the first one. Thus, we need to advance terminalStart so we know that we've done this. When wokring with the buffer this can easily be implemented by checking if the index goes beyond the end of the buffer, and setting it back to the beginning if it does. Circular buffers are a common and clever way of storing a lot of data, where only the most recent data is important. It allows us to keep writing indefinitely, while always being sure there is a certain amount of recent data available. They're often used in signal processing or compression algorithms. In this case, it allows us to store a 128 line history of the terminal, without any penalties for writing over 128 lines. If we didn't have this, we would have to copy 127 lines back a line very time we went beyond the 128th line, wasting valuable time. - -I've mentioned the terminalColour here a few times. You can implement this however you, wish, however there is something of a standard on text terminals to have only 16 colours for foreground, and 16 colours for background (meaning there are 162 = 256 combinations). The colours on a CGA terminal are defined as follows: - -Table 1.1 - CGA Colour Codes -| Number | Colour (R, G, B) | -| ------ | ------------------------| -| 0 | Black (0, 0, 0) | -| 1 | Blue (0, 0, ⅔) | -| 2 | Green (0, ⅔, 0) | -| 3 | Cyan (0, ⅔, ⅔) | -| 4 | Red (⅔, 0, 0) | -| 5 | Magenta (⅔, 0, ⅔) | -| 6 | Brown (⅔, ⅓, 0) | -| 7 | Light Grey (⅔, ⅔, ⅔) | -| 8 | Grey (⅓, ⅓, ⅓) | -| 9 | Light Blue (⅓, ⅓, 1) | -| 10 | Light Green (⅓, 1, ⅓) | -| 11 | Light Cyan (⅓, 1, 1) | -| 12 | Light Red (1, ⅓, ⅓) | -| 13 | Light Magenta (1, ⅓, 1) | -| 14 | Yellow (1, 1, ⅓) | -| 15 | White (1, 1, 1) | - -``` -Brown was used as the alternative (dark yellow) was unappealing and not useful. -``` - -We store the colour of each character by storing the fore colour in the low nibble of the colour byte, and the background colour in the high nibble. Apart from brown, all of these colours follow a pattern such that in binary, the top bit represents adding ⅓ to each component, and the other bits represent adding ⅔ to individual components. This makes it easy to convert to RGB colour values. - -We need a method, TerminalColour, to read these 4 bit colour codes, and then call SetForeColour with the 16 bit equivalent. Try to implement this on your own. If you get stuck, or have not completed the Screen series, my implementation is given below: - -``` -.section .text -TerminalColour: -teq r0,#6 -ldreq r0,=0x02B5 -beq SetForeColour - -tst r0,#0b1000 -ldrne r1,=0x52AA -moveq r1,#0 -tst r0,#0b0100 -addne r1,#0x15 -tst r0,#0b0010 -addne r1,#0x540 -tst r0,#0b0001 -addne r1,#0xA800 -mov r0,r1 -b SetForeColour -``` -### 2 Showing the Text - -The first method we really need for our terminal is TerminalDisplay, one that copies the current data from terminalBuffer to terminalScreen and the actual screen. As mentioned, this method should do a minimal amount of work, because we need to be able to call it often. It should compare the text in terminalBuffer with that in terminalDisplay, and copy it across if they're different. Remember, terminalBuffer is a circular buffer running, in this case, from terminalView to terminalStop or 128*48 characters, whichever comes sooner. If we hit terminalStop, we'll assume all characters after that point are 7f16 (ASCII delete), and have colour 0 (black on a black background). - -Let's look at what we have to do: - - 1. Load in terminalView, terminalStop and the address of terminalDisplay. - 2. For each row: - 1. For each column: - 1. If view is not equal to stop, load the current character and colour from view - 2. Otherwise load the character as 0x7f and the colour as 0 - 3. Load the current character from terminalDisplay - 4. If the character and colour are equal, go to 10 - 5. Store the character and colour to terminalDisplay - 6. Call TerminalColour with the background colour in r0 - 7. Call DrawCharacter with r0 = 0x7f (ASCII delete, a block), r1 = x, r2 = y - 8. Call TerminalColour with the foreground colour in r0 - 9. Call DrawCharacter with r0 = character, r1 = x, r2 = y - 10. Increment the position in terminalDisplay by 2 - 11. If view and stop are not equal, increment the view position by 2 - 12. If the view position is at the end of textBuffer, set it to the start - 13. Increment the x co-ordinate by 8 - 2. Increment the y co-ordinate by 16 - - - -Try to implement this yourself. If you get stuck, my solution is given below: - -1. -``` -.globl TerminalDisplay -TerminalDisplay: -push {r4,r5,r6,r7,r8,r9,r10,r11,lr} -x .req r4 -y .req r5 -char .req r6 -col .req r7 -screen .req r8 -taddr .req r9 -view .req r10 -stop .req r11 - -ldr taddr,=terminalStart -ldr view,[taddr,#terminalView - terminalStart] -ldr stop,[taddr,#terminalStop - terminalStart] -add taddr,#terminalBuffer - terminalStart -add taddr,#128*128*2 -mov screen,taddr -``` - -I go a little wild with variables here. I'm using taddr to store the location of the end of the textBuffer for ease. - -2. -``` -mov y,#0 -yLoop$: -``` -Start off the y loop. - - 1. - ``` - mov x,#0 - xLoop$: - ``` - Start off the x loop. - - 1. - ``` - teq view,stop - ldrneh char,[view] - ``` - I load both the character and the colour into char simultaneously for ease. - - 2. - ``` - moveq char,#0x7f - ``` - This line complements the one above by acting as though a black delete character was read. - - 3. - ``` - ldrh col,[screen] - ``` - For simplicity I load both the character and colour into col simultaneously. - - 4. - ``` - teq col,char - beq xLoopContinue$ - ``` - Now we can check if anything has changed with a teq. - - 5. - ``` - strh char,[screen] - ``` - We can also easily save the current value. - - 6. - ``` - lsr col,char,#8 - and char,#0x7f - lsr r0,col,#4 - bl TerminalColour - ``` - I split up char into the colour in col and the character in char with a bitshift and an and, then use a bitshift to get the background colour to call TerminalColour. - - 7. - ``` - mov r0,#0x7f - mov r1,x - mov r2,y - bl DrawCharacter - ``` - Write out a delete character which is a coloured block. - - 8. - ``` - and r0,col,#0xf - bl TerminalColour - ``` - Use an and to get the low nibble of col then call TerminalColour. - - 9. - ``` - mov r0,char - mov r1,x - mov r2,y - bl DrawCharacter - ``` - Write out the character we're supposed to write. - - 10. - ``` - xLoopContinue$: - add screen,#2 - ``` - Increment the screen pointer. - - 11. - ``` - teq view,stop - addne view,#2 - ``` - Increment the view pointer if necessary. - - 12. - ``` - teq view,taddr - subeq view,#128*128*2 - ``` - It's easy to check for view going past the end of the buffer because the end of the buffer's address is stored in taddr. - - 13. - ``` - add x,#8 - teq x,#1024 - bne xLoop$ - ``` - We increment x and then loop back if there are more characters to go. - - 2. - ``` - add y,#16 - teq y,#768 - bne yLoop$ - ``` - We increment y and then loop back if there are more characters to go. - -``` -pop {r4,r5,r6,r7,r8,r9,r10,r11,pc} -.unreq x -.unreq y -.unreq char -.unreq col -.unreq screen -.unreq taddr -.unreq view -.unreq stop -``` -Don't forget to clean up at the end! - - -### 3 Printing Lines - -Now we have our TerminalDisplay method, which will automatically display the contents of terminalBuffer to terminalScreen, so theoretically we can draw text. However, we don't actually have any drawing routines that work on a character based display. A quick method that will come in handy first of all is TerminalClear, which completely clears the terminal. This can actually very easily be achieved with no loops. Try to deduce why the following method suffices: - -``` -.globl TerminalClear -TerminalClear: -ldr r0,=terminalStart -add r1,r0,#terminalBuffer-terminalStart -str r1,[r0] -str r1,[r0,#terminalStop-terminalStart] -str r1,[r0,#terminalView-terminalStart] -mov pc,lr -``` - -Now we need to make a basic method for character based displays; the Print function. This takes in a string address in r0, and a length in r1, and simply writes it to the current location at the screen. There are a few special characters to be wary of, as well as special behaviour to ensure that terminalView is kept up to date. Let's analyse what it has to do: - - 1. Check if string length is 0, if so return - 2. Load in terminalStop and terminalView - 3. Deduce the x-coordinate of terminalStop - 4. For each character: - 1. Check if the character is a new line - 2. If so, increment bufferStop to the end of the line storing a black on black delete character. - 3. Otherwise, copy the character in the current terminalColour - 4. Check if we're at the end of a line - 5. If so, check if the number of characters between terminalView and terminalStop is more than one screen - 6. If so, increment terminalView by one line - 7. Check if terminalView is at the end of the buffer, replace it with the start if so - 8. Check if terminalStop is at the end of the buffer, replace it with the start if so - 9. Check if terminalStop equals terminalStart, increment terminalStart by one line if so - 10. Check if terminalStart is at the end of the buffer, replace it with the start if so - 5. Store back terminalStop and terminalView. - - - -See if you can implement this yourself. My solution is provided below: - -1. -``` -.globl Print -Print: -teq r1,#0 -moveq pc,lr -``` -This quick check at the beginning makes a call to Print with a string of length 0 almost instant. - -2. -``` -push {r4,r5,r6,r7,r8,r9,r10,r11,lr} -bufferStart .req r4 -taddr .req r5 -x .req r6 -string .req r7 -length .req r8 -char .req r9 -bufferStop .req r10 -view .req r11 - -mov string,r0 -mov length,r1 - -ldr taddr,=terminalStart -ldr bufferStop,[taddr,#terminalStop-terminalStart] -ldr view,[taddr,#terminalView-terminalStart] -ldr bufferStart,[taddr] -add taddr,#terminalBuffer-terminalStart -add taddr,#128*128*2 -``` -I do a lot of setup here. bufferStart contains terminalStart, bufferStop contains terminalStop, view contains terminalView, taddr is the address of the end of terminalBuffer. - -3. -``` -and x,bufferStop,#0xfe -lsr x,#1 -``` -As per usual, a sneaky alignment trick makes everything easier. Because of the aligment of terminalBuffer, the x-coordinate of any character address is simply the last 8 bits divided by 2. - - 4. - 1. - ``` - charLoop$: - ldrb char,[string] - and char,#0x7f - teq char,#'\n' - bne charNormal$ - ``` - We need to check for new lines. - - 2. - ``` - mov r0,#0x7f - clearLine$: - strh r0,[bufferStop] - add bufferStop,#2 - add x,#1 - teq x,#128 blt clearLine$ - - b charLoopContinue$ - ``` - Loop until the end of the line, writing out 0x7f; a delete character in black on a black background. - - 3. - ``` - charNormal$: - strb char,[bufferStop] - ldr r0,=terminalColour - ldrb r0,[r0] - strb r0,[bufferStop,#1] - add bufferStop,#2 - add x,#1 - ``` - Store the current character in the string and the terminalColour to the end of the terminalBuffer and then increment it and x. - - 4. - ``` - charLoopContinue$: - cmp x,#128 - blt noScroll$ - ``` - Check if x is at the end of a line; 128. - - 5. - ``` - mov x,#0 - subs r0,bufferStop,view - addlt r0,#128*128*2 - cmp r0,#128*(768/16)*2 - ``` - Set x back to 0 and check if we're currently showing more than one screen. Remember, we're using a circular buffer, so if the difference between bufferStop and view is negative, we're actually wrapping around the buffer. - - 6. - ``` - addge view,#128*2 - ``` - Add one lines worth of bytes to the view address. - - 7. - ``` - teq view,taddr - subeq view,taddr,#128*128*2 - ``` - If the view address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning. - - 8. - ``` - noScroll$: - teq bufferStop,taddr - subeq bufferStop,taddr,#128*128*2 - ``` - If the stop address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning. - - 9. - ``` - teq bufferStop,bufferStart - addeq bufferStart,#128*2 - ``` - Check if bufferStop equals bufferStart. If so, add one line to bufferStart. - - 10. - ``` - teq bufferStart,taddr - subeq bufferStart,taddr,#128*128*2 - ``` - If the start address is at the end of the buffer we subtract the buffer length from it to move it back to the start. I set taddr to the address of the end of the buffer at the beginning. - -``` -subs length,#1 -add string,#1 -bgt charLoop$ -``` -Loop until the string is done. - -5. -``` -charLoopBreak$: -sub taddr,#128*128*2 -sub taddr,#terminalBuffer-terminalStart -str bufferStop,[taddr,#terminalStop-terminalStart] -str view,[taddr,#terminalView-terminalStart] -str bufferStart,[taddr] - -pop {r4,r5,r6,r7,r8,r9,r10,r11,pc} -.unreq bufferStart -.unreq taddr -.unreq x -.unreq string -.unreq length -.unreq char -.unreq bufferStop -.unreq view -``` -Store back the variables and return. - - -This method allows us to print arbitrary text to the screen. Throughout, I've been using the colour variable, but no where have we actually set it. Normally, terminals use special combinations of characters to change the colour. For example ASCII Escape (1b16) followed by a number 0 to f in hexadecimal could set the foreground colour to that CGA colour number. You can try implementing this yourself; my version is in the further examples section on the download page. - -### 4 Standard Input - -``` -By convention, in many programming languages, every program has access to stdin and stdout, which are an input and and output stream linked to the terminal. This is still true on graphical programs, though many don't use it. -``` - -Now we have an output terminal that in theory can print out text and display it. That is only half the story however, we want input. We want to implement a method, ReadLine, which stores the next line of text a user types to a location given in r0, up to a maximum length given in r1, and returns the length of the string read in r0. The tricky thing is, the user annoyingly wants to see what they're typing as they type it, they want to use backspace to delete mistakes and they want to use return to submit commands. They probably even want a flashing underscore character to indicate the computer would like input! These perfectly reasonable requests make this method a real challenge. One way to achieve all of this is to store the text they type in memory somewhere along with its length, and then after every character, move the terminalStop address back to where it started when ReadLine was called and calling Print. This means we only have to be able to manipulate a string in memory, and then make use of our Print function. - -Lets have a look at what ReadLine will do: - - 1. If the maximum length is 0, return 0 - 2. Retrieve the current values of terminalStop and terminalView - 3. If the maximum length is bigger than half the buffer size, set it to half the buffer size - 4. Subtract one from maximum length to ensure it can store our flashing underscore or a null terminator - 5. Write an underscore to the string - 6. Write the stored terminalView and terminalStop addresses back to the memory - 7. Call Print on the current string - 8. Call TerminalDisplay - 9. Call KeyboardUpdate - 10. Call KeyboardGetChar - 11. If it is a new line character go to 16 - 12. If it is a backspace character, subtract 1 from the length of the string (if it is > 0) - 13. If it is an ordinary character, write it to the string (if the length < maximum length) - 14. If the string ends in an underscore, write a space, otherwise write an underscore - 15. Go to 6 - 16. Write a new line character to the end of the string - 17. Call Print and TerminalDisplay - 18. Replace the new line with a null terminator - 19. Return the length of the string - - - -Convince yourself that this will work, and then try to implement it yourself. My implementation is given below: - -1. -``` -.globl ReadLine -ReadLine: -teq r1,#0 -moveq r0,#0 -moveq pc,lr -``` -Quick special handling for the zero case, which is otherwise difficult. - -2. -``` -string .req r4 -maxLength .req r5 -input .req r6 -taddr .req r7 -length .req r8 -view .req r9 - -push {r4,r5,r6,r7,r8,r9,lr} - -mov string,r0 -mov maxLength,r1 -ldr taddr,=terminalStart -ldr input,[taddr,#terminalStop-terminalStart] -ldr view,[taddr,#terminalView-terminalStart] -mov length,#0 -``` -As per the general theme, I do a lot of initialisations early. input contains the value of terminalStop and view contains terminalView. Length starts at 0. - -3. -``` -cmp maxLength,#128*64 -movhi maxLength,#128*64 -``` -We have to check for unusually large reads, as we can't process them beyond the size of the terminalBuffer (I suppose we CAN, but it would be very buggy, as terminalStart could move past the stored terminalStop). - -4. -``` -sub maxLength,#1 -``` -Since the user wants a flashing cursor, and we ideally want to put a null terminator on this string, we need 1 spare character. - -5. -``` -mov r0,#'_' -strb r0,[string,length] -``` -Write out the underscore to let the user know they can input. - -6. -``` -readLoop$: -str input,[taddr,#terminalStop-terminalStart] -str view,[taddr,#terminalView-terminalStart] -``` -Save the stored terminalStop and terminalView. This is important to reset the terminal after each call to Print, which changes these variables. Strictly speaking it can change terminalStart too, but this is irreversible. - -7. -``` -mov r0,string -mov r1,length -add r1,#1 -bl Print -``` -Write the current input. We add 1 to the length for the underscore. - -8. -``` -bl TerminalDisplay -``` -Copy the new text to the screen. - -9. -``` -bl KeyboardUpdate -``` -Fetch the latest keyboard input. - -10. -``` -bl KeyboardGetChar -``` -Retrieve the key pressed. - -11. -``` -teq r0,#'\n' -beq readLoopBreak$ -teq r0,#0 -beq cursor$ -teq r0,#'\b' -bne standard$ -``` - -Break out of the loop if we have an enter key. Also skip these conditions if we have a null terminator and process a backspace if we have one. - -12. -``` -delete$: -cmp length,#0 -subgt length,#1 -b cursor$ -``` -Remove one from the length to delete a character. - -13. -``` -standard$: -cmp length,maxLength -bge cursor$ -strb r0,[string,length] -add length,#1 -``` -Write out an ordinary character where possible. - -14. -``` -cursor$: -ldrb r0,[string,length] -teq r0,#'_' -moveq r0,#' ' -movne r0,#'_' -strb r0,[string,length] -``` -Load in the last character, and change it to an underscore if it isn't one, and a space if it is. - -15. -``` -b readLoop$ -readLoopBreak$: -``` -Loop until the user presses enter. - -16. -``` -mov r0,#'\n' -strb r0,[string,length] -``` -Store a new line at the end of the string. - -17. -``` -str input,[taddr,#terminalStop-terminalStart] -str view,[taddr,#terminalView-terminalStart] -mov r0,string -mov r1,length -add r1,#1 -bl Print -bl TerminalDisplay -``` -Reset the terminalView and terminalStop and then Print and TerminalDisplay the final input. - -18. -``` -mov r0,#0 -strb r0,[string,length] -``` -Write out the null terminator. - -19. -``` -mov r0,length -pop {r4,r5,r6,r7,r8,r9,pc} -.unreq string -.unreq maxLength -.unreq input -.unreq taddr -.unreq length -.unreq view -``` -Return the length. - - - - -### 5 The Terminal: Rise of the Machine - -So, now we can theoretically interact with the user on the terminal. The most obvious thing to do is to put this to the test! In 'main.s' delete everything after bl UsbInitialise and copy in the following code: - -``` -reset$: - mov sp,#0x8000 - bl TerminalClear - - ldr r0,=welcome - mov r1,#welcomeEnd-welcome - bl Print - -loop$: - ldr r0,=prompt - mov r1,#promptEnd-prompt - bl Print - - ldr r0,=command - mov r1,#commandEnd-command - bl ReadLine - - teq r0,#0 - beq loopContinue$ - - mov r4,r0 - - ldr r5,=command - ldr r6,=commandTable - - ldr r7,[r6,#0] - ldr r9,[r6,#4] - commandLoop$: - ldr r8,[r6,#8] - sub r1,r8,r7 - - cmp r1,r4 - bgt commandLoopContinue$ - - mov r0,#0 - commandName$: - ldrb r2,[r5,r0] - ldrb r3,[r7,r0] - teq r2,r3 - bne commandLoopContinue$ - add r0,#1 - teq r0,r1 - bne commandName$ - - ldrb r2,[r5,r0] - teq r2,#0 - teqne r2,#' ' - bne commandLoopContinue$ - - mov r0,r5 - mov r1,r4 - mov lr,pc - mov pc,r9 - b loopContinue$ - - commandLoopContinue$: - add r6,#8 - mov r7,r8 - ldr r9,[r6,#4] - teq r9,#0 - bne commandLoop$ - - ldr r0,=commandUnknown - mov r1,#commandUnknownEnd-commandUnknown - ldr r2,=formatBuffer - ldr r3,=command - bl FormatString - - mov r1,r0 - ldr r0,=formatBuffer - bl Print - -loopContinue$: - bl TerminalDisplay - b loop$ - -echo: - cmp r1,#5 - movle pc,lr - - add r0,#5 - sub r1,#5 - b Print - -ok: - teq r1,#5 - beq okOn$ - teq r1,#6 - beq okOff$ - mov pc,lr - - okOn$: - ldrb r2,[r0,#3] - teq r2,#'o' - ldreqb r2,[r0,#4] - teqeq r2,#'n' - movne pc,lr - mov r1,#0 - b okAct$ - - okOff$: - ldrb r2,[r0,#3] - teq r2,#'o' - ldreqb r2,[r0,#4] - teqeq r2,#'f' - ldreqb r2,[r0,#5] - teqeq r2,#'f' - movne pc,lr - mov r1,#1 - - okAct$: - - mov r0,#16 - b SetGpio - -.section .data -.align 2 -welcome: .ascii "Welcome to Alex's OS - Everyone's favourite OS" -welcomeEnd: -.align 2 -prompt: .ascii "\n> " -promptEnd: -.align 2 -command: - .rept 128 - .byte 0 - .endr -commandEnd: -.byte 0 -.align 2 -commandUnknown: .ascii "Command `%s' was not recognised.\n" -commandUnknownEnd: -.align 2 -formatBuffer: - .rept 256 - .byte 0 - .endr -formatEnd: - -.align 2 -commandStringEcho: .ascii "echo" -commandStringReset: .ascii "reset" -commandStringOk: .ascii "ok" -commandStringCls: .ascii "cls" -commandStringEnd: - -.align 2 -commandTable: -.int commandStringEcho, echo -.int commandStringReset, reset$ -.int commandStringOk, ok -.int commandStringCls, TerminalClear -.int commandStringEnd, 0 -``` -This code brings everything together into a simple command line operating system. The commands available are echo, reset, ok and cls. echo copies any text after it back to the terminal, reset resets the operating system if things go wrong, ok has two functions: ok on turns the OK LED on, and ok off turns the OK LED off, and cls clears the terminal using TerminalClear. - -Have a go with this code on the Raspberry Pi. If it doesn't work, please see our troubleshooting page. - -When it works, congratulations you've completed a basic terminal Operating System, and have completed the input series. Unfortunately, this is as far as these tutorials go at the moment, but I hope to make more in the future. Please send feedback to awc32@cam.ac.uk. - -You're now in position to start building some simple terminal Operating Systems. My code above builds up a table of available commands in commandTable. Each entry in the table is an int for the address of the string, and an int for the address of the code to run. The last entry has to be commandStringEnd, 0. Try implementing some of your own commands, using our existing functions, or making new ones. The parameters for the functions to run are r0 is the address of the command the user typed, and r1 is the length. You can use this to pass inputs to your commands. Maybe you could make a calculator program, perhaps a drawing program or a chess program. Whatever ideas you've got, give them a go! - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html - -作者:[Alex Chadwick][a] -选题:[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.cl.cam.ac.uk -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/circular_buffer.png diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md new file mode 100644 index 0000000000..6b5db8b104 --- /dev/null +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 11 Input02.md @@ -0,0 +1,911 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 11 Input02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html) +[#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) + +计算机实验室 – 树莓派开发: 课程11 输入02 +====== + +课程输入02是以课程输入01基础讲解的,通过一个简单的命令行实现用户的命令输入和计算机的处理和显示。本文假设你已经具备 [课程11:输入01][1] 的操作系统代码基础。 + +### 1 终端 + +``` +早期的计算一般是在一栋楼里的一个巨型计算机系统,他有很多可以输命令的'终端'。计算机依次执行不同来源的命令。 +``` + +几乎所有的操作系统都是以字符终端显示启动的。经典的黑底白字,通过键盘输入计算机要执行的命令,然后会提示你拼写错误,或者恰好得到你想要的执行结果。这种方法有两个主要优点:键盘和显示器可以提供简易,健壮的计算机交互机制,几乎所有的计算机系统都采用这个机制,这个也广泛被系统管理员应用。 + +让我们分析下真正想要哪些信息: + +1. 计算机打开后,显示欢迎信息 +2. 计算机启动后可以接受输入标志 +3. 用户从键盘输入带参数的命令 +4. 用户输入回车键或提交按钮 +5. 计算机解析命令后执行可用的命令 +6. 计算机显示命令的执行结果,过程信息 +7. 循环跳转到步骤2 + + +这样的终端被定义为标准的输入输出设备。用于输入的屏幕和输出打印的屏幕是同一个。也就是说终端是对字符显示的一个抽象。字符显示中,单个字符是最小的单元,而不是像素。屏幕被划分成固定数量不同颜色的字符。我们可以在现有的屏幕代码基础上,先存储字符和对应的颜色,然后再用方法 DrawCharacter 把其推送到屏幕上。一旦我们需要字符显示,就只需要在屏幕上画出一行字符串。 + +新建文件名为 terminal.s 如下: +``` +.section .data +.align 4 +terminalStart: +.int terminalBuffer +terminalStop: +.int terminalBuffer +terminalView: +.int terminalBuffer +terminalColour: +.byte 0xf +.align 8 +terminalBuffer: +.rept 128*128 +.byte 0x7f +.byte 0x0 +.endr +terminalScreen: +.rept 1024/8 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated 768/16 +.byte 0x7f +.byte 0x0 +.endr +``` +这是文件终端的配置数据文件。我们有两个主要的存储变量:terminalBuffer 和 terminalScreen。terminalBuffer保存所有显示过的字符。它保存128行字符文本(1行包含128个字符)。每个字符有一个 ASCII 字符和颜色单元组成,初始值为0x7f(ASCII的删除键)和 0(前景色和背景色为黑)。terminalScreen 保存当前屏幕显示的字符。它保存128x48的字符,与 terminalBuffer 初始化值一样。你可能会想我仅需要terminalScreen就够了,为什么还要terminalBuffer,其实有两个好处: + + 1. 我们可以很容易看到字符串的变化,只需画出有变化的字符。 + 2. 我们可以回滚终端显示的历史字符,也就是缓冲的字符(有限制) + + +你总是需要尝试去设计一个高效的系统,如果很少变化的条件这个系统会运行的更快。 + +独特的技巧在低功耗系统里很常见。画屏是很耗时的操作,因此我们仅在不得已的时候才去执行这个操作。在这个系统里,我们可以任意改变terminalBuffer,然后调用一个仅拷贝屏幕上字节变化的方法。也就是说我们不需要持续画出每个字符,这样可以节省一大段跨行文本的操作时间。 + +其他在 .data 段的值得含义如下: + + * terminalStart + 写入到 terminalBuffer 的第一个字符 + * terminalStop + 写入到 terminalBuffer 的最后一个字符 + * terminalView + 表示当前屏幕的第一个字符,这样我们可以控制滚动屏幕 + * temrinalColour + 即将被描画的字符颜色 + + +``` +循环缓冲区是**数据结构**一个例子。这是一个组织数据的思路,有时我们通过软件实现这种思路。 +``` + +![显示 Hellow world 插入到大小为5的循环缓冲区的示意图。][2] +terminalStart 需要保存起来的原因是 termainlBuffer 是一个循环缓冲区。意思是当缓冲区变满时,末尾地方会回滚覆盖开始位置,这样最后一个字符变成了第一个字符。因此我们需要将 terminalStart 往前推进,这样我们知道我们已经占满它了。如何实现缓冲区检测:如果索引越界到缓冲区的末尾,就将索引指向缓冲区的开始位置。循环缓冲区是一个比较常见的高明的存储大量数据的方法,往往这些数据的最近部分比较重要。它允许无限制的写入,只保证最近一些特定数据有效。这个常常用于信号处理和数据压缩算法。这样的情况,可以允许我们存储128行终端记录,超过128行也不会有问题。如果不是这样,当超过第128行时,我们需要把127行分别向前拷贝一次,这样很浪费时间。 + +之前已经提到过 terminalColour 几次了。你可以根据你的想法实现终端颜色,但这个文本终端有16个前景色和16个背景色(这里相当于有16²=256种组合)。[CGA][3]终端的颜色定义如下: + +表格 1.1 - CGA 颜色编码 + +| 序号 | 颜色 (R, G, B) | +| ------ | ------------------------| +| 0 | 黑 (0, 0, 0) | +| 1 | 蓝 (0, 0, ⅔) | +| 2 | 绿 (0, ⅔, 0) | +| 3 | 青色 (0, ⅔, ⅔) | +| 4 | 红色 (⅔, 0, 0) | +| 5 | 品红 (⅔, 0, ⅔) | +| 6 | 棕色 (⅔, ⅓, 0) | +| 7 | 浅灰色 (⅔, ⅔, ⅔) | +| 8 | 灰色 (⅓, ⅓, ⅓) | +| 9 | 淡蓝色 (⅓, ⅓, 1) | +| 10 | 淡绿色 (⅓, 1, ⅓) | +| 11 | 淡青色 (⅓, 1, 1) | +| 12 | 淡红色 (1, ⅓, ⅓) | +| 13 | 浅品红 (1, ⅓, 1) | +| 14 | 黄色 (1, 1, ⅓) | +| 15 | 白色 (1, 1, 1) | + +``` +棕色作为替代色(黑黄色)既不吸引人也没有什么用处。 +``` +我们将前景色保存到颜色的低字节,背景色保存到颜色高字节。除过棕色,其他这些颜色遵循一种模式如二进制的高位比特代表增加 ⅓ 到每个组件,其他比特代表增加⅔到各自组件。这样很容易进行RGB颜色转换。 + +我们需要一个方法从TerminalColour读取颜色编码的四个比特,然后用16比特等效参数调用 SetForeColour。尝试实现你自己实现。如果你感觉麻烦或者还没有完成屏幕系列课程,我们的实现如下: + +``` +.section .text +TerminalColour: +teq r0,#6 +ldreq r0,=0x02B5 +beq SetForeColour + +tst r0,#0b1000 +ldrne r1,=0x52AA +moveq r1,#0 +tst r0,#0b0100 +addne r1,#0x15 +tst r0,#0b0010 +addne r1,#0x540 +tst r0,#0b0001 +addne r1,#0xA800 +mov r0,r1 +b SetForeColour +``` +### 2 文本显示 + +我们的终端第一个真正需要的方法是 TerminalDisplay,它用来把当前的数据从 terminalBuffe r拷贝到 terminalScreen 和实际的屏幕。如上所述,这个方法必须是最小开销的操作,因为我们需要频繁调用它。它主要比较 terminalBuffer 与 terminalDisplay的文本,然后只拷贝有差异的字节。请记住 terminalBuffer 是循环缓冲区运行的,这种情况,从 terminalView 到 terminalStop 或者 128*48 字符集,哪个来的最快。如果我们遇到 terminalStop,我们将会假定在这之后的所有字符是7f16 (ASCII delete),背景色为0(黑色前景色和背景色)。 + +让我们看看必须要做的事情: + + 1. 加载 terminalView ,terminalStop 和 terminalDisplay 的地址。 + 2. 执行每一行: + 1. 执行每一列: + 1. 如果 terminalView 不等于 terminalStop,根据 terminalView 加载当前字符和颜色 + 2. 否则加载 0x7f 和颜色 0 + 3. 从 terminalDisplay 加载当前的字符 + 4. 如果字符和颜色相同,直接跳转到10 + 5. 存储字符和颜色到 terminalDisplay + 6. 用 r0 作为背景色参数调用 TerminalColour + 7. 用 r0 = 0x7f (ASCII 删除键, 一大块), r1 = x, r2 = y 调用 DrawCharacter + 8. 用 r0 作为前景色参数调用 TerminalColour + 9. 用 r0 = 字符, r1 = x, r2 = y 调用 DrawCharacter + 10. 对位置参数 terminalDisplay 累加2 + 11. 如果 terminalView 不等于 terminalStop不能相等 terminalView 位置参数累加2 + 12. 如果 terminalView 位置已经是文件缓冲器的末尾,将他设置为缓冲区的开始位置 + 13. x 坐标增加8 + 2. y 坐标增加16 + + +Try to implement this yourself. If you get stuck, my solution is given below: +尝试去自己实现吧。如果你遇到问题,我们的方案下面给出来了: + +1. +``` +.globl TerminalDisplay +TerminalDisplay: +push {r4,r5,r6,r7,r8,r9,r10,r11,lr} +x .req r4 +y .req r5 +char .req r6 +col .req r7 +screen .req r8 +taddr .req r9 +view .req r10 +stop .req r11 + +ldr taddr,=terminalStart +ldr view,[taddr,#terminalView - terminalStart] +ldr stop,[taddr,#terminalStop - terminalStart] +add taddr,#terminalBuffer - terminalStart +add taddr,#128*128*2 +mov screen,taddr +``` + +我这里的变量有点乱。为了方便起见,我用 taddr 存储 textBuffer 的末尾位置。 + +2. +``` +mov y,#0 +yLoop$: +``` +从yLoop开始运行。 + + 1. + ``` + mov x,#0 + xLoop$: + ``` + 从yLoop开始运行。 + + 1. + ``` + teq view,stop + ldrneh char,[view] + ``` + 为了方便起见,我把字符和颜色同时加载到 char 变量了 + + 2. + ``` + moveq char,#0x7f + ``` + 这行是对上面一行的补充说明:读取黑色的Delete键 + + 3. + ``` + ldrh col,[screen] + ``` + 为了简便我把字符和颜色同时加载到 col 里。 + + 4. + ``` + teq col,char + beq xLoopContinue$ + ``` + 现在我用teq指令检查是否有数据变化 + + 5. + ``` + strh char,[screen] + ``` + 我可以容易的保存当前值 + + 6. + ``` + lsr col,char,#8 + and char,#0x7f + lsr r0,col,#4 + bl TerminalColour + ``` + 我用 bitshift(比特偏移) 指令和 and 指令从 char 变量中分离出颜色到 col 变量和字符到 char变量,然后再用bitshift(比特偏移)指令后调用TerminalColour 获取背景色。 + + 7. + ``` + mov r0,#0x7f + mov r1,x + mov r2,y + bl DrawCharacter + ``` + 写入一个彩色的删除字符块 + + 8. + ``` + and r0,col,#0xf + bl TerminalColour + ``` + 用 and 指令获取 col 变量的最低字节,然后调用TerminalColour + + 9. + ``` + mov r0,char + mov r1,x + mov r2,y + bl DrawCharacter + ``` + 写入我们需要的字符 + + 10. + ``` + xLoopContinue$: + add screen,#2 + ``` + 自增屏幕指针 + + 11. + ``` + teq view,stop + addne view,#2 + ``` + 如果可能自增view指针 + + 12. + ``` + teq view,taddr + subeq view,#128*128*2 + ``` + 很容易检测 view指针是否越界到缓冲区的末尾,因为缓冲区的地址保存在 taddr 变量里 + + 13. + ``` + add x,#8 + teq x,#1024 + bne xLoop$ + ``` + 如果还有字符需要显示,我们就需要自增 x 变量然后循环到 xLoop 执行 + + 2. + ``` + add y,#16 + teq y,#768 + bne yLoop$ + ``` + 如果还有更多的字符显示我们就需要自增 y 变量,然后循环到 yLoop 执行 + +``` +pop {r4,r5,r6,r7,r8,r9,r10,r11,pc} +.unreq x +.unreq y +.unreq char +.unreq col +.unreq screen +.unreq taddr +.unreq view +.unreq stop +``` +不要忘记最后清除变量 + + +### 3 行打印 + +现在我有了自己 TerminalDisplay方法,它可以自动显示 terminalBuffer 到 terminalScreen,因此理论上我们可以画出文本。但是实际上我们没有任何基于字符显示的实例。 首先快速容易上手的方法便是 TerminalClear, 它可以彻底清除终端。这个方法没有循环很容易实现。可以尝试分析下面的方法应该不难: + +``` +.globl TerminalClear +TerminalClear: +ldr r0,=terminalStart +add r1,r0,#terminalBuffer-terminalStart +str r1,[r0] +str r1,[r0,#terminalStop-terminalStart] +str r1,[r0,#terminalView-terminalStart] +mov pc,lr +``` + +现在我们需要构造一个字符显示的基础方法:打印函数。它将保存在 r0 的字符串和 保存在 r1 字符串长度简易的写到屏幕上。有一些特定字符需要特别的注意,这些特定的操作是确保 terminalView 是最新的。我们来分析一下需要做啥: + + 1. 检查字符串的长度是否为0,如果是就直接返回 + 2. 加载 terminalStop 和 terminalView + 3. 计算出 terminalStop 的 x 坐标 + 4. 对每一个字符的操作: + 1. 检查字符是否为新起一行 + 2. 如果是的话,自增 bufferStop 到行末,同时写入黑色删除键 + 3. 否则拷贝当前 terminalColour 的字符 + 4. 加成是在行末 + 5. 如果是,检查从 terminalView 到 terminalStop 之间的字符数是否大于一屏 + 6. 如果是,terminalView 自增一行 + 7. 检查 terminalView 是否为缓冲区的末尾,如果是的话将其替换为缓冲区的起始位置 + 8. 检查 terminalStop 是否为缓冲区的末尾,如果是的话将其替换为缓冲区的起始位置 + 9. 检查 terminalStop 是否等于 terminalStart, 如果是的话 terminalStart 自增一行。 + 10. 检查 terminalStart 是否为缓冲区的末尾,如果是的话将其替换为缓冲区的起始位置 + 5. 存取 terminalStop 和 terminalView + + +试一下自己去实现。我们的方案提供如下: + +1. +``` +.globl Print +Print: +teq r1,#0 +moveq pc,lr +``` +这个是打印函数开始快速检查字符串为0的代码 + +2. +``` +push {r4,r5,r6,r7,r8,r9,r10,r11,lr} +bufferStart .req r4 +taddr .req r5 +x .req r6 +string .req r7 +length .req r8 +char .req r9 +bufferStop .req r10 +view .req r11 + +mov string,r0 +mov length,r1 + +ldr taddr,=terminalStart +ldr bufferStop,[taddr,#terminalStop-terminalStart] +ldr view,[taddr,#terminalView-terminalStart] +ldr bufferStart,[taddr] +add taddr,#terminalBuffer-terminalStart +add taddr,#128*128*2 +``` + +这里我做了很多配置。 bufferStart 代表 terminalStart, bufferStop代表terminalStop, view 代表 terminalView,taddr 代表 terminalBuffer 的末尾地址。 + +3. +``` +and x,bufferStop,#0xfe +lsr x,#1 +``` +和通常一样,巧妙的对齐技巧让许多事情更容易。由于需要对齐 terminalBuffer,每个字符的 x 坐标需要8位要除以2。 + + 4. + 1. + ``` + charLoop$: + ldrb char,[string] + and char,#0x7f + teq char,#'\n' + bne charNormal$ + ``` + 我们需要检查新行 + + 2. + ``` + mov r0,#0x7f + clearLine$: + strh r0,[bufferStop] + add bufferStop,#2 + add x,#1 + teq x,#128 blt clearLine$ + + b charLoopContinue$ + ``` + 循环执行值到行末写入 0x7f;黑色删除键 + + 3. + ``` + charNormal$: + strb char,[bufferStop] + ldr r0,=terminalColour + ldrb r0,[r0] + strb r0,[bufferStop,#1] + add bufferStop,#2 + add x,#1 + ``` + 存储字符串的当前字符和 terminalBuffer 末尾的 terminalColour然后将它和 x 变量自增 + + 4. + ``` + charLoopContinue$: + cmp x,#128 + blt noScroll$ + ``` + 检查 x 是否为行末;128 + + 5. + ``` + mov x,#0 + subs r0,bufferStop,view + addlt r0,#128*128*2 + cmp r0,#128*(768/16)*2 + ``` + 这是 x 为 0 然后检查我们是否已经显示超过1屏。请记住,我们是用的循环缓冲区,因此如果 bufferStop 和 view 之前差是负值,我们实际使用是环绕缓冲区。 + + 6. + ``` + addge view,#128*2 + ``` + 增加一行字节到 view 的地址 + + 7. + ``` + teq view,taddr + subeq view,taddr,#128*128*2 + ``` + 如果 view 地址是缓冲区的末尾,我们就从它上面减去缓冲区的长度,让其指向开始位置。我会在开始的时候设置 taddr 为缓冲区的末尾地址。 + + 8. + ``` + noScroll$: + teq bufferStop,taddr + subeq bufferStop,taddr,#128*128*2 + ``` + 如果 stop 的地址在缓冲区末尾,我们就从它上面减去缓冲区的长度,让其指向开始位置。我会在开始的时候设置 taddr 为缓冲区的末尾地址。 + + 9. + ``` + teq bufferStop,bufferStart + addeq bufferStart,#128*2 + ``` + 检查 bufferStop 是否等于 bufferStart。 如果等于增加一行到 bufferStart。 + + 10. + ``` + teq bufferStart,taddr + subeq bufferStart,taddr,#128*128*2 + ``` + 如果 start 的地址在缓冲区的末尾,我们就从它上面减去缓冲区的长度,让其指向开始位置。我会在开始的时候设置 taddr 为缓冲区的末尾地址。 + +``` +subs length,#1 +add string,#1 +bgt charLoop$ +``` +循环执行知道字符串结束 + +5. +``` +charLoopBreak$: +sub taddr,#128*128*2 +sub taddr,#terminalBuffer-terminalStart +str bufferStop,[taddr,#terminalStop-terminalStart] +str view,[taddr,#terminalView-terminalStart] +str bufferStart,[taddr] + +pop {r4,r5,r6,r7,r8,r9,r10,r11,pc} +.unreq bufferStart +.unreq taddr +.unreq x +.unreq string +.unreq length +.unreq char +.unreq bufferStop +.unreq view +``` +保存变量然后返回 + + +这个方法允许我们打印任意字符到屏幕。然而我们用了颜色变量,但实际上没有设置它。一般终端用特性的组合字符去行修改颜色。如ASCII转移(1b16)后面跟着一个0-f的16进制的书,就可以设置前景色为 CGA颜色。如果你自己想尝试实现;在下载页面有一个我的详细的例子。 + + +### 4 标志输入 + +``` +按照惯例,许多编程语言中,任意程序可以访问 stdin 和 stdin,他们可以连接到终端的输入和输出流。在图形程序其实也可以进行同样操作,但实际几乎不用。 +``` + +现在我们有一个可以打印和显示文本的输出终端。这仅仅是说了一半,我们需要输入。我们想实现一个方法:Readline,可以保存文件的一行文本,文本位置有 r0 给出,最大的长度由 r1 给出,返回 r0 里面的字符串长度。棘手的是用户输出字符的时候要回显功能,同时想要退格键的删除功能和命令回车执行功能。他们还想需要一个闪烁的下划线代表计算机需要输入。这些完全合理的要求让构造这个方法更具有挑战性。有一个方法完成这些需求就是存储用户输入的文本和文件大小到内存的某个地方。然后当调用 ReadLine 的时候,移动 terminalStop 的地址到它开始的地方然后调用 Print。也就是说我们只需要确保在内存维护一个字符串,然后构造一个我们自己的打印函数。 + +让我们看看 ReadLine做了哪些事情: + + 1. 如果字符串可保存的最大长度为0,直接返回 + 2. 检索 terminalStop 和 terminalStop 的当前值 + 3. 如果字符串的最大长度大约缓冲区的一半,就设置大小为缓冲区的一半 + 4. 从最大长度里面减去1来确保输入的闪烁字符或结束符 + 5. 向字符串写入一个下划线 + 6. 写入一个 terminalView 和 terminalStop 的地址到内存 + 7. 调用 Print 大约当前字符串 + 8. 调用 TerminalDisplay + 9. 调用 KeyboardUpdate + 10. 调用 KeyboardGetChar + 11. 如果为一个新行直接跳转到16 + 12. 如果是一个退格键,将字符串长度减一(如果其大约0) + 13. 如果是一个普通字符,将他写入字符串(字符串大小确保小于最大值) + 14. 如果字符串是以下划线结束,写入一个空格,否则写入下划线 + 15. 跳转到6 + 16. 字符串的末尾写入一个新行 + 17. 调用 Print 和 TerminalDisplay + 18. 用结束符替换新行 + 19. 返回字符串的长度 + + + +为了方便读者理解,然后然后自己去实现,我们的实现提供如下: + +1. +``` +.globl ReadLine +ReadLine: +teq r1,#0 +moveq r0,#0 +moveq pc,lr +``` +快速处理长度为0的情况 + +2. +``` +string .req r4 +maxLength .req r5 +input .req r6 +taddr .req r7 +length .req r8 +view .req r9 + +push {r4,r5,r6,r7,r8,r9,lr} + +mov string,r0 +mov maxLength,r1 +ldr taddr,=terminalStart +ldr input,[taddr,#terminalStop-terminalStart] +ldr view,[taddr,#terminalView-terminalStart] +mov length,#0 +``` +考虑到常见的场景,我们初期做了很多初始化动作。input 代表 terminalStop 的值,view 代表 terminalView。Length 默认为 0. + +3. +``` +cmp maxLength,#128*64 +movhi maxLength,#128*64 +``` +我们必须检查异常大的读操作,我们不能处理超过 terminalBuffer 大小的输入(理论上可行,但是terminalStart 移动越过存储的terminalStop,会有很多问题)。 + +4. +``` +sub maxLength,#1 +``` +由于用户需要一个闪烁的光标,我们需要一个备用字符在理想状况在这个字符串后面放一个结束符。 + +5. +``` +mov r0,#'_' +strb r0,[string,length] +``` +写入一个下划线让用户知道我们可以输入了。 + +6. +``` +readLoop$: +str input,[taddr,#terminalStop-terminalStart] +str view,[taddr,#terminalView-terminalStart] +``` +保存 terminalStop 和 terminalView。这个对重置一个终端很重要,它会修改这些变量。严格讲也可以修改 terminalStart,但是不可逆。 + +7. +``` +mov r0,string +mov r1,length +add r1,#1 +bl Print +``` +写入当前的输入。由于下划线因此字符串长度加1 +8. +``` +bl TerminalDisplay +``` +拷贝下一个文本到屏幕 + +9. +``` +bl KeyboardUpdate +``` +获取最近一次键盘输入 + +10. +``` +bl KeyboardGetChar +``` +检索键盘输入键值 + +11. +``` +teq r0,#'\n' +beq readLoopBreak$ +teq r0,#0 +beq cursor$ +teq r0,#'\b' +bne standard$ +``` + +如果我们有一个回车键,循环中断。如果有结束符和一个退格键也会同样跳出选好。 + +12. +``` +delete$: +cmp length,#0 +subgt length,#1 +b cursor$ +``` +从 length 里面删除一个字符 + +13. +``` +standard$: +cmp length,maxLength +bge cursor$ +strb r0,[string,length] +add length,#1 +``` +写回一个普通字符 + +14. +``` +cursor$: +ldrb r0,[string,length] +teq r0,#'_' +moveq r0,#' ' +movne r0,#'_' +strb r0,[string,length] +``` +加载最近的一个字符,如果不是下换线则修改为下换线,如果是空格则修改为下划线 + +15. +``` +b readLoop$ +readLoopBreak$: +``` +循环执行值到用户输入按下 + +16. +``` +mov r0,#'\n' +strb r0,[string,length] +``` +在字符串的结尾处存入一新行 + +17. +``` +str input,[taddr,#terminalStop-terminalStart] +str view,[taddr,#terminalView-terminalStart] +mov r0,string +mov r1,length +add r1,#1 +bl Print +bl TerminalDisplay +``` +重置 terminalView 和 terminalStop 然后调用 Print 和 TerminalDisplay 输入回显 + + +18. +``` +mov r0,#0 +strb r0,[string,length] +``` +写入一个结束符 + +19. +``` +mov r0,length +pop {r4,r5,r6,r7,r8,r9,pc} +.unreq string +.unreq maxLength +.unreq input +.unreq taddr +.unreq length +.unreq view +``` +返回长度 + + + + +### 5 终端: 机器进化 + +现在我们理论用终端和用户可以交互了。最显而易见的事情就是拿去测试了!在 'main.s' 里UsbInitialise后面的删除代码如下 + +``` +reset$: + mov sp,#0x8000 + bl TerminalClear + + ldr r0,=welcome + mov r1,#welcomeEnd-welcome + bl Print + +loop$: + ldr r0,=prompt + mov r1,#promptEnd-prompt + bl Print + + ldr r0,=command + mov r1,#commandEnd-command + bl ReadLine + + teq r0,#0 + beq loopContinue$ + + mov r4,r0 + + ldr r5,=command + ldr r6,=commandTable + + ldr r7,[r6,#0] + ldr r9,[r6,#4] + commandLoop$: + ldr r8,[r6,#8] + sub r1,r8,r7 + + cmp r1,r4 + bgt commandLoopContinue$ + + mov r0,#0 + commandName$: + ldrb r2,[r5,r0] + ldrb r3,[r7,r0] + teq r2,r3 + bne commandLoopContinue$ + add r0,#1 + teq r0,r1 + bne commandName$ + + ldrb r2,[r5,r0] + teq r2,#0 + teqne r2,#' ' + bne commandLoopContinue$ + + mov r0,r5 + mov r1,r4 + mov lr,pc + mov pc,r9 + b loopContinue$ + + commandLoopContinue$: + add r6,#8 + mov r7,r8 + ldr r9,[r6,#4] + teq r9,#0 + bne commandLoop$ + + ldr r0,=commandUnknown + mov r1,#commandUnknownEnd-commandUnknown + ldr r2,=formatBuffer + ldr r3,=command + bl FormatString + + mov r1,r0 + ldr r0,=formatBuffer + bl Print + +loopContinue$: + bl TerminalDisplay + b loop$ + +echo: + cmp r1,#5 + movle pc,lr + + add r0,#5 + sub r1,#5 + b Print + +ok: + teq r1,#5 + beq okOn$ + teq r1,#6 + beq okOff$ + mov pc,lr + + okOn$: + ldrb r2,[r0,#3] + teq r2,#'o' + ldreqb r2,[r0,#4] + teqeq r2,#'n' + movne pc,lr + mov r1,#0 + b okAct$ + + okOff$: + ldrb r2,[r0,#3] + teq r2,#'o' + ldreqb r2,[r0,#4] + teqeq r2,#'f' + ldreqb r2,[r0,#5] + teqeq r2,#'f' + movne pc,lr + mov r1,#1 + + okAct$: + + mov r0,#16 + b SetGpio + +.section .data +.align 2 +welcome: .ascii "Welcome to Alex's OS - Everyone's favourite OS" +welcomeEnd: +.align 2 +prompt: .ascii "\n> " +promptEnd: +.align 2 +command: + .rept 128 + .byte 0 + .endr +commandEnd: +.byte 0 +.align 2 +commandUnknown: .ascii "Command `%s' was not recognised.\n" +commandUnknownEnd: +.align 2 +formatBuffer: + .rept 256 + .byte 0 + .endr +formatEnd: + +.align 2 +commandStringEcho: .ascii "echo" +commandStringReset: .ascii "reset" +commandStringOk: .ascii "ok" +commandStringCls: .ascii "cls" +commandStringEnd: + +.align 2 +commandTable: +.int commandStringEcho, echo +.int commandStringReset, reset$ +.int commandStringOk, ok +.int commandStringCls, TerminalClear +.int commandStringEnd, 0 +``` +这块代码集成了一个简易的命令行操作系统。支持命令:echo,reset,ok 和 cls。echo 拷贝任意文本到终端,reset命令会在系统出现问题的是复位操作系统,ok 有两个功能:设置 OK 灯亮灭,最后 cls 调用 TerminalClear 清空终端。 + +试试树莓派的代码吧。如果遇到问题,请参照问题集锦页面吧。 + +如果运行正常,祝贺你完成了一个操作系统基本终端和输入系列的课程。很遗憾这个教程先讲到这里,但是我希望将来能制作更多教程。有问题请反馈至awc32@cam.ac.uk。 + +你已经在建立了一个简易的终端操作系统。我们的代码在 commandTable 构造了一个可用的命令表格。每个表格的入口是一个整型数字,用来表示字符串的地址,和一个整型数字表格代码的执行入口。 最后一个入口是 为 0 的commandStringEnd。尝试实现你自己的命令,可以参照已有的函数,建立一个新的。函数的参数 r0 是用户输入的命令地址,r1是其长度。你可以用这个传递你输入值到你的命令。也许你有一个计算器程序,或许是一个绘图程序或国际象棋。不管你的什么电子,让它跑起来! + + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input02.html + +作者:[Alex Chadwick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/guevaraya) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.cl.cam.ac.uk +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/circular_buffer.png +[3]: https://en.wikipedia.org/wiki/Color_Graphics_Adapter From 50f6079b94fe33c0d09847b283fa2c97805e2052 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 18:02:04 +0800 Subject: [PATCH 124/813] APL:20190125 Top 5 Linux Distributions for Development in 2019 --- ...0190125 Top 5 Linux Distributions for Development in 2019.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md b/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md index b3e2de22ba..12df85e27a 100644 --- a/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md +++ b/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 607caf67d2d89488f9ea19e75fa131dd0097627c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 19:08:03 +0800 Subject: [PATCH 125/813] TSL:20190125 Top 5 Linux Distributions for Development in 2019.md --- ...x Distributions for Development in 2019.md | 161 ------------------ ...x Distributions for Development in 2019.md | 138 +++++++++++++++ 2 files changed, 138 insertions(+), 161 deletions(-) delete mode 100644 sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md create mode 100644 translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md diff --git a/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md b/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md deleted file mode 100644 index 12df85e27a..0000000000 --- a/sources/tech/20190125 Top 5 Linux Distributions for Development in 2019.md +++ /dev/null @@ -1,161 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 Linux Distributions for Development in 2019) -[#]: via: (https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -Top 5 Linux Distributions for Development in 2019 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev-main.jpg?itok=DEe9pYtb) - -One of the most popular tasks undertaken on Linux is development. With good reason: Businesses rely on Linux. Without Linux, technology simply wouldn’t meet the demands of today’s ever-evolving world. Because of that, developers are constantly working to improve the environments with which they work. One way to manage such improvements is to have the right platform to start with. Thankfully, this is Linux, so you always have a plethora of choices. - -But sometimes, too many choices can be a problem in and of itself. Which distribution is right for your development needs? That, of course, depends on what you’re developing, but certain distributions that just make sense to use as a foundation for your task. I’ll highlight five distributions I consider the best for developers in 2019. - -### Ubuntu - -Let’s not mince words here. Although the Linux Mint faithful are an incredibly loyal group (with good reason, their distro of choice is fantastic), Ubuntu Linux gets the nod here. Why? Because, thanks to the likes of [AWS][1], Ubuntu is one of the most deployed server operating systems. That means developing on a Ubuntu desktop distribution makes for a much easier translation to Ubuntu Server. And because Ubuntu makes it incredibly easy to develop for, work with, and deploy containers, it makes perfect sense that you’d want to work with this platform. Couple that with Ubuntu’s inclusion of Snap Packages, and Canonical's operating system gets yet another boost in popularity. - -But it’s not just about what you can do with Ubuntu, it’s how easily you can do it. For nearly every task, Ubuntu is an incredibly easy distribution to use. And because Ubuntu is so popular, chances are every tool and IDE you want to work with can be easily installed from the Ubuntu Software GUI (Figure 1). - -![Ubuntu][3] - -Figure 1: Developer tools found in the Ubuntu Software tool. - -[Used with permission][4] - -If you’re looking for ease of use, simplicity of migration, and plenty of available tools, you cannot go wrong with Ubuntu as a development platform. - -### openSUSE - -There’s a very specific reason why I add openSUSE to this list. Not only is it an outstanding desktop distribution, it’s also one of the best rolling releases you’ll find on the market. So if you’re wanting to develop with and release for the most recent software available, [openSUSE Tumbleweed][5] should be one of your top choices. If you want to leverage the latest releases of your favorite IDEs, if you always want to make sure you’re developing with the most recent libraries and toolkits, Tumbleweed is your platform. - -But openSUSE doesn’t just offer a rolling release distribution. If you’d rather make use of a standard release platform, [openSUSE Leap][6] is what you want. - -Of course, it’s not just about standard or rolling releases. The openSUSE platform also has a Kubernetes-specific release, called [Kubic][7], which is based on Kubernetes atop openSUSE MicroOS. But even if you aren’t developing for Kubernetes, you’ll find plenty of software and tools to work with. - -And openSUSE also offers the ability to select your desktop environment, or (should you chose) a generic desktop or server (Figure 2). - -![openSUSE][9] - -Figure 2: The openSUSE Tumbleweed installation in action. - -[Used with permission][4] - -### Fedora - -Using Fedora as a development platform just makes sense. Why? The distribution itself seems geared toward developers. With a regular, six month release cycle, developers can be sure they won’t be working with out of date software for long. This can be important, when you need the most recent tools and libraries. And if you’re developing for enterprise-level businesses, Fedora makes for an ideal platform, as it is the upstream for Red Hat Enterprise Linux. What that means is the transition to RHEL should be painless. That’s important, especially if you hope to bring your project to a much larger market (one with deeper pockets than a desktop-centric target). - -Fedora also offers one of the best GNOME experiences you’ll come across (Figure 3). This translates to a very stable and fast desktops. - -![GNOME][11] - -Figure 3: The GNOME desktop on Fedora. - -[Used with permission][4] - -But if GNOME isn’t your jam, you can opt to install one of the [Fedora spins][12] (which includes KDE, XFCE, LXQT, Mate-Compiz, Cinnamon, LXDE, and SOAS). - -### Pop!_OS - -I’d be remiss if I didn’t include [System76][13]’s platform, customized specifically for their hardware (although it does work fine on other hardware). Why would I include such a distribution, especially one that doesn’t really venture far away from the Ubuntu platform for which is is based? Primarily because this is the distribution you want if you plan on purchasing a desktop or laptop from System76. But why would you do that (especially given that Linux works on nearly all off-the-shelf hardware)? Because System76 sells outstanding hardware. With the release of their Thelio desktop, you have available one of the most powerful desktop computers on the market. If you’re developing seriously large applications (especially ones that lean heavily on very large databases or require a lot of processing power for compilation), why not go for the best? And since Pop!_OS is perfectly tuned for System76 hardware, this is a no-brainer. -Since Pop!_OS is based on Ubuntu, you’ll have all the tools available to the base platform at your fingertips (Figure 4). - -![Pop!_OS][15] - -Figure 4: The Anjunta IDE running on Pop!_OS. - -[Used with permission][4] - -Pop!_OS also defaults to encrypted drives, so you can trust your work will be safe from prying eyes (should your hardware fall into the wrong hands). - -### Manjaro - -For anyone that likes the idea of developing on Arch Linux, but doesn’t want to have to jump through all the hoops of installing and working with Arch Linux, there’s Manjaro. Manjaro makes it easy to have an Arch Linux-based distribution up and running (as easily as installing and using, say, Ubuntu). - -But what makes Manjaro developer-friendly (besides enjoying that Arch-y goodness at the base) is how many different flavors you’ll find available for download. From the [Manjaro download page][16], you can grab the following flavors: - - * GNOME - - * XFCE - - * KDE - - * OpenBox - - * Cinnamon - - * I3 - - * Awesome - - * Budgie - - * Mate - - * Xfce Developer Preview - - * KDE Developer Preview - - * GNOME Developer Preview - - * Architect - - * Deepin - - - - -Of note are the developer editions (which are geared toward testers and developers), the Architect edition (which is for users who want to build Manjaro from the ground up), and the Awesome edition (Figure 5 - which is for developers dealing with everyday tasks). The one caveat to using Manjaro is that, like any rolling release, the code you develop today may not work tomorrow. Because of this, you need to think with a certain level of agility. Of course, if you’re not developing for Manjaro (or Arch), and you’re doing more generic (or web) development, that will only affect you if the tools you use are updated and no longer work for you. Chances of that happening, however, are slim. And like with most Linux distributions, you’ll find a ton of developer tools available for Manjaro. - -![Manjaro][18] - -Figure 5: The Manjaro Awesome Edition is great for developers. - -[Used with permission][4] - -Manjaro also supports the Arch User Repository (a community-driven repository for Arch users), which includes cutting edge software and libraries, as well as proprietary applications like [Unity Editor][19] or yEd. A word of warning, however, about the Arch User Repository: It was discovered that the AUR contained software considered to be malicious. So, if you opt to work with that repository, do so carefully and at your own risk. - -### Any Linux Will Do - -Truth be told, if you’re a developer, just about any Linux distribution will work. This is especially true if you do most of your development from the command line. But if you prefer a good GUI running on top of a reliable desktop, give one of these distributions a try, they will not disappoint. - -Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019 - -作者:[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://aws.amazon.com/ -[2]: https://www.linux.com/files/images/dev1jpg -[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_1.jpg?itok=7QJQWBKi (Ubuntu) -[4]: https://www.linux.com/licenses/category/used-permission -[5]: https://en.opensuse.org/Portal:Tumbleweed -[6]: https://en.opensuse.org/Portal:Leap -[7]: https://software.opensuse.org/distributions/tumbleweed -[8]: /files/images/dev2jpg -[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_2.jpg?itok=1GJmpr1t (openSUSE) -[10]: /files/images/dev3jpg -[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_3.jpg?itok=_6Ki4EOo (GNOME) -[12]: https://spins.fedoraproject.org/ -[13]: https://system76.com/ -[14]: /files/images/dev4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_4.jpg?itok=nNG2Ax24 (Pop!_OS) -[16]: https://manjaro.org/download/ -[17]: /files/images/dev5jpg -[18]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_5.jpg?itok=RGfF2UEi (Manjaro) -[19]: https://unity3d.com/unity/editor -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md b/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md new file mode 100644 index 0000000000..c7cec1b5a3 --- /dev/null +++ b/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Distributions for Development in 2019) +[#]: via: (https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +5 个用于开发工作的 Linux 发行版 +====== + +> 这五个发行版用于开发工作将不会让你失望。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev-main.jpg?itok=DEe9pYtb) + +Linux 上最受欢迎的任务之一肯定是开发。理由很充分:业务依赖 Linux。没有 Linux,技术根本无法满足当今不断发展的世界的需求。因此,开发人员不断努力改善他们的工作环境。而进行此类改善的一种方法就是拥有合适的平台。值得庆幸的是,这就是 Linux,所以你总是有很多选择。 + +但有时候,太多的选择本身就是一个问题。哪种发行版适合你的开发需求?当然,这取决于你正在开发的工作,但某些发行版更适合作为你的工作任务的基础。我将重点介绍我认为 2019 年最适合开发人员的五个发行版。 + +### Ubuntu + +无需赘言。虽然 Linux Mint 的忠实用户无疑是一个非常忠诚的群体(这是有充分的理由的,他们选择的发行版很棒),但 Ubuntu Linux 在这里更被认可。为什么?因为有像 [AWS][1] 这样的云服务商存在,Ubuntu 成了部署最多的服务器操作系统之一。这意味着在 Ubuntu 桌面发行版上进行开发可以更轻松地转换为 Ubuntu Server。而且因为 Ubuntu 使得开发、使用和部署容器非常容易,所以你想要使用这个平台是完全合理的。而 Ubuntu 与其包含的 Snap 软件包相结合,使得这个 Canonical(Ubuntu 发行版背后的公司)的操作系统如虎添翼。 + +但这不仅是你可以用 Ubuntu 做什么,而是你可以轻松做到。几乎对于所有的任务,Ubuntu 都是一个非常易用的发行版。而且因为 Ubuntu 如此受欢迎,所以你可以从 Ubuntu “软件” 应用的图形界面里轻松安装你想要使用的每个工具和 IDE(图 1)。 + +![Ubuntu][3] + +*图 1:可以在 Ubuntu “软件”工具里面找到开发者工具。* + +如果你正在寻求易用、易于迁移,以及大量的工具,那么将 Ubuntu 作为开发平台就不会有错。 + +### openSUSE + +我将 openSUSE 添加到此列表中有一个非常具体的原因。它不仅是一个出色的桌面发行版,它还是市场上最好的滚动发行版之一。因此,如果你希望用最新的软件开发、发布最新的软件,[openSUSE Tumbleweed][5] 应该是你的首选之一。如果你想使用最喜欢的 IDE 的最新版本,如果你总是希望确保使用最新的库和工具包进行开发,那么 Tumbleweed 就是你的平台。 + +但 openSUSE 不仅提供滚动发布版本。如果你更愿意使用标准发行版,那么 [openSUSE Leap][6] 就是你想要的。 + +当然,它不仅有标准版或滚动版,openSUSE 平台还有一个名为 [Kubic][7] 的 Kubernetes 特定版本,该版本基于 openSUSE MicroOS 上的 Kubernetes。但即使你没有为 Kubernetes 进行开发,你也会发现许多软件和工具可供使用。 + +openSUSE 还提供了选择桌面环境的能力,或者你也可以选择通用桌面或服务器(图 2)。 + +![openSUSE][9] + +*图 2: 正在安装 openSUSE Tumbleweed。* + +### Fedora + +使用 Fedora 作为开发平台才有意义。为什么?这个发行版本身似乎是面向开发人员的。通过定期的六个月发布周期,开发人员可以确保他们不会一直使用过时的软件。当你需要最新的工具和库时,这很重要。如果你正在开发企业级业务,Fedora 是一个理想的平台,因为它是红帽企业 Linux(RHEL)的上游。这意味着向 RHEL 的过渡应该是无痛的。这一点很重要,特别是如果你希望将你的项目带到一个更大的市场(一个比以桌面为中心的目标更深的领域)。 + +Fedora 还提供了你将体验到的最佳 GNOME 体验之一(图 3)。换言之,这是非常稳定和快速的桌面。 + +![GNOME][11] + +*图 3:Fedora 上的 GNOME 桌面。* + +但是如果 GNOME 不是你的菜,你还可以选择安装一个 [Fedora 花样版][12](包括 KDE、XFCE、LXQT、Mate-Compiz、Cinnamon、LXDE 和 SOAS)。 + +### Pop!_OS + +如果我不包括 [System76][13] 平台专门为他们的硬件定制的操作系统(虽然它也在其他硬件上运行良好),那我算是失职了。为什么我要包含这样的发行版,尤其是它还并未远离其所基于的 Ubuntu 平台? 主要是因为如果你计划从 System76 购买台式机或笔记本电脑,那它就是你想要的发行版。但是你为什么要这样做呢(特别是考虑到 Linux 几乎适用于所有现成的硬件)?因为 System76 销售的出色硬件。随着他们的 Thelio 桌面的发布,这是你可以使用的市场上最强大的台式计算机之一。如果你正在努力开发大型应用程序(特别是那些非常依赖于非常大的数据库或需要大量处理能力进行编译的应用程序),为什么不用最好的计算机呢?而且由于 Pop!_OS 完全适用于 System76 硬件,因此这是一个明智的选择。 + +由于 Pop!_OS 基于 Ubuntu,因此你可以轻松获得其所基于的 Ubuntu 可用的所有工具(图 4)。 + +![Pop!_OS][15] + +*图 4:运行在 Pop!_OS 上的 Anjunta IDE* + +Pop!_OS 也会默认加密驱动器,因此你可以放心你的工作可以避免窥探(如果你的硬件落入坏人之手)。 + +### Manjaro + +对于那些喜欢在 Arch Linux 上开发,但不想经历安装和使用 Arch Linux 的所有环节的人来说,那就是 Manjaro。Manjaro 可以轻松地启动和运行一个基于 Arch Linux 的发行版(就像安装和使用 Ubuntu 一样简单)。 + +但是 Manjaro 对开发人员友好的原因(除了享受 Arch 式本色)是你可以下载好多种不同口味的桌面。从[Manjaro 下载页面][16] 中,你可以获得以下口味: + + * GNOME + * XFCE + * KDE + * OpenBox + * Cinnamon + * I3 + * Awesome + * Budgie + * Mate + * Xfce 开发者预览版 + * KDE 开发者预览版 + * GNOME 开发者预览版 + * Architect + * Deepin + +值得注意的是它的开发者版本(面向测试人员和开发人员),Architect 版本(适用于想要从头开始构建 Manjaro 的用户)和 Awesome 版本(图 5,适用于开发人员处理日常工作的版本)。使用 Manjaro 的一个警告是,与任何滚动版本一样,你今天开发的代码可能明天无法运行。因此,你需要具备一定程度的敏捷性。当然,如果你没有为 Manjaro(或 Arch)做开发,并且你正在进行工作更多是通用的(或 Web)开发,那么只有当你使用的工具被更新了且不再适合你时,才会影响你。然而,这种情况发生的可能性很小。和大多数 Linux 发行版一样,你会发现 Manjaro 有大量的开发工具。 + +![Manjaro][18] + +*图 5:Manjaro Awesome 版对于开发者来说很棒。* + +Manjaro 还支持 AUR(Arch User Repository —— Arch 用户的社区驱动软件库),其中包括最先进的软件和库,以及 [Unity Editor][19] 或 yEd 等专有应用程序。但是,有个关于 AUR 的警告:AUR 包含的软件中被怀疑发现了恶意软件。因此,如果你选择使用 AUR,请谨慎操作,风险自负。 + +### 其实任何 Linux 都可以 + +说实话,如果你是开发人员,几乎任何 Linux 发行版都可以工作。如果从命令行执行大部分开发,则尤其如此。但是如果你喜欢在可靠的桌面上运行一个好的图形界面程序,试试这些发行版中的一个,它们不会令人失望。 + +通过 Linux 基金会和 edX 的免费[“Linux 简介”][20]课程了解有关 Linux 的更多信息。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019 + +作者:[Jack Wallen][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.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://aws.amazon.com/ +[2]: https://www.linux.com/files/images/dev1jpg +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_1.jpg?itok=7QJQWBKi (Ubuntu) +[4]: https://www.linux.com/licenses/category/used-permission +[5]: https://en.opensuse.org/Portal:Tumbleweed +[6]: https://en.opensuse.org/Portal:Leap +[7]: https://software.opensuse.org/distributions/tumbleweed +[8]: /files/images/dev2jpg +[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_2.jpg?itok=1GJmpr1t (openSUSE) +[10]: /files/images/dev3jpg +[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_3.jpg?itok=_6Ki4EOo (GNOME) +[12]: https://spins.fedoraproject.org/ +[13]: https://system76.com/ +[14]: /files/images/dev4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_4.jpg?itok=nNG2Ax24 (Pop!_OS) +[16]: https://manjaro.org/download/ +[17]: /files/images/dev5jpg +[18]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev_5.jpg?itok=RGfF2UEi (Manjaro) +[19]: https://unity3d.com/unity/editor +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 3745ea698eed9a6a1c05c3a4c43de85fa228b4eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 23:15:08 +0800 Subject: [PATCH 126/813] PRF:20190125 Top 5 Linux Distributions for Development in 2019.md @wxy --- ... Linux Distributions for Development in 2019.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md b/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md index c7cec1b5a3..db40b24947 100644 --- a/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md +++ b/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 5 Linux Distributions for Development in 2019) @@ -14,7 +14,7 @@ ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dev-main.jpg?itok=DEe9pYtb) -Linux 上最受欢迎的任务之一肯定是开发。理由很充分:业务依赖 Linux。没有 Linux,技术根本无法满足当今不断发展的世界的需求。因此,开发人员不断努力改善他们的工作环境。而进行此类改善的一种方法就是拥有合适的平台。值得庆幸的是,这就是 Linux,所以你总是有很多选择。 +Linux 上最受欢迎的任务之一肯定是开发。理由很充分:业务依赖于 Linux。没有 Linux,技术根本无法满足当今不断发展的世界的需求。因此,开发人员不断努力改善他们的工作环境。而进行此类改善的一种方法就是拥有合适的平台。值得庆幸的是,这就是 Linux,所以你总是有很多选择。 但有时候,太多的选择本身就是一个问题。哪种发行版适合你的开发需求?当然,这取决于你正在开发的工作,但某些发行版更适合作为你的工作任务的基础。我将重点介绍我认为 2019 年最适合开发人员的五个发行版。 @@ -54,11 +54,11 @@ Fedora 还提供了你将体验到的最佳 GNOME 体验之一(图 3)。换 *图 3:Fedora 上的 GNOME 桌面。* -但是如果 GNOME 不是你的菜,你还可以选择安装一个 [Fedora 花样版][12](包括 KDE、XFCE、LXQT、Mate-Compiz、Cinnamon、LXDE 和 SOAS)。 +但是如果 GNOME 不是你的菜,你还可以选择安装一个 [Fedora 花样版][12](包括 KDE、XFCE、LXQT、Mate-Compiz、Cinnamon、LXDE 和 SOAS 等桌面环境)。 ### Pop!_OS -如果我不包括 [System76][13] 平台专门为他们的硬件定制的操作系统(虽然它也在其他硬件上运行良好),那我算是失职了。为什么我要包含这样的发行版,尤其是它还并未远离其所基于的 Ubuntu 平台? 主要是因为如果你计划从 System76 购买台式机或笔记本电脑,那它就是你想要的发行版。但是你为什么要这样做呢(特别是考虑到 Linux 几乎适用于所有现成的硬件)?因为 System76 销售的出色硬件。随着他们的 Thelio 桌面的发布,这是你可以使用的市场上最强大的台式计算机之一。如果你正在努力开发大型应用程序(特别是那些非常依赖于非常大的数据库或需要大量处理能力进行编译的应用程序),为什么不用最好的计算机呢?而且由于 Pop!_OS 完全适用于 System76 硬件,因此这是一个明智的选择。 +如果这个列表中我没有包括 [System76][13] 平台专门为他们的硬件定制的操作系统(虽然它也在其他硬件上运行良好),那我算是失职了。为什么我要包含这样的发行版,尤其是它还并未远离其所基于的 Ubuntu 平台?主要是因为如果你计划从 System76 购买台式机或笔记本电脑,那它就是你想要的发行版。但是你为什么要这样做呢(特别是考虑到 Linux 几乎适用于所有现成的硬件)?因为 System76 销售的出色硬件。随着他们的 Thelio 桌面的发布,这是你可以使用的市场上最强大的台式计算机之一。如果你正在努力开发大型应用程序(特别是那些非常依赖于非常大的数据库或需要大量处理能力进行编译的应用程序),为什么不用最好的计算机呢?而且由于 Pop!_OS 完全适用于 System76 硬件,因此这是一个明智的选择。 由于 Pop!_OS 基于 Ubuntu,因此你可以轻松获得其所基于的 Ubuntu 可用的所有工具(图 4)。 @@ -70,9 +70,9 @@ Pop!_OS 也会默认加密驱动器,因此你可以放心你的工作可以避 ### Manjaro -对于那些喜欢在 Arch Linux 上开发,但不想经历安装和使用 Arch Linux 的所有环节的人来说,那就是 Manjaro。Manjaro 可以轻松地启动和运行一个基于 Arch Linux 的发行版(就像安装和使用 Ubuntu 一样简单)。 +对于那些喜欢在 Arch Linux 上开发,但不想经历安装和使用 Arch Linux 的所有环节的人来说,那选择就是 Manjaro。Manjaro 可以轻松地启动和运行一个基于 Arch Linux 的发行版(就像安装和使用 Ubuntu 一样简单)。 -但是 Manjaro 对开发人员友好的原因(除了享受 Arch 式本色)是你可以下载好多种不同口味的桌面。从[Manjaro 下载页面][16] 中,你可以获得以下口味: +但是 Manjaro 对开发人员友好的原因(除了享受 Arch 式好处)是你可以下载好多种不同口味的桌面。从[Manjaro 下载页面][16] 中,你可以获得以下口味: * GNOME * XFCE @@ -110,7 +110,7 @@ via: https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-201 作者:[Jack Wallen][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 078e59a29c0b73d5a29422512275e03f8c056057 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 23:15:46 +0800 Subject: [PATCH 127/813] PUB:20190125 Top 5 Linux Distributions for Development in 2019.md @wxy https://linux.cn/article-10534-1.html --- ...90125 Top 5 Linux Distributions for Development in 2019.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190125 Top 5 Linux Distributions for Development in 2019.md (99%) diff --git a/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md b/published/20190125 Top 5 Linux Distributions for Development in 2019.md similarity index 99% rename from translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md rename to published/20190125 Top 5 Linux Distributions for Development in 2019.md index db40b24947..ae358bfbe0 100644 --- a/translated/tech/20190125 Top 5 Linux Distributions for Development in 2019.md +++ b/published/20190125 Top 5 Linux Distributions for Development in 2019.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10534-1.html) [#]: subject: (Top 5 Linux Distributions for Development in 2019) [#]: via: (https://www.linux.com/blog/2019/1/top-5-linux-distributions-development-2019) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) From 0e8d88d449c27f55fb50ee144eef7f62ada09b89 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 23:28:45 +0800 Subject: [PATCH 128/813] PRF:20190115 Getting started with Sandstorm, an open source web app platform.md @geekpi --- ...h Sandstorm, an open source web app platform.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md b/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md index 4a98d7fb4f..135cc82e6f 100644 --- a/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md +++ b/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md @@ -1,18 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with Sandstorm, an open source web app platform) [#]: via: (https://opensource.com/article/19/1/productivity-tool-sandstorm) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 Sandstorm,一个开源 Web 应用平台 +开始使用 Sandstorm 吧,一个开源 Web 应用平台 ====== -了解 Sandstorm,这是我们在开源工具系列中的第三篇,它将在 2019 年提高你的工作效率。 + +> 了解 Sandstorm,这是我们在开源工具系列中的第三篇,它将在 2019 年提高你的工作效率。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第三个工具来帮助你在 2019 年更有效率。 @@ -22,7 +24,7 @@ ![](https://opensource.com/sites/default/files/uploads/sandstorm_1.png) -[Sandstorm][1]是打包的开源应用集合,它们都可从一个 Web 界面访问,也可在中央控制台进行管理。你可以自己托管或使用 [Sandstorm Oasis][2] 服务。它按用户收费。 +[Sandstorm][1] 是打包的开源应用集合,它们都可从一个 Web 界面访问,也可在中央控制台进行管理。你可以自己托管或使用 [Sandstorm Oasis][2] 服务。它按用户收费。 ![](https://opensource.com/sites/default/files/uploads/sandstorm_2.png) @@ -46,7 +48,7 @@ via: https://opensource.com/article/19/1/productivity-tool-sandstorm 作者:[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 eb372488a776385db18b08b6a04ff933cf55a6cc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 23:29:51 +0800 Subject: [PATCH 129/813] PUB:20190115 Getting started with Sandstorm, an open source web app platform.md @geekpi https://linux.cn/article-10535-1.html --- ...started with Sandstorm, an open source web app platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190115 Getting started with Sandstorm, an open source web app platform.md (97%) diff --git a/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md b/published/20190115 Getting started with Sandstorm, an open source web app platform.md similarity index 97% rename from translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md rename to published/20190115 Getting started with Sandstorm, an open source web app platform.md index 135cc82e6f..ae67f2ede2 100644 --- a/translated/tech/20190115 Getting started with Sandstorm, an open source web app platform.md +++ b/published/20190115 Getting started with Sandstorm, an open source web app platform.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10535-1.html) [#]: subject: (Getting started with Sandstorm, an open source web app platform) [#]: via: (https://opensource.com/article/19/1/productivity-tool-sandstorm) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 640ab5d941222444ace23ee5690c6623d4557461 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 23:47:52 +0800 Subject: [PATCH 130/813] PRF:20190128 3 simple and useful GNOME Shell extensions.md @geekpi --- ...imple and useful GNOME Shell extensions.md | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md b/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md index 7ef3efd956..2f6948c810 100644 --- a/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md +++ b/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (3 simple and useful GNOME Shell extensions) @@ -11,37 +11,37 @@ ====== ![](https://fedoramagazine.org/wp-content/uploads/2019/01/3simple-816x345.png) -Fedora Workstation 的默认桌面 GNOME Shell,因其最小化,整洁的用户界面而闻名并深受许多用户的喜爱。它还以可使用扩展添加到 stock 界面的能力而闻名。在本文中,我们将介绍 GNOME Shell 的 3 个简单且有用的扩展。这三个扩展为你的桌面提供了简单的,你可能每天都会做的行为。 +Fedora 工作站的默认桌面 GNOME Shell,因其极简、整洁的用户界面而闻名,并深受许多用户的喜爱。它还以可使用扩展添加到 stock 界面的能力而闻名。在本文中,我们将介绍 GNOME Shell 的 3 个简单且有用的扩展。这三个扩展为你的桌面提供了更多的行为,可以完成你可能每天都会做的简单任务。 ### 安装扩展程序 -安装 GNOME Shell 扩展的最快捷最简单的方法是使用软件应用。有关详细信息,请查看 Magazine 中的上一篇文章: +安装 GNOME Shell 扩展的最快捷、最简单的方法是使用“软件”应用。有关详细信息,请查看 Magazine [以前的文章](https://fedoramagazine.org/install-extensions-via-software-application/): ![](https://fedoramagazine.org/wp-content/uploads/2018/11/installing-extensions-768x325.jpg) -### Removable Drive Menu +### 可移动驱动器菜单 ![][1] -Fedora 29 中的 Removable Drive Menu 扩展 +*Fedora 29 中的 Removable Drive Menu 扩展* -首先是 [Removable Drive Menu][2] 扩展。如果你的计算机中有可移动驱动器,那么它是一个可在系统托盘中添加一个 widget 的简单工具。它可以使你轻松打开可移动驱动器中的文件,或者快速方便地弹出驱动器以安全移除设备。 +首先是 [Removable Drive Menu][2] 扩展。如果你的计算机中有可移动驱动器,它是一个可在系统托盘中添加一个 widget 的简单工具。它可以使你轻松打开可移动驱动器中的文件,或者快速方便地弹出驱动器以安全移除设备。 ![][3] -软件应用中的 Removable Drive Menu +*软件应用中的 Removable Drive Menu* -### Extensions 扩展 +### 扩展之扩展 ![][4] -如果你一直在安装和尝试新扩展,那么 [Extensions][5] 扩展非常有用。它提供了所有已安装扩展的列表,允许你启用或禁用它们。此外,如果扩展有设置,那么可以快速打开每个扩展的设置对话框。 +如果你一直在安装和尝试新扩展,那么 [Extensions][5] 扩展非常有用。它提供了所有已安装扩展的列表,允许你启用或禁用它们。此外,如果该扩展有设置,那么可以快速打开每个扩展的设置对话框。 ![][6] -软件中的 Extensions 扩展 +*软件中的 Extensions 扩展* -### Frippery Move Clock +### 无用的时钟移动 ![][7] @@ -56,7 +56,8 @@ via: https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/ 作者:[Ryan Lerch][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/introducing-flatpak/ From 68901e0ce6ae60185713831442e06a3e97e61f21 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Feb 2019 23:48:39 +0800 Subject: [PATCH 131/813] PUB:20190128 3 simple and useful GNOME Shell extensions.md @geekpi https://linux.cn/article-10536-1.html --- .../20190128 3 simple and useful GNOME Shell extensions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190128 3 simple and useful GNOME Shell extensions.md (97%) diff --git a/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md b/published/20190128 3 simple and useful GNOME Shell extensions.md similarity index 97% rename from translated/tech/20190128 3 simple and useful GNOME Shell extensions.md rename to published/20190128 3 simple and useful GNOME Shell extensions.md index 2f6948c810..3125f76e71 100644 --- a/translated/tech/20190128 3 simple and useful GNOME Shell extensions.md +++ b/published/20190128 3 simple and useful GNOME Shell extensions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10536-1.html) [#]: subject: (3 simple and useful GNOME Shell extensions) [#]: via: (https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/) [#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) From 7bcf2b1866c022710961994c8bdbdc20665ed4d9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Feb 2019 00:05:54 +0800 Subject: [PATCH 132/813] APL:20190102 How To Display Thumbnail Images In Terminal.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @WangYueScream 超期了,我接走了 --- .../20190102 How To Display Thumbnail Images In Terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md index 3c4105e13f..871b9b29cc 100644 --- a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md +++ b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( WangYueScream) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 49f04b0e0a2d93319f926608776f31a772547579 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Feb 2019 00:28:11 +0800 Subject: [PATCH 133/813] TSL:20190102 How To Display Thumbnail Images In Terminal.md --- ...To Display Thumbnail Images In Terminal.md | 186 ------------------ ...To Display Thumbnail Images In Terminal.md | 185 +++++++++++++++++ 2 files changed, 185 insertions(+), 186 deletions(-) delete mode 100644 sources/tech/20190102 How To Display Thumbnail Images In Terminal.md create mode 100644 translated/tech/20190102 How To Display Thumbnail Images In Terminal.md diff --git a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md deleted file mode 100644 index 871b9b29cc..0000000000 --- a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md +++ /dev/null @@ -1,186 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Display Thumbnail Images In Terminal) -[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Display Thumbnail Images In Terminal -====== -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png) - -A while ago, we discussed about [**Fim**][1], a lightweight, CLI image viewer application used to display various type of images, such as bmp, gif, jpeg, and png etc., from command line. Today, I stumbled upon a similar utility named **‘lsix’**. It is like ‘ls’ command in Unix-like systems, but for images only. The lsix is a simple CLI utility designed to display thumbnail images in Terminal using **Sixel** graphics. For those wondering, Sixel, short for six pixels, is a type of bitmap graphics format. It uses **ImageMagick** , so almost all file formats supported by imagemagick will work fine. - -### Features - -Concerning the features of lsix, we can list the following: - - * Automatically detects if your Terminal supports Sixel graphics or not. If your Terminal doesn’t support Sixel, it will notify you to enable it. - * Automatically detects the terminal background color. It uses terminal escape sequences to try to figure out the foreground and background colors of your Terminal application and will display the thumbnails clearly. - * If there are more images in the directory, usually >21, lsix will display those images one row a a time, so you need not to wait for the entire montage to be created. - * Works well over SSH, so you can manipulate images stored on your remote web server without much hassle. - * It supports Non-bitmap graphics, such as.svg, .eps, .pdf, .xcf etc. - * Written in BASH, so works on almost all Linux distros. - - - -### Installing lsix - -Since lsix uses ImageMagick, make sure you have installed it. It is available in the default repositories of most Linux distributions. For example, on Arch Linux and its variants like Antergos, Manjaro Linux, ImageMagick can be installed using command: - -``` -$ sudo pacman -S imagemagick -``` - -On Debian, Ubuntu, Linux Mint: - -``` -$ sudo apt-get install imagemagick -``` - -lsix doesn’t require any installation as it is just a BASH script. Just download it and move it to your $PATH. It’s that simple. - -Download the latest lsix version from project’s github page. I am going to download the lsix archive file using command: - -``` -$ wget https://github.com/hackerb9/lsix/archive/master.zip -``` - -Extract the downloaded zip file: - -``` -$ unzip master.zip -``` - -This command will extract all contents into a folder named ‘lsix-master’. Copy the lsix binary from this directory to your $PATH, for example /usr/local/bin/. - -``` -$ sudo cp lsix-master/lsix /usr/local/bin/ -``` - -Finally, make the lsbix binary executable: - -``` -$ sudo chmod +x /usr/local/bin/lsix -``` - -That’s it. Now is the time to display thumbnails in the terminal itself. - -Before start using lsix, **make sure your Terminal supports Sixel graphics**. - -The developer has developed lsix on an Xterm in **vt340 emulation mode**. However, the he claims that lsix should work on any Sixel compatible Terminal. - -Xterm supports Sixel graphics, but it isn’t enabled by default. - -You can launch Xterm with Sixel mode enabled using command (from another Terminal): - -``` -$ xterm -ti vt340 -``` - -Alternatively, you can make vt340 the default terminal type for Xterm as described below. - -Edit **.Xresources** file (If it not available, just create it): - -``` -$ vi .Xresources -``` - -Add the following line: - -``` -xterm*decTerminalID : vt340 -``` - -Press **ESC** and type **:wq** to save and close the file. - -Finally, run the following command to apply the changes: - -``` -$ xrdb -merge .Xresources -``` - -Now Xterm will start with Sixel mode enabled at every launch by default. - -### Display Thumbnail Images In Terminal - -Launch Xterm (Don’t forget to start it with vt340 mode). Here is how Xterm looks like in my system. -![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png) - -Like I already stated, lsix is very simple utility. It doesn’t have any command line flags or configuration files. All you have to do is just pass the path of your file as an argument like below. - -``` -$ lsix ostechnix/logo.png -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png) - -If you run it without path, it will display the thumbnail images in your current working directory. I have few files in a directory named **ostechnix**. - -To display the thumbnails in this directory, just run: - -``` -$ lsix -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png) - -See? The thumbnails of all files are displayed in the terminal itself. - -If you use ‘ls’ command, you would just see the filenames only, not thumbnails. - -![][3] - -You can also display a specific image or group of images of a specific type using wildcards. - -For example, to display a single image, just mention the full path of the image like below. - -``` -$ lsix girl.jpg -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png) - -To display all images of a specific type, say PNG, use the wildcard character like below. - -``` -$ lsix *.png -``` - -![][4] - -For JPEG type images, the command would be: - -``` -$ lsix *jpg -``` - -The thumbnail image quality is surprisingly good. I thought lsix would just display blurry thumbnails. I was wrong. The thumbnails are clearly visible just like on the graphical image viewers. - -And, that’s all for now. As you can see, lsix is very similar to ‘ls’ command, but it only for displaying thumbnails. If you deal with a lot of images at work, lsix might be quite handy. Give it a try and let us know your thoughts on this utility in the comment section below. If you know any similar tools, please suggest them as well. I will check and update this guide. - -More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/ - -作者:[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]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png -[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png diff --git a/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md b/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md new file mode 100644 index 0000000000..7984083891 --- /dev/null +++ b/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Display Thumbnail Images In Terminal) +[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在终端显示图像缩略图 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png) + +不久前,我们讨论了 [Fim][1],这是一个轻量级的命令行图像查看器应用程序,用于从命令行显示各种类型的图像,如 bmp、gif、jpeg 和 png 等。今天,我偶然发现了一个名为 `lsix` 的类似工具。它类似于类 Unix 系统中的 `ls` 命令,但仅适用于图像。`lsix` 是一个简单的命令行实用程序,旨在使用 Sixel 图形在终端中显示缩略图。对于那些想知道的人来说,Sixel 是六像素的缩写,是一种位图图形格式。它使用 ImageMagick,因此几乎所有 imagemagick 支持的文件格式都可以正常工作。 + +### 功能 + +关于 `lsix` 的功能,我们可以列出如下: + +* 自动检测你的终端是否支持 Sixel 图形。如果你的终端不支持 Sixel,它会通知你启用它。 +* 自动检测终端背景颜色。它使用终端转义序列来试图找出终端应用程序的前景色和背景色,并清楚地显示缩略图。 +* 如果目录中有更多图像,通常大于 21 个,`lsix` 将一次显示这些图像,因此你无需等待创建整个蒙太奇图像。 +* 可以通过 SSH 工作,因此你可以轻松操作存储在远程 Web 服务器上的图像。 +* 它支持非位图图形,例如 .svg、.eps、.pdf、.xcf 等。 +* 用 Bash 编写,适用于几乎所有 Linux 发行版。 +   +### 安装 lsix + +由于 `lsix` 使用 ImageMagick,请确保已安装它。它在大多数 Linux 发行版的默认软件库中都可用。 例如,在 Arch Linux 及其变体如 Antergos、Manjaro Linux 上,可以使用以下命令安装ImageMagick: + +``` +$ sudo pacman -S imagemagick +``` + +在 Debian、Ubuntu、Linux Mint: + +``` +$ sudo apt-get install imagemagick +``` + +`lsix` 并不需要安装,因为它只是一个 Bash 脚本。只需要下载它并移动到你的 `$PATH` 中。就这么简单。 + +从该项目的 GitHub 主页下载最新的 `lsix` 版本。我使用如下命令下载 `lsix` 归档包: + +``` +$ wget https://github.com/hackerb9/lsix/archive/master.zip +``` + +提取下载的 zip 文件: + +``` +$ unzip master.zip +``` + +此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$ PATH` ,例如 `/usr/local/bin/`。 + +``` +$ sudo cp lsix-master/lsix /usr/local/bin/ +``` + +最后,使 `lsbix` 二进制文件可执行: + +``` +$ sudo chmod +x /usr/local/bin/lsix +``` + +如此,现在是在终端本身显示缩略图的时候了。 + +在开始使用 `lsix` 之前,请确保你的终端支持 Sixel 图形。 + +开发人员在 vt340 仿真模式下的 Xterm 上开发了 `lsix`。 然而,他声称 `lsix` 应该适用于任何Sixel 兼容终端。 + +Xterm 支持 Sixel 图形,但默认情况下不启用。 + +你可以从另外一个终端使用命令启动有个启用了 Sixel 模式的 Xterm: + +``` +$ xterm -ti vt340 +``` + +或者,你可以使 vt340 成为 Xterm 的默认终端类型,如下所述。 + +编辑 `.Xresources` 文件(如果它不可用,只需创建它): + +``` +$ vi .Xresources +``` + +添加如下行: + +``` +xterm*decTerminalID : vt340 +``` + +按下 `ESC` 并键入 `:wq` 以保存并关闭该文件。 + +最后,运行如下命令来应用改变: + +``` +$ xrdb -merge .Xresources +``` + +现在,每次启动 Xterm 就会默认启用 Sixel 模式。 + +### 在终端中显示缩略图 + +启动 Xterm(不要忘记以 vt340 模式启动它)。以下是 Xterm 在我的系统中的样子。 + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png) + +就像我已经说过的那样,`lsix` 非常简单实用。它没有任何命令行选项或配置文件。你所要做的就是将文件的路径作为参数传递,如下所示。 +Like I already stated, lsix is very simple utility. It doesn’t have any command + +``` +$ lsix ostechnix/logo.png +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png) + +如果在没有路径的情况下运行它,它将显示在当前工作目录中的缩略图图像。我在名为 `ostechnix` 的目录中有几个文件。 + +要显示此目录中的缩略图,只需运行: + +``` +$ lsix +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png) + +看到了吗?所有文件的缩略图都显示在终端里。 + +如果使用 `ls` 命令,则只能看到文件名,而不是缩略图。 + +![][3] + +你还可以使用通配符显示特定类型的指定图像或一组图像。 + +例如,要显示单个图像,只需提及图像的完整路径,如下所示。 + +``` +$ lsix girl.jpg +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png) + +要显示特定类型的所有图像,例如 PNG,请使用如下所示的通配符。 + +``` +$ lsix *.png +``` + +![][4] + +对于 JEPG 类型,命令如下: + +``` +$ lsix *jpg +``` + +缩略图的显示质量非常好。我以为 `lsix` 会显示模糊的缩略图。但我错了,缩略图清晰可见,就像在图形图像查看器上一样。 + +而且,这一切都是唾手可得。如你所见,`lsix` 与 `ls` 命令非常相似,但它仅用于显示缩略图。如果你在工作中处理很多图像,`lsix` 可能会非常方便。试一试,请在下面的评论部分告诉我们你对此实用程序的看法。如果你知道任何类似的工具,也请提出建议。我将检查并更新本指南。 + +更多好东西即将到来。敬请关注! + +干杯! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/ + +作者:[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]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png From 20f10a73c39aa2b6aa8fa77df72931d99749cb3e Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 14 Feb 2019 08:39:23 +0800 Subject: [PATCH 134/813] Translating --- .../tech/20190208 7 steps for hunting down Python code bugs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190208 7 steps for hunting down Python code bugs.md b/sources/tech/20190208 7 steps for hunting down Python code bugs.md index 63058be4a4..77b2c802a0 100644 --- a/sources/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/sources/tech/20190208 7 steps for hunting down Python code bugs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (LazyWolfLin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 46efe2ba3902667c22e2961e40a670adaf1338e2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 Feb 2019 08:54:49 +0800 Subject: [PATCH 135/813] translated --- ... on an adventure in your Linux terminal.md | 54 ------------------ ... on an adventure in your Linux terminal.md | 55 +++++++++++++++++++ 2 files changed, 55 insertions(+), 54 deletions(-) delete mode 100644 sources/tech/20181224 Go on an adventure in your Linux terminal.md create mode 100644 translated/tech/20181224 Go on an adventure in your Linux terminal.md diff --git a/sources/tech/20181224 Go on an adventure in your Linux terminal.md b/sources/tech/20181224 Go on an adventure in your Linux terminal.md deleted file mode 100644 index 1dd9fa3c43..0000000000 --- a/sources/tech/20181224 Go on an adventure in your Linux terminal.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Go on an adventure in your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-adventure) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Go on an adventure in your Linux terminal -====== - -Our final day of the Linux command-line toys advent calendar ends with the beginning of a grand adventure. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-advent.png?itok=OImUJJI5) - -Today is the final day of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal. - -And while you may have seen some toys from our calendar before, we hope there’s at least one new thing for everyone. - -Today's toy was suggested by Opensource.com moderator [Joshua Allen Holm][2]: - -"If the last day of your advent calendar is not ESR's [Eric S. Raymond's] [open source release of Adventure][3], which retains use of the classic 'advent' command (Adventure in the BSD Games package uses 'adventure), I will be very, very, very disappointed. ;-)" - -What a perfect way to end our series. - -Colossal Cave Adventure (often just called Adventure), is a text-based game from the 1970s that gave rise to the entire adventure game genre. Despite its age, Adventure is still an easy way to lose hours as you explore a fantasy world, much like a Dungeons and Dragons dungeon master might lead you through an imaginary place. - -Rather than take you through the history of Adventure here, I encourage you to go read Joshua's [history of the game][4] itself and why it was resurrected and re-ported a few years ago. Then, go [clone the source][5] and follow the [installation instructions][6] to launch the game with **advent** **** on your system. Or, as Joshua mentions, another version of the game can be obtained from the **bsd-games** package, which is probably available from your default repositories in your distribution of choice. - -Do you have a favorite command-line toy that you we should have included? Our series concludes today, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [The Linux command line can fetch fun from afar][7], and I'll see you next year! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-adventure - -作者:[Jason Baker][a] -选题:[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/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/12/linux-toy-boxes -[2]: https://opensource.com/users/holmja -[3]: https://gitlab.com/esr/open-adventure (https://gitlab.com/esr/open-adventure) -[4]: https://opensource.com/article/17/6/revisit-colossal-cave-adventure-open-adventure -[5]: https://gitlab.com/esr/open-adventure -[6]: https://gitlab.com/esr/open-adventure/blob/master/INSTALL.adoc -[7]: https://opensource.com/article/18/12/linux-toy-remote diff --git a/translated/tech/20181224 Go on an adventure in your Linux terminal.md b/translated/tech/20181224 Go on an adventure in your Linux terminal.md new file mode 100644 index 0000000000..711d37a597 --- /dev/null +++ b/translated/tech/20181224 Go on an adventure in your Linux terminal.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go on an adventure in your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-adventure) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端上进行冒险 +====== + +我们的 Linux 命令行玩具日历的最后一天以开始一场盛大冒险结束。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-advent.png?itok=OImUJJI5) + +今天是我们为期 24 天的 Linux 命令行玩具日历的最后一天。希望你一直有在看,但如果没有,请从[头][1]开始,继续努力。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 + +虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人而言至少有一件新东西。 + +今天的玩具是由 Opensource.com 管理员 [Joshua Allen Holm][2] 提出的: + +“如果你的日历的最后一天不是 ESR(Eric S. Raymond)的[开源 Adventure][3],它保留了使用经典的 “advent” 命令(BSD 游戏包中的 Adventure 包名是 “adventure”) ,我会非常非常非常失望 ;-)“ + +这是结束我们这个系列的完美方式。 + +Colossal Cave Adventure(通常简称 Adventure),是一款来自 20 世纪 70 年代的基于文本的游戏,它带领产生了冒险游戏类型。尽管它很古老,但是当探索幻想世界时,Adventure 仍然是一种轻松消耗时间的方式,就像龙与地下城那样,地下城主可能会引导你穿过一个想象的地方。 + +与其带你了解 Adventure 的历史,我鼓励你去阅读 Joshua 的[游戏的历史][4]这篇文章,为什么它几年前会复活,并且被重新移植。接着,[克隆源码][5]并按照[安装说明][6]在你的系统上使用 **advent** 启动游戏。或者,像 Joshua 提到的那样,可以从 **bsd-games** 包中获取另一个版本的游戏,该软件包可能存在于你的发行版中的默认仓库。 + + +你有喜欢的命令行玩具认为我们应该介绍么?今天我们的系列结束了,但我们仍然乐于在新的一年中介绍一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看一下。让我知道你对今天玩具的看法。 + +一定要看看昨天的玩具,[能从远程获得乐趣的 Linux 命令][7],明年再见! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-adventure + +作者:[Jason Baker][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/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/linux-toy-boxes +[2]: https://opensource.com/users/holmja +[3]: https://gitlab.com/esr/open-adventure (https://gitlab.com/esr/open-adventure) +[4]: https://opensource.com/article/17/6/revisit-colossal-cave-adventure-open-adventure +[5]: https://gitlab.com/esr/open-adventure +[6]: https://gitlab.com/esr/open-adventure/blob/master/INSTALL.adoc +[7]: https://opensource.com/article/18/12/linux-toy-remote From e5c08226d13ca5992add5375ab2c4403383e62e8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 Feb 2019 09:00:51 +0800 Subject: [PATCH 136/813] translating --- ...started with Go For It, a flexible to-do list application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md b/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md index 56dde41884..cd5d3c63ed 100644 --- a/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md +++ b/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3485e661201da7f7f30d63a180a569c569658b0e Mon Sep 17 00:00:00 2001 From: beamrolling <33046439+beamrolling@users.noreply.github.com> Date: Thu, 14 Feb 2019 23:28:31 +0800 Subject: [PATCH 137/813] =?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 --- ...uction to the Pony programming language.md | 95 ------------------ ...uction to the Pony programming language.md | 96 +++++++++++++++++++ 2 files changed, 96 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20180530 Introduction to the Pony programming language.md create mode 100644 translated/tech/20180530 Introduction to the Pony programming language.md diff --git a/sources/tech/20180530 Introduction to the Pony programming language.md b/sources/tech/20180530 Introduction to the Pony programming language.md deleted file mode 100644 index 2292c65fc2..0000000000 --- a/sources/tech/20180530 Introduction to the Pony programming language.md +++ /dev/null @@ -1,95 +0,0 @@ -beamrolling is translating. -Introduction to the Pony programming language -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keys.jpg?itok=O4qaYCHK) - -At [Wallaroo Labs][1], where I'm the VP of engineering, we're are building a [high-performance, distributed stream processor][2] written in the [Pony][3] programming language. Most people haven't heard of Pony, but it has been an excellent choice for Wallaroo, and it might be an excellent choice for your next project, too. - -> "A programming language is just another tool. It's not about syntax. It's not about expressiveness. It's not about paradigms or models. It's about managing hard problems." —Sylvan Clebsch, creator of Pony - -I'm a contributor to the Pony project, but here I'll touch on why Pony is a good choice for applications like Wallaroo and share ways I've used Pony. If you are interested in a more in-depth look at why we use Pony to write Wallaroo, we have a [blog post][4] about that. - -### What is Pony? - -You can think of Pony as something like "Rust meets Erlang." Pony sports buzzworthy features. It is: - - * Type-safe - * Memory-safe - * Exception-safe - * Data-race-free - * Deadlock-free - - - -Additionally, it's compiled to efficient native code, and it's developed in the open and available under a two-clause BSD license. - -That's a lot of features, but here I'll focus on the few that were key to my company adopting Pony. - -### Why Pony? - -Writing fast, safe, efficient, highly concurrent programs is not easy with most of our existing tools. "Fast, efficient, and highly concurrent" is an achievable goal, but throw in "safe," and things get a lot harder. With Wallaroo, we wanted to accomplish all four, and Pony has made it easy to achieve. - -#### Highly concurrent - -Pony makes concurrency easy. Part of the way it does that is by providing an opinionated concurrency story. In Pony, all concurrency happens via the [actor model][5]. - -The actor model is most famous via the implementations in Erlang and Akka. The actor model has been around since the 1970s, and details vary widely from implementation to implementation. What doesn't vary is that all computation is executed by actors that communicate via asynchronous messaging. - -Think of the actor model this way: objects in object-oriented programming are state + synchronous methods and actors are state + asynchronous methods. - -When an actor receives a message, it executes a corresponding method. That method might operate on a state that is accessible by only that actor. The actor model allows us to use a mutable state in a concurrency-safe manner. Every actor is single-threaded. Two methods within an actor are never run concurrently. This means that, within a given actor, data updates cannot cause data races or other problems commonly associated with threads and mutable states. - -#### Fast and efficient - -Pony actors are scheduled with an efficient work-stealing scheduler. There's a single Pony scheduler per available CPU. The thread-per-core concurrency model is part of Pony's attempt to work in concert with the CPU to operate as efficiently as possible. The Pony runtime attempts to be as CPU-cache friendly as possible. The less your code thrashes the cache, the better it will run. Pony aims to help your code play nice with CPU caches. - -The Pony runtime also features per-actor heaps so that, during garbage collection, there's no "stop the world" garbage collection step. This means your program is always doing at least some work. As a result, Pony programs end up with very consistent performance and predictable latencies. - -#### Safe - -The Pony type system introduces a novel concept: reference capabilities, which make data safety part of the type system. The type of every variable in Pony includes information about how the data can be shared between actors. The Pony compiler uses the information to verify, at compile time, that your code is data-race- and deadlock-free. - -If this sounds a bit like Rust, it's because it is. Pony's reference capabilities and Rust's borrow checker both provide data safety; they just approach it in different ways and have different tradeoffs. - -### Is Pony right for you? - -Deciding whether to use a new programming language for a non-hobby project is hard. You must weigh the appropriateness of the tool against its immaturity compared to other solutions. So, what about Pony and you? - -Pony might be the right solution if you have a hard concurrency problem to solve. Concurrent applications are Pony's raison d'être. If you can accomplish what you want in a single-threaded Python script, you probably don't need Pony. If you have a hard concurrency problem, you should consider Pony and its powerful data-race-free, concurrency-aware type system. - -You'll get a compiler that will prevent you from introducing many concurrency-related bugs and a runtime that will give you excellent performance characteristics. - -### Getting started with Pony - -If you're ready to get started with Pony, your first visit should be the [Learn section][6] of the Pony website. There you will find directions for installing the Pony compiler and resources for learning the language. - -If you like to contribute to the language you are using, we have some [beginner-friendly issues][7] waiting for you on GitHub. - -Also, I can't wait to start talking with you on [our IRC channel][8] and the [Pony mailing list][9]. - -To learn more about Pony, attend Sean Allen's talk, [Pony: How I learned to stop worrying and embrace an unproven technology][10], at the [20th OSCON][11], July 16-19, 2018, in Portland, Ore. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/pony - -作者:[Sean T Allen][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/seantallen -[1]:http://www.wallaroolabs.com/ -[2]:https://github.com/wallaroolabs/wallaroo -[3]:https://www.ponylang.org/ -[4]:https://blog.wallaroolabs.com/2017/10/why-we-used-pony-to-write-wallaroo/ -[5]:https://en.wikipedia.org/wiki/Actor_model -[6]:https://www.ponylang.org/learn/ -[7]:https://github.com/ponylang/ponyc/issues?q=is%3Aissue+is%3Aopen+label%3A%22complexity%3A+beginner+friendly%22 -[8]:https://webchat.freenode.net/?channels=%23ponylang -[9]:https://pony.groups.io/g/user -[10]:https://conferences.oreilly.com/oscon/oscon-or/public/schedule/speaker/213590 -[11]:https://conferences.oreilly.com/oscon/oscon-or diff --git a/translated/tech/20180530 Introduction to the Pony programming language.md b/translated/tech/20180530 Introduction to the Pony programming language.md new file mode 100644 index 0000000000..de00e1f042 --- /dev/null +++ b/translated/tech/20180530 Introduction to the Pony programming language.md @@ -0,0 +1,96 @@ +Pony 编程语言简介 +====== + +Pony,一种“Rust 遇上 Erlang”的语言,让开发快捷,安全,高效,以及高并发程序更简单。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keys.jpg?itok=O4qaYCHK) + +在 [Wallaroo Labs][1],我是副总工程师,我们正在构建一个用 [Pony][3] 编程语言编写的 [高性能分布式流处理器][2]。大多数人没有听说过 Pony,但它一直是 Wallaroo 的最佳选择,它也可能成为你的下一个项目的最佳选择。 + +> "一门编程语言只是另一种工具。与语法无关。与表达性无关。与范式或模型无关。仅与管理难题有关" —Sylvan Clebsch,Pony 的创建者 + +我是 Pony 项目的贡献者,但在这里我要谈谈为什么 Pony 对于像 Wallaroo 这样的应用是个好选择,并分享我使用 Pony 的方式。如果你对我们为什么使用 Pony 来编写 Wallaroo 甚感兴趣,我们有一篇关于它的 [博文][4]。 + +### Pony 是什么? + +你可以把 Pony 想象成某种“Rust 遇上 Erlang”的东西。Pony 有着最引人注目的特性,它们是: + + * 类型安全 + * 存储安全 + * 异常安全 + * 无数据竞争 + * 无死锁 + + + +此外,它被编译为高效的本地代码,它是在开放的情况下开发的,在 2-clause BSD 许可下可用。 + +以上说的功能不少,但在这里我将重点关注那些对我们公司来说采用 Pony 至关重要的功能。 + +### 为什么使用 Pony? + +使用大多数我们现有的工具编写快速,安全,高效,高并发的程序并非易事。“快速,高效,高度并发”是可实现的目标,但加入“安全”之后,就困难了许多。通过 Wallaroo,我们希望同时实现四个目标,而 Pony 让实现它们更加简单。 + +#### 高并发 + +Pony 让并发变得简单。一部分是因为通过提供一个自用的并发主张。在 Pony 语言中,所有的并发都是通过 [Actor 模型][5] 进行的。 + +Actor 模型在 Erlang 和 Akka 中的实现最为著名。Actor 模型从 1970 年出现,细节因实施而异。不变的是,所有计算都由异步消息进行通信的 actor 来执行。 + +你可以用这种方式来看待 Actor 模型:面向对象中的对象是状态+同步方法,而 actor 是状态+异步方法。 + +当一个 actor 收到一个消息时,它执行相应的方法。该方法可以在只有该 actor 可访问的状态下运行。Actor 模型允许我们以并发安全的方式使用可变状态。每个 actor 都是单线程的。actor 中的两个方法不会并发运行。这意味着,在给定的 actor 中,数据更新不会引起数据竞争或通常与线程和可变状态相关的其他问题。 + +#### 快速高效 + +Pony actor 安排了一个高效的工作窃取调度程序。每个可用的 CPU 都有一个 Pony 调度程序。这种每个核心一个线程的并发模型是 Pony 尝试与 CPU 协同工作以尽可能高效运行的一部分。Pony 运行时尝试尽可能保持 CPU 缓存。代码越少,缓存越高,运行得越好。Pony 意在帮你的代码与 CPU 缓存友好相处。 + +Pony 运行时还会有每个 actor 的堆,因此在垃圾收集期间,没有“stop the world”的垃圾收集步骤。这意味着你的程序总是至少能做一点工作。因此 Pony 程序最终具有非常一致的性能和可预测的延迟。 + +#### 安全 + +Pony 型别系统引入了一个新概念:参考能力使得数据安全成为型别系统的一部分。Pony 语言中每种变量的类型都包含了有关如何在 actor 之间分享数据的信息。Pony 编译器用这些信息来确认,在编译时,你的代码是数据竞争和无死锁的。 + +如果这听起来有点像 Rust,那是因为本来就是这样的。Pony 的参考功能和 Rust 的借用检查器都提供数据安全性;它们只是以不同的方式来接近它,并有不同的权衡。 + +### Pony 适合你吗? + +决定是否要在一个非业余爱好的项目上使用一门新的编程语言是困难的。与其他方法想比,你必须权衡工具的适当性和不成熟度。那么,Pony 和你搭不搭呢? + +如果你有一个困难的并发问题需要解决,那么 Pony 可能是一个好选择。解决并发应用问题是 Pony 存在的理由。如果你能用一个单线程的 Python 脚本就完成所需操作,那你大概不需要它。如果你有一个困难的并发问题,你应该考虑 Pony 及其强大的无数据竞争,并发感知型别系统。 + +你将获得一个编译器,它将阻止你引入许多与并发相关的错误,并在运行时为你提供出色的性能特征。 + +### 开始使用 Pony + +如果你准备好开始使用 Pony,你需要先在 Pony 的网站上访问 [学习部分][6]。在这里你会找到安装 Pony 编译器的步骤和学习这门语言的资源。 + +如果你愿意为你正在使用的语言做出贡献,我们会在 GitHub 上为你提供一些 [初学者友好的问题][7]。 + +同时,我迫不及待地想在 [我们的 IRC 频道][8] 和 [Pony 邮件列表][9] 上与你交谈。 + +要了解更多有关 Pony 的消息,请参阅 Sean Allen 2018 年 7 月 16 日至 19 日在俄勒冈州波特兰举行的 [第 20 届 OSCON 会议][11] 上的演讲: [Pony,我如何学会停止担心并拥抱未经证实的技术][10]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/pony + +作者:[Sean T Allen][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[beamrolling](https://github.com/beamrolling) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/seantallen +[1]:http://www.wallaroolabs.com/ +[2]:https://github.com/wallaroolabs/wallaroo +[3]:https://www.ponylang.org/ +[4]:https://blog.wallaroolabs.com/2017/10/why-we-used-pony-to-write-wallaroo/ +[5]:https://en.wikipedia.org/wiki/Actor_model +[6]:https://www.ponylang.org/learn/ +[7]:https://github.com/ponylang/ponyc/issues?q=is%3Aissue+is%3Aopen+label%3A%22complexity%3A+beginner+friendly%22 +[8]:https://webchat.freenode.net/?channels=%23ponylang +[9]:https://pony.groups.io/g/user +[10]:https://conferences.oreilly.com/oscon/oscon-or/public/schedule/speaker/213590 +[11]:https://conferences.oreilly.com/oscon/oscon-or From ee0b6a7b8de9fcef08d35ac04168330a02a0bce8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Feb 2019 23:36:10 +0800 Subject: [PATCH 138/813] PRF:20181224 Go on an adventure in your Linux terminal.md @geekpi --- ...4 Go on an adventure in your Linux terminal.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/translated/tech/20181224 Go on an adventure in your Linux terminal.md b/translated/tech/20181224 Go on an adventure in your Linux terminal.md index 711d37a597..24804bb5bf 100644 --- a/translated/tech/20181224 Go on an adventure in your Linux terminal.md +++ b/translated/tech/20181224 Go on an adventure in your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Go on an adventure in your Linux terminal) @@ -10,24 +10,23 @@ 在 Linux 终端上进行冒险 ====== -我们的 Linux 命令行玩具日历的最后一天以开始一场盛大冒险结束。 +> 我们的 Linux 命令行玩具日历的最后一天以一场盛大冒险结束。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-advent.png?itok=OImUJJI5) -今天是我们为期 24 天的 Linux 命令行玩具日历的最后一天。希望你一直有在看,但如果没有,请从[头][1]开始,继续努力。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 +今天是我们为期 24 天的 Linux 命令行玩具日历的最后一天。希望你一直有在看,但如果没有,请[从头开始][1],继续努力。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人而言至少有一件新东西。 今天的玩具是由 Opensource.com 管理员 [Joshua Allen Holm][2] 提出的: -“如果你的日历的最后一天不是 ESR(Eric S. Raymond)的[开源 Adventure][3],它保留了使用经典的 “advent” 命令(BSD 游戏包中的 Adventure 包名是 “adventure”) ,我会非常非常非常失望 ;-)“ +> “如果你的冒险日历的最后一天不是 ESR(Eric S. Raymond)的[开源版的 Adventure 游戏][3] —— 它仍然使用经典的 `advent` 命令(在 BSD 游戏包中的 `adventure`) ,我会非常非常非常失望 ;-)“ 这是结束我们这个系列的完美方式。 -Colossal Cave Adventure(通常简称 Adventure),是一款来自 20 世纪 70 年代的基于文本的游戏,它带领产生了冒险游戏类型。尽管它很古老,但是当探索幻想世界时,Adventure 仍然是一种轻松消耗时间的方式,就像龙与地下城那样,地下城主可能会引导你穿过一个想象的地方。 - -与其带你了解 Adventure 的历史,我鼓励你去阅读 Joshua 的[游戏的历史][4]这篇文章,为什么它几年前会复活,并且被重新移植。接着,[克隆源码][5]并按照[安装说明][6]在你的系统上使用 **advent** 启动游戏。或者,像 Joshua 提到的那样,可以从 **bsd-games** 包中获取另一个版本的游戏,该软件包可能存在于你的发行版中的默认仓库。 +巨洞冒险Colossal Cave Adventure(通常简称 Adventure),是一款来自 20 世纪 70 年代的基于文本的游戏,它引领产生了冒险游戏这个类型的游戏。尽管它很古老,但是当探索幻想世界时,Adventure 仍然是一种轻松消耗时间的方式,就像龙与地下城那样,地下城主可能会引导你穿过一个充满想象的地方。 +与其带你了解 Adventure 的历史,我鼓励你去阅读 Joshua 的[该游戏的历史][4]这篇文章,以及为什么它几年前会重新复活,并且被重新移植。接着,[克隆它的源码][5]并按照[安装说明][6]在你的系统上使用 `advent` 启动游戏。或者,像 Joshua 提到的那样,可以从 bsd-games 包中获取该游戏的另一个版本,该软件包可能存在于你的发行版中的默认仓库。 你有喜欢的命令行玩具认为我们应该介绍么?今天我们的系列结束了,但我们仍然乐于在新的一年中介绍一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看一下。让我知道你对今天玩具的看法。 @@ -40,7 +39,7 @@ via: https://opensource.com/article/18/12/linux-toy-adventure 作者:[Jason Baker][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 76e55243c6236052a1f9816cdb49ffb5941b8d25 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Feb 2019 23:37:10 +0800 Subject: [PATCH 139/813] PUB:20181224 Go on an adventure in your Linux terminal.md @geekpi https://linux.cn/article-10537-1.html --- .../20181224 Go on an adventure in your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181224 Go on an adventure in your Linux terminal.md (97%) diff --git a/translated/tech/20181224 Go on an adventure in your Linux terminal.md b/published/20181224 Go on an adventure in your Linux terminal.md similarity index 97% rename from translated/tech/20181224 Go on an adventure in your Linux terminal.md rename to published/20181224 Go on an adventure in your Linux terminal.md index 24804bb5bf..2bdaef9bd7 100644 --- a/translated/tech/20181224 Go on an adventure in your Linux terminal.md +++ b/published/20181224 Go on an adventure in your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10537-1.html) [#]: subject: (Go on an adventure in your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-adventure) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From e38e0721fb9dcab8bb190440b847996e320d7113 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Feb 2019 09:02:14 +0800 Subject: [PATCH 140/813] translated --- ...ith Budgie Desktop, a Linux environment.md | 60 ------------------- ...ith Budgie Desktop, a Linux environment.md | 60 +++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md create mode 100644 translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md diff --git a/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md b/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md deleted file mode 100644 index 9dceb60f1d..0000000000 --- a/sources/tech/20190130 Get started with Budgie Desktop, a Linux environment.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Budgie Desktop, a Linux environment) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-budgie-desktop) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with Budgie Desktop, a Linux environment -====== -Configure your desktop as you want with Budgie, the 18th in our series on open source tools that will make you more productive in 2019. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the 18th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Budgie Desktop - -There are many, many desktop environments for Linux. From the easy to use and graphically stunning [GNOME desktop][1] (default on most major Linux distributions) and [KDE][2], to the minimalist [Openbox][3], to the highly configurable tiling [i3][4], there are a lot of options. What I look for in a good desktop environment is speed, unobtrusiveness, and a clean user experience. It is hard to be productive when a desktop works against you, not with or for you. - -![](https://opensource.com/sites/default/files/uploads/budgie-1.png) - -[Budgie Desktop][5] is the default desktop on the [Solus][6] Linux distribution and is available as an add-on package for most of the major Linux distributions. It is based on GNOME and uses many of the same tools and libraries you likely already have on your computer. - -The default desktop is exceptionally minimalistic, with just the panel and a blank desktop. Budgie includes an integrated sidebar (called Raven) that gives quick access to the calendar, audio controls, and settings menu. Raven also contains an integrated notification area with a unified display of system messages similar to MacOS's. - -![](https://opensource.com/sites/default/files/uploads/budgie-2.png) - -Clicking on the gear icon in Raven brings up Budgie's control panel with its configuration settings. Since Budgie is still in development, it is a little bare-bones compared to GNOME or KDE, and I hope it gets more options over time. The Top Panel option, which allows the user to configure the ordering, positioning, and contents of the top panel, is nice. - -![](https://opensource.com/sites/default/files/uploads/budgie-3.png) - -The Budgie Welcome application (presented at first login) contains options to install additional software, panel applets, snaps, and Flatpack packages. There are applets to handle networking, screenshots, additional clocks and timers, and much, much more. - -![](https://opensource.com/sites/default/files/uploads/budgie-4.png) - -Budgie provides a desktop that is clean and stable. It responds quickly and has many options that allow you to customize it as you see fit. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-budgie-desktop - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://www.gnome.org/ -[2]: https://www.kde.org/ -[3]: http://openbox.org/wiki/Main_Page -[4]: https://i3wm.org/ -[5]: https://getsol.us/solus/experiences/ -[6]: https://getsol.us/home/ diff --git a/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md b/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md new file mode 100644 index 0000000000..8ad345665d --- /dev/null +++ b/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Budgie Desktop, a Linux environment) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-budgie-desktop) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 Linux 桌面环境 Budgie +====== +使用 Budgie 按需配置你的桌面,这是我们开源工具系列中的第 18 个工具,它将在 2019 年提高你的工作效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 18 个工具来帮助你在 2019 年更有效率。 + +### Budgie 桌面 + +Linux 种有许多桌面环境。从易于使用以及有令人惊叹图形界面的 [GNOME 桌面][1](在大多数主要 Linux 发行版上是默认桌面)和 [KDE][2],到极简主义的 [Openbox][3],到高度可配置的平铺化 [i3][4],有很多选择。我要找的桌面环境需要速度、不引人注目和干净的用户体验。当桌面不适合你时,很难会有高效率。 + +![](https://opensource.com/sites/default/files/uploads/budgie-1.png) + +[Budgie 桌面][5]是 [Solus][6] Linux 发行版的默认桌面,它在大多数主要 Linux 发行版的附加软件包中提供。它基于 GNOME,并使用了许多你可能已经在计算机上使用的相同工具和库。 + +默认桌面非常简约,只有面板和空白桌面。Budgie 包含一个集成的侧边栏(称为 Raven),通过它可以快速访问日历、音频控件和设置菜单。Raven 还包含一个集成的通知区域,其中包含与 MacOS 类似的统一系统消息显示。 + +![](https://opensource.com/sites/default/files/uploads/budgie-2.png) + +点击 Raven 中的齿轮图标会显示 Budgie 的控制面板及其配置。由于 Budgie 仍处于开发阶段,与 GNOME 或 KDE相 比,它有点勉强,我希望随着时间的推移它会有更多的选项。顶部面板选项允许用户配置顶部面板的排序、位置和内容,这很不错。 + +![](https://opensource.com/sites/default/files/uploads/budgie-3.png) + +Budgie Welcome 应用(首次登录时展示)包含安装其他软件、面板小程序、截图和 Flatpack 软件包的选项。这些小程序有处理网络、截图、额外的时钟和计时器等等。 + +![](https://opensource.com/sites/default/files/uploads/budgie-4.png) + +Budgie 提供干净稳定的桌面。它响应迅速,有许多选项,允许你根据需要自定义它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-budgie-desktop + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://www.gnome.org/ +[2]: https://www.kde.org/ +[3]: http://openbox.org/wiki/Main_Page +[4]: https://i3wm.org/ +[5]: https://getsol.us/solus/experiences/ +[6]: https://getsol.us/home/ From 6b0964e5f2d602c92bd00cc0431a8ce11eeba794 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Feb 2019 09:16:26 +0800 Subject: [PATCH 141/813] translating --- ...ith LogicalDOC, an open source document management system.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md index 21687c0ce3..f26fcf5a30 100644 --- a/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md +++ b/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8f3d590454da7ed7a10d21effc8829b098704677 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Thu, 14 Feb 2019 19:52:10 -0600 Subject: [PATCH 142/813] New PR for submitting translated passage New PR for submitting translated passage --- ... connect to a remote desktop from Linux.md | 137 ------------------ ... connect to a remote desktop from Linux.md | 135 +++++++++++++++++ 2 files changed, 135 insertions(+), 137 deletions(-) delete mode 100644 sources/tech/20180621 How to connect to a remote desktop from Linux.md create mode 100644 translated/tech/20180621 How to connect to a remote desktop from Linux.md diff --git a/sources/tech/20180621 How to connect to a remote desktop from Linux.md b/sources/tech/20180621 How to connect to a remote desktop from Linux.md deleted file mode 100644 index 241d243b0b..0000000000 --- a/sources/tech/20180621 How to connect to a remote desktop from Linux.md +++ /dev/null @@ -1,137 +0,0 @@ -tomjlw is translating -How to connect to a remote desktop from Linux -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO) - -A [remote desktop][1], according to Wikipedia, is "a software or operating system feature that allows a personal computer's desktop environment to be run remotely on one system (usually a PC, but the concept applies equally to a server), while being displayed on a separate client device." - -In other words, a remote desktop is used to access an environment running on another computer. For example, the [ManageIQ/Integration tests][2] repository's pull request (PR) testing system exposes a Virtual Network Computing (VNC) connection port so I can remotely view my PRs being tested in real time. Remote desktops are also used to help customers solve computer problems: with the customer's permission, you can establish a VNC or Remote Desktop Protocol (RDP) connection to see or interactively access the computer to troubleshoot or repair the problem. - -These connections are made using remote desktop connection software, and there are many options available. I use [Remmina][3] because I like its minimal, easy-to-use user interface (UI). It's written in GTK+ and is open source under the GNU GPL license. - -In this article, I'll explain how to use the Remmina client to connect remotely from a Linux computer to a Windows 10 system and a Red Hat Enterprise Linux 7 system. - -### Install Remmina on Linux - -First, you need to install Remmina on the computer you'll use to access the other computer(s) remotely. If you're using Fedora, you can run the following command to install Remmina: -``` -sudo dnf install -y remmina - -``` - -If you want to install Remmina on a different Linux platform, follow these [installation instructions][4]. You should then find Remmina with your other apps (Remmina is selected in this image). - -![](https://opensource.com/sites/default/files/uploads/remmina1-on-desktop.png) - -Launch Remmina by clicking on the icon. You should see a screen that resembles this: - -![](https://opensource.com/sites/default/files/uploads/remmina2_launched.png) - -Remmina offers several types of connections, including RDP, which is used to connect to Windows-based computers, and VNC, which is used to connect to Linux machines. As you can see in the top-left corner above, Remmina's default setting is RDP. - -### Connecting to Windows 10 - -Before you can connect to a Windows 10 computer through RDP, you must change some permissions to allow remote desktop sharing and connections through your firewall. - -[Note: Windows 10 Home has no RDP feature listed. ][5] - -To enable remote desktop sharing, in **File Explorer** right-click on **My Computer → Properties → Remote Settings** and, in the pop-up that opens, check **Allow remote connections to this computer** , then select **Apply**. - -![](https://opensource.com/sites/default/files/uploads/remmina3_connect_win10.png) - -Next, enable remote desktop connections through your firewall. First, search for **firewall settings** in the **Start** menu and select **Allow an app through Windows Firewall**. - -![](https://opensource.com/sites/default/files/uploads/remmina4_firewall.png) - -In the window that opens, look for **Remote Desktop** under **Allowed apps and features**. Check the box(es) in the **Private **and/or **Public** columns, depending on the type of network(s) you will use to access this desktop. Click **OK**. - -![](https://opensource.com/sites/default/files/uploads/remmina5_firewall_2.png) - -Go to the Linux computer you use to remotely access the Windows PC and launch Remmina. Enter the IP address of your Windows computer and hit the Enter key. (How do I locate my IP address [in Linux][6] and [Windows 10][7]?) When prompted, enter your username and password and click OK. - -![](https://opensource.com/sites/default/files/uploads/remmina6_login.png) - -If you're asked to accept the certificate, select OK. - -![](https://opensource.com/sites/default/files/uploads/remmina7_certificate.png) - -You should be able to see your Windows 10 computer's desktop. - -![](https://opensource.com/sites/default/files/uploads/remmina8_remote_desktop.png) - -### Connecting to Red Hat Enterprise Linux 7 - -To set permissions to enable remote access on your RHEL7 computer, open **All Settings** on the Linux desktop. - -![](https://opensource.com/sites/default/files/uploads/remmina9_settings.png) - -Click on the Sharing icon, and this window will open: - -![](https://opensource.com/sites/default/files/uploads/remmina10_sharing.png) - -If **Screen Sharing** is off, click on it. A window will open, where you can slide it into the **On** position. If you want to allow remote connections to control the desktop, set **Allow Remote Control** to **On**. You can also select between two access options: one that prompts the computer's primary user to accept or deny the connection request, and another that allows connection authentication with a password. At the bottom of the window, select the network interface where connections are allowed, then close the window. - -Next, open **Firewall Settings** from **Applications Menu → Sundry → Firewall**. - -![](https://opensource.com/sites/default/files/uploads/remmina11_firewall_settings.png) - -Check the box next to vnc-server (as shown above) and close the window. Then, head to Remmina on your remote computer, enter the IP address of the Linux desktop you want to connect with, select **VNC** as the protocol, and hit the **Enter** key. - -![](https://opensource.com/sites/default/files/uploads/remmina12_vncprotocol.png) - -If you previously chose the authentication option **New connections must ask for access** , the RHEL system's user will see a prompt like this: - -![](https://opensource.com/sites/default/files/uploads/remmina13_permission.png) - -Select **Accept** for the remote connection to succeed. - -If you chose the option to authenticate the connection with a password, Remmina will prompt you for the password. - -![](https://opensource.com/sites/default/files/uploads/remmina14_password-auth.png) - -Enter the password and hit **OK** , and you should be connected to the remote computer. - -![](https://opensource.com/sites/default/files/uploads/remmina15_connected.png) - -### Using Remmina - -Remmina offers a tabbed UI, as shown in above picture, much like a web browser. In the top-left corner, as shown in the screenshot above, you can see two tabs: one for the previously established Windows 10 connection and a new one for the RHEL connection. - -On the left-hand side of the window, there is a toolbar with options such as **Resize Window** , **Full-Screen Mode** , **Preferences** , **Screenshot** , **Disconnect** , and more. Explore them and see which ones work best for you. - -You can also create saved connections in Remmina by clicking on the **+** (plus) sign in the top-left corner. Fill in the form with details specific to your connection and click **Save**. Here is an example Windows 10 RDP connection: - -![](https://opensource.com/sites/default/files/uploads/remmina16_saved-connection.png) - -The next time you open Remmina, the connection will be available. - -![](https://opensource.com/sites/default/files/uploads/remmina17_connection-available.png) - -Just click on it, and your connection will be established without re-entering the details. - -### Additional info - -When you use remote desktop software, all the operations you perform take place on the remote desktop and use its resources—Remmina (or similar software) is just a way to interact with that desktop. You can also access a computer remotely through SSH, but it usually limits you to a text-only terminal to that computer. - -You should also note that enabling remote connections with your computer could cause serious damage if an attacker uses this method to gain access to your computer. Therefore, it is wise to disallow remote desktop connections and block related services in your firewall when you are not actively using Remote Desktop. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/linux-remote-desktop - -作者:[Kedar Vijay Kulkarni][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/kkulkarn -[1]:https://en.wikipedia.org/wiki/Remote_desktop_software -[2]:https://github.com/ManageIQ/integration_tests -[3]:https://www.remmina.org/wp/ -[4]:https://www.tecmint.com/remmina-remote-desktop-sharing-and-ssh-client/ -[5]:https://superuser.com/questions/1019203/remote-desktop-settings-missing#1019212 -[6]:https://opensource.com/article/18/5/how-find-ip-address-linux -[7]:https://www.groovypost.com/howto/find-windows-10-device-ip-address/ diff --git a/translated/tech/20180621 How to connect to a remote desktop from Linux.md b/translated/tech/20180621 How to connect to a remote desktop from Linux.md new file mode 100644 index 0000000000..61182f12f2 --- /dev/null +++ b/translated/tech/20180621 How to connect to a remote desktop from Linux.md @@ -0,0 +1,135 @@ +如何从 Linux 上连接到远程桌面 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO) + +根据维基百科,[远程桌面][1] 是一种“可以让个人电脑上的桌面环境在一个系统(通常是电脑,但是也可以是服务器)上远程运行并在另一个分开的客户端设备显示的软件或者操作系统特性”。 + +换句话说,远程桌面是用来访问在另一台电脑上运行的环境的。比如说 [ManageIQ/Integration tests][2] 仓库的拉取请求 (PR) 测试系统暴露了一个虚拟网络计算 (VNC) 连接端口,使得我能够远程浏览正被实时测试的拉取请求。远程桌面也被用于帮助客户解决电脑问题:在客户的许可下,你可以远程建立 VNC 或者远程桌面协议(RDP)连接来看或者交互式地访问电脑以寻找并解决问题。 + +运用远程桌面连接软件可以建立这些连接。可供选择的软件有很多,我用 [Remmina][3] 因为我喜欢它极简、好用的用户界面 (UI)。它是用 GTK+ 编写的,在 GNU GPL 证书下它是开源的。 + +在这篇文章里,我会解释如何使用 Remmina 客户端从一台 Linux 电脑上远程连接到 Windows 10 系统 和 Red Hat 企业版 Linux 7 系统。 + +### 在 Linux 上安装 Remmina + +首先,你需要在你用来远程访问其它电脑的的主机上安装 Remmina。如果你用的是 Fedora,你可以运行如下的命令来安装 Remmina: +``` +sudo dnf install -y remmina +``` + +如果你想在一个不同的 Linux 平台上安装 Remmina,跟着 [安装教程][4] 走。然后你会发现 Remmina 正和你其它软件待在一起(Remmina 在这张图片里被选中)。 + +![](https://opensource.com/sites/default/files/uploads/remmina1-on-desktop.png) + +点击图标运行 Remmina,你应该能看到像这样的屏幕: + +![](https://opensource.com/sites/default/files/uploads/remmina2_launched.png) + +Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统的 RDP 和 用来连接到 Linux 系统的 VNC。如你在上图左上角所见的,Remmina 的默认设置是 RDP。 + +### 连接到 Windows 10 + +在你通过 RDP 连接到一台 Windows 10 电脑之前,你必须修改权限以允许分享远程桌面并通过防火墙建立连接。 + +[注意: Windows 10 家庭版没有列出 RDP 特性][5] + +要许可远程桌面分享,在**文件管理器**界面右击**我的电脑 → 属性 → 远程设置**,接着在跳出的窗口中,勾选**在这台电脑上允许远程连接**,再点击**应用**。 + +![](https://opensource.com/sites/default/files/uploads/remmina3_connect_win10.png) + +然后,允许远程连接通过你的防火墙。首先在**开始菜单中**查找**防火墙设置**,选择**允许应用通过防火墙**。 + +![](https://opensource.com/sites/default/files/uploads/remmina4_firewall.png) + +在打开的窗口中,在**允许的应用和特性**下找到**远程桌面**。根据你用来访问这个桌面的网络酌情勾选**隐私**和/或**公开**列的选框。点击**确定**。 + +![](https://opensource.com/sites/default/files/uploads/remmina5_firewall_2.png) + +回到你用来远程访问 Windows 主机的 Linux 电脑,打开 Remmina。输入你的 Windows 主机的 IP 地址,敲击回车键。(我怎么在 [Linux][6] 和 [Windws][7] 中定位我的 IP 地址?)看到提示后,输入你的用户名和密码,点击确定。 + +![](https://opensource.com/sites/default/files/uploads/remmina6_login.png) + +如果你被询问是否接受证书,点击确定。 + +![](https://opensource.com/sites/default/files/uploads/remmina7_certificate.png) + +你此时应能看到你的 Windows 10 主机桌面。 + +![](https://opensource.com/sites/default/files/uploads/remmina8_remote_desktop.png) + +### 连接到 Red Hat 企业版 Linux 7 + +要在你的 RHEL7 电脑上允许远程访问,在 Linux 桌面上打开**所有设置**。 + +![](https://opensource.com/sites/default/files/uploads/remmina9_settings.png) + +点击分享图标会打开如下的窗口: + +![](https://opensource.com/sites/default/files/uploads/remmina10_sharing.png) + +如果**屏幕分享**处于关闭状态,点击一下。一个窗口会弹出,你可以滑动到**打开**的位置。如果你想允许远程控制桌面,将**允许远程控制**调到**打开**。你同样也可以在两种访问选项间选择:一个能够让电脑的主要用户接受或者否绝连接要求,另一个能用密码验证连接。在窗口底部,选择被允许连接的网络界面,最后关闭窗口。 + +接着,从**应用菜单 → 其它 → 防火墙**打开**防火墙设置**。 + +![](https://opensource.com/sites/default/files/uploads/remmina11_firewall_settings.png) + +勾选 vnc-服务器旁边的选框(如下图所示)关闭窗口。接着直接到你远程电脑上的 Remmina,输入 你想连接到的 Linux 桌面的 IP 地址,选择 **VNC** 作为协议,点击**回车**键。 + +![](https://opensource.com/sites/default/files/uploads/remmina12_vncprotocol.png) + +如果你之前选择的验证选项是**新连接必须询问访问许可**,RHEL 系统用户会看到这样的一个弹窗 + +![](https://opensource.com/sites/default/files/uploads/remmina13_permission.png) + +点击**接受**以成功进行远程连接。 + +如果你选择用密码验证连接,Remmina 会向你询问密码。 + +![](https://opensource.com/sites/default/files/uploads/remmina14_password-auth.png) + +输入密码然后**确认**,你应该能连接到远程电脑。 + +![](https://opensource.com/sites/default/files/uploads/remmina15_connected.png) + +### 使用 Remmina + +Remmina 提供如上图所示的标签化的 UI,就好像一个浏览器一样。在上图所示的左上角你可以看到两个标签:一个是之前建立的 WIndows 10 连接,另一个新的是 RHEL 连接。 + +在窗口的左侧,有一个有着**缩放窗口**,**全屏模式**,**偏好**,**截屏**,**断开连接**等选项的工具栏。你可以自己探索看那种适合你。 + +你也可以通过点击左上角的**+**号创建保存过的连接。根据你的连接情况填好表单点击**保存**。以下是一个 Windows 10 RDP 连接的示例: + +![](https://opensource.com/sites/default/files/uploads/remmina16_saved-connection.png) + +下次你打开 Remmina 时连接就在那了。 + +![](https://opensource.com/sites/default/files/uploads/remmina17_connection-available.png) + +点击一下它你不用补充细节就可以建立连接了。 + +### 补充说明 + +当你使用远程桌面软件时,你所有的操作都在远程桌面上消耗资源—— Remmina(或者其它类似软件)仅仅是一种与远程桌面交互的方式。你也可以通过 SSH 远程访问一台电脑,但那将会让你在那台电脑上局限于仅能使用文字的终端。 + +你也应当注意到当你允许你的电脑远程连接时,如果一名攻击者用这种方法获得你电脑的访问权同样会给你带来严重损失。因此当你不频繁使用远程桌面时,禁止远程桌面连接以及其在防火墙中相关的服务是很明智的做法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/linux-remote-desktop + +作者:[Kedar Vijay Kulkarni][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[tomjlw](https://github.com/tomjlw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/kkulkarn +[1]:https://en.wikipedia.org/wiki/Remote_desktop_software +[2]:https://github.com/ManageIQ/integration_tests +[3]:https://www.remmina.org/wp/ +[4]:https://www.tecmint.com/remmina-remote-desktop-sharing-and-ssh-client/ +[5]:https://superuser.com/questions/1019203/remote-desktop-settings-missing#1019212 +[6]:https://opensource.com/article/18/5/how-find-ip-address-linux +[7]:https://www.groovypost.com/howto/find-windows-10-device-ip-address/ From 7a251ddedf5eeda8109665ccb22eadc82326929c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 10:06:27 +0800 Subject: [PATCH 143/813] PRF:20190102 How To Display Thumbnail Images In Terminal.md --- ...To Display Thumbnail Images In Terminal.md | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md b/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md index 7984083891..7f26b32ffe 100644 --- a/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md +++ b/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Display Thumbnail Images In Terminal) @@ -12,19 +12,19 @@ ![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png) -不久前,我们讨论了 [Fim][1],这是一个轻量级的命令行图像查看器应用程序,用于从命令行显示各种类型的图像,如 bmp、gif、jpeg 和 png 等。今天,我偶然发现了一个名为 `lsix` 的类似工具。它类似于类 Unix 系统中的 `ls` 命令,但仅适用于图像。`lsix` 是一个简单的命令行实用程序,旨在使用 Sixel 图形在终端中显示缩略图。对于那些想知道的人来说,Sixel 是六像素的缩写,是一种位图图形格式。它使用 ImageMagick,因此几乎所有 imagemagick 支持的文件格式都可以正常工作。 +不久前,我们讨论了 [Fim][1],这是一个轻量级的命令行图像查看器应用程序,用于从命令行显示各种类型的图像,如 bmp、gif、jpeg 和 png 等。今天,我偶然发现了一个名为 `lsix` 的类似工具。它类似于类 Unix 系统中的 `ls` 命令,但仅适用于图像。`lsix` 是一个简单的命令行实用程序,旨在使用 Sixel 图形格式在终端中显示缩略图。对于那些想知道的人来说,Sixel 是六像素six pixels的缩写,是一种位图图形格式。它使用 ImageMagick,因此几乎所有 imagemagick 支持的文件格式都可以正常工作。 ### 功能 关于 `lsix` 的功能,我们可以列出如下: -* 自动检测你的终端是否支持 Sixel 图形。如果你的终端不支持 Sixel,它会通知你启用它。 +* 自动检测你的终端是否支持 Sixel 图形格式。如果你的终端不支持 Sixel,它会通知你启用它。 * 自动检测终端背景颜色。它使用终端转义序列来试图找出终端应用程序的前景色和背景色,并清楚地显示缩略图。 -* 如果目录中有更多图像,通常大于 21 个,`lsix` 将一次显示这些图像,因此你无需等待创建整个蒙太奇图像。 +* 如果目录中有更多图像(通常大于 21 个),`lsix` 将一次显示这些图像,因此你无需等待创建整个蒙太奇图像(LCTT 译注:拼贴图)。 * 可以通过 SSH 工作,因此你可以轻松操作存储在远程 Web 服务器上的图像。 * 它支持非位图图形,例如 .svg、.eps、.pdf、.xcf 等。 * 用 Bash 编写,适用于几乎所有 Linux 发行版。 -   + ### 安装 lsix 由于 `lsix` 使用 ImageMagick,请确保已安装它。它在大多数 Linux 发行版的默认软件库中都可用。 例如,在 Arch Linux 及其变体如 Antergos、Manjaro Linux 上,可以使用以下命令安装ImageMagick: @@ -53,7 +53,7 @@ $ wget https://github.com/hackerb9/lsix/archive/master.zip $ unzip master.zip ``` -此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$ PATH` ,例如 `/usr/local/bin/`。 +此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$ PATH` 中,例如 `/usr/local/bin/`。 ``` $ sudo cp lsix-master/lsix /usr/local/bin/ @@ -67,13 +67,13 @@ $ sudo chmod +x /usr/local/bin/lsix 如此,现在是在终端本身显示缩略图的时候了。 -在开始使用 `lsix` 之前,请确保你的终端支持 Sixel 图形。 +在开始使用 `lsix` 之前,请确保你的终端支持 Sixel 图形格式。 开发人员在 vt340 仿真模式下的 Xterm 上开发了 `lsix`。 然而,他声称 `lsix` 应该适用于任何Sixel 兼容终端。 -Xterm 支持 Sixel 图形,但默认情况下不启用。 +Xterm 支持 Sixel 图形格式,但默认情况下不启用。 -你可以从另外一个终端使用命令启动有个启用了 Sixel 模式的 Xterm: +你可以从另外一个终端使用命令来启动一个启用了 Sixel 模式的 Xterm: ``` $ xterm -ti vt340 @@ -101,7 +101,7 @@ xterm*decTerminalID : vt340 $ xrdb -merge .Xresources ``` -现在,每次启动 Xterm 就会默认启用 Sixel 模式。 +现在,每次启动 Xterm 就会默认启用 Sixel 图形支持。 ### 在终端中显示缩略图 @@ -110,7 +110,6 @@ $ xrdb -merge .Xresources ![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png) 就像我已经说过的那样,`lsix` 非常简单实用。它没有任何命令行选项或配置文件。你所要做的就是将文件的路径作为参数传递,如下所示。 -Like I already stated, lsix is very simple utility. It doesn’t have any command ``` $ lsix ostechnix/logo.png @@ -173,7 +172,7 @@ via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/ 作者:[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 01075fec74ec83966401cb585cf6b1974e9f06d4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 10:07:01 +0800 Subject: [PATCH 144/813] PUB:20190102 How To Display Thumbnail Images In Terminal.md @wxy https://linux.cn/article-10538-1.html --- .../20190102 How To Display Thumbnail Images In Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190102 How To Display Thumbnail Images In Terminal.md (98%) diff --git a/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md b/published/20190102 How To Display Thumbnail Images In Terminal.md similarity index 98% rename from translated/tech/20190102 How To Display Thumbnail Images In Terminal.md rename to published/20190102 How To Display Thumbnail Images In Terminal.md index 7f26b32ffe..20104da619 100644 --- a/translated/tech/20190102 How To Display Thumbnail Images In Terminal.md +++ b/published/20190102 How To Display Thumbnail Images In Terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10538-1.html) [#]: subject: (How To Display Thumbnail Images In Terminal) [#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 2df53381c2373c1a0c69b49a6294cf7a52e8f64c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 10:27:26 +0800 Subject: [PATCH 145/813] PRF:20190121 Get started with TaskBoard, a lightweight kanban board.md @geekpi --- ...h TaskBoard, a lightweight kanban board.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md b/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md index d2490b03da..7b0dc4ed9d 100644 --- a/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md +++ b/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md @@ -1,25 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with TaskBoard, a lightweight kanban board) [#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用轻量级看板 TaskBoard +开始使用 TaskBoard 吧,一款轻量级看板 ====== -了解我们在开源工具系列中的第九个工具,它将帮助你在 2019 年提高工作效率。 + +> 了解我们在开源工具系列中的第九个工具,它将帮助你在 2019 年提高工作效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第九个工具来帮助你在 2019 年更有效率。 ### TaskBoard -正如我在本系列的[第二篇文章][1]中所写的那样,[看板][2]现在非常受欢迎。并非所有的看板都是相同的。[TaskBoard][3] 是一个易于在现有 Web 服务器上部署的 PHP 应用,它有一些易于使用和管理的功能。 +正如我在本系列的[第二篇文章][1]中所写的那样,[看板][2]现在非常受欢迎。但并非所有的看板都是相同的。[TaskBoard][3] 是一个易于在现有 Web 服务器上部署的 PHP 应用,它有一些易于使用和管理的功能。 ![](https://opensource.com/sites/default/files/uploads/taskboard-1.png) @@ -29,15 +30,15 @@ ![](https://opensource.com/sites/default/files/uploads/taskboard-2.png) -TaskBoard 还允许你创建自动操作,包括更改用户分配、列或卡片类别这些操作。虽然 TaskBoard 不如其他一些看板应用那么强大,但你可以设置自动操作,使看板用户更容易看到卡片,清除截止日期,并根据需要自动为人们分配新卡片。例如,在下面的截图中,如果将卡片分配给 “admin” 用户,那么它的颜色将更改为红色,并且当将卡片分配给我的用户时,其颜色将更改为蓝绿色。如果项目已添加到“待办事项”列,我还添加了一个操作来清除项目的截止日期,并在发生这种情况时自动将卡片分配给我的用户。 +TaskBoard 还允许你创建自动操作,包括更改用户分配、列或卡片类别这些操作。虽然 TaskBoard 不如其他一些看板应用那么强大,但你可以设置自动操作,使看板用户更容易看到卡片、清除截止日期,并根据需要自动为人们分配新卡片。例如,在下面的截图中,如果将卡片分配给 “admin” 用户,那么它的颜色将更改为红色,并且当将卡片分配给我的用户时,其颜色将更改为蓝绿色。如果项目已添加到“待办事项”列,我还添加了一个操作来清除项目的截止日期,并在发生这种情况时自动将卡片分配给我的用户。 ![](https://opensource.com/sites/default/files/uploads/taskboard-3.png) -卡片非常简单。虽然他们没有开始日期,但他们确实有结束日期和点数字段。点数可用于估计所需的时间、所需的工作量或仅是一般优先级。使用点数是可选的,但如果你使用 TaskBoard 进行 scrum 规划或其他敏捷技术,那么这是一个非常方便的功能。你还可以按用户和类别过滤视图。这对于正在进行多个工作流的团队非常有用,因为它允许团队负责人或经理了解进度状态或人员工作量。 +卡片非常简单。虽然它们没有开始日期,但它们确实有结束日期和点数字段。点数可用于估计所需的时间、所需的工作量或仅是一般优先级。使用点数是可选的,但如果你使用 TaskBoard 进行 scrum 规划或其他敏捷技术,那么这是一个非常方便的功能。你还可以按用户和类别过滤视图。这对于正在进行多个工作流的团队非常有用,因为它允许团队负责人或经理了解进度状态或人员工作量。 ![](https://opensource.com/sites/default/files/uploads/taskboard-4.png) -如果你需要一个相当轻便的看板,请看下 TaskBoard。它安装快速,有一些很好的功能,且非常,非常容易使用。它还足够的灵活性,可用于开发团队,个人任务跟踪等等。 +如果你需要一个相当轻便的看板,请看下 TaskBoard。它安装快速,有一些很好的功能,且非常、非常容易使用。它还足够的灵活性,可用于开发团队,个人任务跟踪等等。 -------------------------------------------------------------------------------- @@ -46,13 +47,13 @@ via: https://opensource.com/article/19/1/productivity-tool-taskboard 作者:[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 (Kevin Sonney) [b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/19/1/productivity-tool-wekan +[1]: https://linux.cn/article-10454-1.html [2]: https://en.wikipedia.org/wiki/Kanban [3]: https://taskboard.matthewross.me/ [4]: https://taskboard.matthewross.me/docs/ From 13540cbac169dd39794196520d7ac82d3d58e6a3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 10:28:00 +0800 Subject: [PATCH 146/813] PUB:20190121 Get started with TaskBoard, a lightweight kanban board.md @geekpi https://linux.cn/article-10539-1.html --- ... Get started with TaskBoard, a lightweight kanban board.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190121 Get started with TaskBoard, a lightweight kanban board.md (98%) diff --git a/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md b/published/20190121 Get started with TaskBoard, a lightweight kanban board.md similarity index 98% rename from translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md rename to published/20190121 Get started with TaskBoard, a lightweight kanban board.md index 7b0dc4ed9d..bff5c209c7 100644 --- a/translated/tech/20190121 Get started with TaskBoard, a lightweight kanban board.md +++ b/published/20190121 Get started with TaskBoard, a lightweight kanban board.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10539-1.html) [#]: subject: (Get started with TaskBoard, a lightweight kanban board) [#]: via: (https://opensource.com/article/19/1/productivity-tool-taskboard) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 927a35f0bfc9e93399fbae48b16ae8fdc1fa296d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 10:43:53 +0800 Subject: [PATCH 147/813] PRF:20190102 How To Display Thumbnail Images In Terminal.md --- .../20190102 How To Display Thumbnail Images In Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20190102 How To Display Thumbnail Images In Terminal.md b/published/20190102 How To Display Thumbnail Images In Terminal.md index 20104da619..7e70d280a5 100644 --- a/published/20190102 How To Display Thumbnail Images In Terminal.md +++ b/published/20190102 How To Display Thumbnail Images In Terminal.md @@ -53,13 +53,13 @@ $ wget https://github.com/hackerb9/lsix/archive/master.zip $ unzip master.zip ``` -此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$ PATH` 中,例如 `/usr/local/bin/`。 +此命令将所有内容提取到名为 `lsix-master` 的文件夹中。将 `lsix` 二进制文件从此目录复制到 `$PATH` 中,例如 `/usr/local/bin/`。 ``` $ sudo cp lsix-master/lsix /usr/local/bin/ ``` -最后,使 `lsbix` 二进制文件可执行: +最后,使 `lsix` 二进制文件可执行: ``` $ sudo chmod +x /usr/local/bin/lsix From e79ea4c95e91d4b6f9c470a9bcf6979c101f97e9 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Fri, 15 Feb 2019 10:52:35 +0800 Subject: [PATCH 148/813] translating by hopefully2333 translating by hopefully2333 --- ...e Evil-Twin Framework- A tool for improving WiFi security.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md index 81b5d2ddf1..cd71fdd62b 100644 --- a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md +++ b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -1,3 +1,5 @@ +translating by hopefully2333 + [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) From d48769445f9bfcc4edb2ac0fb83a9c30001dcea8 Mon Sep 17 00:00:00 2001 From: lixinyuxx <524187166@qq.com> Date: Fri, 15 Feb 2019 12:50:05 +0800 Subject: [PATCH 149/813] Update 20180612 7 open source tools to make literature reviews easy.md --- ...180612 7 open source tools to make literature reviews easy.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180612 7 open source tools to make literature reviews easy.md b/sources/tech/20180612 7 open source tools to make literature reviews easy.md index 96edb68eff..674f4ea44b 100644 --- a/sources/tech/20180612 7 open source tools to make literature reviews easy.md +++ b/sources/tech/20180612 7 open source tools to make literature reviews easy.md @@ -1,3 +1,4 @@ +translated by lixinyuxx 7 open source tools to make literature reviews easy ====== From eb38a8eb1194c4977def428962457b940df5aa81 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 15 Feb 2019 13:31:57 +0800 Subject: [PATCH 150/813] Translating 7 steps for hunting down Python code bugs. --- ...steps for hunting down Python code bugs.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 translated/tech/20190208 7 steps for hunting down Python code bugs.md diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md new file mode 100644 index 0000000000..3441e6d9e6 --- /dev/null +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 steps for hunting down Python code bugs) +[#]: via: (https://opensource.com/article/19/2/steps-hunting-code-python-bugs) +[#]: author: (Maria Mckinley https://opensource.com/users/parody) + +7 步检查 Python 代码错误 +====== +了解一些技巧来减少你花费在寻找代码失败原因的时间。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) + +在周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经转移了的通知。 + +Turns out they are somewhere you can't get to, but they are in the process of being moved to a web application—so you will have this nifty application for searching and reading them, but of course, it is not finished yet. It should be up in a couple of days. I know, totally unrealistic situation, right? Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking. + +OK, so you found the logs or tried the call, and indeed, the customer has found a bug. Maybe you even think you know where the bug is. + +You immediately open the file you think might be the problem and start poking around. + +### 1. Don't touch your code yet + +Go ahead and look at it, maybe even come up with a hypothesis. But before you start mucking about in the code, take that call that creates the bug and turn it into a test. This will be an integration test because although you may have suspicions, you do not yet know exactly where the problem is. + +Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. + +### 2. Write a failing test + +Now that you have a failing test or maybe a test with an error, it is time to troubleshoot. But before you do that, let's do a review of the stack, as this makes troubleshooting easier. + +The stack consists of all of the tasks you have started but not finished. So, if you are baking a cake and adding the flour to the batter, then your stack would be: + + * Make cake + * Make batter + * Add flour + + + +You have started making your cake, you have started making the batter, and you are adding the flour. Greasing the pan is not on the list since you already finished that, and making the frosting is not on the list because you have not started that. + +If you are fuzzy on the stack, I highly recommend playing around on [Python Tutor][1], where you can watch the stack as you execute lines of code. + +Now, if something goes wrong with your Python program, the interpreter helpfully prints out the stack for you. This means that whatever the program was doing at the moment it became apparent that something went wrong is on the bottom. + +### 3. Always check the bottom of the stack first + +Not only is the bottom of the stack where you can see which error occurred, but often the last line of the stack is where you can find the issue. If the bottom doesn't help, and your code has not been linted in a while, it is amazing how helpful it can be to run. I recommend pylint or flake8. More often than not, it points right to where there is an error that I have been overlooking. + +If the error is something that seems obscure, your next move might just be to Google it. You will have better luck if you don't include information that is relevant only to your code, like the name of variables, files, etc. If you are using Python 3 (which you should be), it's helpful to include the 3 in the search; otherwise, Python 2 solutions tend to dominate the top. + +Once upon a time, developers had to troubleshoot without the benefit of a search engine. This was a dark time. Take advantage of all the tools available to you. + +Unfortunately, sometimes the problem occurred earlier and only became apparent during the line executed on the bottom of the stack. Think about how forgetting to add the baking powder becomes obvious when the cake doesn't rise. + +It is time to look up the stack. Chances are quite good that the problem is in your code, and not Python core or even third-party packages, so scan the stack looking for lines in your code first. Plus it is usually much easier to put a breakpoint in your own code. Stick the breakpoint in your code a little further up the stack and look around to see if things look like they should. + +"But Maria," I hear you say, "this is all helpful if I have a stack trace, but I just have a failing test. Where do I start?" + +Pdb, the Python Debugger. + +Find a place in your code where you know this call should hit. You should be able to find at least one place. Stick a pdb break in there. + +#### A digression + +Why not a print statement? I used to depend on print statements. They still come in handy sometimes. But once I started working with complicated code bases, and especially ones making network calls, print just became too slow. I ended up with print statements all over the place, I lost track of where they were and why, and it just got complicated. But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful. + +You follow my advice, and put in a pdb break and run your test. And it whooshes on by and fails again, with no break at all. Leave your breakpoint in, and run a test already in your test suite that does something very similar to the broken test. If you have a decent test suite, you should be able to find a test that is hitting the same code you think your failed test should hit. Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. + +### 4. Change things + +If you still feel lost, try making a new test where you vary something slightly. Can you get the new test to work? What is different? What is the same? Try changing something else. Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.) + +### 5. Take a break + +In all seriousness, when it stops feeling like a fun challenge or game and starts becoming really frustrating, your best course of action is to walk away from the problem. Take a break. I highly recommend going for a walk and trying to think about something else. + +### 6. Write everything down + +When you come back, if you aren't suddenly inspired to try something, write down any information you have about the problem. This should include: + + * Exactly the call that is causing the problem + * Exactly what happened, including any error messages or related log messages + * Exactly what you were expecting to happen + * What you have done so far to find the problem and any clues that you have discovered while troubleshooting + + + +Sometimes this is a lot of information, but trust me, it is really annoying trying to pry information out of someone piecemeal. Try to be concise, but complete. + +### 7. Ask for help + +I often find that just writing down all the information triggers a thought about something I have not tried yet. Sometimes, of course, I realize what the problem is immediately after hitting the submit button. At any rate, if you still have not thought of anything after writing everything down, try sending an email to someone. First, try colleagues or other people involved in your project, then move on to project email lists. Don't be afraid to ask for help. Most people are kind and helpful, and I have found that to be especially true in the Python community. + +Maria McKinley will present [Hunting the Bugs][3] at [PyCascades 2019][4], February 23-24 in Seattle. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/steps-hunting-code-python-bugs + +作者:[Maria Mckinley][a] +选题:[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/parody +[b]: https://github.com/lujun9972 +[1]: http://www.pythontutor.com/ +[2]: https://betterexplained.com/articles/a-visual-guide-to-version-control/ +[3]: https://2019.pycascades.com/talks/hunting-the-bugs +[4]: https://2019.pycascades.com/ From aacf266e756ec67177bf85b0e2af67c3a0959356 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Fri, 15 Feb 2019 15:29:47 +0800 Subject: [PATCH 151/813] translating by hopefully2333 translating by hopefully2333 --- ...Evil-Twin Framework- A tool for improving WiFi security.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md index cd71fdd62b..7ab67f5c22 100644 --- a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md +++ b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -1,7 +1,5 @@ -translating by hopefully2333 - [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hopefully2333) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8fb05c3ad4dd613487f7c95f15201206746aef88 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 15:52:06 +0800 Subject: [PATCH 152/813] APL:20181204 4 Unique Terminal Emulators for Linux.md --- sources/tech/20181204 4 Unique Terminal Emulators for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md b/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md index 04110b670e..142c8d5e2a 100644 --- a/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md +++ b/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9b0c1659a8f729ec44ba570edfe9243ceecf7c2e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Feb 2019 17:27:59 +0800 Subject: [PATCH 153/813] TSL:20181204 4 Unique Terminal Emulators for Linux.md --- ...4 4 Unique Terminal Emulators for Linux.md | 169 ------------------ ...4 4 Unique Terminal Emulators for Linux.md | 152 ++++++++++++++++ 2 files changed, 152 insertions(+), 169 deletions(-) delete mode 100644 sources/tech/20181204 4 Unique Terminal Emulators for Linux.md create mode 100644 translated/tech/20181204 4 Unique Terminal Emulators for Linux.md diff --git a/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md b/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md deleted file mode 100644 index 142c8d5e2a..0000000000 --- a/sources/tech/20181204 4 Unique Terminal Emulators for Linux.md +++ /dev/null @@ -1,169 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 Unique Terminal Emulators for Linux) -[#]: via: (https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -4 Unique Terminal Emulators for Linux -====== -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_main.jpg?itok=e6av-5VO) -Let’s face it, if you’re a Linux administrator, you’re going to work with the command line. To do that, you’ll be using a terminal emulator. Most likely, your distribution of choice came pre-installed with a default terminal emulator that gets the job done. But this is Linux, so you have a wealth of choices to pick from, and that ideology holds true for terminal emulators as well. In fact, if you open up your distribution’s GUI package manager (or search from the command line), you’ll find a trove of possible options. Of those, many are pretty straightforward tools; however, some are truly unique. - -In this article, I’ll highlight four such terminal emulators, that will not only get the job done, but do so while making the job a bit more interesting or fun. So, let’s take a look at these terminals. - -### Tilda - -[Tilda][1] is designed for Gtk and is a member of the cool drop-down family of terminals. That means the terminal is always running in the background, ready to drop down from the top of your monitor (such as Guake and Yakuake). What makes Tilda rise above many of the others is the number of configuration options available for the terminal (Figure 1). -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_1.jpg?itok=bra6qb6X) - -Tilda can be installed from the standard repositories. On a Ubuntu- (or Debian-) based distribution, the installation is as simple as: - -``` -sudo apt-get install tilda -y -``` - -Once installed, open Tilda from your desktop menu, which will also open the configuration window. Configure the app to suit your taste and then close the configuration window. You can then open and close Tilda by hitting the F1 hotkey. One caveat to using Tilda is that, after the first run, you won’t find any indication as to how to reach the configuration wizard. No worries. If you run the command tilda -C it will open the configuration window, while still retaining the options you’ve previously set. - -Available options include: - - * Terminal size and location - - * Font and color configurations - - * Auto Hide - - * Title - - * Custom commands - - * URL Handling - - * Transparency - - * Animation - - * Scrolling - - * And more - - - - -What I like about these types of terminals is that they easily get out of the way when you don’t need them and are just a button click away when you do. For those that hop in and out of the terminal, a tool like Tilda is ideal. - -### Aterm - -Aterm holds a special place in my heart, as it was one of the first terminals I used that made me realize how flexible Linux was. This was back when AfterStep was my window manager of choice (which dates me a bit) and I was new to the command line. What Aterm offered was a terminal emulator that was highly customizable, while helping me learn the ins and outs of using the terminal (how to add options and switches to a command). “How?” you ask. Because Aterm never had a GUI for customization. To run Aterm with any special options, it had to run as a command. For example, say you want to open Aterm with transparency enabled, green text, white highlights, and no scroll bar. To do this, issue the command: - -``` -aterm -tr -fg green -bg white +xb -``` - -The end result (with the top command running for illustration) would look like that shown in Figure 2. - -![Aterm][3] - -Figure 2: Aterm with a few custom options. - -[Used with permission][4] - -Of course, you must first install Aterm. Fortunately, the application is still found in the standard repositories, so installing on the likes of Ubuntu is as simple as: - -``` -sudo apt-get install aterm -y -``` - -If you want to always open Aterm with those options, your best bet is to create an alias in your ~/.bashrc file like so: - -``` -alias=”aterm -tr -fg green -bg white +sb” -``` - -Save that file and, when you issue the command aterm, it will always open with those options. For more about creating aliases, check out [this tutorial][5]. - -### Eterm - -Eterm is the second terminal that really showed me how much fun the Linux command line could be. Eterm is the default terminal emulator for the Enlightenment desktop. When I eventually migrated from AfterStep to Enlightenment (back in the early 2000s), I was afraid I’d lose out on all those cool aesthetic options. That turned out to not be the case. In fact, Eterm offered plenty of unique options, while making the task easier with a terminal toolbar. With Eterm, you can easily select from a large number of background images (should you want one - Figure 3) by selecting from the Background > Pixmap menu entry. - -![Eterm][7] - -Figure 3: Selecting from one of the many background images for Eterm. - -[Used with permission][4] - -There are a number of other options to configure (such as font size, map alerts, toggle scrollbar, brightness, contrast, and gamma of background images, and more). The one thing you want to make sure is, after you’ve configured Eterm to suit your tastes, to click Eterm > Save User Settings (otherwise, all settings will be lost when you close the app). - -Eterm can be installed from the standard repositories, with a command such as: - -``` -sudo apt-get install eterm -``` - -### Extraterm - -[Extraterm][8] should probably win a few awards for coolest feature set of any terminal window project available today. The most unique feature of Extraterm is the ability to wrap commands in color-coded frames (blue for successful commands and red for failed commands - Figure 4). - -![Extraterm][10] - -Figure 4: Extraterm showing two failed command frames. - -[Used with permission][4] - -When you run a command, Extraterm will wrap the command in an isolated frame. If the command succeeds, the frame will be outlined in blue. Should the command fail, the frame will be outlined in red. - -Extraterm cannot be installed via the standard repositories. In fact, the only way to run Extraterm on Linux (at the moment) is to [download the precompiled binary][11] from the project’s GitHub page, extract the file, change into the newly created directory, and issue the command ./extraterm. - -Once the app is running, to enable frames you must first enable bash integration. To do that, open Extraterm and then right-click anywhere in the window to reveal the popup menu. Scroll until you see the entry for Inject Bash shell Integration (Figure 5). Select that entry and you can then begin using the frames option. - -![Extraterm][13] - -Figure 5: Injecting Bash integration for Extraterm. - -[Used with permission][4] - -If you run a command, and don’t see a frame appear, you probably have to create a new frame for the command (as Extraterm only ships with a few default frames). To do that, click on the Extraterm menu button (three horizontal lines in the top right corner of the window), select Settings, and then click the Frames tab. In this window, scroll down and click the New Rule button. You can then add a command you want to work with the frames option (Figure 6). - -![frames][15] - -Figure 6: Adding a new rule for frames. - -[Used with permission][4] - -If, after this, you still don’t see frames appearing, download the extraterm-commands file from the [Download page][11], extract the file, change into the newly created directory, and issue the command sh setup_extraterm_bash.sh. That should enable frames for Extraterm. -There’s plenty more options available for Extraterm. I’m convinced, once you start playing around with this new take on the terminal window, you won’t want to go back to the standard terminal. Hopefully the developer will make this app available to the standard repositories soon (as it could easily become one of the most popular terminal windows in use). - -### And Many More - -As you probably expected, there are quite a lot of terminals available for Linux. These four represent (at least for me) four unique takes on the task, each of which do a great job of helping you run the commands every Linux admin needs to run. If you aren’t satisfied with one of these, give your package manager a look to see what’s available. You are sure to find something that works perfectly for you. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2018/12/4-unique-terminals-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]: http://tilda.sourceforge.net/tildadoc.php -[2]: https://www.linux.com/files/images/terminals2jpg -[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_2.jpg?itok=gBkRLwDI (Aterm) -[4]: https://www.linux.com/licenses/category/used-permission -[5]: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands -[6]: https://www.linux.com/files/images/terminals3jpg -[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_3.jpg?itok=RVPTJAtK (Eterm) -[8]: http://extraterm.org -[9]: https://www.linux.com/files/images/terminals4jpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_4.jpg?itok=2n01qdwO (Extraterm) -[11]: https://github.com/sedwards2009/extraterm/releases -[12]: https://www.linux.com/files/images/terminals5jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_5.jpg?itok=FdaE1Mpf (Extraterm) -[14]: https://www.linux.com/files/images/terminals6jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_6.jpg?itok=lQ1Zv5wq (frames) diff --git a/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md b/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md new file mode 100644 index 0000000000..3570459516 --- /dev/null +++ b/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 Unique Terminal Emulators for Linux) +[#]: via: (https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +4 个独特的 Linux 终端模拟器 +====== + +> 这四个不同的终端模拟器 —— 不仅可以完成工作,还可以增加一些乐趣。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_main.jpg?itok=e6av-5VO) + +让我们面对现实,如果你是 Linux 管理员,那么你要用命令行来工作。为此,你将使用终端模拟器(LCTT 译注:常简称为“终端”,与终端本身的原意不同)。最有可能的是,你的选择发行版预先安装了一个可以完成工作的默认终端模拟器。但这是有很多选择可供选择的 Linux,所以这种思想自然也适用于终端模拟器。实际上,如果你打开发行版的图形界面的包管理器(或从命令行搜索),你将找到大量可能的选择。其中许多是非常简单的工具;然而,有些是真正独特的。 + +在本文中,我将重点介绍四个这样的终端模拟器,它们不仅可以完成工作,而且可以使工作变得更有趣或更有趣。 那么,让我们来看看这些终端。 + +### Tilda + +[Tilda][1] 是为Gtk设计的,是一种酷炫的下拉终端。这意味着该终端始终在后台运行,随时准备从显示器顶部拉下来(例如 Guake 和 Yakuake)。让 Tilda 超越许多其他产品的原因是该终端可用的配置选项数量(图 1)。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_1.jpg?itok=bra6qb6X) + +可以从标准的软件库安装 Tilda。在基于 Ubuntu(或 Debian)的发行版上,安装非常简单: + +``` +sudo apt-get install tilda -y +``` + +安装完成后,从桌面菜单中打开 Tilda,这也将打开其配置窗口。根据你的喜好配置应用程序,然后关闭配置窗口。然后,你可以通过点击 `F1` 热键来打开和关闭 Tilda。对使用 Tilda 的一个警告是,在第一次运行后,你将找不到有关如何找到配置向导的任何提示。别担心。只要运行命令 `tilda -C`,它将打开配置窗口,同时仍保留你之前设置的选项。 + +可用选项包括: + +* 终端大小和位置 +* 字体和颜色配置 +* 自动隐藏 +* 标题 +* 自定义命令 +* URL 处理 +* 透明度 +* 动画 +* 滚动 +* 和更多 + +我喜欢这些类型的终端是因为当你不需要它们时它们很容易就会消失,只需按一下按钮即可。对于那些不断进出终端的人来说,像 Tilda 这样的工具是理想的选择。 + +### Aterm + +Aterm 在我心中占有特殊的位置,因为它是我第一次使用的终端之一,它让我意识到 Linux 的灵活性。 这要回到当 AfterStep 成为我选择的窗口管理器时(用了不太久),而且那时我是命令行新手。Aterm 提供的是一个高度可定制的终端仿真器,同时帮助我了解使用终端的细节(如何添加选项和切换到命令)。“你觉得怎么样?”。因为 Aterm 从未有过用于定制的图形界面。要使用任何特殊选项运行 Aterm,它必须以命令选项的方式运行。例如,假设你要启用透明度、绿色文本、白色高亮和无滚动条。为此,请运行以下命令: + +``` +aterm -tr -fg green -bg white +xb +``` + +最终结果(`top` 命令运行用于说明)看起来如图 2 所示。 + +![Aterm][3] + +*图 2:使用了一些定制选项的 Aterm* + +当然,你必须先安装 Aterm。幸运的是,这个应用程序仍然可以在标准软件库中找到,因此在 Ubuntu 上安装就像下面这样简单: + +``` +sudo apt-get install aterm -y +``` + +如果你想总是用这些选项打开 Aterm,你最好的办法是在 `~/.bashrc` 文件中创建一个别名,如下所示: + +``` +alias=”aterm -tr -fg green -bg white +sb” +``` +保存该文件,当你运行命令 `aterm` 时,它将始终打开这些选项。有关创建别名的更多信息,请查看[这个教程][5]。 + +### Eterm + +Eterm 是第二个真正告诉我 Linux 命令行可以带来多少乐趣的终端。Eterm 是 Enlightenment 桌面的默认终端模拟器。当我最终从 AfterStep 迁移到 Enlightenment 时(那时早在 20 世纪初),我担心我会失去所有那些很酷的美学选择。结果并非如此。 实际上,Eterm 提供了许多独特的选项,同时使用终端工具栏使任务更容易。使用 Eterm,你可以通过从 “Background > Pixmap”菜单条目中轻松地从大量背景图像中选择一个背景(如果你需要一个的话,图 3)。 + +![Eterm][7] + +*图 3:从大量的背景图中为 Eterm 选择一个。* + +还有许多其他配置选项(例如字体大小、映射警报、切换滚动条、亮度、对比度和背景图像的透明度等)。 你要确定的一件事是,在你配置 Eterm 以满足你的口味后,需要单击 “Eterm > Save User Settings”(否则,关闭应用程序时所有设置都将丢失)。 + +可以从标准软件库安装 Eterm,其命令如下: + +``` +sudo apt-get install eterm +``` + +### Extraterm + +[Extraterm][8] 应该可以赢得今天任何终端窗口项目最酷功能集的一些奖项。Extraterm 最独特的功能是能够以彩色框来包装命令(蓝色表示成功命令,红色表示失败命令。图 4)。 + +![Extraterm][10] + +*图 4:Extraterm 显示有两个失败的命令框。* + +在运行命令时,Extraterm 会将命令包装在一个单独的颜色框中。如果该命令成功,则该颜色框将以蓝色轮廓显示。如果命令失败,框将以红色标出。 + +无法通过标准软件库安装 Extraterm。事实上,在 Linux 上运行 Extraterm(目前)的唯一方法是从项目的 GitHub 页面[下载预编译的二进制文件][11],解压缩文件,切换到新创建的目录,然后运行命令 `./extraterm`。 + +当该应用程序运行后,要启用颜色框,你必须首先启用 bash 集成。为此,请打开 Extraterm,然后右键单击窗口中的任意位置以显示弹出菜单。滚动,直到看到 “Inject Bash shell Integration”的条目(图 5)。选择该条目,然后你可以开始使用这个颜色框选项。 + +![Extraterm][13] + +*图 5:为 Extraterm 插入 Bash 集成。。* + +如果你运行了一个命令,并且看不到颜色框,则可能必须为该命令创建一个新的颜色框(因为 Extraterm 仅附带一些默认颜色框)。为此,请单击 “Extraterm” 菜单按钮(窗口右上角的三条水平线),选择“Settings”,然后单击“Frames”选项卡。在此窗口中,向下滚动并单击“New Rule”按钮。 然后,你可以添加要使用颜色框的命令(图 6)。 + +![frames][15] + +*图 6:为颜色框添加新规则。* + +如果在此之后仍然没有看到框架出现,请从[下载页面][11]下载 `extraterm-commands` 文件,解压缩该文件,切换到新创建的目录,然后运行命令 `sh setup_extraterm_bash.sh`。这应该可以为 Extraterm 启用颜色框。 + +还有更多可用于 Extraterm 的选项。我相信,一旦你开始在终端窗口上玩这个新花头,你就不会想回到标准终端。希望开发人员尽快将这个应用程序提供给标准软件库(因为它很容易就可以成为最常用的终端窗口之一)。 + +### 更多 + +正如你可能预期的那样,Linux 有很多可用的终端。这四个代表(至少对我来说)四个独特的终端,每个都可以帮助你运行每个 Linux 管理员需要运行的命令。如果你对其中一个不满意,请让你的包管理员查看可用的软件包。你一定会找到适合你的东西。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux + +作者:[Jack Wallen][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.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: http://tilda.sourceforge.net/tildadoc.php +[2]: https://www.linux.com/files/images/terminals2jpg +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_2.jpg?itok=gBkRLwDI (Aterm) +[4]: https://www.linux.com/licenses/category/used-permission +[5]: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands +[6]: https://www.linux.com/files/images/terminals3jpg +[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_3.jpg?itok=RVPTJAtK (Eterm) +[8]: http://extraterm.org +[9]: https://www.linux.com/files/images/terminals4jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_4.jpg?itok=2n01qdwO (Extraterm) +[11]: https://github.com/sedwards2009/extraterm/releases +[12]: https://www.linux.com/files/images/terminals5jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_5.jpg?itok=FdaE1Mpf (Extraterm) +[14]: https://www.linux.com/files/images/terminals6jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_6.jpg?itok=lQ1Zv5wq (frames) From 2791021455996515b0e21da4f055e6eeaae1e8d4 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Fri, 15 Feb 2019 18:55:03 +0800 Subject: [PATCH 154/813] translating --- sources/tech/20190207 10 Methods To Create A File In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190207 10 Methods To Create A File In Linux.md b/sources/tech/20190207 10 Methods To Create A File In Linux.md index b74bbacf13..2ae63c5715 100644 --- a/sources/tech/20190207 10 Methods To Create A File In Linux.md +++ b/sources/tech/20190207 10 Methods To Create A File In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 45fbbf6205b5e03b463eb55636558a52aa0e0add Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 15 Feb 2019 17:00:27 +0000 Subject: [PATCH 155/813] =?UTF-8?q?Revert=20"=E7=94=B3=E9=A2=86=E7=BF=BB?= =?UTF-8?q?=E8=AF=91"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 92615dab5a0abc49a52d652a31f28151b8c74fb5. --- .../tech/20181221 Large files with Git- LFS and git-annex.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20181221 Large files with Git- LFS and git-annex.md b/sources/tech/20181221 Large files with Git- LFS and git-annex.md index 2e7b9a9b74..29a76f810f 100644 --- a/sources/tech/20181221 Large files with Git- LFS and git-annex.md +++ b/sources/tech/20181221 Large files with Git- LFS and git-annex.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (runningwater) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -96,7 +96,7 @@ via: https://anarc.at/blog/2018-12-21-large-files-with-git/ 作者:[Anarc.at][a] 选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f000c7156ad8885f48f8f70d386243ab42fffbb3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Feb 2019 14:52:21 +0800 Subject: [PATCH 156/813] PRF:20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @qhwdw --- ...atory - Raspberry Pi- Lesson 6 Screen01.md | 191 +++++++----------- 1 file changed, 69 insertions(+), 122 deletions(-) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md index 99da7c98fc..51dfe63053 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @@ -1,34 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 6 Screen01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) -计算机实验室 – 树莓派:课程 6 屏幕01 +计算机实验室之树莓派:课程 6 屏幕01 ====== -欢迎来到屏幕系列课程。在本系列中,你将学习在树莓派中如何使用汇编代码控制屏幕,从显示随机数据开始,接着学习显示一个固定的图像和显示文本,然后格式化文本中的数字。假设你已经完成了 `OK` 系列课程的学习,所以在本系列中出现的有些知识将不再重复。 +欢迎来到屏幕系列课程。在本系列中,你将学习在树莓派中如何使用汇编代码控制屏幕,从显示随机数据开始,接着学习显示一个固定的图像和显示文本,然后格式化数字为文本。假设你已经完成了 OK 系列课程的学习,所以在本系列中出现的有些知识将不再重复。 第一节的屏幕课程教你一些关于图形的基础理论,然后用这些理论在屏幕或电视上显示一个图案。 ### 1、入门 -预期你已经完成了 `OK` 系列的课程,以及那个系列课程中在 `gpio.s` 和 `systemTimer.s` 文件中调用的函数。如果你没有完成这些,或你喜欢完美的实现,可以去下载 `OK05.s` 解决方案。在这里也要使用 `main.s` 文件中从开始到包含 `mov sp,#0x8000` 的这一行之前的代码。请删除这一行以后的部分。 +预期你已经完成了 OK 系列的课程,以及那个系列课程中在 `gpio.s` 和 `systemTimer.s` 文件中调用的函数。如果你没有完成这些,或你喜欢完美的实现,可以去下载 `OK05.s` 解决方案。在这里也要使用 `main.s` 文件中从开始到包含 `mov sp,#0x8000` 的这一行之前的代码。请删除这一行以后的部分。 ### 2、计算机图形 -将颜色表示为数字有几种方法。在这里我们专注于 RGB 方法,但 HSL 也是很常用的另一种方法。 +正如你所认识到的,从根本上来说,计算机是非常愚蠢的。它们只能执行有限数量的指令,仅仅能做一些数学,但是它们也能以某种方式来做很多很多的事情。而在这些事情中,我们目前想知道的是,计算机是如何将一个图像显示到屏幕上的。我们如何将这个问题转换成二进制?答案相当简单;我们为每个颜色设计一些编码方法,然后我们为在屏幕上的每个像素保存一个编码。一个像素就是你的屏幕上的一个非常小的点。如果你离屏幕足够近,你或许能够辨别出你的屏幕上的单个像素,能够看到每个图像都是由这些像素组成的。 -正如你所认识到的,从根本上来说,计算机是非常愚蠢的。它们只能执行有限数量的指令,仅仅能做一些数学,但是它们也能以某种方式来做很多很多的事情。而在这些事情中,我们目前想知道的是,计算机是如何将一个图像显示到屏幕上的。我们如何将这个问题转换成二进制?答案相当简单;我们为每个颜色设计一些编码方法,然后我们为生个像素在屏幕上保存一个编码。一个像素在你的屏幕上就是一个非常小的点。如果你离屏幕足够近,你或许能够在你的屏幕上辨别出单个的像素,能够看到每个图像都是由这些像素组成的。 +> 将颜色表示为数字有几种方法。在这里我们专注于 RGB 方法,但 HSL 也是很常用的另一种方法。 -随着计算机时代的到来,人们希望显示更多更复杂的图形,于是发明了图形卡的概念。图形卡是你的计算机上用来在屏幕上专门绘制图像的第二个处理器。它的任务就是将像素值信息转换成显示在屏幕上的亮度级别。在现代计算机中,图形卡已经能够做更多更复杂的事情了,比如绘制三维图形。但是在本系列教程中,我们只专注于图形卡的基本使用;从内存中取得像素然后把它显示到屏幕上。 +随着计算机时代的进步,人们希望显示越来越复杂的图形,于是发明了图形卡的概念。图形卡是你的计算机上用来在屏幕上专门绘制图像的第二个处理器。它的任务就是将像素值信息转换成显示在屏幕上的亮度级别。在现代计算机中,图形卡已经能够做更多更复杂的事情了,比如绘制三维图形。但是在本系列教程中,我们只专注于图形卡的基本使用;从内存中取得像素然后把它显示到屏幕上。 -不念经使用哪种方法,现在马上出现的一个问题就是我们使用的颜色编码。这里有几种选择,每个产生不同的输出质量。为了完整起见,我在这里只是简单概述它们。 - -不过这里的一些图像几乎没有颜色,因为它们使用了一个叫空间抖动的技术。这允许它们以很少的颜色仍然能表示出非常好的图像。许多早期的操作系统就使用了这种技术。 +不管使用哪种方法,现在马上出现的一个问题就是我们使用的颜色编码。这里有几种选择,每个产生不同的输出质量。为了完整起见,我在这里只是简单概述它们。 | 名字 | 唯一颜色数量 | 描述 | 示例 | | ----------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | @@ -40,27 +38,26 @@ | 真彩色 | 16,777,216 | 每个像素使用 24 位去保存,前八位表示红色通道,第二个八位表示绿色通道,最后八位表示蓝色通道。 | ![True colour image of a bird][6] | | RGBA32 | 16,777,216 带 256 级透明度 | 每个像素使用 32 位去保存,前八位表示红色通道,第二个八位表示绿色通道,第三个八位表示蓝色通道。只有一个图像绘制在另一个图像的上方时才考虑使用透明通道,值为 0 时表示下面图像的颜色,值为 255 时表示上面这个图像的颜色,介于这两个值之间的所有值表示这两个图像颜色的混合。 || +> 不过这里的一些图像只用了很少的颜色,因为它们使用了一个叫空间抖动的技术。这允许它们以很少的颜色仍然能表示出非常好的图像。许多早期的操作系统就使用了这种技术。 在本教程中,我们将从使用高色值开始。这样你就可以看到图像的构成,它的形成过程清楚,图像质量好,又不像真彩色那样占用太多的空间。也就是说,显示一个比较小的 800x600 像素的图像,它只需要小于 1 MiB 的空间。它另外的好处是它的大小是 2 次幂的倍数,相比真彩色这将极大地降低了获取信息的复杂度。 -``` -保存帧缓冲给一台计算机带来了很大的内存负担。基于这种原因,早期计算机经常作弊,比如,保存一屏幕文本,在每次单独刷新时,它只绘制刷新了的字母。 -``` - 树莓派和它的图形处理器有一种特殊而奇怪的关系。在树莓派上,首先运行的事实上是图形处理器,它负责启动主处理器。这是很不常见的。最终它不会有太大的差别,但在许多交互中,它经常给人感觉主处理器是次要的,而图形处理器才是主要的。在树莓派上这两者之间依靠一个叫 “邮箱” 的东西来通讯。它们中的每一个都可以为对方投放邮件,这个邮件将在未来的某个时刻被对方收集并处理。我们将使用这个邮箱去向图形处理器请求一个地址。这个地址将是一个我们在屏幕上写入像素颜色信息的位置,我们称为帧缓冲,图形卡将定期检查这个位置,然后更新屏幕上相应的像素。 +> 保存帧缓冲frame buffer给计算机带来了很大的内存负担。基于这种原因,早期计算机经常作弊,比如,保存一屏幕文本,在每次单独刷新时,它只绘制刷新了的字母。 + ### 3、编写邮差程序 -``` -消息传递是组件间通讯时使用的常见方法。一些操作系统在程序之间使用虚拟消息进行通讯。 -``` +接下来我们做的第一件事情就是编写一个“邮差”程序。它有两个方法:`MailboxRead`,从寄存器 `r0` 中的邮箱通道读取一个消息。而 `MailboxWrite`,将寄存器 `r0` 中的头 28 位的值写到寄存器 `r1` 中的邮箱通道。树莓派有 7 个与图形处理器进行通讯的邮箱通道。但仅第一个对我们有用,因为它用于协调帧缓冲。 -接下来我们做的第一件事情就是编写一个“邮差”程序。它有两个方法:MailboxRead,从寄存器 `r0` 中的邮箱通道读取一个消息。而 MailboxWrite,将寄存器 `r0` 中的头 28 位的值写到寄存器 `r1` 中的邮箱通道。树莓派有 7 个与图形处理器进行通讯的邮箱通道。但仅第一个对我们有用,因为它用于协调帧缓冲。 +> 消息传递是组件间通讯时使用的常见方法。一些操作系统在程序之间使用虚拟消息进行通讯。 下列的表和示意图描述了邮箱的操作。 表 3.1 邮箱地址 + | 地址 | 大小 / 字节 | 名字 | 描述 | 读 / 写 | +| ---- | ---------- | ------------ | -------------------- | ------ | | 2000B880 | 4 | Read | 接收邮件 | R | | 2000B890 | 4 | Poll | 不检索接收 | R | | 2000B894 | 4 | Sender |发送者信息 | R | @@ -70,20 +67,16 @@ 为了给指定的邮箱发送一个消息: - 1. 发送者等待,直到 `Status`字段的头一位为 0。 + 1. 发送者等待,直到 `Status` 字段的头一位为 0。 2. 发送者写入到 `Write`,低 4 位是要发送到的邮箱,高 28 位是要写入的消息。 - - 为了读取一个消息: 1. 接收者等待,直到 `Status` 字段的第 30 位为 0。 2. 接收者读取消息。 3. 接收者确认消息来自正确的邮箱,否则再次重试。 - - -如果你觉得有信心,你现在有足够的信息去写出我们所需的两个方法。如果没有信心,请继续往下看。 +如果你觉得有信心,你现在已经有足够的信息去写出我们所需的两个方法。如果没有信心,请继续往下看。 与以前一样,我建议你实现的第一个方法是获取邮箱区域的地址。 @@ -103,12 +96,11 @@ mov pc,lr 5. 将写入的值和邮箱通道组合到一起。 6. 写入到 `Write`。 - - 我们来按顺序写出它们中的每一步。 -1. -```assembly +1. 这将实现我们验证 `r0` 和 `r1` 的目的。`tst` 是通过计算两个操作数的逻辑与来比较两个操作数的函数,然后将结果与 0 进行比较。在本案例中,它将检查在寄存器 `r0` 中的输入的低 4 位是否为全 0。 + + ```assembly .globl MailboxWrite MailboxWrite: tst r0,#0b1111 @@ -117,14 +109,11 @@ cmp r1,#15 movhi pc,lr ``` -```assembly -tst reg,#val 计算寄存器 reg 和 #val 的逻辑与,然后将计算结果与 0 进行比较。 -``` + > `tst reg,#val` 计算寄存器 `reg` 和 `#val` 的逻辑与,然后将计算结果与 0 进行比较。 -这将实现我们验证 `r0` 和 `r1` 的目的。`tst` 是通过计算两个操作数的逻辑与来比较两个操作数的函数,然后将结果与 0 进行比较。在本案例中,它将检查在寄存器 `r0` 中的输入的低 4 位是否为全 0。 +2. 这段代码确保我们不会覆盖我们的值,或链接寄存器,然后调用 `GetMailboxBase`。 -2. -```assembly + ```assembly channel .req r1 value .req r2 mov value,r0 @@ -133,48 +122,39 @@ bl GetMailboxBase mailbox .req r0 ``` -这段代码确保我们不会覆盖我们的值,或链接寄存器,然后调用 `GetMailboxBase`。 +3. 这段代码加载当前状态。 -3. -```assembly + ```assembly wait1$: status .req r3 ldr status,[mailbox,#0x18] ``` -这段代码加载当前状态。 +4. 这段代码检查状态字段的头一位是否为 0,如果不为 0,循环回到第 3 步。 -4. -```assembly + ```assembly tst status,#0x80000000 .unreq status bne wait1$ ``` -这段代码检查状态字段的头一位是否为 0,如果不为 0,循环回到第 3 步。 +5. 这段代码将通道和值组合到一起。 -5. -```assembly + ```assembly add value,channel .unreq channel ``` -这段代码将通道和值组合到一起。 +6. 这段代码保存结果到写入字段。 -6. -```assembly + ```assembly str value,[mailbox,#0x20] .unreq value .unreq mailbox pop {pc} ``` -这段代码保存结果到写入字段。 - - - - -MailboxRead 的代码和它非常类似。 +`MailboxRead` 的代码和它非常类似。 1. 我们的输入将从哪个邮箱读取(`r0`)。我们必须要验证邮箱的真实性。不要忘了验证输入。 2. 使用 `GetMailboxBase` 去检索地址。 @@ -184,22 +164,20 @@ MailboxRead 的代码和它非常类似。 6. 检查邮箱是否是我们所要的,如果不是返回到第 3 步。 7. 返回结果。 - - 我们来按顺序写出它们中的每一步。 -1. -```assembly +1. 这一段代码来验证 `r0` 中的值。 + + ```assembly .globl MailboxRead MailboxRead: cmp r0,#15 movhi pc,lr ``` -这一段代码来验证 `r0` 中的值。 +2. 这段代码确保我们不会覆盖掉我们的值,或链接寄存器,然后调用 `GetMailboxBase`。 -2. -```assembly + ```assembly channel .req r1 mov channel,r0 push {lr} @@ -207,37 +185,33 @@ bl GetMailboxBase mailbox .req r0 ``` -这段代码确保我们不会覆盖掉我们的值,或链接寄存器,然后调用 `GetMailboxBase`。 +3. 这段代码加载当前状态。 -3. -```assembly + ```assembly rightmail$: wait2$: status .req r2 ldr status,[mailbox,#0x18] ``` -这段代码加载当前状态。 +4. 这段代码检查状态字段第 30 位是否为 0,如果不为 0,返回到第 3 步。 -4. -```assembly + ```assembly tst status,#0x40000000 .unreq status bne wait2$ ``` -这段代码检查状态字段第 30 位是否为 0,如果不为 0,返回到第 3 步。 +5. 这段代码从邮箱中读取下一条消息。 -5. -```assembly + ```assembly mail .req r2 ldr mail,[mailbox,#0] ``` -这段代码从邮箱中读取下一条消息。 +6. 这段代码检查我们正在读取的邮箱通道是否为提供给我们的通道。如果不是,返回到第 3 步。 -6. -```assembly + ```assembly inchan .req r3 and inchan,mail,#0b1111 teq inchan,channel @@ -247,31 +221,22 @@ bne rightmail$ .unreq channel ``` -这段代码检查我们正在读取的邮箱通道是否为提供给我们的通道。如果不是,返回到第 3 步。 +7. 这段代码将答案(邮件的前 28 位)移动到寄存器 `r0` 中。 -7. - -```assembly + ```assembly and r0,mail,#0xfffffff0 .unreq mail pop {pc} ``` -这段代码将答案(邮件的前 28 位)移动到寄存器 `r0` 中。 - - - - ### 4、我心爱的图形处理器 通过我们新的邮差程序,我们现在已经能够向图形卡上发送消息了。我们应该发送些什么呢?这对我来说可能是个很难找到答案的问题,因为它不是任何线上手册能够找到答案的问题。尽管如此,通过查找有关树莓派的 GNU/Linux,我们能够找出我们需要发送的内容。 -``` -由于在树莓派的内存是在图形处理器和主处理器之间共享的,我们能够只发送可以找到我们信息的位置即可。这就是 DMA,许多复杂的设备使用这种技术去加速访问时间。 -``` - 消息很简单。我们描述我们想要的帧缓冲区,而图形卡要么接受我们的请求,给我们返回一个 0,然后用我们写的一个小的调查问卷来填充屏幕;要么发送一个非 0 值,我们知道那表示很遗憾(出错了)。不幸的是,我并不知道它返回的其它数字是什么,也不知道它意味着什么,但我们知道仅当它返回一个 0,才表示一切顺利。幸运的是,对于合理的输入,它总是返回一个 0,因此我们不用过于担心。 +> 由于在树莓派的内存是在图形处理器和主处理器之间共享的,我们能够只发送可以找到我们信息的位置即可。这就是 DMA,许多复杂的设备使用这种技术去加速访问时间。 + 为简单起见,我们将提前设计好我们的请求,并将它保存到 `framebuffer.s` 文件的 `.data` 节中,它的代码如下: ```assembly @@ -293,11 +258,9 @@ FrameBufferInfo: 这就是我们发送到图形处理器的消息格式。第一对两个关键字描述了物理宽度和高度。第二对关键字描述了虚拟宽度和高度。帧缓冲的宽度和高度就是虚拟的宽度和高度,而 GPU 按需要伸缩帧缓冲去填充物理屏幕。如果 GPU 接受我们的请求,接下来的关键字将是 GPU 去填充的参数。它们是帧缓冲每行的字节数,在本案例中它是 `2 × 1024 = 2048`。下一个关键字是每个像素分配的位数。使用了一个 16 作为值意味着图形处理器使用了我们上面所描述的高色值模式。值为 24 是真彩色,而值为 32 则是 RGBA32。接下来的两个关键字是 x 和 y 偏移量,它表示当将帧缓冲复制到屏幕时,从屏幕左上角跳过的像素数目。最后两个关键字是由图形处理器填写的,第一个表示指向帧缓冲的实际指针,第二个是用字节数表示的帧缓冲大小。 -``` -当设备使用 DMA 时,对齐约束变得非常重要。GPU 预期消息都是 16 字节对齐的。 -``` +在这里我非常谨慎地使用了一个 `.align 4` 指令。正如前面所讨论的,这样确保了下一行地址的低 4 位是 0。所以,我们可以确保将被放到那个地址上的帧缓冲(`FrameBufferInfo`)是可以发送到图形处理器上的,因为我们的邮箱仅发送低 4 位全为 0 的值。 -在这里我非常谨慎地使用了一个 `.align 4` 指令。正如前面所讨论的,这样确保了下一行地址的低 4 位是 0。所以,我们可以确保将被放到那个地址上的帧缓冲是可以发送到图形处理器上的,因为我们的邮箱仅发送低 4 位全为 0 的值。 +> 当设备使用 DMA 时,对齐约束变得非常重要。GPU 预期该消息都是 16 字节对齐的。 到目前为止,我们已经有了待发送的消息,我们可以写代码去发送它了。通讯将按如下的步骤进行: @@ -305,8 +268,6 @@ FrameBufferInfo: 2. 从邮箱 1 上读取结果。如果它是非 0 值,意味着我们没有请求一个正确的帧缓冲。 3. 复制我们的图像到指针,这时图像将出现在屏幕上! - - 我在步骤 1 中说了一些以前没有提到的事情。我们在发送之前,在帧缓冲地址上加了 `0x40000000`。这其实是一个给 GPU 的特殊信号,它告诉 GPU 应该如何写到结构上。如果我们只是发送地址,GPU 将写到它的回复上,这样不能保证我们可以通过刷新缓存看到它。缓存是处理器使用的值在它们被发送到存储之前保存在内存中的片段。通过加上 `0x40000000`,我们告诉 GPU 不要将写入到它的缓存中,这样将确保我们能够看到变化。 因为在那里发生很多事情,因此最好将它实现为一个函数,而不是将它以代码的方式写入到 `main.s` 中。我们将要写一个函数 `InitialiseFrameBuffer`,由它来完成所有协调和返回指向到上面提到的帧缓冲数据的指针。为方便起见,我们还将帧缓冲的宽度、高度、位深作为这个方法的输入,这样就很容易地修改 `main.s` 而不必知道协调的细节了。 @@ -320,12 +281,11 @@ FrameBufferInfo: 5. 如果回复是非 0 值,方法失败。我们应该返回 0 去表示失败。 6. 返回指向帧缓冲信息的指针。 - - 现在,我们开始写更多的方法。以下是上面其中一个实现。 -1. -```assembly +1. 这段代码检查宽度和高度是小于或等于 4096,位深小于或等于 32。这里再次使用了条件运行的技巧。相信自己这是可行的。 + + ```assembly .section .text .globl InitialiseFrameBuffer InitialiseFrameBuffer: @@ -340,10 +300,9 @@ movhi result,#0 movhi pc,lr ``` -这段代码检查宽度和高度是小于或等于 4096,位深小于或等于 32。这里再次使用了条件运行的技巧。相信自己这是可行的。 +2. 这段代码写入到我们上面定义的帧缓冲结构中。我也趁机将链接寄存器推入到栈上。 -2. -```assembly + ```assembly fbInfoAddr .req r3 push {lr} ldr fbInfoAddr,=FrameBufferInfo @@ -357,53 +316,44 @@ str bitDepth,[fbInfoAddr,#20] .unreq bitDepth ``` -这段代码写入到我们上面定义的帧缓冲结构中。我也趁机将链接寄存器推入到栈上。 +3. `MailboxWrite` 方法的输入是写入到寄存器 `r0` 中的值,并将通道写入到寄存器 `r1` 中。 -3. -```assembly + ```assembly mov r0,fbInfoAddr add r0,#0x40000000 mov r1,#1 bl MailboxWrite ``` -`MailboxWrite` 方法的输入是写入到寄存器 `r0` 中的值,并将通道写入到寄存器 `r1` 中。 +4. `MailboxRead` 方法的输入是写入到寄存器 `r0` 中的通道,而输出是值读数。 -4. -```assembly + ```assembly mov r0,#1 bl MailboxRead ``` -`MailboxRead` 方法的输入是写入到寄存器 `r0` 中的通道,而输出是值读数。 +5. 这段代码检查 `MailboxRead` 方法的结果是否为 0,如果不为 0,则返回 0。 -5. -```assembly + ```assembly teq result,#0 movne result,#0 popne {pc} ``` -这段代码检查 `MailboxRead` 方法的结果是否为 0,如果不为 0,则返回 0。 +6. 这是代码结束,并返回帧缓冲信息地址。 -6. -```assembly + ```assembly mov result,fbInfoAddr pop {pc} .unreq result .unreq fbInfoAddr ``` -这是代码结束,并返回帧缓冲信息地址。 - - - - ### 5、在一帧中一行之内的一个像素 到目前为止,我们已经创建了与图形处理器通讯的方法。现在它已经能够给我们返回一个指向到帧缓冲的指针去绘制图形了。我们现在来绘制一个图形。 -第一示例,我们将在屏幕上绘制连续的颜色。它看起来并不漂亮,但至少能说明它在工作。我们如何才能在帧缓冲中设置每个像素为一个连续的数字,并且要持续不断地这样做。 +第一示例中,我们将在屏幕上绘制连续的颜色。它看起来并不漂亮,但至少能说明它在工作。我们如何才能在帧缓冲中设置每个像素为一个连续的数字,并且要持续不断地这样做。 将下列代码复制到 `main.s` 文件中,并放置在 `mov sp,#0x8000` 行之后。 @@ -414,7 +364,7 @@ mov r2,#16 bl InitialiseFrameBuffer ``` -这段代码使用了我们的 `InitialiseFrameBuffer` 方法,简单地创建了一个宽 1024、高 768、位深为 16 的帧缓冲区。在这里,如果你愿意可以尝试使用不同的值,只要整个代码中都一样就可以。如果图形处理器没有给我们创建好一个帧缓冲区,这个方法将返回 0,我们最好检查一下返回值,如果出现返回值为 0 的情况,我们打开 `OK` LED 灯。 +这段代码使用了我们的 `InitialiseFrameBuffer` 方法,简单地创建了一个宽 1024、高 768、位深为 16 的帧缓冲区。在这里,如果你愿意可以尝试使用不同的值,只要整个代码中都一样就可以。如果图形处理器没有给我们创建好一个帧缓冲区,这个方法将返回 0,我们最好检查一下返回值,如果出现返回值为 0 的情况,我们打开 OK LED 灯。 ```assembly teq r0,#0 @@ -435,8 +385,7 @@ fbInfoAddr .req r4 mov fbInfoAddr,r0 ``` -现在,我们已经有了帧缓冲信息的地址,我们需要取得帧缓冲信息的指针,并开始绘制屏幕。我们使用两个循环来做实现,一个走行,一个走列。事实上,树莓派中的大多数应用程序中,图片都是以从左右然后从上下到的顺序来保存的,因此我们也按这个顺序来写循环。 - +现在,我们已经有了帧缓冲信息的地址,我们需要取得帧缓冲信息的指针,并开始绘制屏幕。我们使用两个循环来做实现,一个走行,一个走列。事实上,树莓派中的大多数应用程序中,图片都是以从左到右然后从上到下的顺序来保存的,因此我们也按这个顺序来写循环。 ```assembly render$: @@ -470,9 +419,7 @@ render$: .unreq fbInfoAddr ``` -```assembly -strh reg,[dest] 将寄存器中的低位半个字保存到给定的 dest 地址上。 -``` +> `strh reg,[dest]` 将寄存器中的低位半个字保存到给定的 `dest` 地址上。 这是一个很长的代码块,它嵌套了三层循环。为了帮你理清头绪,我们将循环进行缩进处理,这就有点类似于高级编程语言,而汇编器会忽略掉这些用于缩进的 `tab` 字符。我们看到,在这里它从帧缓冲信息结构中加载了帧缓冲的地址,然后基于每行来循环,接着是每行上的每个像素。在每个像素上,我们使用一个 `strh`(保存半个字)命令去保存当前颜色,然后增加地址继续写入。每行绘制完成后,我们增加绘制的颜色号。在整个屏幕绘制完成后,我们跳转到开始位置。 @@ -489,7 +436,7 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html 作者:[Alex Chadwick][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ff5feb62e25d824684aa517f49c5870db106f088 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Feb 2019 14:53:38 +0800 Subject: [PATCH 157/813] PUB:20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @qhwdw https://linux.cn/article-10540-1.html --- ...6 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md (99%) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md similarity index 99% rename from translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md rename to published/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md index 51dfe63053..2419ac4f32 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md +++ b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10540-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 6 Screen01) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) From 65b8ccf8431af907eaedf746939c029f3796ddf6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Feb 2019 15:39:38 +0800 Subject: [PATCH 158/813] PRF:20180530 Introduction to the Pony programming language.md @beamrolling --- ...uction to the Pony programming language.md | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/translated/tech/20180530 Introduction to the Pony programming language.md b/translated/tech/20180530 Introduction to the Pony programming language.md index de00e1f042..c23c17e93a 100644 --- a/translated/tech/20180530 Introduction to the Pony programming language.md +++ b/translated/tech/20180530 Introduction to the Pony programming language.md @@ -1,13 +1,13 @@ Pony 编程语言简介 ====== -Pony,一种“Rust 遇上 Erlang”的语言,让开发快捷,安全,高效,以及高并发程序更简单。 +> Pony,一种“Rust 遇上 Erlang”的语言,让开发快捷、安全、高效、高并发的程序更简单。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keys.jpg?itok=O4qaYCHK) -在 [Wallaroo Labs][1],我是副总工程师,我们正在构建一个用 [Pony][3] 编程语言编写的 [高性能分布式流处理器][2]。大多数人没有听说过 Pony,但它一直是 Wallaroo 的最佳选择,它也可能成为你的下一个项目的最佳选择。 +在 [Wallaroo Labs][1],我是工程副总裁,我们正在构建一个用 [Pony][3] 编程语言编写的 [高性能分布式流处理器][2]。大多数人没有听说过 Pony,但它一直是 Wallaroo 的最佳选择,它也可能成为你的下一个项目的最佳选择。 -> "一门编程语言只是另一种工具。与语法无关。与表达性无关。与范式或模型无关。仅与管理难题有关" —Sylvan Clebsch,Pony 的创建者 +> “一门编程语言只是另一种工具。与语法无关,与表达性无关,与范式或模型无关,仅与解决难题有关。” —Sylvan Clebsch,Pony 的创建者 我是 Pony 项目的贡献者,但在这里我要谈谈为什么 Pony 对于像 Wallaroo 这样的应用是个好选择,并分享我使用 Pony 的方式。如果你对我们为什么使用 Pony 来编写 Wallaroo 甚感兴趣,我们有一篇关于它的 [博文][4]。 @@ -21,51 +21,49 @@ Pony,一种“Rust 遇上 Erlang”的语言,让开发快捷,安全,高 * 无数据竞争 * 无死锁 - - -此外,它被编译为高效的本地代码,它是在开放的情况下开发的,在 2-clause BSD 许可下可用。 +此外,它可以被编译为高效的本地代码,它是在开放的情况下开发的,在两句版 BSD 许可证下发布。 以上说的功能不少,但在这里我将重点关注那些对我们公司来说采用 Pony 至关重要的功能。 ### 为什么使用 Pony? -使用大多数我们现有的工具编写快速,安全,高效,高并发的程序并非易事。“快速,高效,高度并发”是可实现的目标,但加入“安全”之后,就困难了许多。通过 Wallaroo,我们希望同时实现四个目标,而 Pony 让实现它们更加简单。 +使用大多数我们现有的工具编写快速、安全、高效、高并发的程序并非易事。“快速、高效、高并发”是可实现的目标,但加入“安全”之后,就困难了许多。对于 Wallaroo,我们希望同时实现四个目标,而 Pony 让实现它们更加简单。 #### 高并发 -Pony 让并发变得简单。一部分是因为通过提供一个自用的并发主张。在 Pony 语言中,所有的并发都是通过 [Actor 模型][5] 进行的。 +Pony 让并发变得简单。部分是通过提供一个固执的并发方式实现的。在 Pony 语言中,所有的并发都是通过 [Actor 模型][5] 进行的。 -Actor 模型在 Erlang 和 Akka 中的实现最为著名。Actor 模型从 1970 年出现,细节因实施而异。不变的是,所有计算都由异步消息进行通信的 actor 来执行。 +Actor 模型以在 Erlang 和 Akka 中的实现最为著名。Actor 模型出现于上世纪 70 年代,细节因实现方式而异。不变的是,所有计算都由通过异步消息进行通信的 actor 来执行。 -你可以用这种方式来看待 Actor 模型:面向对象中的对象是状态+同步方法,而 actor 是状态+异步方法。 +你可以用这种方式来看待 Actor 模型:面向对象中的对象是状态 + 同步方法,而 actor 是状态 + 异步方法。 -当一个 actor 收到一个消息时,它执行相应的方法。该方法可以在只有该 actor 可访问的状态下运行。Actor 模型允许我们以并发安全的方式使用可变状态。每个 actor 都是单线程的。actor 中的两个方法不会并发运行。这意味着,在给定的 actor 中,数据更新不会引起数据竞争或通常与线程和可变状态相关的其他问题。 +当一个 actor 收到一个消息时,它执行相应的方法。该方法可以在只有该 actor 可访问的状态下运行。Actor 模型允许我们以并发安全的方式使用可变状态。每个 actor 都是单线程的。一个 actor 中的两个方法绝不会并发运行。这意味着,在给定的 actor 中,数据更新不会引起数据竞争或通常与线程和可变状态相关的其他问题。 #### 快速高效 -Pony actor 安排了一个高效的工作窃取调度程序。每个可用的 CPU 都有一个 Pony 调度程序。这种每个核心一个线程的并发模型是 Pony 尝试与 CPU 协同工作以尽可能高效运行的一部分。Pony 运行时尝试尽可能保持 CPU 缓存。代码越少,缓存越高,运行得越好。Pony 意在帮你的代码与 CPU 缓存友好相处。 +Pony actor 通过一个高效的工作窃取调度程序来调度。每个可用的 CPU 都有一个单独 Pony 调度程序。这种每个核心一个线程的并发模型是 Pony 尝试与 CPU 协同工作以尽可能高效运行的一部分。Pony 运行时尝试尽可能利用 CPU 缓存。代码越少干扰缓存,运行得越好。Pony 意在帮你的代码与 CPU 缓存友好相处。 -Pony 运行时还会有每个 actor 的堆,因此在垃圾收集期间,没有“stop the world”的垃圾收集步骤。这意味着你的程序总是至少能做一点工作。因此 Pony 程序最终具有非常一致的性能和可预测的延迟。 +Pony 的运行时还会有每个 actor 的堆,因此在垃圾收集期间,没有 “停止一切” 的垃圾收集步骤。这意味着你的程序总是至少能做一点工作。因此 Pony 程序最终具有非常一致的性能和可预测的延迟。 #### 安全 -Pony 型别系统引入了一个新概念:参考能力使得数据安全成为型别系统的一部分。Pony 语言中每种变量的类型都包含了有关如何在 actor 之间分享数据的信息。Pony 编译器用这些信息来确认,在编译时,你的代码是数据竞争和无死锁的。 +Pony 类型系统引入了一个新概念:引用能力,它使得数据安全成为类型系统的一部分。Pony 语言中每种变量的类型都包含了有关如何在 actor 之间分享数据的信息。Pony 编译器用这些信息来确认,在编译时,你的代码是无数据竞争和无死锁的。 -如果这听起来有点像 Rust,那是因为本来就是这样的。Pony 的参考功能和 Rust 的借用检查器都提供数据安全性;它们只是以不同的方式来接近它,并有不同的权衡。 +如果这听起来有点像 Rust,那是因为本来就是这样的。Pony 的引用功能和 Rust 的借用检查器都提供数据安全性;它们只是以不同的方式来接近这个目标,并有不同的权衡。 ### Pony 适合你吗? 决定是否要在一个非业余爱好的项目上使用一门新的编程语言是困难的。与其他方法想比,你必须权衡工具的适当性和不成熟度。那么,Pony 和你搭不搭呢? -如果你有一个困难的并发问题需要解决,那么 Pony 可能是一个好选择。解决并发应用问题是 Pony 存在的理由。如果你能用一个单线程的 Python 脚本就完成所需操作,那你大概不需要它。如果你有一个困难的并发问题,你应该考虑 Pony 及其强大的无数据竞争,并发感知型别系统。 +如果你有一个困难的并发问题需要解决,那么 Pony 可能是一个好选择。解决并发应用问题是 Pony 之所以存在的理由。如果你能用一个单线程的 Python 脚本就完成所需操作,那你大概不需要它。如果你有一个困难的并发问题,你应该考虑 Pony 及其强大的无数据竞争、并发感知类型系统。 -你将获得一个编译器,它将阻止你引入许多与并发相关的错误,并在运行时为你提供出色的性能特征。 +你将获得一个这样的编译器,它将阻止你引入许多与并发相关的错误,并在运行时为你提供出色的性能特征。 ### 开始使用 Pony 如果你准备好开始使用 Pony,你需要先在 Pony 的网站上访问 [学习部分][6]。在这里你会找到安装 Pony 编译器的步骤和学习这门语言的资源。 -如果你愿意为你正在使用的语言做出贡献,我们会在 GitHub 上为你提供一些 [初学者友好的问题][7]。 +如果你愿意为你正在使用的这个语言做出贡献,我们会在 GitHub 上为你提供一些 [初学者友好的问题][7]。 同时,我迫不及待地想在 [我们的 IRC 频道][8] 和 [Pony 邮件列表][9] 上与你交谈。 @@ -78,7 +76,7 @@ via: https://opensource.com/article/18/5/pony 作者:[Sean T Allen][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[beamrolling](https://github.com/beamrolling) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3109f9fafad9e642d1f6c1e3fe87927e68da0d72 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Feb 2019 15:40:18 +0800 Subject: [PATCH 159/813] PUB:20180530 Introduction to the Pony programming language.md @beamrolling https://linux.cn/article-10541-1.html --- .../20180530 Introduction to the Pony programming language.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180530 Introduction to the Pony programming language.md (100%) diff --git a/translated/tech/20180530 Introduction to the Pony programming language.md b/published/20180530 Introduction to the Pony programming language.md similarity index 100% rename from translated/tech/20180530 Introduction to the Pony programming language.md rename to published/20180530 Introduction to the Pony programming language.md From 07a1d8f3a77c7b58cee4ca1f8f17ab967ac68bad Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Feb 2019 16:01:25 +0800 Subject: [PATCH 160/813] PRF:20180621 How to connect to a remote desktop from Linux.md @tomjlw --- ... connect to a remote desktop from Linux.md | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/translated/tech/20180621 How to connect to a remote desktop from Linux.md b/translated/tech/20180621 How to connect to a remote desktop from Linux.md index 61182f12f2..27115bc620 100644 --- a/translated/tech/20180621 How to connect to a remote desktop from Linux.md +++ b/translated/tech/20180621 How to connect to a remote desktop from Linux.md @@ -1,24 +1,27 @@ 如何从 Linux 上连接到远程桌面 ====== +> Remmina 的极简用户界面使得远程访问 Linux / Windows 10 变得轻松。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO) -根据维基百科,[远程桌面][1] 是一种“可以让个人电脑上的桌面环境在一个系统(通常是电脑,但是也可以是服务器)上远程运行并在另一个分开的客户端设备显示的软件或者操作系统特性”。 +根据维基百科,[远程桌面][1] 是一种“软件或者操作系统特性,它可以让个人电脑上的桌面环境在一个系统(通常是电脑,但是也可以是服务器)上远程运行,但在另一个分开的客户端设备显示”。 -换句话说,远程桌面是用来访问在另一台电脑上运行的环境的。比如说 [ManageIQ/Integration tests][2] 仓库的拉取请求 (PR) 测试系统暴露了一个虚拟网络计算 (VNC) 连接端口,使得我能够远程浏览正被实时测试的拉取请求。远程桌面也被用于帮助客户解决电脑问题:在客户的许可下,你可以远程建立 VNC 或者远程桌面协议(RDP)连接来看或者交互式地访问电脑以寻找并解决问题。 +换句话说,远程桌面是用来访问在另一台电脑上运行的环境的。比如说 [ManageIQ/Integration tests][2] 仓库的拉取请求 (PR) 测试系统开放了一个虚拟网络计算 (VNC) 连接端口,使得我能够远程浏览正被实时测试的拉取请求。远程桌面也被用于帮助客户解决电脑问题:在客户的许可下,你可以远程建立 VNC 或者远程桌面协议(RDP)连接来查看或者交互式地访问该电脑以寻找并解决问题。 -运用远程桌面连接软件可以建立这些连接。可供选择的软件有很多,我用 [Remmina][3] 因为我喜欢它极简、好用的用户界面 (UI)。它是用 GTK+ 编写的,在 GNU GPL 证书下它是开源的。 +运用远程桌面连接软件可以建立这些连接。可供选择的软件有很多,我用 [Remmina][3],因为我喜欢它极简、好用的用户界面 (UI)。它是用 GTK+ 编写的,在 GNU GPL 许可证开源。 在这篇文章里,我会解释如何使用 Remmina 客户端从一台 Linux 电脑上远程连接到 Windows 10 系统 和 Red Hat 企业版 Linux 7 系统。 ### 在 Linux 上安装 Remmina 首先,你需要在你用来远程访问其它电脑的的主机上安装 Remmina。如果你用的是 Fedora,你可以运行如下的命令来安装 Remmina: + ``` sudo dnf install -y remmina ``` -如果你想在一个不同的 Linux 平台上安装 Remmina,跟着 [安装教程][4] 走。然后你会发现 Remmina 正和你其它软件待在一起(Remmina 在这张图片里被选中)。 +如果你想在一个不同的 Linux 平台上安装 Remmina,跟着 [安装教程][4] 走。然后你会发现 Remmina 正和你其它软件出现在一起(在这张图片里选中了 Remmina)。 ![](https://opensource.com/sites/default/files/uploads/remmina1-on-desktop.png) @@ -26,31 +29,31 @@ sudo dnf install -y remmina ![](https://opensource.com/sites/default/files/uploads/remmina2_launched.png) -Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统的 RDP 和 用来连接到 Linux 系统的 VNC。如你在上图左上角所见的,Remmina 的默认设置是 RDP。 +Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统的 RDP 和用来连接到 Linux 系统的 VNC。如你在上图左上角所见的,Remmina 的默认设置是 RDP。 ### 连接到 Windows 10 在你通过 RDP 连接到一台 Windows 10 电脑之前,你必须修改权限以允许分享远程桌面并通过防火墙建立连接。 -[注意: Windows 10 家庭版没有列出 RDP 特性][5] +- [注意: Windows 10 家庭版没有列入 RDP 特性][5] -要许可远程桌面分享,在**文件管理器**界面右击**我的电脑 → 属性 → 远程设置**,接着在跳出的窗口中,勾选**在这台电脑上允许远程连接**,再点击**应用**。 +要许可远程桌面分享,在“文件管理器”界面右击“我的电脑 → 属性 → 远程设置”,接着在跳出的窗口中,勾选“在这台电脑上允许远程连接”,再点击“应用”。 ![](https://opensource.com/sites/default/files/uploads/remmina3_connect_win10.png) -然后,允许远程连接通过你的防火墙。首先在**开始菜单中**查找**防火墙设置**,选择**允许应用通过防火墙**。 +然后,允许远程连接通过你的防火墙。首先在“开始菜单”中查找“防火墙设置”,选择“允许应用通过防火墙”。 ![](https://opensource.com/sites/default/files/uploads/remmina4_firewall.png) -在打开的窗口中,在**允许的应用和特性**下找到**远程桌面**。根据你用来访问这个桌面的网络酌情勾选**隐私**和/或**公开**列的选框。点击**确定**。 +在打开的窗口中,在“允许的应用和特性”下找到“远程桌面”。根据你用来访问这个桌面的网络酌情勾选“隐私”和/或“公开”列的选框。点击“确定”。 ![](https://opensource.com/sites/default/files/uploads/remmina5_firewall_2.png) -回到你用来远程访问 Windows 主机的 Linux 电脑,打开 Remmina。输入你的 Windows 主机的 IP 地址,敲击回车键。(我怎么在 [Linux][6] 和 [Windws][7] 中定位我的 IP 地址?)看到提示后,输入你的用户名和密码,点击确定。 +回到你用来远程访问 Windows 主机的 Linux 电脑,打开 Remmina。输入你的 Windows 主机的 IP 地址,敲击回车键。(我怎么在 [Linux][6] 和 [Windws][7] 中确定我的 IP 地址?)看到提示后,输入你的用户名和密码,点击“确定”。 ![](https://opensource.com/sites/default/files/uploads/remmina6_login.png) -如果你被询问是否接受证书,点击确定。 +如果你被询问是否接受证书,点击“确定”。 ![](https://opensource.com/sites/default/files/uploads/remmina7_certificate.png) @@ -60,7 +63,7 @@ Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统 ### 连接到 Red Hat 企业版 Linux 7 -要在你的 RHEL7 电脑上允许远程访问,在 Linux 桌面上打开**所有设置**。 +要在你的 RHEL7 电脑上允许远程访问,在 Linux 桌面上打开“所有设置”。 ![](https://opensource.com/sites/default/files/uploads/remmina9_settings.png) @@ -68,27 +71,27 @@ Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统 ![](https://opensource.com/sites/default/files/uploads/remmina10_sharing.png) -如果**屏幕分享**处于关闭状态,点击一下。一个窗口会弹出,你可以滑动到**打开**的位置。如果你想允许远程控制桌面,将**允许远程控制**调到**打开**。你同样也可以在两种访问选项间选择:一个能够让电脑的主要用户接受或者否绝连接要求,另一个能用密码验证连接。在窗口底部,选择被允许连接的网络界面,最后关闭窗口。 +如果“屏幕分享”处于关闭状态,点击一下。一个窗口会弹出,你可以滑动到“打开”的位置。如果你想允许远程控制桌面,将“允许远程控制”调到“打开”。你同样也可以在两种访问选项间选择:一个能够让电脑的主要用户接受或者否绝连接要求,另一个能用密码验证连接。在窗口底部,选择被允许连接的网络界面,最后关闭窗口。 -接着,从**应用菜单 → 其它 → 防火墙**打开**防火墙设置**。 +接着,从“应用菜单 → 其它 → 防火墙”打开“防火墙设置”。 ![](https://opensource.com/sites/default/files/uploads/remmina11_firewall_settings.png) -勾选 vnc-服务器旁边的选框(如下图所示)关闭窗口。接着直接到你远程电脑上的 Remmina,输入 你想连接到的 Linux 桌面的 IP 地址,选择 **VNC** 作为协议,点击**回车**键。 +勾选 “vnc-server”旁边的选框(如下图所示)关闭窗口。接着直接到你远程电脑上的 Remmina,输入你想连接到的 Linux 桌面的 IP 地址,选择 VNC 作为协议,点击回车键。 ![](https://opensource.com/sites/default/files/uploads/remmina12_vncprotocol.png) -如果你之前选择的验证选项是**新连接必须询问访问许可**,RHEL 系统用户会看到这样的一个弹窗 +如果你之前选择的验证选项是“新连接必须询问访问许可”,RHEL 系统用户会看到这样的一个弹窗: ![](https://opensource.com/sites/default/files/uploads/remmina13_permission.png) -点击**接受**以成功进行远程连接。 +点击“接受”以成功进行远程连接。 如果你选择用密码验证连接,Remmina 会向你询问密码。 ![](https://opensource.com/sites/default/files/uploads/remmina14_password-auth.png) -输入密码然后**确认**,你应该能连接到远程电脑。 +输入密码然后“确认”,你应该能连接到远程电脑。 ![](https://opensource.com/sites/default/files/uploads/remmina15_connected.png) @@ -96,9 +99,9 @@ Remmina 提供不同种类的连接,其中包括用来连接到 Windows 系统 Remmina 提供如上图所示的标签化的 UI,就好像一个浏览器一样。在上图所示的左上角你可以看到两个标签:一个是之前建立的 WIndows 10 连接,另一个新的是 RHEL 连接。 -在窗口的左侧,有一个有着**缩放窗口**,**全屏模式**,**偏好**,**截屏**,**断开连接**等选项的工具栏。你可以自己探索看那种适合你。 +在窗口的左侧,有一个有着“缩放窗口”、“全屏模式”、“偏好”、“截屏”、“断开连接”等选项的工具栏。你可以自己探索看那种适合你。 -你也可以通过点击左上角的**+**号创建保存过的连接。根据你的连接情况填好表单点击**保存**。以下是一个 Windows 10 RDP 连接的示例: +你也可以通过点击左上角的“+”号创建保存过的连接。根据你的连接情况填好表单点击“保存”。以下是一个 Windows 10 RDP 连接的示例: ![](https://opensource.com/sites/default/files/uploads/remmina16_saved-connection.png) @@ -106,11 +109,11 @@ Remmina 提供如上图所示的标签化的 UI,就好像一个浏览器一样 ![](https://opensource.com/sites/default/files/uploads/remmina17_connection-available.png) -点击一下它你不用补充细节就可以建立连接了。 +点击一下它,你不用补充细节就可以建立连接了。 ### 补充说明 -当你使用远程桌面软件时,你所有的操作都在远程桌面上消耗资源—— Remmina(或者其它类似软件)仅仅是一种与远程桌面交互的方式。你也可以通过 SSH 远程访问一台电脑,但那将会让你在那台电脑上局限于仅能使用文字的终端。 +当你使用远程桌面软件时,你所有的操作都在远程桌面上消耗资源 —— Remmina(或者其它类似软件)仅仅是一种与远程桌面交互的方式。你也可以通过 SSH 远程访问一台电脑,但那将会让你在那台电脑上局限于仅能使用文字的终端。 你也应当注意到当你允许你的电脑远程连接时,如果一名攻击者用这种方法获得你电脑的访问权同样会给你带来严重损失。因此当你不频繁使用远程桌面时,禁止远程桌面连接以及其在防火墙中相关的服务是很明智的做法。 @@ -121,7 +124,7 @@ via: https://opensource.com/article/18/6/linux-remote-desktop 作者:[Kedar Vijay Kulkarni][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0d7fd8a310905d132c0468a82159ad72b7a385bf Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Feb 2019 16:03:30 +0800 Subject: [PATCH 161/813] PUB:20180621 How to connect to a remote desktop from Linux.md @tomjlw https://linux.cn/article-10542-1.html --- .../20180621 How to connect to a remote desktop from Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180621 How to connect to a remote desktop from Linux.md (100%) diff --git a/translated/tech/20180621 How to connect to a remote desktop from Linux.md b/published/20180621 How to connect to a remote desktop from Linux.md similarity index 100% rename from translated/tech/20180621 How to connect to a remote desktop from Linux.md rename to published/20180621 How to connect to a remote desktop from Linux.md From 4a9c814748cba27271d06dff1708aa08a86cbac8 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Sat, 16 Feb 2019 07:30:49 -0600 Subject: [PATCH 162/813] Apply for translating Apply for translating --- ...0922 Annoying Experiences Every Linux Gamer Never Wanted.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md index 8362f15d9b..cbac45b76d 100644 --- a/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md +++ b/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @@ -1,3 +1,4 @@ +tomjlw is translating Annoying Experiences Every Linux Gamer Never Wanted! ============================================================ @@ -103,7 +104,7 @@ Have more annoyances to share? Do let us know in the comments. via: https://itsfoss.com/linux-gaming-problems/ 作者:[Avimanyu Bandyopadhyay ][a] -译者:[译者ID](https://github.com/译者ID) +译者:[tomjlw](https://github.com/tomjlw 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 454962d409ed5f97367b9ea4d7792fa69b2a3825 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 09:33:06 +0800 Subject: [PATCH 163/813] PRF:20190110 Toyota Motors and its Linux Journey.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jdh8383 恭喜你完成了第一篇翻译! --- ...110 Toyota Motors and its Linux Journey.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/translated/talk/20190110 Toyota Motors and its Linux Journey.md b/translated/talk/20190110 Toyota Motors and its Linux Journey.md index b4ae8074a3..109c37eb09 100644 --- a/translated/talk/20190110 Toyota Motors and its Linux Journey.md +++ b/translated/talk/20190110 Toyota Motors and its Linux Journey.md @@ -1,34 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (jdh8383) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Toyota Motors and its Linux Journey) [#]: via: (https://itsfoss.com/toyota-motors-linux-journey) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) +[#]: author: (Malcolm Dean https://itsfoss.com/toyota-motors-linux-journey) -丰田汽车的Linux之旅 +丰田汽车的 Linux 之旅 ====== -**这篇文章来自 It's FOSS 的读者 Malcolm Dean的投递。** +我之前跟丰田汽车北美分公司的 Brian.R.Lyons(丰田发言人)聊了聊,话题是关于 Linux 在丰田和雷克萨斯汽车的信息娱乐系统上的实施方案。我了解到一些汽车制造商使用了 Automotive Grade Linux(AGL)。 -我之前跟丰田汽车北美分公司的 Brian.R.Lyons(丰田发言人)聊了聊,话题是关于Linux在丰田和雷克萨斯汽车的信息娱乐系统上的实施方案。我了解到一些汽车制造商使用了 Automotive Grade Linux (AGL)。 +然后我写了一篇短文,记录了我和 Brian 的讨论内容,谈及了丰田和 Linux 的一些渊源。希望 Linux 的狂热粉丝们能够喜欢这次对话。 -然后我写了一篇短文,记录了我和 Brian 的讨论内容,就是丰田和 Linux 的一些渊源。希望 Linux 的狂热粉丝们能够喜欢这次对话。 - -全部[丰田和雷克萨斯汽车都将会使用 Automotive Grade Linux][1] (AGL),主要是用于车载信息娱乐系统。这项措施对于丰田集团来说是至关重要的,因为据 Lyons 先生所说:“作为技术的引领者之一,丰田认识到,赶上科技快速进步最好的方法就是拥抱开源理念”。 +全部的[丰田和雷克萨斯汽车都将会使用 Automotive Grade Linux(AGL)][1],主要是用于车载信息娱乐系统。这项措施对于丰田集团来说是至关重要的,因为据 Lyons 先生所说:“作为技术的引领者之一,丰田认识到,赶上科技快速进步最好的方法就是接受开源发展的理念。” 丰田和众多汽车制造公司都认为,与使用非自由软件相比,采用基于 Linux 的操作系统在更新和升级方面会更加廉价和快捷。 -这简直太棒了! Linux 终于跟汽车结合起来了。我每天都在电脑上使用 Linux;能看到这个优秀的软件在一个完全不同的产业领域里大展拳脚真是太好了。 +这简直太棒了!Linux 终于跟汽车结合起来了。我每天都在电脑上使用 Linux;能看到这个优秀的软件在一个完全不同的产业领域里大展拳脚真是太好了。 -我很好奇丰田是什么时候开始使用 [Automotive Grade Linux][2] (AGL) 的。按照 Lyons 先生的说法,这要追溯到 2011 年。 +我很好奇丰田是什么时候开始使用 [Automotive Grade Linux(AGL)][2]的。按照 Lyons 先生的说法,这要追溯到 2011 年。 ->“自 AGL 项目在五年前启动之始,作为活跃的会员和贡献者,丰田与其他顶级制造商和供应商展开合作,着手开发一个基于 Linux 的强大平台,并不断地增强其功能和安全性。” +> “自 AGL 项目在五年前启动之始,作为活跃的会员和贡献者,丰田与其他顶级制造商和供应商展开合作,着手开发一个基于 Linux 的强大平台,并不断地增强其功能和安全性。” ![丰田信息娱乐系统][3] -[丰田于2011年加入了 Linux 基金会][4],与其他汽车制造商和软件公司就 IVI(车内信息娱乐系统)展开讨论,最终在 2012 年,Linux 基金会内部成立了 Automotive Grade Linux 工作组。 +[丰田于 2011 年加入了 Linux 基金会][4],与其他汽车制造商和软件公司就 IVI(车内信息娱乐系统)展开讨论,最终在 2012 年,Linux 基金会内部成立了 Automotive Grade Linux 工作组。 丰田在 AGL 工作组里首先提出了“代码优先”的策略,这在开源领域是很常见的做法。然后丰田和其他汽车制造商、IVI 一线厂家,软件公司等各方展开对话,根据各方的技术需求详细制定了初始方向。 @@ -48,14 +46,14 @@ via: https://itsfoss.com/toyota-motors-linux-journey -作者:[Abhishek Prakash][a] +作者:[Malcolm Dean][a] 选题:[lujun9972][b] 译者:[jdh8383](https://github.com/jdh8383) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: https://itsfoss.com/author/abhishek/ +[a]: https://itsfoss.com/toyota-motors-linux-journey [b]: https://github.com/lujun9972 [1]: https://www.linuxfoundation.org/press-release/2018/01/automotive-grade-linux-hits-road-globally-toyota-amazon-alexa-joins-agl-support-voice-recognition/ [2]: https://www.automotivelinux.org/ From e741107b7b6f9e643c869d43f523e5f295516f0e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 09:34:44 +0800 Subject: [PATCH 164/813] PUB:20190110 Toyota Motors and its Linux Journey.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jdh8383 本文首发地址:https://linux.cn/article-10543-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/jdh8383 请注册领取您的 LCCN: https://lctt.linux.cn/ --- .../20190110 Toyota Motors and its Linux Journey.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190110 Toyota Motors and its Linux Journey.md (98%) diff --git a/translated/talk/20190110 Toyota Motors and its Linux Journey.md b/published/20190110 Toyota Motors and its Linux Journey.md similarity index 98% rename from translated/talk/20190110 Toyota Motors and its Linux Journey.md rename to published/20190110 Toyota Motors and its Linux Journey.md index 109c37eb09..d89f4f2a29 100644 --- a/translated/talk/20190110 Toyota Motors and its Linux Journey.md +++ b/published/20190110 Toyota Motors and its Linux Journey.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (jdh8383) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10543-1.html) [#]: subject: (Toyota Motors and its Linux Journey) [#]: via: (https://itsfoss.com/toyota-motors-linux-journey) [#]: author: (Malcolm Dean https://itsfoss.com/toyota-motors-linux-journey) From d0a78278b3c65733cca4365127001de9a040abc1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 09:58:16 +0800 Subject: [PATCH 165/813] PRF:20181204 4 Unique Terminal Emulators for Linux.md @wxy --- ...4 4 Unique Terminal Emulators for Linux.md | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md b/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md index 3570459516..31effbf1eb 100644 --- a/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md +++ b/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 Unique Terminal Emulators for Linux) @@ -14,13 +14,13 @@ ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_main.jpg?itok=e6av-5VO) -让我们面对现实,如果你是 Linux 管理员,那么你要用命令行来工作。为此,你将使用终端模拟器(LCTT 译注:常简称为“终端”,与终端本身的原意不同)。最有可能的是,你的选择发行版预先安装了一个可以完成工作的默认终端模拟器。但这是有很多选择可供选择的 Linux,所以这种思想自然也适用于终端模拟器。实际上,如果你打开发行版的图形界面的包管理器(或从命令行搜索),你将找到大量可能的选择。其中许多是非常简单的工具;然而,有些是真正独特的。 +让我们面对现实,如果你是 Linux 管理员,那么你要用命令行来工作。为此,你将使用终端模拟器(LCTT 译注:常简称为“终端”,与终端本身的原意不同)。最有可能的是,你选择的发行版预先安装了一个可以完成工作的默认终端模拟器。但这是有很多选择可供选择的 Linux,所以这种思想自然也适用于终端模拟器。实际上,如果你打开发行版的图形界面的包管理器(或从命令行搜索),你将找到大量可能的选择。其中许多是非常简单的工具;然而,有些是真正独特的。 -在本文中,我将重点介绍四个这样的终端模拟器,它们不仅可以完成工作,而且可以使工作变得更有趣或更有趣。 那么,让我们来看看这些终端。 +在本文中,我将重点介绍四个这样的终端模拟器,它们不仅可以完成工作,而且可以使工作变得更有趣或更好玩。那么,让我们来看看这些终端。 ### Tilda -[Tilda][1] 是为Gtk设计的,是一种酷炫的下拉终端。这意味着该终端始终在后台运行,随时准备从显示器顶部拉下来(例如 Guake 和 Yakuake)。让 Tilda 超越许多其他产品的原因是该终端可用的配置选项数量(图 1)。 +[Tilda][1] 是为 Gtk 设计的,是一种酷炫的下拉终端。这意味着该终端始终运行在后台,可以随时从显示器顶部拉下来(就像 Guake 和 Yakuake)。让 Tilda 超越许多其他产品的原因是该终端可用的配置选项数量(图 1)。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/terminals_1.jpg?itok=bra6qb6X) @@ -30,7 +30,7 @@ sudo apt-get install tilda -y ``` -安装完成后,从桌面菜单中打开 Tilda,这也将打开其配置窗口。根据你的喜好配置应用程序,然后关闭配置窗口。然后,你可以通过点击 `F1` 热键来打开和关闭 Tilda。对使用 Tilda 的一个警告是,在第一次运行后,你将找不到有关如何找到配置向导的任何提示。别担心。只要运行命令 `tilda -C`,它将打开配置窗口,同时仍保留你之前设置的选项。 +安装完成后,从桌面菜单中打开 Tilda,这也将打开其配置窗口。根据你的喜好配置应用程序,然后关闭配置窗口。然后,你可以通过点击 `F1` 热键来打开和关闭 Tilda。对使用 Tilda 的一个警告是,在第一次运行后,你将找不到有关如何打开配置向导的任何提示。别担心。只要运行命令 `tilda -C`,它将打开配置窗口,同时仍会保留你之前设置的选项。 可用选项包括: @@ -43,13 +43,13 @@ sudo apt-get install tilda -y * 透明度 * 动画 * 滚动 -* 和更多 +* 等等 -我喜欢这些类型的终端是因为当你不需要它们时它们很容易就会消失,只需按一下按钮即可。对于那些不断进出终端的人来说,像 Tilda 这样的工具是理想的选择。 +我喜欢这些类型的终端是因为当你不需要时它们很容易就会消失,只需按一下按钮即可。对于那些不断进出于终端的人来说,像 Tilda 这样的工具是理想的选择。 ### Aterm -Aterm 在我心中占有特殊的位置,因为它是我第一次使用的终端之一,它让我意识到 Linux 的灵活性。 这要回到当 AfterStep 成为我选择的窗口管理器时(用了不太久),而且那时我是命令行新手。Aterm 提供的是一个高度可定制的终端仿真器,同时帮助我了解使用终端的细节(如何添加选项和切换到命令)。“你觉得怎么样?”。因为 Aterm 从未有过用于定制的图形界面。要使用任何特殊选项运行 Aterm,它必须以命令选项的方式运行。例如,假设你要启用透明度、绿色文本、白色高亮和无滚动条。为此,请运行以下命令: +Aterm 在我心中占有特殊的位置,因为它是我第一次使用的终端之一,它让我意识到 Linux 的灵活性。 这要回到 AfterStep 成为我选择的窗口管理器时(没用了太久),而且那时我是命令行新手。Aterm 提供的是一个高度可定制的终端仿真器,同时帮助我了解了使用终端的细节(如何给命令添加选项和开关)。或许你会问:“你觉得怎么样?”。因为 Aterm 从未有过用于定制选项的图形界面。要使用任何特殊选项运行 Aterm,必须以命令选项的方式运行。例如,假设你要启用透明度、绿色文本、白色高亮和无滚动条。为此,请运行以下命令: ``` aterm -tr -fg green -bg white +xb @@ -67,16 +67,17 @@ aterm -tr -fg green -bg white +xb sudo apt-get install aterm -y ``` -如果你想总是用这些选项打开 Aterm,你最好的办法是在 `~/.bashrc` 文件中创建一个别名,如下所示: +如果你想总是用这些选项打开 Aterm,最好的办法是在 `~/.bashrc` 文件中创建一个别名,如下所示: ``` alias=”aterm -tr -fg green -bg white +sb” ``` + 保存该文件,当你运行命令 `aterm` 时,它将始终打开这些选项。有关创建别名的更多信息,请查看[这个教程][5]。 ### Eterm -Eterm 是第二个真正告诉我 Linux 命令行可以带来多少乐趣的终端。Eterm 是 Enlightenment 桌面的默认终端模拟器。当我最终从 AfterStep 迁移到 Enlightenment 时(那时早在 20 世纪初),我担心我会失去所有那些很酷的美学选择。结果并非如此。 实际上,Eterm 提供了许多独特的选项,同时使用终端工具栏使任务更容易。使用 Eterm,你可以通过从 “Background > Pixmap”菜单条目中轻松地从大量背景图像中选择一个背景(如果你需要一个的话,图 3)。 +Eterm 是第二个真正告诉我 Linux 命令行可以带来多少乐趣的终端。Eterm 是 Enlightenment 桌面的默认终端模拟器。当我最终从 AfterStep 迁移到 Enlightenment 时(那时早在 20 世纪初),我担心我会失去所有那些很酷的美学选择。结果并非如此。实际上,Eterm 提供了许多独特的选项,同时使用终端工具栏使任务变得更容易。使用 Eterm,你可以通过从 “Background > Pixmap” 菜单条目中轻松地从大量背景图像中选择一个背景(如果你需要一个的话,图 3)。 ![Eterm][7] @@ -92,7 +93,7 @@ sudo apt-get install eterm ### Extraterm -[Extraterm][8] 应该可以赢得今天任何终端窗口项目最酷功能集的一些奖项。Extraterm 最独特的功能是能够以彩色框来包装命令(蓝色表示成功命令,红色表示失败命令。图 4)。 +[Extraterm][8] 应该可以赢得当今终端窗口项目最酷功能集的一些奖项。Extraterm 最独特的功能是能够以彩色框来包装命令(蓝色表示成功命令,红色表示失败命令。图 4)。 ![Extraterm][10] @@ -100,27 +101,27 @@ sudo apt-get install eterm 在运行命令时,Extraterm 会将命令包装在一个单独的颜色框中。如果该命令成功,则该颜色框将以蓝色轮廓显示。如果命令失败,框将以红色标出。 -无法通过标准软件库安装 Extraterm。事实上,在 Linux 上运行 Extraterm(目前)的唯一方法是从项目的 GitHub 页面[下载预编译的二进制文件][11],解压缩文件,切换到新创建的目录,然后运行命令 `./extraterm`。 +无法通过标准软件库安装 Extraterm。事实上,在 Linux 上运行 Extraterm(目前)的唯一方法是从该项目的 GitHub 页面[下载预编译的二进制文件][11],解压缩文件,切换到新创建的目录,然后运行命令 `./extraterm`。 -当该应用程序运行后,要启用颜色框,你必须首先启用 bash 集成。为此,请打开 Extraterm,然后右键单击窗口中的任意位置以显示弹出菜单。滚动,直到看到 “Inject Bash shell Integration”的条目(图 5)。选择该条目,然后你可以开始使用这个颜色框选项。 +当该应用程序运行后,要启用颜色框,你必须首先启用 Bash 集成功能。为此,请打开 Extraterm,然后右键单击窗口中的任意位置以显示弹出菜单。滚动,直到看到 “Inject Bash shell Integration” 的条目(图 5)。选择该条目,然后你可以开始使用这个颜色框选项。 ![Extraterm][13] *图 5:为 Extraterm 插入 Bash 集成。。* -如果你运行了一个命令,并且看不到颜色框,则可能必须为该命令创建一个新的颜色框(因为 Extraterm 仅附带一些默认颜色框)。为此,请单击 “Extraterm” 菜单按钮(窗口右上角的三条水平线),选择“Settings”,然后单击“Frames”选项卡。在此窗口中,向下滚动并单击“New Rule”按钮。 然后,你可以添加要使用颜色框的命令(图 6)。 +如果你运行了一个命令,并且看不到颜色框,则可能必须为该命令创建一个新的颜色框(因为 Extraterm 仅附带一些默认颜色框)。为此,请单击 “Extraterm” 菜单按钮(窗口右上角的三条水平线),选择 “Settings”,然后单击 “Frames” 选项卡。在此窗口中,向下滚动并单击 “New Rule” 按钮。 然后,你可以添加要使用颜色框的命令(图 6)。 ![frames][15] *图 6:为颜色框添加新规则。* -如果在此之后仍然没有看到框架出现,请从[下载页面][11]下载 `extraterm-commands` 文件,解压缩该文件,切换到新创建的目录,然后运行命令 `sh setup_extraterm_bash.sh`。这应该可以为 Extraterm 启用颜色框。 +如果在此之后仍然没有看到颜色框出现,请从[下载页面][11]下载 `extraterm-commands` 文件,解压缩该文件,切换到新创建的目录,然后运行命令 `sh setup_extraterm_bash.sh`。这应该可以为 Extraterm 启用颜色框。 -还有更多可用于 Extraterm 的选项。我相信,一旦你开始在终端窗口上玩这个新花头,你就不会想回到标准终端。希望开发人员尽快将这个应用程序提供给标准软件库(因为它很容易就可以成为最常用的终端窗口之一)。 +还有更多可用于 Extraterm 的选项。我相信,一旦你开始在终端窗口上玩这个新花招,你就不会想回到标准终端了。希望开发人员可以尽快将这个应用程序提供给标准软件库(因为它很容易就可以成为最流行的终端窗口之一)。 ### 更多 -正如你可能预期的那样,Linux 有很多可用的终端。这四个代表(至少对我来说)四个独特的终端,每个都可以帮助你运行每个 Linux 管理员需要运行的命令。如果你对其中一个不满意,请让你的包管理员查看可用的软件包。你一定会找到适合你的东西。 +正如你可能预期的那样,Linux 有很多可用的终端。这四个代表四个独特的终端(至少对我来说),每个都可以帮助你运行 Linux 管理员需要运行的命令。如果你对其中一个不满意,用你的包管理器找找有什么可用的软件包。你一定会找到适合你的东西。 -------------------------------------------------------------------------------- @@ -129,7 +130,7 @@ via: https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux 作者:[Jack Wallen][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 1ec6d39b01aab7273af2f83c6f80c0baf6c3b138 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 10:58:26 +0800 Subject: [PATCH 166/813] PUB:20181204 4 Unique Terminal Emulators for Linux.md @wxy https://linux.cn/article-10544-1.html --- .../20181204 4 Unique Terminal Emulators for Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181204 4 Unique Terminal Emulators for Linux.md (99%) diff --git a/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md b/published/20181204 4 Unique Terminal Emulators for Linux.md similarity index 99% rename from translated/tech/20181204 4 Unique Terminal Emulators for Linux.md rename to published/20181204 4 Unique Terminal Emulators for Linux.md index 31effbf1eb..0ed7fd1908 100644 --- a/translated/tech/20181204 4 Unique Terminal Emulators for Linux.md +++ b/published/20181204 4 Unique Terminal Emulators for Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10544-1.html) [#]: subject: (4 Unique Terminal Emulators for Linux) [#]: via: (https://www.linux.com/blog/learn/2018/12/4-unique-terminals-linux) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) From 18b47a1623e4c80da1ecee03ac73f570c44301c5 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Sun, 17 Feb 2019 14:54:09 +0800 Subject: [PATCH 167/813] translated --- ...07 10 Methods To Create A File In Linux.md | 325 ------------------ ...07 10 Methods To Create A File In Linux.md | 323 +++++++++++++++++ 2 files changed, 323 insertions(+), 325 deletions(-) delete mode 100644 sources/tech/20190207 10 Methods To Create A File In Linux.md create mode 100644 translated/tech/20190207 10 Methods To Create A File In Linux.md diff --git a/sources/tech/20190207 10 Methods To Create A File In Linux.md b/sources/tech/20190207 10 Methods To Create A File In Linux.md deleted file mode 100644 index 2ae63c5715..0000000000 --- a/sources/tech/20190207 10 Methods To Create A File In Linux.md +++ /dev/null @@ -1,325 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 Methods To Create A File In Linux) -[#]: via: (https://www.2daygeek.com/linux-command-to-create-a-file/) -[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) - -10 Methods To Create A File In Linux -====== - -As we already know that everything is a file in Linux, that includes device as well. - -Linux admin should be performing the file creation activity multiple times (It may 20 times or 50 times or more than that, it’s depends upon their environment) in a day. - -Navigate to the following URL, if you would like to **[create a file in a specific size in Linux][1]**. - -It’s very important. how efficiently are we creating a file. Why i’m saying efficient? there is a lot of benefit if you know the efficient way to perform an activity. - -It will save you a lot of time. You can spend those valuable time on other important or major tasks, where you want to spend some more time instead of doing that in hurry. - -Here i’m including multiple ways to create a file in Linux. I advise you to choose few which is easy and efficient for you to perform your activity. - -You no need to install any of the following commands because all these commands has been installed as part of Linux core utilities except nano command. - -It can be done using the following 6 methods. - - * **`Redirect Symbol (>):`** Standard redirect symbol allow us to create a 0KB empty file in Linux. - * **`touch:`** touch command can create a 0KB empty file if does not exist. - * **`echo:`** echo command is used to display line of text that are passed as an argument. - * **`printf:`** printf command is used to display the given text on the terminal window. - * **`cat:`** It concatenate files and print on the standard output. - * **`vi/vim:`** Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. - * **`nano:`** nano is a small and friendly editor. It copies the look and feel of Pico, but is free software. - * **`head:`** head is used to print the first part of files.. - * **`tail:`** tail is used to print the last part of files.. - * **`truncate:`** truncate is used to shrink or extend the size of a file to the specified size. - - - -### How To Create A File In Linux Using Redirect Symbol (>)? - -Standard redirect symbol allow us to create a 0KB empty file in Linux. Basically it used to redirect the output of a command to a new file. When you use redirect symbol without a command then it’s create a file. - -But it won’t allow you to input any text while creating a file. However, it’s very simple and will be useful for lazy admins. To do so, simple enter the redirect symbol followed by the filename which you want. - -``` -$ > daygeek.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek.txt --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt -``` - -### How To Create A File In Linux Using touch Command? - -touch command is used to update the access and modification times of each FILE to the current time. - -It’s create a new file if does not exist. Also, touch command doesn’t allow us to enter any text while creating a file. By default it creates a 0KB empty file. - -``` -$ touch daygeek1.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek1.txt --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt -``` - -### How To Create A File In Linux Using echo Command? - -echo is a built-in command found in most operating systems. It is frequently used in scripts, batch files, and as part of individual commands to insert a text. - -This is nice command that allow users to input a text while creating a file. Also, it allow us to append the text in the next time. - -``` -$ echo "2daygeek.com is a best Linux blog to learn Linux" > daygeek2.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek2.txt --rw-rw-r-- 1 daygeek daygeek 49 Feb 4 02:04 daygeek2.txt -``` - -To view the content from the file, use the cat command. - -``` -$ cat daygeek2.txt -2daygeek.com is a best Linux blog to learn Linux -``` - -If you would like to append the content in the same file, use the double redirect Symbol (>>). - -``` -$ echo "It's FIVE years old blog" >> daygeek2.txt -``` - -You can view the appended content from the file using cat command. - -``` -$ cat daygeek2.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -``` - -### How To Create A File In Linux Using printf Command? - -printf command also works in the same way like how echo command works. - -printf command in Linux is used to display the given string on the terminal window. printf can have format specifiers, escape sequences or ordinary characters. - -``` -$ printf "2daygeek.com is a best Linux blog to learn Linux\n" > daygeek3.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek3.txt --rw-rw-r-- 1 daygeek daygeek 48 Feb 4 02:12 daygeek3.txt -``` - -To view the content from the file, use the cat command. - -``` -$ cat daygeek3.txt -2daygeek.com is a best Linux blog to learn Linux -``` - -If you would like to append the content in the same file, use the double redirect Symbol (>>). - -``` -$ printf "It's FIVE years old blog\n" >> daygeek3.txt -``` - -You can view the appended content from the file using cat command. - -``` -$ cat daygeek3.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -``` - -### How To Create A File In Linux Using cat Command? - -cat stands for concatenate. It is very frequently used in Linux to reads data from a file. - -cat is one of the most frequently used commands on Unix-like operating systems. It’s offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file. - -``` -$ cat > daygeek4.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek4.txt --rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:18 daygeek4.txt -``` - -To view the content from the file, use the cat command. - -``` -$ cat daygeek4.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -``` - -If you would like to append the content in the same file, use the double redirect Symbol (>>). - -``` -$ cat >> daygeek4.txt -This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. -``` - -You can view the appended content from the file using cat command. - -``` -$ cat daygeek4.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. -``` - -### How To Create A File In Linux Using vi/vim Command? - -Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs. - -There are a lot of features are available in vim to edit a single file with the command. - -``` -$ vi daygeek5.txt - -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek5.txt --rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt -``` - -To view the content from the file, use the cat command. - -``` -$ cat daygeek5.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -``` - -### How To Create A File In Linux Using nano Command? - -Nano’s is a another editor, an enhanced free Pico clone. nano is a small and friendly editor. It copies the look and feel of Pico, but is free software, and implements several features that Pico lacks, such as: opening multiple files, scrolling per line, undo/redo, syntax coloring, line numbering, and soft-wrapping overlong lines. - -``` -$ nano daygeek6.txt - -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek6.txt --rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt -``` - -To view the content from the file, use the cat command. - -``` -$ cat daygeek6.txt -2daygeek.com is a best Linux blog to learn Linux -It's FIVE years old blog -This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. -``` - -### How To Create A File In Linux Using head Command? - -head command is used to output the first part of files. By default it prints the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. - -``` -$ head -c 0K /dev/zero > daygeek7.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek7.txt --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:30 daygeek7.txt -``` - -### How To Create A File In Linux Using tail Command? - -tail command is used to output the last part of files. By default it prints the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. - -``` -$ tail -c 0K /dev/zero > daygeek8.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek8.txt --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:31 daygeek8.txt -``` - -### How To Create A File In Linux Using truncate Command? - -truncate command is used to shrink or extend the size of a file to the specified size. - -``` -$ truncate -s 0K daygeek9.txt -``` - -Use the ls command to check the created file. - -``` -$ ls -lh daygeek9.txt --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:37 daygeek9.txt -``` - -I have performed totally 10 commands in this article to test this. All together in the single output. - -``` -$ ls -lh daygeek* --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt --rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:07 daygeek2.txt --rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:15 daygeek3.txt --rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:20 daygeek4.txt --rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt --rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt --rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek7.txt --rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek8.txt --rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:38 daygeek9.txt --rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-command-to-create-a-file/ - -作者:[Vinoth 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.2daygeek.com/author/vinoth/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/ diff --git a/translated/tech/20190207 10 Methods To Create A File In Linux.md b/translated/tech/20190207 10 Methods To Create A File In Linux.md new file mode 100644 index 0000000000..4f3e94ad31 --- /dev/null +++ b/translated/tech/20190207 10 Methods To Create A File In Linux.md @@ -0,0 +1,323 @@ +[#]: collector: (lujun9972) +[#]: translator: (dianbanjiu ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Methods To Create A File In Linux) +[#]: via: (https://www.2daygeek.com/linux-command-to-create-a-file/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +在 Linux 上创建文件的 10 个方法 +====== + +我们都知道,在 Linux 上,包括设备在内的一切都是文件。 + +Linux 管理员每天应该会多次执行文件创建活动(可能是 20 次,50 次,甚至是更多,这依赖于他们的环境)。 + +如果你想 **[在Linux上创建一个特定大小的文件][1]**,查看前面的这个链接。 + +高效创建一个文件是非常重要的。为什么我说高效?如果你了解一些高效进行你当前活动的方式,你就可以事半功倍。 + +这将会节省你很多的时间。你可以把这些有用的时间用到到其他重要的事情上。 + +我下面将会介绍多个在 Linux 上创建文件的方法。我建议你选择几个简单高效的来辅助你的工作。 + +你不必安装下列的任何一个命令,因为它们已经作为 Linux 核心工具的一部分安装到你的系统上了。 + +创建文件可以通过以下六个方式来完成。 + + * **`重定向符号 (>):`** 标准重定向符允许我们创建一个 0KB 的空文件。 + * **`touch:`** 如果文件不存在的话,touch 命令将会创建一个 0KB 的空文件。 + * **`echo:`** echo 命令通过一个参数显示文本的某行。 + * **`printf:`** printf 命令用于显示在终端给定的文本。 + * **`cat:`** 它串联并打印文件到标准输出。 + * **`vi/vim:`** Vim 是一个向上兼容 Vi 的文本编辑器。它常用于编辑各种类型的纯文本。 + * **`nano:`** nano 是一个简小且用户友好的编辑器。它复制了 Pico 的外观和优点,而且还是免费的。 + * **`head:`** head 用于打印一个文件开头的一部分。 + * **`tail:`** tail 用于打印一个文件的最后一部分。 + * **`truncate:`** truncate 用于缩小或者扩展文件的尺寸到指定大小。 + + + +### 在 Linux 上使用重定向符(>>)创建一个文件 + +标准重定向符允许我们创建一个 0KB 的空文件。它通常用于重定向一个命令的输出到一个新文件中。在没有命令的情况下使用重定向符号时,它会创建一个文件。 + +但是它不允许你在创建文件时向其中输入任何文本。然而它对于不是很勤劳的管理员是非常简单有用的。只需要输入重定向符后面跟着你想要的文件名。 +(译者注:在输入下面的命令回车后,该命令并不会立刻中断,回车后你其实还可以继续输入一些文本,而这些文本都会被记录到你所创建的文章中去。在输入完成后,你可以使用 Ctrl+C 或者 Ctrl+D 来结束输入) + +``` +$ > daygeek.txt +``` + +使用 ls 命令查看刚刚创建的文件。 + +``` +$ ls -lh daygeek.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt +``` + +### 在 Linux 上使用 touch 命令创建一个文件 + +touch 命令常用于将每个文件的访问和修改时间更新为当前时间。 + +如果指定的文件名不存在,将会创建一个新的文件。touch 不允许我们在创建文件的同时向其中输入一些文本。它默认创建一个 0KB 的空文件。 + +``` +$ touch daygeek1.txt +``` + +使用 ls 命令查看刚刚创建的文件。 + +``` +$ ls -lh daygeek1.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt +``` + +### 在 Linux 上使用 echo 命令创建一个文件 + +echo 内置于大多数的操作系统中。它常用于脚本,批处理文件,以及作为插入文本的单个命令的一部分。 + +它允许你在创建一个文件时就向其中输入一些文本。当然也允许你在之后向其中输入一些文本。 + +``` +$ echo "2daygeek.com is a best Linux blog to learn Linux" > daygeek2.txt +``` + +使用 ls 命令查看刚刚创建的文件。 + +``` +$ ls -lh daygeek2.txt +-rw-rw-r-- 1 daygeek daygeek 49 Feb 4 02:04 daygeek2.txt +``` + +可以使用 cat 命令查看文件的内容。 + +``` +$ cat daygeek2.txt +2daygeek.com is a best Linux blog to learn Linux +``` + +你可以使用两个重定向符 (>>) 添加其他内容到同一个文件。 + +``` +$ echo "It's FIVE years old blog" >> daygeek2.txt +``` + +你可以使用 cat 命令查看添加的内容。 + +``` +$ cat daygeek2.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +### 在 Linux 上使用 printf 命令创建一个新的文件 +printf 命令也可以以类似 echo 的方式执行。 + +printf 命令常用来显示在终端窗口给出的字符串。printf 可以有格式说明符,转义序列或普通字符。 + +``` +$ printf "2daygeek.com is a best Linux blog to learn Linux\n" > daygeek3.txt +``` + +使用 ls 命令查看刚刚创建的文件。 + +``` +$ ls -lh daygeek3.txt +-rw-rw-r-- 1 daygeek daygeek 48 Feb 4 02:12 daygeek3.txt +``` + +使用 cat 命令查看文件的内容。 + +``` +$ cat daygeek3.txt +2daygeek.com is a best Linux blog to learn Linux +``` + +你可以使用两个重定向符 (>>) 添加其他的内容到同一个文件中去。 + +``` +$ printf "It's FIVE years old blog\n" >> daygeek3.txt +``` + +你可以使用 cat 命令查看这个文件中添加的内容。 + +``` +$ cat daygeek3.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +### 在 Linux 中使用 cat 创建一个文件 +cat 表示串联(concatenate)。在 Linux 经常用于读取一个文件中的数据。 + +cat 是在类 Unix 系统中最常使用的命令之一。 它提供了三个与文本文件相关的功能:显示一个文件的内容,组合多个文件的内容到一个输出以及创建一个新的文件。 +(译者注:如果 cat 命令后如果不带任何文件的话,下面的命令在回车后也不会立刻结束,回车后的操作同上面的重定向符中的注解) + + +``` +$ cat > daygeek4.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +使用 ls 命令查看创建的文件。 + +``` +$ ls -lh daygeek4.txt +-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:18 daygeek4.txt +``` + +使用 cat 命令查看文件的内容。 + +``` +$ cat daygeek4.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +如果你想向同一个文件中添加其他内容,使用两个连接的重定向符(>>)。 + +``` +$ cat >> daygeek4.txt +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +你可以使用 cat 命令查看添加的内容。 + +``` +$ cat daygeek4.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +### 在 Linux 上使用 vi/vim 命令创建一个文件 +Vim 是一个向上兼容 Vi 的文本编辑器。它通常用来编辑所有种类的纯文本。在编辑程序时特别有用。 + +vim 中有很多功能可以用于编辑单个文件。 + +``` +$ vi daygeek5.txt + +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +使用 ls 查看刚才创建的文件。 + +``` +$ ls -lh daygeek5.txt +-rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt +``` + +使用 cat 命令查看文件的内容。 + +``` +$ cat daygeek5.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +``` + +### 在 Linux 上使用 nano 命令创建一个文件 +Nano 是一个编辑器,它是一个免费的 Pico 的克隆。nano 是一个小且用户友好的编辑器。它复制了 Pico 的外观及优点,并且是一个免费的应用,它添加了 Pico 缺乏的一系列特性,像是打开多个文件,每行滚动,撤销/重做,语法高亮,行号等等。 + +``` +$ nano daygeek6.txt + +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +使用 ls 命令查看创建的文件。 + +``` +$ ls -lh daygeek6.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt +``` +使用 cat 命令来查看一个文件的内容。 + +``` +$ cat daygeek6.txt +2daygeek.com is a best Linux blog to learn Linux +It's FIVE years old blog +This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. +``` + +### 在 Linux 上使用 head 命令创建一个文件 + +head 命令通常用于输出一个文件开头的一部分。它默认会打印一个文件的开头 10 行到标准输出。如果有多个文件,则每个文件前都会有一个标题,用来表示文件名。 + +``` +$ head -c 0K /dev/zero > daygeek7.txt +``` + +使用 ls 命令查看创建的文件。 + +``` +$ ls -lh daygeek7.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:30 daygeek7.txt +``` + +### 在 Linux 上使用 tail 创建一个文件 + +tail 命令通常用来输出一个文件最后的一部分。它默认会打印每个文件的最后 10 行到标准输出。如果有多个文件,则每个文件前都会有一个标题,用来表示文件名。 + +``` +$ tail -c 0K /dev/zero > daygeek8.txt +``` + +使用 ls 命令查看创建的文件。 + +``` +$ ls -lh daygeek8.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:31 daygeek8.txt +``` + +### 在 Linux 上使用 truncate 命令创建一个文件 + +truncate 命令通常用作将一个文件的尺寸缩小或者扩展为某个指定的尺寸。 + +``` +$ truncate -s 0K daygeek9.txt +``` + +使用 ls 命令检查创建的文件。 + +``` +$ ls -lh daygeek9.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:37 daygeek9.txt +``` + +在这篇文章中,我使用这十个命令分别创建了下面的这十个文件。 + +``` +$ ls -lh daygeek* +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:02 daygeek1.txt +-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:07 daygeek2.txt +-rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:15 daygeek3.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:20 daygeek4.txt +-rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek7.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:32 daygeek8.txt +-rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:38 daygeek9.txt +-rw-rw-r-- 1 daygeek daygeek 0 Feb 4 02:00 daygeek.txt +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-to-create-a-file/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[dianbanjiu](https://github.com/dianbanjiu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/ From a3f4704d7f58431c719001d43032d38ddf83c102 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 15:36:02 +0800 Subject: [PATCH 168/813] APL:20181124 14 Best ASCII Games for Linux That are Insanely Good --- ...1124 14 Best ASCII Games for Linux That are Insanely Good.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md b/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md index 094467698b..0dd011f5dc 100644 --- a/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md +++ b/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (14 Best ASCII Games for Linux That are Insanely Good) From 801cefd2a74451f9838b6fa5846b2afe371de05f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 20:58:12 +0800 Subject: [PATCH 169/813] TSL:20180725 Best Online Linux Terminals and Online Bash Editors.md --- ... Games for Linux That are Insanely Good.md | 201 +++++++++--------- ...Linux Terminals and Online Bash Editors.md | 0 2 files changed, 99 insertions(+), 102 deletions(-) rename {sources => translated}/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md (100%) diff --git a/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md b/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md index 0dd011f5dc..211b19b5a1 100644 --- a/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md +++ b/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md @@ -7,70 +7,67 @@ [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) [#]: url: ( ) -14 Best ASCII Games for Linux That are Insanely Good +14 个依然很棒的 Linux ASCII 游戏 ====== -Text-based or should I say [terminal-based games][1] were very popular a decade back – when you didn’t have visual masterpieces like God Of War, Red Dead Redemption 2 or Spiderman. +基于文本的(或者我应该说是[基于终端的][1])游戏在十年前非常流行 —— 当时还没有像战神God Of War荒野大镖客:救赎 2Red Dead Redemption 2蜘蛛侠Spiderman这样的视觉游戏大作。 -Of course, the Linux platform has its share of good games – but not always the “latest and greatest”. But, there are some ASCII games out there – to which you can never turn your back on. +当然,Linux 平台有很多好游戏 —— 虽然并不总是“最新和最好”。但是,有一些 ASCII 游戏,却是你永远不会玩腻的。 -I’m not sure if you’d believe me, some of the ASCII games proved to be very addictive (So, it might take a while for me to resume work on the next article, or I might just get fired? – Help me!) +你或许不相信,有一些 ASCII 游戏被证明是非常容易上瘾的(所以,我可能需要一段时间才能继续写下一篇文章,或者我可能会被解雇? —— 帮帮我!) -Jokes apart, let us take a look at the best ASCII games. +哈哈,开个玩笑。让我们来看看最好的 ASCII 游戏吧。 -**Note:** Installing ASCII games could be time-consuming (some might ask you to install additional dependencies or simply won’t work). You might even encounter some ASCII games that require you build from Source. So, we’ve filtered out only the ones that are easy to install/run – without breaking a sweat. +**注意:**安装 ASCII 游戏可能要花费不少时间(有些可能会要求你安装其他依赖项或根本不起作用)。你甚至可能会遇到一些需要你从源代码构建的 ASCII 游戏。因此,我们只筛选出那些易于安装和运行的产品 —— 不用费劲。 -### Things to do before Running or Installing an ASCII Game +### 在运行和安装 ASCII 游戏之前需要做的事情 -Some of the ASCII games might require you to install [Simple DirectMedia Layer][2] unless you already have it installed. So, in case, you should install them first before trying to run any of the games mentioned in this article. +如果你没有安装的话,某些 ASCII 游戏可能需要你安装 [Simple DirectMedia Layer][2]。因此,以防万一,你应该先尝试安装它,然后再尝试运行本文中提到的任何游戏。 -For that, you just need to type in these commands: +要安装它,你需要键入如下命令: ``` sudo apt install libsdl2-2.0 -``` - -``` sudo apt install libsdl2_mixer-2.0 ``` - -### Best ASCII Games for Linux +### Linux 上最好的 ASCII 游戏 ![Best Ascii games for Linux][3] -The games listed are in no particular order of ranking. +如下列出的游戏排名不分先后。 -#### 1 . [Curse of War][4] +#### 1、战争诅咒 ![Curse of War ascii games][5] -Curse of War is an interesting strategy game. You might find it a bit confusing at first but once you get to know it – you’ll love it. I’ll recommend you to take a look at the rules of the game on their [homepage][4] before launching the game. +[战争诅咒][4]Curse of War是一个有趣的策略游戏。一开始你可能会发现它有点令人困惑,但一旦你掌握了,就会喜欢上它。在启动游戏之前,我建议你在其 [主页][4] 上查看该游戏规则。 -You will be building infrastructure, secure resources and directing your army to fight. All you have to do is place your flag in a good position to let your army take care of the rest. It’s not just about attacking – you need to manage and secure the resources to help win the fight. +你将建设基础设施、保护资源并指挥你的军队进行战斗。你所要做的就是把你的旗帜放在一个合适的位置,让你的军队来完成其余的任务。不仅仅是攻击敌人,你还需要管理和保护资源以帮助赢得战斗。 -If you’ve never played any ASCII game before, be patient and spend some time learning it – to experience it to its fullest potential. +如果你之前从未玩过任何 ASCII 游戏,请耐心花一些时间来学习它、体验它的全部潜力。 -##### How to install Curse of War? +##### 如何安装? -You will find it in the official repository. So, type in the following command to install it: +你可以在官方软件库里找到它。键入如下命令来安装它: ``` sudo apt install curseofwar ``` -#### 2. ASCII Sector + +#### 2、ASCII 领域 ![ascii sector][6] -Hate strategy games? Fret not, ASCII sector is a game that has a space-setting and lets you explore a lot. +讨厌策略游戏?不用担心,ASCII 领域ASCII Sector是一款具有空间环境的游戏,可让你进行大量探索。 -Also, the game isn’t just limited to exploration, you need some action? You got that here as well. Of course, not the best combat experience- but it is fun. It gets even more exciting when you see a variety of bases, missions, and quests. You’ll encounter a leveling system in this tiny game where you have to earn enough money or trade in order upgrade your spaceship. +此外,不仅仅局限于探索,你还想要采取一些行动吗?也是可以的。当然,虽然战斗体验不是最好的,但它也很有趣。当你看到各种基地、任务和探索时,会让你更加兴奋。你会在这个小小的游戏中遇到一个练级系统,你必须赚取足够的钱或进行交易才能升级你的宇宙飞船。 -The best part about this game is – you can create your own quests or play other’s. +而这个游戏最好的地方是你可以创建自己的任务,也可以玩其他人的任务。 -###### How to install ASCII Sector? +##### 如何安装? -You need to first download and unpack the archived package from the [official site][7]. After it’s done, open up your terminal and type these commands (replace the **Downloads** folder with your location where the unpacked folder exists, ignore it if the unpacked folder resides inside your home directory): +你需要先从其 [官方网站][7] 下载并解压缩归档包。完成后,打开终端并输入这些命令(将 “Downloads” 文件夹替换为你解压缩文件夹所在的位置,如果解压缩文件夹位于你的主目录中,则忽略它): ``` cd Downloads @@ -79,42 +76,40 @@ chmod +x asciisec ./asciisec ``` -#### 3. DoomRL +#### 3、DoomRL ![doom ascii game][8] -You must be knowing the classic game “Doom”. So, if you want the scaled down experience of it as a rogue-like, DoomRL is for you. It is an ASCII-based game, in case you don’t feel like it to be. +你肯定知道经典游戏“毁灭战士DOOM”,所以,如果你想把它像 Rogue 类游戏一样略微体验一下,DoomRL 就是适合你的游戏。它是一个基于 ASCII 的游戏,这或许让你想不到。 -It’s a very tiny game with a lot of gameplay hours to have fun with. +这是一个非常小的游戏,但是可以玩很久。 -###### How to install DoomRL? +##### 如何安装? -Similar to what you did for ASCII Sector, you need to download the official archive from their [download page][9] and then extract it to a folder. +与你对 “ASCII 领域”所做的类似,你需要从其 [下载页面][9] 下载官方归档文件,然后将其解压缩到一个文件夹。 -After extracting it, type in these commands: +解压缩后,输入以下命令: ``` cd Downloads // navigating to the location where the unpacked folder exists -``` - -``` cd doomrl-linux-x64-0997 chmod +x doomrl ./doomrl ``` -#### 4. Pyramid Builder + +#### 4、金字塔建造者 ![Pyramid Builder ascii game for Linux][10] -Pyramid Builder is an innovative take as an ASCII game where get to improve your civilization by helping build pyramids. +金字塔建造者Pyramid Builder 是一款创新的 ASCII 游戏,你可以通过帮助建造金字塔来提升你的文明。 -You need to direct the workers to farm, unload the cargo, and move the gigantic stones to successfully build the pyramid. +你需要指导工人耕种、卸载货物、并移动巨大的石头,以成功建造金字塔。 -It is indeed a beautiful ASCII game to download. +这确实是一个值得下载的 ASCII 游戏。 -###### How to install Pyramid Builder? +##### 如何安装? -Simply head to its official site and download the package to unpack it. After extraction, navigate to the folder and run the executable file. +只需前往其官方网站并下载包以解压缩。提取后,导航到该文件夹并运行可执行文件。 ``` cd Downloads @@ -122,178 +117,180 @@ cd pyramid_builder_linux chmod +x pyramid_builder_linux.x86_64 ./pyramid_builder_linux.x86_64 ``` -#### 5. DiabloRL + +#### 5、DiabloRL ![Diablo ascii RPG game][11] -If you’re an avid gamer, you must have heard about Blizzard’s Diablo 1. It is undoubtedly a good game. +如果你是一位狂热的游戏玩家,你一定听说过暴雪的暗黑破坏神Diablo 1 代,毫无疑问这是一个精彩的游戏。 -You get the chance to play a unique rendition of the game – which is an ASCII game. DiabloRL is a turn-based rogue-like game that is insanely good. You get to choose from a variety of classes (Warrior, Sorcerer, or Rogue). Every class would result in a different gameplay experience with a set of different stats. +现在你有机会玩一个该游戏的独特演绎版本 —— 一个 ASCII 游戏。DiabloRL 是一款非常棒的基于回合制的 Rogue 类的游戏。你可以从各种职业(战士、巫师或盗贼)中进行选择。每个职业都具有一套不同的属性,可以带来不同游戏体验。 -Of course, personal preference will differ – but it’s a decent “unmake” of Diablo. What do you think? +当然,个人偏好会有所不同,但它是一个不错的暗黑破坏神“降级版”。你觉得怎么样? -#### 6. Ninvaders +#### 6、Ninvaders ![Ninvaders terminal game for Linux][12] -Ninvaders is one of the best ASCII game just because it’s so simple and an arcade game to kill time. +Ninvaders 是最好的 ASCII 游戏之一,因为它是如此简单,且可以消磨时间的街机游戏。 -You have to defend against a hord of invaders – just finish them off before they get to you. It sounds very simple – but it is a challenging game. +你必须防御入侵者,需要在它们到达之前击败它们。这听起来很简单,但它极具挑战性。 -##### How to install Ninvaders? +##### 如何安装? -Similar to Curse of War, you can find this in the official repository. So, just type in this command to install it: +与“战争诅咒”类似,你可以在官方软件库中找到它。所以,只需输入此命令即可安装它: ``` sudo apt install ninvaders  ``` -#### 7. Empire + +#### 7、帝国 ![Empire terminal game][13] -A real-time strategy game for which you will need an active Internet connection. I’m personally not a fan of Real-Time strategy games, but if you are a fan of such games – you should really check out their [guide][14] to play this game – because it can be very challenging to learn. +帝国Empire这是一款即时战略游戏,你需要互联网连接。我个人不是实时战略游戏的粉丝,但如果你是这类游戏的粉丝,你可以看看他们的 [指南][14] 来玩这个游戏,因为学习起来非常具有挑战性。 -The rectangle contains cities, land, and water. You need to expand your city with an army, ships, planes and other resources. By expanding quickly, you will be able to capture other cities by destroying them before they make a move. +游戏区域包含城市、土地和水。你需要用军队、船只、飞机和其他资源扩展你的城市。通过快速扩张,你可以通过在对方动作之前摧毁它们来捕获其他城市。 -##### How to install Empire? +##### 如何安装? -Install this is very simple, just type in the following command: +安装很简单,只需输入以下命令: ``` sudo apt install empire ``` -#### 8. Nudoku +#### 8、Nudoku ![Nudoku is a terminal version game of Sudoku][15] -Love Sudoku? Well, you have Nudoku – a clone for it. A perfect time-killing ASCII game while you relax. +喜欢数独游戏?好吧,你也有个 Nudoku 游戏,这是它的克隆。这是当你想放松时的一个完美的消磨时间的 ASCII 游戏。 -It presents you with three difficulty levels – Easy, normal, and hard. If you want to put up a challenge with the computer, the hard difficulty will be perfect! If you just want to chill, go for the easy one. +它为你提供三个难度级别:简单、正常和困难。如果你想要挑战电脑,其难度会非常难!如果你只是想放松一下,那么就选择简单难度吧。 -##### How to install Nudoku? +##### 如何安装? -It’s very easy to get it installed, just type in the following command in the terminal: +安装它很容易,只需在终端输入以下命令: ``` sudo apt install nudoku ``` -#### 9\. Nethack +#### 9、Nethack -A dungeons and dragon-style ASCII game which is one of the best out there. I believe it’s one of your favorites if you already knew about ASCII games for Linux – in general. +最好的地下城式 ASCII 游戏之一。如果你已经知道一些 Linux 的 ASCII 游戏,我相信这是你的最爱之一。 -It features a lot of different levels (about 45) and comes packed in with a bunch of weapons, scrolls, potions, armor, rings, and gems. You can also choose permadeath as your mode to play it. +它具有许多不同的层(约 45 个),并且包含一堆武器、卷轴、药水、盔甲、戒指和宝石。你也可以选择“永久死亡”模式来玩试试。 -It’s not just about killing here – you got a lot to explore. +在这里可不仅仅是杀戮,你还有很多需要探索的地方。 -##### How to install Nethack? +##### 如何安装? -Simply follow the command below to install it: +只需按照以下命令安装它: ``` sudo apt install nethack ``` -#### 10. ASCII Jump +#### 10、ASCII 滑雪 ![ascii jump game][16] -ASCII Jump is a dead simple game where you have to slide along a varierty of tracks – while jumping, changing position, and moving as long as you can to cover maximum distance. +ASCII 滑雪ASCII Jump 是一款简单易玩的游戏,你必须沿着各种轨道滑动,同时跳跃、改变位置,并尽可能长时间地移动以达到最大距离。 -It’s really amazing to see how this ASCII game looks like (visually) even it seems so simple. You can start with the training mode and then proceed to the world cup. You also get to choose your competitors and the hills on which you want to start the game. +即使看起来很简单,但是看看这个 ASCII 游戏视觉上的表现也是很神奇的。你可以从训练模式开始,然后进入世界杯比赛。你还可以选择你的竞争对手以及你想要开始游戏的山丘。 -##### How to install Ascii Jump? +##### 如何安装? -To install the game, just type the following command: +只需按照以下命令安装它: ``` sudo apt install asciijump ``` -#### 11. Bastet +#### 11、Bastet ![Bastet is tetris game in ascii form][17] -Let’s just not pay any attention to the name – it’s actually a fun clone of Tetris game. +不要被这个名字误导,它实际上是俄罗斯方块游戏的一个有趣的克隆。 -You shouldn’t expect it to be just another ordinary tetris game – but it will present you the worst possible bricks to play with. Have fun! +你不要觉得它只是另一个普通的俄罗斯方块游戏,它会为你丢下最糟糕的砖块。祝你玩得开心! -##### How to install Bastet? +##### 如何安装? -Open the terminal and type in the following command: +打开终端并键入如下命令: ``` sudo apt install bastet ``` -#### 12\. Bombardier +#### 12、Bombardier ![Bomabrdier game in ascii form][18] -Bombardier is yet another simple ASCII game which will keep you hooked on to it. +Bombardier 是另一个简单的 ASCII 游戏,它会让你迷上它。 -Here, you have a helicopter (or whatever you’d like to call your aircraft) which lowers down every cycle and you need to throw bombs in order to destroy the blocks/buildings under you. The game also puts a pinch of humor for the messages it displays when you destroy a block. It is fun. +在这里,你有一架直升机(或许你想称之为飞机),每一圈它都会降低,你需要投掷炸弹才能摧毁你下面的街区/建筑物。当你摧毁一个街区时,游戏还会在它显示的消息里面添加一些幽默。很好玩。 -##### How to install Bombardier? +##### 如何安装? -Bombardier is available in the official repository, so just type in the following in the terminal to install it: +Bombardier 可以在官方软件库中找到,所以只需在终端中键入以下内容即可安装它: ``` sudo apt install bombardier ``` -#### 13\. Angband +#### 13、Angband ![Angband ascii game][19] -A cool dungeon exploration game with a neat interface. You can see all the vital information in a single screen while you explore the game. +一个很酷的地下城探索游戏,界面整洁。在探索该游戏时,你可以在一个屏幕上看到所有重要信息。 -It contains different kinds of race to pick a character. You can either be an Elf, Hobbit, Dwarf or something else – there’s nearly a dozen to choose from. Remember, that you need to defeat the lord of darkness at the end – so make every upgrade possible to your weapon and get ready. +它包含不同种类的种族可供选择角色。你可以是精灵、霍比特人、矮人或其他什么,有十几种可供选择。请记住,你需要在最后击败黑暗之王,所以尽可能升级你的武器并做好准备。 -How to install Angband? +##### 如何安装? -Simply type in the following command: +直接键入如下命令: ``` sudo apt install angband ``` -#### 14\. GNU Chess +#### 14、GNU 国际象棋 ![GNU Chess is a chess game that you can play in Linux terminal][20] -How can you not play chess? It is my favorite strategy game! +为什么不下盘棋呢?这是我最喜欢的策略游戏了! -But, GNU Chess can be tough to play with unless you know the Algebraic notation to describe the next move. Of course, being an ASCII game – it isn’t quite possible to interact – so it asks you the notation to detect your move and displays the output (while it waits for the computer to think its next move). +但是,除非你知道如何使用代表的符号来描述下一步行动,否则 GNU 国际象棋可能很难玩。当然,作为一个 ASCII 游戏,它不太好交互,所以它会要求你记录你的移动并显示输出(当它等待计算机思考它的下一步行动时)。 -##### How to install GNU Chess? +##### 如何安装? -If you’re aware of the algebraic notations of Chess, enter the following command to install it from the terminal: +如果你了解国际象棋的代表符号,请输入以下命令从终端安装它: ``` sudo apt install gnuchess ``` -#### Some Honorable Mentions +#### 一些荣誉奖 -As I mentioned earlier, we’ve tried to recommend you the best (but also the ones that are the easiest to install on your Linux machine). +正如我之前提到的,我们试图向你推荐最好的(也是最容易在 Linux 机器上安装的那些) ASCII 游戏。 -However, there are some iconic ASCII games which deserve the attention and requires a tad more effort to install (You will get the source code and you need to build it / install it). +然而,有一些标志性的 ASCII 游戏值得关注,它们需要更多的安装工作(你可以获得源代码,但需要构建它/安装它)。 -Some of those games are: +其中一些游戏是: + [Cataclysm: Dark Days Ahead][22] + [Brogue][23] + [Dwarf Fortress][24] -You should follow our [guide to install software from source code][21]. +你可以按照我们的 [从源代码安装软件的完全指南][21] 来进行。 -### Wrapping Up +### 总结 -Which of the ASCII games mentioned seem perfect for you? Did we miss any of your favorites? +我们提到的哪些 ASCII 游戏适合你?我们错过了你最喜欢的吗? -Let us know your thoughts in the comments below. +请在下面的评论中告诉我们你的想法。 -------------------------------------------------------------------------------- @@ -301,7 +298,7 @@ via: https://itsfoss.com/best-ascii-games/ 作者:[Ankush Das][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/) 荣誉推出 @@ -328,7 +325,7 @@ via: https://itsfoss.com/best-ascii-games/ [18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/bombardier.jpg?fit=800%2C571&ssl=1 [19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/angband-ascii-game.jpg?ssl=1 [20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/11/gnuchess-ascii-game.jpg?ssl=1 -[21]: https://itsfoss.com/install-software-from-source-code/ +[21]: https://linux.cn/article-9172-1.html [22]: https://github.com/CleverRaven/Cataclysm-DDA [23]: https://sites.google.com/site/broguegame/ [24]: http://www.bay12games.com/dwarves/index.html diff --git a/sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md b/translated/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md similarity index 100% rename from sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md rename to translated/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md From d317e674dff8e5ca59013bd10b9eed8e5597c450 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 21:07:59 +0800 Subject: [PATCH 170/813] TSL:20181124 14 Best ASCII Games for Linux That are Insanely Good.md --- ...Best Online Linux Terminals and Online Bash Editors.md | 0 ...4 Best ASCII Games for Linux That are Insanely Good.md | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename {translated => sources}/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md (100%) rename {sources => translated}/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md (99%) diff --git a/translated/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md b/sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md similarity index 100% rename from translated/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md rename to sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md diff --git a/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md b/translated/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md similarity index 99% rename from sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md rename to translated/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md index 211b19b5a1..cac0934625 100644 --- a/sources/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md +++ b/translated/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) [#]: subject: (14 Best ASCII Games for Linux That are Insanely Good) [#]: via: (https://itsfoss.com/best-ascii-games/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10546-1.html) 14 个依然很棒的 Linux ASCII 游戏 ====== @@ -299,7 +299,7 @@ via: https://itsfoss.com/best-ascii-games/ 作者:[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 aad650cd4ebfb5c2f47a31e782557cb07f40551b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 21:11:44 +0800 Subject: [PATCH 171/813] PUB:20181124 14 Best ASCII Games for Linux That are Insanely Good.md @wxy https://linux.cn/article-10546-1.html --- ...181124 14 Best ASCII Games for Linux That are Insanely Good.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181124 14 Best ASCII Games for Linux That are Insanely Good.md (100%) diff --git a/translated/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md b/published/20181124 14 Best ASCII Games for Linux That are Insanely Good.md similarity index 100% rename from translated/tech/20181124 14 Best ASCII Games for Linux That are Insanely Good.md rename to published/20181124 14 Best ASCII Games for Linux That are Insanely Good.md From c6817509d9015cd3ac4c86ee6373fe11688147cf Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 21:28:29 +0800 Subject: [PATCH 172/813] PRF:20190130 Get started with Budgie Desktop, a Linux environment.md @geekpi --- ...ith Budgie Desktop, a Linux environment.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md b/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md index 8ad345665d..4589106465 100644 --- a/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md +++ b/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md @@ -1,39 +1,40 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Budgie Desktop, a Linux environment) [#]: via: (https://opensource.com/article/19/1/productivity-tool-budgie-desktop) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 Linux 桌面环境 Budgie +开始使用 Budgie 吧,一款 Linux 桌面环境 ====== -使用 Budgie 按需配置你的桌面,这是我们开源工具系列中的第 18 个工具,它将在 2019 年提高你的工作效率。 + +> 使用 Budgie 按需配置你的桌面,这是我们开源工具系列中的第 18 个工具,它将在 2019 年提高你的工作效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 18 个工具来帮助你在 2019 年更有效率。 ### Budgie 桌面 -Linux 种有许多桌面环境。从易于使用以及有令人惊叹图形界面的 [GNOME 桌面][1](在大多数主要 Linux 发行版上是默认桌面)和 [KDE][2],到极简主义的 [Openbox][3],到高度可配置的平铺化 [i3][4],有很多选择。我要找的桌面环境需要速度、不引人注目和干净的用户体验。当桌面不适合你时,很难会有高效率。 +Linux 中有许多桌面环境。从易于使用并有令人惊叹图形界面的 [GNOME 桌面][1](在大多数主要 Linux 发行版上是默认桌面)和 [KDE][2],到极简主义的 [Openbox][3],再到高度可配置的平铺化的 [i3][4],有很多选择。我要寻找的桌面环境需要速度、不引人注目和干净的用户体验。当桌面不适合你时,很难会有高效率。 ![](https://opensource.com/sites/default/files/uploads/budgie-1.png) [Budgie 桌面][5]是 [Solus][6] Linux 发行版的默认桌面,它在大多数主要 Linux 发行版的附加软件包中提供。它基于 GNOME,并使用了许多你可能已经在计算机上使用的相同工具和库。 -默认桌面非常简约,只有面板和空白桌面。Budgie 包含一个集成的侧边栏(称为 Raven),通过它可以快速访问日历、音频控件和设置菜单。Raven 还包含一个集成的通知区域,其中包含与 MacOS 类似的统一系统消息显示。 +其默认桌面非常简约,只有面板和空白桌面。Budgie 包含一个集成的侧边栏(称为 Raven),通过它可以快速访问日历、音频控件和设置菜单。Raven 还包含一个集成的通知区域,其中包含与 MacOS 类似的统一系统消息显示。 ![](https://opensource.com/sites/default/files/uploads/budgie-2.png) -点击 Raven 中的齿轮图标会显示 Budgie 的控制面板及其配置。由于 Budgie 仍处于开发阶段,与 GNOME 或 KDE相 比,它有点勉强,我希望随着时间的推移它会有更多的选项。顶部面板选项允许用户配置顶部面板的排序、位置和内容,这很不错。 +点击 Raven 中的齿轮图标会显示 Budgie 的控制面板及其配置。由于 Budgie 仍处于开发阶段,与 GNOME 或 KDE 相比,它的选项有点少,我希望随着时间的推移它会有更多的选项。顶部面板选项允许用户配置顶部面板的排序、位置和内容,这很不错。 ![](https://opensource.com/sites/default/files/uploads/budgie-3.png) -Budgie Welcome 应用(首次登录时展示)包含安装其他软件、面板小程序、截图和 Flatpack 软件包的选项。这些小程序有处理网络、截图、额外的时钟和计时器等等。 +Budgie 的 Welcome 应用(首次登录时展示)包含安装其他软件、面板小程序、截图和 Flatpack 软件包的选项。这些小程序有处理网络、截图、额外的时钟和计时器等等。 ![](https://opensource.com/sites/default/files/uploads/budgie-4.png) @@ -46,7 +47,7 @@ via: https://opensource.com/article/19/1/productivity-tool-budgie-desktop 作者:[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 3353d335b474d5aa67c5674567444363888e29a8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 21:29:54 +0800 Subject: [PATCH 173/813] PUB:20190130 Get started with Budgie Desktop, a Linux environment.md @geekpi https://linux.cn/article-10547-1.html --- ...30 Get started with Budgie Desktop, a Linux environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190130 Get started with Budgie Desktop, a Linux environment.md (98%) diff --git a/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md b/published/20190130 Get started with Budgie Desktop, a Linux environment.md similarity index 98% rename from translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md rename to published/20190130 Get started with Budgie Desktop, a Linux environment.md index 4589106465..58a8a6505c 100644 --- a/translated/tech/20190130 Get started with Budgie Desktop, a Linux environment.md +++ b/published/20190130 Get started with Budgie Desktop, a Linux environment.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10547-1.html) [#]: subject: (Get started with Budgie Desktop, a Linux environment) [#]: via: (https://opensource.com/article/19/1/productivity-tool-budgie-desktop) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From e7f63e4ebe2539a02ded9254ffa588a0f710d823 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 22:52:23 +0800 Subject: [PATCH 174/813] APL:20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way --- ...nstalling Kali Linux on VirtualBox- Quickest - Safest Way.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md index 54e4ce314c..b5e387c047 100644 --- a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md +++ b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ec3d5d59e0ee24ed02db4323976524c1786997c2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Feb 2019 23:23:51 +0800 Subject: [PATCH 175/813] TSL:20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md --- ...ux on VirtualBox- Quickest - Safest Way.md | 133 ---------------- ...ux on VirtualBox- Quickest - Safest Way.md | 142 ++++++++++++++++++ 2 files changed, 142 insertions(+), 133 deletions(-) delete mode 100644 sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md create mode 100644 translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md diff --git a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md deleted file mode 100644 index b5e387c047..0000000000 --- a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md +++ /dev/null @@ -1,133 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) -[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Installing Kali Linux on VirtualBox: Quickest & Safest Way -====== - -**This tutorial shows you how to install Kali Linux on Virtual Box in Windows and Linux in the quickest way possible.** - -[Kali Linux][1] is one of the [best Linux distributions for hacking][2] and security enthusiasts. - -Since it deals with a sensitive topic like hacking, it’s like a double-edged sword. We have discussed it in the detailed Kali Linux review in the past so I am not going to bore you with the same stuff again. - -While you can install Kali Linux by replacing the existing operating system, using it via a virtual machine would be a better and safer option. - -With Virtual Box, you can use Kali Linux as a regular application in your Windows/Linux system. It’s almost the same as running VLC or a game in your system. - -Using Kali Linux in a virtual machine is also safe. Whatever you do inside Kali Linux will NOT impact your ‘host system’ (i.e. your original Windows or Linux operating system). Your actual operating system will be untouched and your data in the host system will be safe. - -![Kali Linux on Virtual Box][3] - -### How to install Kali Linux on VirtualBox - -I’ll be using [VirtualBox][4] here. It is a wonderful open source virtualization solution for just about anyone (professional or personal use). It’s available free of cost. - -In this tutorial, we will talk about Kali Linux in particular but you can install almost any other OS whose ISO file exists or a pre-built virtual machine save file is available. - -**Note:** The same steps apply for Windows/Linux running VirtualBox. - -As I already mentioned, you can have either Windows or Linux installed as your host. But, in this case, I have Windows 10 installed (don’t hate me!) where I try to install Kali Linux in VirtualBox step by step. - -And, the best part is – even if you happen to use a Linux distro as your primary OS, the same steps will be applicable! - -Wondering, how? Let’s see… - -### Step by Step Guide to install Kali Linux on VirtualBox - -We are going to use a custom Kali Linux image made for VirtualBox specifically. You can also download the ISO file for Kali Linux and create a new virtual machine – but why do that when you have an easy alternative? - -#### 1\. Download and install VirtualBox - -The first thing you need to do is to download and install VirtualBox from Oracle’s official website. - -[Download VirtualBox](https://www.virtualbox.org/wiki/Downloads) - -Once you download the installer, just double click on it to install VirtualBox. It’s the same for installing VirtualBox on Ubuntu/Fedora Linux as well. - -#### 2\. Download ready-to-use virtual image of Kali Linux - -After installing it successfully, head to [Offensive Security’s download page][5] to download the VM image for VirtualBox. If you change your mind to utilize [VMware][6], that is available too. - -![Kali Linux Virtual Box Image][7] - -As you can see the file size is well over 3 GB, you should either use the torrent option or download it using a [download manager][8]. - -#### 3\. Install Kali Linux on Virtual Box - -Once you have installed VirtualBox and downloaded the Kali Linux image, you just need to import it to VirtualBox in order to make it work. - -Here’s how to import the VirtualBox image for Kali Linux: - -**Step 1** : Launch VirtualBox. You will notice an **Import** button – click on it - -![virtualbox import][9] Click on Import button - -**Step 2:** Next, browse the file you just downloaded and choose it to be imported (as you can see in the image below). The file name should start with ‘kali linux‘ and end with . **ova** extension. - -![virtualbox import file][10] Importing Kali Linux image - -**S** Once selected, proceed by clicking on **Next**. - -**Step 3** : Now, you will be shown the settings for the virtual machine you are about to import. So, you can customize them or not – that is your choice. It is okay if you go with the default settings. - -You need to select a path where you have sufficient storage available. I would never recommend the **C:** drive on Windows. - -![virtualbox kali linux settings][11] Import hard drives as VDI - -Here, the hard drives as VDI refer to virtually mount the hard drives by allocating the storage space set. - -After you are done with the settings, hit **Import** and wait for a while. - -**Step 4:** You will now see it listed. So, just hit **Start** to launch it. - -You might get an error at first for USB port 2.0 controller support, you can disable it to resolve it or just follow the on-screen instruction of installing an additional package to fix it. And, you are done! - -![kali linux on windows virtual box][12]Kali Linux running in VirtualBox - -I hope this guide helps you easily install Kali Linux on Virtual Box. Of course, Kali Linux has a lot of useful tools in it for penetration testing – good luck with that! - -**Tip** : Both Kali Linux and Ubuntu are Debian-based. If you face any issues or error with Kali Linux, you may follow the tutorials intended for Ubuntu or Debian on the internet. - -### Bonus: Free Kali Linux Guide Book - -If you are just starting with Kali Linux, it will be a good idea to know how to use Kali Linux. - -Offensive Security, the company behind Kali Linux, has created a guide book that explains the basics of Linux, basics of Kali Linux, configuration, setups. It also has a few chapters on penetration testing and security tools. - -Basically, it has everything you need to get started with Kali Linux. And the best thing is that the book is available to download for free. - -Let us know in the comments below if you face an issue or simply share your experience with Kali Linux on VirtualBox. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-kali-linux-virtualbox - -作者:[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://itsfoss.com/linux-hacking-penetration-testing/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 -[4]: https://www.virtualbox.org/ -[5]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ -[6]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 -[8]: https://itsfoss.com/4-best-download-managers-for-linux/ -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md new file mode 100644 index 0000000000..0f32ec9991 --- /dev/null +++ b/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) +[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +在 VirtualBox 上安装 Kali Linux 的最安全快捷的方式 +====== + +> 本教程将向你展示如何以最快的方式在 Windows 和 Linux 上的 VirtualBox 上安装 Kali Linux。 + +[Kali Linux][1] 是最好的[黑客][2] 和安全爱好者的 Linux 发行版之一。 + +由于它涉及像黑客这样的敏感话题,它就像一把双刃剑。我们过去在一篇详细的 Kali Linux 点评中对此进行了讨论,所以我不会再次赘述。 + +虽然你可以通过替换现有的操作系统来安装 Kali Linux,但通过虚拟机使用它将是一个更好、更安全的选择。 + +使用 Virtual Box,你可以将 Kali Linux 当做 Windows / Linux 系统中的常规应用程序一样,几乎就和在系统中运行 VLC 或游戏一样简单。 + +在虚拟机中使用 Kali Linux 也是安全的。无论你在 Kali Linux 中做什么都不会影响你的“宿主机系统”(即你原来的 Windows 或 Linux 操作系统)。你的实际操作系统将不会受到影响,宿主机系统中的数据将是安全的。 + +![Kali Linux on Virtual Box][3] + +### 如何在 VirtualBox 上安装 Kali Linux + +我将在这里使用 [VirtualBox][4]。它是一个很棒的开源虚拟化解决方案,适用于任何人(无论是专业或个人用途)。它可以免费使用。 + +在本教程中,我们将特指 Kali Linux 的安装,但你几乎可以安装任何其他已有 ISO 文件的操作系统或预先构建好的虚拟机存储文件。 + +**注意:**这些相同的步骤适用于运行在 Windows / Linux 上的 VirtualBox。 + +正如我已经提到的,你可以安装 Windows 或 Linux 作为宿主机。但是,在本文中,我安装了 Windows 10(不要讨厌我!),我会尝试在 VirtualBox 中逐步安装 Kali Linux。 + +而且,最好的是,即使你碰巧使用 Linux 发行版作为主要操作系统,相同的步骤也完全适用! + +想知道怎么样做吗? 让我们来看看… + +### 在 VirtualBox 上安装 Kali Linux 的逐步指导 + +我们将使用专为 VirtualBox 制作的定制 Kali Linux 镜像。当然,你还可以下载 Kali Linux 的 ISO 文件并创建一个新的虚拟机,但是为什么在你有一个简单的替代方案时这样做呢? + +#### 1、下载并安装 VirtualBox + +你需要做的第一件事是从 Oracle 官方网站下载并安装 VirtualBox。 + +- [下载 VirtualBox](https://www.virtualbox.org/wiki/Downloads) + +下载了安装程序后,只需双击它即可安装 VirtualBox。 在 Ubuntu / Fedora Linux 上安装 VirtualBox 也是一样的。 + +#### 2、下载就绪的 Kali Linux 虚拟镜像 + +VirtualBox 成功安装后,前往 [Offensive Security 的下载页面][5] 下载用于 VirtualBox 的虚拟机镜像。如果你改变主意想使用 [VMware][6],也有用于它的。 + +![Kali Linux Virtual Box Image][7] + +如你所见,文件大小远远超过 3 GB,你应该使用 torrent 方式或使用 [下载管理器][8] 下载它。 + +#### 3、在 VirtualBox 上安装 Kali Linux + +一旦安装了 VirtualBox 并下载了 Kali Linux 镜像,你只需将其导入 VirtualBox 即可使其正常工作。 + +以下是如何导入 Kali Linux 的 VirtualBox 镜像: + +**步骤 1**:启动 VirtualBox。你会注意到有一个 “Import”,点击它。 + +![virtualbox import][9] + +*点击 “Import” 按钮* + +**步骤 2**:接着,浏览找到你刚刚下载的文件并选择它导入(如你在下图所见)。文件名应该以 “kali linux” 开头,并以 “.ova” 扩展名结束。 + +![virtualbox import file][10] + +*导入 Kali Linux 镜像* + +选择好之后,点击 “Next” 进行处理。 + +**步骤 3**:现在,你将看到要导入的这个虚拟机的设置。你可以自定义它们,这是你的自由。如果你使用默认设置,也没关系。 + +你需要选择具有足够存储空间的路径。我永远不会在 Windows 上推荐使用 C:驱动器。 + +![virtualbox kali linux settings][11] + +*以 VDI 方式导入硬盘驱动器* + +这里, VDI 方式的硬盘驱动器是指通过分配存储空间集来虚拟安装硬盘驱动器。 + +完成设置后,点击 “Import” 并等待一段时间。 + +**步骤 4**:你现在将看到这个虚拟机已经列出了。 所以,只需点击“Start”即可启动它。 + +你最初可能会因 USB 端口 2.0 控制器支持而出现错误,你可以将其禁用以解决此问题,或者只需按照屏幕上的说明安装其他软件包进行修复即可。现在就完成了! + +![kali linux on windows virtual box][12] + +*运行于 VirtualBox 中的 Kali Linux* + +我希望本指南可以帮助你在 VirtualBox 上轻松安装 Kali Linux。当然,Kali Linux 有很多有用的工具可用于渗透测试 - 祝你好运! + +**提示**:Kali Linux 和 Ubuntu 都是基于 Debian 的。如果你在使用 Kali Linux 时遇到任何问题或错误,可以按照互联网上针对 Ubuntu 或 Debian 的教程进行操作。 + +### 赠品:免费的 Kali Linux 指南手册 + +如果你刚刚开始使用 Kali Linux,那么了解如何使用 Kali Linux 将是一个好主意。 + +Kali Linux 背后的公司 Offensive Security 已经创建了一本指南,介绍了 Linux 的基础知识,Kali Linux 的基础知识、配置和设置。它还有一些关于渗透测试和安全工具的章节。 + +基本上,它拥有你开始使用 Kali Linux 所需知道的一切。最棒的是这本书可以免费下载。 + +- [免费下载 Kali Linux 揭秘](https://kali.training/downloads/Kali-Linux-Revealed-1st-edition.pdf) + +如果你遇到问题或想分享 VirtualBox 上运行 Kali Linux 的经验,请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kali-linux-virtualbox + +作者:[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://www.kali.org/ +[2]: https://itsfoss.com/linux-hacking-penetration-testing/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ +[6]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 +[8]: https://itsfoss.com/4-best-download-managers-for-linux/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?fit=800%2C450&ssl=1 From ffb86ca0d551df03fa4c94dfc7a882bd1f0d1fbe Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 Feb 2019 08:57:51 +0800 Subject: [PATCH 176/813] translated --- ...ojects to try in COPR for February 2019.md | 95 ------------------ ...ojects to try in COPR for February 2019.md | 96 +++++++++++++++++++ 2 files changed, 96 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md create mode 100644 translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md diff --git a/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md b/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md deleted file mode 100644 index b63cf4da75..0000000000 --- a/sources/tech/20190206 4 cool new projects to try in COPR for February 2019.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 cool new projects to try in COPR for February 2019) -[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/) -[#]: author: (Dominik Turecek https://fedoramagazine.org) - -4 cool new projects to try in COPR for February 2019 -====== - -![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) - -COPR is a [collection][1] of personal repositories for software that isn’t carried in Fedora. Some software doesn’t conform to standards that allow easy packaging. Or it may not meet other Fedora standards, despite being free and open source. COPR can offer these projects outside the Fedora set of packages. Software in COPR isn’t supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software. - -Here’s a set of new and interesting projects in COPR. - -### CryFS - -[CryFS][2] is a cryptographic filesystem. It is designed for use with cloud storage, mainly Dropbox, although it works with other storage providers as well. CryFS encrypts not only the files in the filesystem, but also metadata, file sizes and directory structure. - -#### Installation instructions - -The repo currently provides CryFS for Fedora 28 and 29, and for EPEL 7. To install CryFS, use these commands: - -``` -sudo dnf copr enable fcsm/cryfs -sudo dnf install cryfs -``` - -### Cheat - -[Cheat][3] is a utility for viewing various cheatsheets in command-line, aiming to help remind usage of programs that are used only occasionally. For many Linux utilities, cheat provides cheatsheets containing condensed information from man pages, focusing mainly on the most used examples. In addition to the built-in cheatsheets, cheat allows you to edit the existing ones or creating new ones from scratch. - -![][4] - -#### Installation instructions - -The repo currently provides cheat for Fedora 28, 29 and Rawhide, and for EPEL 7. To install cheat, use these commands: - -``` -sudo dnf copr enable tkorbar/cheat -sudo dnf install cheat -``` - -### Setconf - -[Setconf][5] is a simple program for making changes in configuration files, serving as an alternative for sed. The only thing setconf does is that it finds the key in the specified file and changes its value. Setconf provides only a few options to change its behavior — for example, uncommenting the line that is being changed. - -#### Installation instructions - -The repo currently provides setconf for Fedora 27, 28 and 29. To install setconf, use these commands: - -``` -sudo dnf copr enable jamacku/setconf -sudo dnf install setconf -``` - -### Reddit Terminal Viewer - -[Reddit Terminal Viewer][6], or rtv, is an interface for browsing Reddit from terminal. It provides the basic functionality of Reddit, so you can log in to your account, view subreddits, comment, upvote and discover new topics. Rtv currently doesn’t, however, support Reddit tags. - -![][7] - -#### Installation instructions - -The repo currently provides Reddit Terminal Viewer for Fedora 29 and Rawhide. To install Reddit Terminal Viewer, use these commands: - -``` -sudo dnf copr enable tc01/rtv -sudo dnf install rtv -``` - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/ - -作者:[Dominik Turecek][a] -选题:[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 -[b]: https://github.com/lujun9972 -[1]: https://copr.fedorainfracloud.org/ -[2]: https://www.cryfs.org/ -[3]: https://github.com/chrisallenlane/cheat -[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/cheat.png -[5]: https://setconf.roboticoverlords.org/ -[6]: https://github.com/michael-lazar/rtv -[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/rtv.png diff --git a/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md b/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md new file mode 100644 index 0000000000..2edb446699 --- /dev/null +++ b/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for February 2019) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/) +[#]: author: (Dominik Turecek https://fedoramagazine.org) + +2019 年 2 月 COPR 中 4 个值得尝试很酷的新项目 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) + +COPR 是个人软件仓库[集合][1],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不被 Fedora 基础设施不支持或没有被该项目所签名。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + + +这是 COPR 中一组新的有趣项目。 + +### CryFS + +[CryFS][2] 是一个加密文件系统。它设计用于云存储,主要用于 Dropbox,尽管它也可以与其他存储提供商一起使用。CryFS 不仅加密文件系统中的文件,还会加密元数据、文件大小和目录结构。 + +#### 安装说明 + +仓库目前为 Fedora 28 和 29 以及 EPEL 7 提供 CryFS。要安装 CryFS,请使用以下命令: + +``` +sudo dnf copr enable fcsm/cryfs +sudo dnf install cryfs +``` + +### Cheat + +[Cheat][3] 是一个用于在命令行中查看各种备忘录的工具,用来提醒仅偶尔使用的程序的使用方法。对于许多 Linux 程序,cheat 提供了来自手册页的压缩后的信息,主要关注最常用的示例。除了内置的备忘录,cheat 允许你编辑现有的备忘录或从头开始创建新的备忘录。 + +![][4] + +#### 安装说明 + +仓库目前为 Fedora 28、29 和 Rawhide 以及 EPEL 7 提供 cheat。要安装 cheat,请使用以下命令: + +``` +sudo dnf copr enable tkorbar/cheat +sudo dnf install cheat +``` + +### Setconf + +[setconf][5] 是一个简单的程序,作为 sed 的替代方案,用于对配置文件进行更改。setconf 唯一能做的就是找到指定文件中的密钥并更改其值。setconf 仅提供一些选项来更改其行为 - 例如,取消更改行的注释。 + +#### 安装说明 + +仓库目前为 Fedora 27、28 和 29 提供 setconf。要安装 setconf,请使用以下命令: + +``` +sudo dnf copr enable jamacku/setconf +sudo dnf install setconf +``` + +### Reddit Terminal Viewer + +[Reddit Terminal Viewer][6],或称为 rtv,提供了从终端浏览 Reddit 的界面。它提供了 Reddit 的基本功能,因此你可以登录到你的帐户,查看 subreddits、评论、点赞和发现新主题。但是,rtv 目前不支持 Reddit 标签。 + +![][7] + +#### 安装说明 + +该仓库目前为 Fedora 29 和 Rawhide 提供 Reddit Terminal Viewer。要安装 Reddit Terminal Viewer,请使用以下命令: + +``` +sudo dnf copr enable tc01/rtv +sudo dnf install rtv +``` + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/ + +作者:[Dominik Turecek][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 +[b]: https://github.com/lujun9972 +[1]: https://copr.fedorainfracloud.org/ +[2]: https://www.cryfs.org/ +[3]: https://github.com/chrisallenlane/cheat +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/cheat.png +[5]: https://setconf.roboticoverlords.org/ +[6]: https://github.com/michael-lazar/rtv +[7]: https://fedoramagazine.org/wp-content/uploads/2019/01/rtv.png From 1429ec79d648f1ce62626ee25c4aaf30e9a55e19 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 Feb 2019 09:07:19 +0800 Subject: [PATCH 177/813] translating --- ...9 Get started with gPodder, an open source podcast client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190129 Get started with gPodder, an open source podcast client.md b/sources/tech/20190129 Get started with gPodder, an open source podcast client.md index ca1556e16d..aaf72026b4 100644 --- a/sources/tech/20190129 Get started with gPodder, an open source podcast client.md +++ b/sources/tech/20190129 Get started with gPodder, an open source podcast client.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7165531fb49eb809df31dda51c51afd94be0b356 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Mon, 18 Feb 2019 11:47:23 +0800 Subject: [PATCH 178/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index d645cf2561..76ff85fae3 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jdh8383) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b8c5596bdeed5537376f746040999f35c9669648 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 18 Feb 2019 13:34:59 +0800 Subject: [PATCH 179/813] Translating 7 steps for hunting down Python code bugs. --- .../20190208 7 steps for hunting down Python code bugs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 3441e6d9e6..2c83e02fe1 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -12,9 +12,9 @@ 了解一些技巧来减少你花费在寻找代码失败原因的时间。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) -在周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经转移了的通知。 +在周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经移动了的通知。 -Turns out they are somewhere you can't get to, but they are in the process of being moved to a web application—so you will have this nifty application for searching and reading them, but of course, it is not finished yet. It should be up in a couple of days. I know, totally unrealistic situation, right? Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking. +结果这些日志被转移到你获取不到的地方,但他们正在转移到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。它应该会在几天内完成。我知道,这完全不符合实际情况,对吧?Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking. OK, so you found the logs or tried the call, and indeed, the customer has found a bug. Maybe you even think you know where the bug is. From e7e13d35c7063e5ba17f58e78854caf3ede0832d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Feb 2019 13:46:51 +0800 Subject: [PATCH 180/813] APL:20190201 Top 5 Linux Distributions for New Users --- .../tech/20190201 Top 5 Linux Distributions for New Users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190201 Top 5 Linux Distributions for New Users.md b/sources/tech/20190201 Top 5 Linux Distributions for New Users.md index 6b6985bf0a..0a7f7151fe 100644 --- a/sources/tech/20190201 Top 5 Linux Distributions for New Users.md +++ b/sources/tech/20190201 Top 5 Linux Distributions for New Users.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c79eebc372c52f303e2d21a236334953fce3182d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 18 Feb 2019 13:50:56 +0800 Subject: [PATCH 181/813] Translating --- sources/tech/20190208 How To Install And Use PuTTY On Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190208 How To Install And Use PuTTY On Linux.md b/sources/tech/20190208 How To Install And Use PuTTY On Linux.md index 844d55f040..14a8b0f50b 100644 --- a/sources/tech/20190208 How To Install And Use PuTTY On Linux.md +++ b/sources/tech/20190208 How To Install And Use PuTTY On Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From dbdf0e6c50191bc779092ffa9731cf183f68762b Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 18 Feb 2019 15:17:05 +0800 Subject: [PATCH 182/813] Translated --- ...8 How To Install And Use PuTTY On Linux.md | 153 ------------------ ...8 How To Install And Use PuTTY On Linux.md | 150 +++++++++++++++++ 2 files changed, 150 insertions(+), 153 deletions(-) delete mode 100644 sources/tech/20190208 How To Install And Use PuTTY On Linux.md create mode 100644 translated/tech/20190208 How To Install And Use PuTTY On Linux.md diff --git a/sources/tech/20190208 How To Install And Use PuTTY On Linux.md b/sources/tech/20190208 How To Install And Use PuTTY On Linux.md deleted file mode 100644 index 14a8b0f50b..0000000000 --- a/sources/tech/20190208 How To Install And Use PuTTY On Linux.md +++ /dev/null @@ -1,153 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zhs852) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Install And Use PuTTY On Linux) -[#]: via: (https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Install And Use PuTTY On Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-720x340.png) - -**PuTTY** is a free and open source GUI client that supports wide range of protocols including SSH, Telnet, Rlogin and serial for Windows and Unix-like operating systems. Generally, Windows admins use PuTTY as a SSH and telnet client to access the remote Linux servers from their local Windows systems. However, PuTTY is not limited to Windows. It is also popular among Linux users as well. This guide explains how to install PuTTY on Linux and how to access and manage the remote Linux servers using PuTTY. - -### Install PuTTY on Linux - -PuTTY is available in the official repositories of most Linux distributions. For instance, you can install PuTTY on Arch Linux and its variants using the following command: - -``` -$ sudo pacman -S putty -``` - -On Debian, Ubuntu, Linux Mint: - -``` -$ sudo apt install putty -``` - -### How to use PuTTY to access remote Linux systems - -Once PuTTY is installed, launch it from the menu or from your application launcher. Alternatively, you can launch it from the Terminal by running the following command: - -``` -$ putty -``` - -This is how PuTTY default interface looks like. - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-default-interface.png) - -As you can see, most of the options are self-explanatory. On the left pane of the PuTTY interface, you can do/edit/modify various configurations such as, - - 1. PuTTY session logging, - 2. Options for controlling the terminal emulation, control and change effects of keys, - 3. Control terminal bell sounds, - 4. Enable/disable Terminal advanced features, - 5. Set the size of PuTTY window, - 6. Control the scrollback in PuTTY window (Default is 2000 lines), - 7. Change appearance of PuTTY window and cursor, - 8. Adjust windows border, - 9. Change fonts for texts in PuTTY window, - 10. Save login details, - 11. Set proxy details, - 12. Options to control various protocols such as SSH, Telnet, Rlogin, Serial etc. - 13. And more. - - - -All options are categorized under a distinct name for ease of understanding. - -### Access a remote Linux server using PuTTY - -Click on the **Session** tab on the left pane. Enter the hostname (or IP address) of your remote system you want to connect to. Next choose the connection type, for example Telnet, Rlogin, SSH etc. The default port number will be automatically selected depending upon the connection type you choose. For example if you choose SSH, port number 22 will be selected. For Telnet, port number 23 will be selected and so on. If you have changed the default port number, don’t forget to mention it in the **Port** section. I am going to access my remote via SSH, hence I choose SSH connection type. After entering the Hostname or IP address of the system, click **Open**. - -![](http://www.ostechnix.com/wp-content/uploads/2019/02/putty-1.png) - -If this is the first time you have connected to this remote system, PuTTY will display a security alert dialog box that asks whether you trust the host you are connecting to. Click **Accept** to add the remote system’s host key to the PuTTY’s cache: - -![][2] - -Next enter your remote system’s user name and password. Congratulations! You’ve successfully connected to your remote system via SSH using PuTTY. - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-3.png) - -**Access remote systems configured with key-based authentication** - -Some Linux administrators might have configured their remote servers with key-based authentication. For example, when accessing AMS instances from PuTTY, you need to specify the key file’s location. PuTTY supports public key authentication and uses its own key format ( **.ppk** files). - -Enter the hostname or IP address in the Session section. Next, In the **Category** pane, expand **Connection** , expand **SSH** , and then choose **Auth**. Browse the location of the **.ppk** key file and click **Open**. - -![][3] - -Click Accept to add the host key if it is the first time you are connecting to the remote system. Finally, enter the remote system’s passphrase (if the key is protected with a passphrase while generating it) to connect. - -**Save PuTTY sessions** - -Sometimes, you want to connect to the remote system multiple times. If so, you can save the session and load it whenever you want without having to type the hostname or ip address, port number every time. - -Enter the hostname (or IP address) and provide a session name and click **Save**. If you have key file, make sure you have already given the location before hitting the Save button. - -![][4] - -Now, choose session name under the **Saved sessions** tab and click **Load** and click **Open** to launch it. - -**Transferring files to remote systems using the PuTTY Secure Copy Client (pscp) -** - -Usually, the Linux users and admins use **‘scp’** command line tool to transfer files from local Linux system to the remote Linux servers. PuTTY does have a dedicated client named **PuTTY Secure Copy Clinet** ( **PSCP** in short) to do this job. If you’re using windows os in your local system, you may need this tool to transfer files from local system to remote systems. PSCP can be used in both Linux and Windows systems. - -The following command will copy **file.txt** to my remote Ubuntu system from Arch Linux. - -``` -pscp -i test.ppk file.txt sk@192.168.225.22:/home/sk/ -``` - -Here, - - * **-i test.ppk** : Key file to access remote system, - * **file.txt** : file to be copied to remote system, - * **sk@192.168.225.22** : username and ip address of remote system, - * **/home/sk/** : Destination path. - - - -To copy a directory. use **-r** (recursive) option like below: - -``` - pscp -i test.ppk -r dir/ sk@192.168.225.22:/home/sk/ -``` - -To transfer files from Windows to remote Linux server using pscp, run the following command from command prompt: - -``` -pscp -i test.ppk c:\documents\file.txt.txt sk@192.168.225.22:/home/sk/ -``` - -You know now what is PuTTY, how to install and use it to access remote systems. Also, you have learned how to transfer files to the remote systems from the local system using pscp program. - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/ - -作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-2.png -[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-4.png -[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-5.png diff --git a/translated/tech/20190208 How To Install And Use PuTTY On Linux.md b/translated/tech/20190208 How To Install And Use PuTTY On Linux.md new file mode 100644 index 0000000000..62f6f5ae1a --- /dev/null +++ b/translated/tech/20190208 How To Install And Use PuTTY On Linux.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (zhs852) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install And Use PuTTY On Linux) +[#]: via: (https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +在 Linux 中安装并使用 PuTTY +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-720x340.png) + +PuTTY 是一个免费、开源且支持包括 SSH、Telnet 和 Rlogin 在内的多种协议的 GUI 客户端。一般来说,Windows 管理员们会把 PuTTY 当成 SSH 或 Telnet 客户端来在本地 Windows 系统和远程 Linux 服务器之间建立连接。不过,PuTTY 可不是 Windows 的独占软件。它在 Linux 用户之中也是很流行的。本篇文章将会告诉你如何在 Linux 中安装并使用 PuTTY。 + +### 在 Linux 中安装 PuTTY + +PuTTY 已经包含在了许多 Linux 发行版的官方源中。举个例子,在 Arch Linux 中,我们可以通过这个命令安装 PuTTY: + +```shell +$ sudo pacman -S putty +``` + +在 Debian、Ubuntu 或是 Linux Mint 中安装它: + +```shell +$ sudo apt install putty +``` + +### 使用 PuTTY 访问远程 Linux 服务器 + +在安装完 PuTTY 之后,你可以在菜单或启动器中打开它。如果你想用终端打开它,也是可以的: + +```shell +$ putty +``` + +PuTTY 的默认界面长这个样子: + +![PuTTY 默认界面](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-default-interface.png) + +如你所见,许多选项都配上了说明。在左侧面板中,你可以配置许多项目,比如: + + 1. 修改 PuTTY 登录会话选项; + 2. 修改终端模拟器控制选项,控制各个按键的功能; + 3. 控制终端响铃的声音; + 4. 启用/禁用终端的高级功能; + 5. 设定 PuTTY 窗口大小; + 6. 控制命令回滚长度(默认是 2000 行); + 7. 修改 PuTTY 窗口或光标的外观; + 8. 调整窗口边缘; + 9. 调整字体; + 10. 保存登录信息; + 11. 设置代理; + 12. 修改各协议的控制选项; + 13. 以及更多。 + +所有选项基本都有注释,相信你理解起来不难。 + +### 使用 PuTTY 访问远程 Linux 服务器 + +请在左侧面板点击 **会话** 选项卡,输入远程主机名(或 IP 地址)。然后,请选择连接类型(比如 Telnet、Rlogin 以及 SSH 等)。根据你选择的连接类型,PuTTY 会自动选择对应连接类型的默认端口号(比如 SSH 是 22、Telnet 是 23),如果你修改了默认端口号,别忘了手动把它输入到 **端口** 里。在这里,我用 SSH 连接到远程主机。在输入所有信息后,请点击 **打开**。 + +![通过 SSH 连接](http://www.ostechnix.com/wp-content/uploads/2019/02/putty-1.png) + +如果这是你首次连接到这个远程主机,PuTTY 会显示一个安全警告,问你是否信任你连接到的远程主机。点击 **接受** 即可将远程主机的密钥加入 PuTTY 的储存当中: + +![PuTTY 安全警告][2] + +接下来,输入远程主机的用户名和密码。然后你就成功地连接上远程主机啦。 + +![已连接上远程主机](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-3.png) + +#### 使用密钥验证访问远程主机 + +一些 Linux 管理员可能在服务器上配置了密钥认证。举个例子,在用 PuTTY 访问 AMS instances 的时候,你需要指定密钥文件的位置。PuTTY 可以使用它自己的格式(**.ppk** 文件)来进行公钥验证。 + +首先输入主机名或 IP。之后,在 **分类** 选项卡中,展开 **连接**,再展开 **SSH**,然后选择 **认证**,之后便可选择 **.ppk** 密钥文件了。 + +![][3] + +点击接受来关闭安全提示。然后,输入远程主机的密码片段(如果密钥被密码片段保护)来建立连接。 + +#### 保存 PuTTY 会话 + +有些时候,你可能需要多次连接到同一个远程主机,你可以保存这些会话并在之后不输入信息访问他们。 + +请输入主机名(或 IP 地址),并提供一个会话名称,然后点击 **保存**。如果你有密钥文件,请确保你在点击保存按钮之前指定它们。 + +![][4] + +现在,你可以通过选择 **已保存的会话**,然后点击 **Load**,再点击 **打开** 来启动连接。 + +#### 使用 pscpPuTTY Secure Copy Client 来将文件传输到远程主机中 + +通常来说,Linux 用户和管理员会使用 **scp** 这个命令行工具来从本地往远程主机传输文件。不过 PuTTY 给我们提供了一个叫做 PuTTY 安全拷贝客户端PuTTY Secure Copy Client(简写为 **PSCP**)的工具来干这个事情。如果你的本地主机运行的是 Windows,你可能需要这个工具。PSCP 在 Windows 和 Linux 下都是可用的。 + +使用这个命令来将 **file.txt** 从本地的 Arch Linux 拷贝到远程的 Ubuntu 上: + +```shell +pscp -i test.ppk file.txt sk@192.168.225.22:/home/sk/ +``` + +让我们来拆分这个命令: + + * **-i test.ppk** : 访问远程主机的密钥文件; + * **file.txt** : 要拷贝到远程主机的文件; + * **sk@192.168.225.22** : 远程主机的用户名与 IP; + * **/home/sk/** : 目标路径。 + + + +要拷贝一个目录,请使用 **-r**Recursive 参数: + +```shell + pscp -i test.ppk -r dir/ sk@192.168.225.22:/home/sk/ +``` + +要使用 pscp 传输文件,请执行以下命令: + +```shell +pscp -i test.ppk c:\documents\file.txt.txt sk@192.168.225.22:/home/sk/ +``` + +你现在应该了解了 PuTTY 是什么,知道了如何安装它和如何使用它。同时,你也学习到了如何使用 pscp 程序在本地和远程主机上传输文件。 + +以上便是所有了,希望这篇文章对你有帮助。 + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[zhs852](https://github.com/zhs852) +校对:[校对者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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-2.png +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-4.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/putty-5.png From 0c4440c6ed0424737f6754b629a9bb1b63f81b67 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:27:20 +0800 Subject: [PATCH 183/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190217=20How=20?= =?UTF-8?q?to=20Change=20User=20Password=20in=20Ubuntu=20[Beginner?= =?UTF-8?q?=E2=80=99s=20Tutorial]=20sources/tech/20190217=20How=20to=20Cha?= =?UTF-8?q?nge=20User=20Password=20in=20Ubuntu=20-Beginner-s=20Tutorial.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Password in Ubuntu -Beginner-s Tutorial.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md diff --git a/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..d1c179123b --- /dev/null +++ b/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Change User Password in Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/change-password-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Change User Password in Ubuntu [Beginner’s Tutorial] +====== + +**Want to change root password in Ubuntu? Learn how to change the password for any user in Ubuntu Linux. Both terminal and GUI methods have been discussed.** + +When do you need to change the password in Ubuntu? Let me give you a couple of scenarios. + +When you install [Ubuntu][1], you create a user and set a password for it. It could be a weak password or perhaps a bit too complicated and you want to change it. + +If you are a sysadmin, you may need to change the password for other users on your system. + +You may have a few other reasons for doing this. Now the question comes, how to change the password for a user in Ubuntu or Linux? + +In this quick tutorial, I’ll show you the command line and the GUI ways of changing passwords in Ubuntu. + +### Change user password in Ubuntu [Command Line] + +![How to change user password in Ubuntu Linux][2] + +Changing user password in Ubuntu is dead simple. In fact, it’s the same with any Linu distribution because you use the generic Linux command called passwd for this purpose. + +If you want to change your current password, simply run this command in a terminal: + +``` +passwd +``` + +You’ll be asked to enter your current password and the new password twice. + +You won’t see anything on the screen while typing the password. This is perfectly normal behavior for UNIX and Linux. + +``` +passwd + +Changing password for abhishek. + +(current) UNIX password: + +Enter new UNIX password: + +Retype new UNIX password: + +passwd: password updated successfully +``` + +Since this is your admin account, you just changed the sudo password in Ubuntu without even realizing it. + +![Change user password in Linux command line][3] + +If you want to change password for some other user, you can do that as well with the passwd command. But in this case, you’ll have to use sudo. + +``` +sudo passwd +``` + +If you changed your password and forgot it later, don’t worry. You can [easily reset Ubuntu password][4]. + +### Change root password in Ubuntu + +By default, the root user in Ubuntu doesn’t have a password. Don’t be surprised. You don’t use the root user in Ubuntu all the time. Confused? Let me explain it to you quickly. + +While [installing Ubuntu][5], you are forced to create a user. This user has admin access. This admin user can gain root access using the sudo command. But it uses its own password, not the root account’s password (because there is none). + +You can set or change root password using the **passwd** command. However, in most cases, you don’t need it and you shouldn’t be doing it. + +You’ll have to use sudo (with an account with admin privileges). If the root password has no password set up previously, it will ask you to set it up. Else, you can change it using the existing root password. + +``` +sudo password root +``` + +### Change Ubuntu password using GUI + +I have used GNOME desktop with Ubuntu 18.04 here. The steps should be more or less the same for other desktop environments and Ubuntu versions. + +Go to Menu (press Windows/Super key) and search for Settings. + +In the Settings, scroll down a bit and go to Details. + +![Go to details in Ubuntu GNOME settings][6] + +In here, click on Users to access all the available users on your system. + +![Users settings in Ubuntu][7] + +You can select any user you want, including your main admin account. You need to unlock the users first and then click the password field. + +![Changing user password in Ubuntu][8] + +You’ll be asked to set the password. If you are changing your own password, you’ll have to enter your current password as well. + +![Changing user password in Ubuntu][9] + +Once done, click on the Change button on the top. That’s it. You have successfully changed user password in Ubuntu. + +I hope this quick little tip helped you to change user password in Ubuntu. If you have questions or suggestions, please leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-password-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://www.ubuntu.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-password-ubuntu-linux.png?resize=800%2C450&ssl=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-linux-1.jpg?resize=800%2C253&ssl=1 +[4]: https://itsfoss.com/how-to-hack-ubuntu-password/ +[5]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-2.jpg?resize=800%2C484&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-3.jpg?resize=800%2C488&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-4.jpg?resize=800%2C555&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-1.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-password-ubuntu-linux.png?fit=800%2C450&ssl=1 From c28ae8f081e159f490b8ea7920596eb2a475dfa6 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:29:22 +0800 Subject: [PATCH 184/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190214=20Run=20?= =?UTF-8?q?Particular=20Commands=20Without=20Sudo=20Password=20In=20Linux?= =?UTF-8?q?=20sources/tech/20190214=20Run=20Particular=20Commands=20Withou?= =?UTF-8?q?t=20Sudo=20Password=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Commands Without Sudo Password In Linux.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md diff --git a/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md b/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md new file mode 100644 index 0000000000..df5bfddb3a --- /dev/null +++ b/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run Particular Commands Without Sudo Password In Linux) +[#]: via: (https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Run Particular Commands Without Sudo Password In Linux +====== + +I had a script on my Ubuntu system deployed on AWS. The primary purpose of this script is to check if a specific service is running at regular interval (every one minute to be precise) and start that service automatically if it is stopped for any reason. But the problem is I need sudo privileges to start the service. As you may know already, we should provide password when we run something as sudo user. But I don’t want to do that. What I actually want to do is to run the service as sudo without password. If you’re ever in a situation like this, I know a small work around, Today, in this brief guide, I will teach you how to run particular commands without sudo password in Unix-like operating systems. + +Have a look at the following example. + +``` +$ sudo mkdir /ostechnix +[sudo] password for sk: +``` + +![][2] + +As you can see in the above screenshot, I need to provide sudo password when creating a directory named ostechnix in root (/) folder. Whenever we try to execute a command with sudo privileges, we must enter the password. However, in my scenario, I don’t want to provide the sudo password. Here is what I did to run a sudo command without password on my Linux box. + +### Run Particular Commands Without Sudo Password In Linux + +For any reasons, if you want to allow a user to run a particular command without giving the sudo password, you need to add that command in **sudoers** file. + +I want the user named **sk** to execute **mkdir** command without giving the sudo password. Let us see how to do it. + +Edit sudoers file: + +``` +$ sudo visudo +``` + +Add the following line at the end of file. + +``` +sk ALL=NOPASSWD:/bin/mkdir +``` + +![][3] + +Here, **sk** is the username. As per the above line, the user **sk** can run ‘mkdir’ command from any terminal, without sudo password. + +You can add additional commands (for example **chmod** ) with comma-separated values as shown below. + +``` +sk ALL=NOPASSWD:/bin/mkdir,/bin/chmod +``` + +Save and close the file. Log out (or reboot) your system. Now, log in as normal user ‘sk’ and try to run those commands with sudo and see what happens. + +``` +$ sudo mkdir /dir1 +``` + +![][4] + +See? Even though I ran ‘mkdir’ command with sudo privileges, there was no password prompt. From now on, the user **sk** need not to enter the sudo password while running ‘mkdir’ command. + +When running all other commands except those commands added in sudoers files, you will be prompted to enter the sudo password. + +Let us run another command with sudo. + +``` +$ sudo apt update +``` + +![][5] + +See? This command prompts me to enter the sudo password. + +If you don’t want this command to prompt you to ask sudo password, edit sudoers file: + +``` +$ sudo visudo +``` + +Add the ‘apt’ command in visudo file like below: + +``` +sk ALL=NOPASSWD: /bin/mkdir,/usr/bin/apt +``` + +Did you notice that the apt binary executable file path is different from mkdir? Yes, you must provide the correct executable file path. To find executable file path of any command, for example ‘apt’, use ‘whereis’ command like below. + +``` +$ whereis apt +apt: /usr/bin/apt /usr/lib/apt /etc/apt /usr/share/man/man8/apt.8.gz +``` + +As you see, the executable file for apt command is **/usr/bin/apt** , hence I added it in sudoers file. + +Like I already mentioned, you can add any number of commands with comma-separated values. Save and close your sudoers file once you’re done. Log out and log in again to your system. + +Now, check if you can be able to run the command with sudo prefix without using the password: + +``` +$ sudo apt update +``` + +![][6] + +See? The apt command didn’t ask me the password even though I ran it with sudo. + +Here is yet another example. If you want to run a specific service, for example apache2, add it as shown below. + +``` +sk ALL=NOPASSWD:/bin/mkdir,/usr/bin/apt,/bin systemctl restart apache2 +``` + +Now, the user can run ‘sudo systemctl restart apache2’ command without sudo password. + +Can I re-authenticate to a particular command in the above case? Of course, yes! Just remove the added command. Log out and log in back. + +Alternatively, you can add **‘PASSWD:’** directive in-front of the command. Look at the following example. + +Add/modify the following line as shown below. + +``` +sk ALL=NOPASSWD:/bin/mkdir,/bin/chmod,PASSWD:/usr/bin/apt +``` + +In this case, the user **sk** can run ‘mkdir’ and ‘chmod’ commands without entering the sudo password. However, he must provide sudo password when running ‘apt’ command. + +**Disclaimer:** This is for educational-purpose only. You should be very careful while applying this method. This method might be both productive and destructive. Say for example, if you allow users to execute ‘rm’ command without sudo password, they could accidentally or intentionally delete important stuffs. You have been warned! + +**Suggested read:** + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-1.png +[3]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-7.png +[4]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-6.png +[5]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-4.png +[6]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-5.png From c671b23f88bf21ab760964d4affc9b2a9a697375 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:33:50 +0800 Subject: [PATCH 185/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190215=20Make?= =?UTF-8?q?=20websites=20more=20readable=20with=20a=20shell=20script=20sou?= =?UTF-8?q?rces/tech/20190215=20Make=20websites=20more=20readable=20with?= =?UTF-8?q?=20a=20shell=20script.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...sites more readable with a shell script.md | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 sources/tech/20190215 Make websites more readable with a shell script.md diff --git a/sources/tech/20190215 Make websites more readable with a shell script.md b/sources/tech/20190215 Make websites more readable with a shell script.md new file mode 100644 index 0000000000..06b748cfb5 --- /dev/null +++ b/sources/tech/20190215 Make websites more readable with a shell script.md @@ -0,0 +1,258 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make websites more readable with a shell script) +[#]: via: (https://opensource.com/article/19/2/make-websites-more-readable-shell-script) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Make websites more readable with a shell script +====== +Calculate the contrast ratio between your website's text and background to make sure your site is easy to read. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ) + +If you want people to find your website useful, they need to be able to read it. The colors you choose for your text can affect the readability of your site. Unfortunately, a popular trend in web design is to use low-contrast colors when printing text, such as gray text on a white background. Maybe that looks really cool to the web designer, but it is really hard for many of us to read. + +The W3C provides Web Content Accessibility Guidelines, which includes guidance to help web designers pick text and background colors that can be easily distinguished from each other. This is called the "contrast ratio." The W3C definition of the contrast ratio requires several calculations: given two colors, you first compute the relative luminance of each, then calculate the contrast ratio. The ratio will fall in the range 1 to 21 (typically written 1:1 to 21:1). The higher the contrast ratio, the more the text will stand out against the background. For example, black text on a white background is highly visible and has a contrast ratio of 21:1. And white text on a white background is unreadable at a contrast ratio of 1:1. + +The [W3C says body text][1] should have a contrast ratio of at least 4.5:1 with headings at least 3:1. But that seems to be the bare minimum. The W3C also recommends at least 7:1 for body text and at least 4.5:1 for headings. + +Calculating the contrast ratio can be a chore, so it's best to automate it. I've done that with this handy Bash script. In general, the script does these things: + + 1. Gets the text color and background color + 2. Computes the relative luminance of each + 3. Calculates the contrast ratio + + + +### Get the colors + +You may know that every color on your monitor can be represented by red, green, and blue (R, G, and B). To calculate the relative luminance of a color, my script will need to know the red, green, and blue components of the color. Ideally, my script would read this information as separate R, G, and B values. Web designers might know the specific RGB code for their favorite colors, but most humans don't know RGB values for the different colors. Instead, most people reference colors by names like "red" or "gold" or "maroon." + +Fortunately, the GNOME [Zenity][2] tool has a color-picker app that lets you use different methods to select a color, then returns the RGB values in a predictable format of "rgb( **R** , **G** , **B** )". Using Zenity makes it easy to get a color value: + +``` +color=$( zenity --title 'Set text color' --color-selection --color='black' ) +``` + +In case the user (accidentally) clicks the Cancel button, the script assumes a color: + +``` +if [ $? -ne 0 ] ; then +        echo '** color canceled .. assume black' +        color='rgb(0,0,0)' +fi +``` + +My script does something similar to set the background color value as **$background**. + +### Compute the relative luminance + +Once you have the foreground color in **$color** and the background color in **$background** , the next step is to compute the relative luminance for each. On its website, the [W3C provides an algorithm][3] to compute the relative luminance of a color. + +> For the sRGB colorspace, the relative luminance of a color is defined as +> **L = 0.2126 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated R + 0.7152 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated G + 0.0722 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated B** where R, G and B are defined as: +> +> if RsRGB <= 0.03928 then R = RsRGB/12.92 +> else R = ((RsRGB+0.055)/1.055) ^ 2.4 +> +> if GsRGB <= 0.03928 then G = GsRGB/12.92 +> else G = ((GsRGB+0.055)/1.055) ^ 2.4 +> +> if BsRGB <= 0.03928 then B = BsRGB/12.92 +> else B = ((BsRGB+0.055)/1.055) ^ 2.4 +> +> and RsRGB, GsRGB, and BsRGB are defined as: +> +> RsRGB = R8bit/255 +> +> GsRGB = G8bit/255 +> +> BsRGB = B8bit/255 + +Since Zenity returns color values in the format "rgb( **R** , **G** , **B** )," the script can easily pull apart the R, B, and G values to compute the relative luminance. AWK makes this a simple task, using the comma as the field separator ( **-F,** ) and using AWK's **substr()** string function to pick just the text we want from the "rgb( **R** , **G** , **B** )" color value: + +``` +R=$( echo $color | awk -F, '{print substr($1,5)}' ) +G=$( echo $color | awk -F, '{print $2}' ) +B=$( echo $color | awk -F, '{n=length($3); print substr($3,1,n-1)}' ) +``` + +**(For more on extracting and displaying data with AWK,[Get our AWK cheat sheet][4].)** + +Calculating the final relative luminance is best done using the BC calculator. BC supports the simple if-then-else needed in the calculation, which makes this part simple. But since BC cannot directly calculate exponentiation using a non-integer exponent, we need to do some extra math using the natural logarithm instead: + +``` +echo "scale=4 +rsrgb=$R/255 +gsrgb=$G/255 +bsrgb=$B/255 +if ( rsrgb <= 0.03928 ) r = rsrgb/12.92 else r = e( 2.4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated l((rsrgb+0.055)/1.055) ) +if ( gsrgb <= 0.03928 ) g = gsrgb/12.92 else g = e( 2.4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated l((gsrgb+0.055)/1.055) ) +if ( bsrgb <= 0.03928 ) b = bsrgb/12.92 else b = e( 2.4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated l((bsrgb+0.055)/1.055) ) +0.2126 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated r + 0.7152 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated g + 0.0722 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated b" | bc -l +``` + +This passes several instructions to BC, including the if-then-else statements that are part of the relative luminance formula. BC then prints the final value. + +### Calculate the contrast ratio + +With the relative luminance of the text color and the background color, now the script can calculate the contrast ratio. The [W3C determines the contrast ratio][5] with this formula: + +> (L1 + 0.05) / (L2 + 0.05), where +> L1 is the relative luminance of the lighter of the colors, and +> L2 is the relative luminance of the darker of the colors + +Given two relative luminance values **$r1** and **$r2** , it's easy to calculate the contrast ratio using the BC calculator: + +``` +echo "scale=2 +if ( $r1 > $r2 ) { l1=$r1; l2=$r2 } else { l1=$r2; l2=$r1 } +(l1 + 0.05) / (l2 + 0.05)" | bc +``` + +This uses an if-then-else statement to determine which value ( **$r1** or **$r2** ) is the lighter or darker color. BC performs the resulting calculation and prints the result, which the script can store in a variable. + +### The final script + +With the above, we can pull everything together into a final script. I use Zenity to display the final result in a text box: + +``` +#!/bin/sh +# script to calculate contrast ratio of colors + +# read color and background color: +# zenity returns values like 'rgb(255,140,0)' and 'rgb(255,255,255)' + +color=$( zenity --title 'Set text color' --color-selection --color='black' ) +if [ $? -ne 0 ] ; then +        echo '** color canceled .. assume black' +        color='rgb(0,0,0)' +fi + +background=$( zenity --title 'Set background color' --color-selection --color='white' ) +if [ $? -ne 0 ] ; then +        echo '** background canceled .. assume white' +        background='rgb(255,255,255)' +fi + +# compute relative luminance: + +function luminance() +{ +        R=$( echo $1 | awk -F, '{print substr($1,5)}' ) +        G=$( echo $1 | awk -F, '{print $2}' ) +        B=$( echo $1 | awk -F, '{n=length($3); print substr($3,1,n-1)}' ) + +        echo "scale=4 +rsrgb=$R/255 +gsrgb=$G/255 +bsrgb=$B/255 +if ( rsrgb <= 0.03928 ) r = rsrgb/12.92 else r = e( 2.4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated l((rsrgb+0.055)/1.055) ) +if ( gsrgb <= 0.03928 ) g = gsrgb/12.92 else g = e( 2.4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated l((gsrgb+0.055)/1.055) ) +if ( bsrgb <= 0.03928 ) b = bsrgb/12.92 else b = e( 2.4 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated l((bsrgb+0.055)/1.055) ) +0.2126 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated r + 0.7152 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated g + 0.0722 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated b" | bc -l +} + +lum1=$( luminance $color ) +lum2=$( luminance $background ) + +# compute contrast + +function contrast() +{ +        echo "scale=2 +if ( $1 > $2 ) { l1=$1; l2=$2 } else { l1=$2; l2=$1 } +(l1 + 0.05) / (l2 + 0.05)" | bc +} + +rel=$( contrast $lum1 $lum2 ) + +# print results + +( cat< Date: Mon, 18 Feb 2019 16:34:54 +0800 Subject: [PATCH 186/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190216=20How=20?= =?UTF-8?q?To=20Grant=20And=20Remove=20Sudo=20Privileges=20To=20Users=20On?= =?UTF-8?q?=20Ubuntu=20sources/tech/20190216=20How=20To=20Grant=20And=20Re?= =?UTF-8?q?move=20Sudo=20Privileges=20To=20Users=20On=20Ubuntu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...move Sudo Privileges To Users On Ubuntu.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md diff --git a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md new file mode 100644 index 0000000000..0a21ec0e60 --- /dev/null +++ b/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) +[#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Grant And Remove Sudo Privileges To Users On Ubuntu +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/02/sudo-privileges-720x340.png) + +As you know already, the user can perform any administrative tasks with sudo privileges on Ubuntu systems. When creating a new users on your Linux box, they can’t do any administrative tasks until you make them to be a member of **‘sudo’ group**. In this brief tutorial, we explain how to add a regular user to sudo group and remove the given privileges to make it as just a normal user. + +**Grant Sudo Privileges To A regular User On Linux** + +Usually, we use **‘adduser’** command to create new user like below. + +``` +$ sudo adduser ostechnix +``` + +If you want the newly created user to perform any administrative tasks with sudo, just add him to the sudo group using command: + +``` +$ sudo usermod -a -G sudo hduser +``` + +The above command will make the user called **‘ostechnix’** to be the member of sudo group. + +You can also use this command too to add the users to sudo group. + +``` +$ sudo adduser ostechnix sudo +``` + +Now, log out and log in back as the new user for this change to take effect. The user has now become an administrative user. + +To verify it, just use ‘sudo’ as prefix in a any command. + +``` +$ sudo mkdir /test +[sudo] password for ostechnix: +``` + +### Remove sudo privileges of an User + +Sometimes, you might want to remove sudo privileges to a particular user without deleting it from your Linux box. To make any user as a normal user, just remove them from the sudo group. + +Say for example If you want to remove a user called **ostechnix** , from the sudo group, just run: + +``` +$ sudo deluser ostechnix sudo +``` + +**Sample output:** + +``` +Removing user `ostechnix' from group `sudo' ... +Done. +``` + +This command will only remove user ‘ostechnix’ from the sudo group, but it will not delete the user permanently from the system. Now, He becomes a regular user and can’t do any administrative tasks as sudo user. + +Also, you can use the following command to revoke the sudo access from an user: + +``` +$ sudo gpasswd -d ostechnix sudo +``` + +Please be careful while removing users from the sudo group. Do not remove the real administrator from the “sudo” group. + +Verify the user “ostechnix” has been really removed from sudo group using command: + +``` +$ sudo -l -U ostechnix +User ostechnix is not allowed to run sudo on ubuntuserver. +``` + +Yes, the user “ostechnix” has been removed from sudo group, and he can’t execute any administrative tasks. + +Please be careful while removing a user from a sudo group. If you have only one sudo user on your system and you remove him from the sudo group, you can’t perform any administrative stuffs such as installing, removing and updating programs on your system. So, please be careful. In our next, tutorial, we will explain how to restore sudo privileges to a user + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ + +作者:[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 From c9a51d1bbbfaf14d5d47048386e6f271c4b7b7b6 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:37:16 +0800 Subject: [PATCH 187/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190216=20FinalC?= =?UTF-8?q?rypt=20=E2=80=93=20An=20Open=20Source=20File=20Encryption=20App?= =?UTF-8?q?lication=20sources/tech/20190216=20FinalCrypt=20-=20An=20Open?= =?UTF-8?q?=20Source=20File=20Encryption=20Application.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Open Source File Encryption Application.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md diff --git a/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md b/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md new file mode 100644 index 0000000000..3d03dcfa0a --- /dev/null +++ b/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FinalCrypt – An Open Source File Encryption Application) +[#]: via: (https://itsfoss.com/finalcrypt/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +FinalCrypt – An Open Source File Encryption Application +====== + +I usually don’t encrypt files – but if I am planning to organize my important documents or credentials, an encryption program would come in handy. + +You may be already using a program like [GnuPG][1] that helps you encrypt/decrypt your files on your Linux machine. There is [EncryptPad][2] as well that encrypts your notes. + +However, I have come across a new free and open source encryption tool called FinalCrypt. You can check out their recent releases and the source on its [GitHub page][3]. + +In this article, I will be sharing my experience of using this tool. Do note that I won’t be comparing this with any other program available out there – so if you want a detailed comparison between multiple solutions, let us know in the comments. + +![FinalCrypt][4] + +### Using FinalCrypt to encrypt files + +FinalCrypt uses the [One-Time pad][5] key generation cipher to encrypt files. In other words, it generates an OTP key which you will use for encrypting or decrypting your files. + +The key will be completely random as per the size of the key – which you can specify. So, it is impossible to decrypt the file without the key file. + +While the OTP key method for encryption/decryption is simple and effective, but managing or securing the key file could be an inconvenience for some. + +If you want to use FinalCrypt, you can install the DEB/RPM files from its website. FinalCrypt is also available for Windows and macOS. + +Once downloaded, simply double click to [install it from deb][6] or rpm files. You can also build it from the source code if you want. + +### FileCrypt in Action + +This video shows how to use FinalCrypt: + + + +If you like Linux related videos, please [subscribe to our YouTube channel][7]. + +Once you have installed FinalCrypt, you’ll find it in your list of installed applications. Launch it from there. + +Upon launch, you will observe two sections (split) for the items to encrypt/decrypt and the other to select the OTP file. + +![Using FinalCrypt for encrypting files in Linux][8] + +First, you will have to generate an OTP key. Here’s how to do that: + +![finalcrypt otp][9] + +Do note that your file name can be anything – but you need to make sure that the key file size is greater or equal to the file you want to encrypt. I find it absurd but that’s how it is. + +![][10] + +After you generate the file, select the key on the right-side of the window and then select the files that you want to encrypt on the left-side of the window. + +You will find the checksum value, key file size, and valid status highlighted after generating the OTP: + +![][11] + +After making the selection, you just need to click on “ **Encrypt** ” to encrypt those files and if already encrypted, then “ **Decrypt** ” to decrypt those. + +![][12] + +You can also use FinalCrypt in command line to automate your encryption job. + +#### How do you secure your OTP key? + +It is easy to encrypt/decrypt the files you want to protect. But, where should you keep your OTP key? + +It is literally useless if you fail to keep your OTP key in a safe storage location. + +Well, one of the best ways would be to use a USB stick specifically for the keys you want to store. Just plug it in when you want to decrypt files and its all good. + +In addition to that, you may save your key on a [cloud service][13], if you consider it secure enough. + +More information about FinalCrypt can be found on its website. + +[FinalCrypt](https://sites.google.com/site/ronuitholland/home/finalcrypt) + +**Wrapping Up** + +It might seem a little overwhelming at the beginning but it is actually a simple and user-friendly encryption program available for Linux. There are other programs to [password protect folders][14] as well if you are interested in some additional reading. + +What do you think about FinalCrypt? Do you happen to know about something similar which is potentially better? Let us know in the comments and we shall take a look at them! + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/finalcrypt/ + +作者:[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.gnupg.org/ +[2]: https://itsfoss.com/encryptpad-encrypted-text-editor-linux/ +[3]: https://github.com/ron-from-nl/FinalCrypt +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.png?resize=800%2C450&ssl=1 +[5]: https://en.wikipedia.org/wiki/One-time_pad +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.jpg?fit=800%2C439&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-otp-key.jpg?resize=800%2C443&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-otp-generate.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-key.jpg?fit=800%2C420&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-encrypt.jpg?ssl=1 +[13]: https://itsfoss.com/cloud-services-linux/ +[14]: https://itsfoss.com/password-protect-folder-linux/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.png?fit=800%2C450&ssl=1 From c84ebaad946fe2549167fdbf395fb2b9fb8ff4f0 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:39:26 +0800 Subject: [PATCH 188/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190213=20How=20?= =?UTF-8?q?to=20build=20a=20WiFi=20picture=20frame=20with=20a=20Raspberry?= =?UTF-8?q?=20Pi=20sources/tech/20190213=20How=20to=20build=20a=20WiFi=20p?= =?UTF-8?q?icture=20frame=20with=20a=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... WiFi picture frame with a Raspberry Pi.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md diff --git a/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md b/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md new file mode 100644 index 0000000000..615f7620ed --- /dev/null +++ b/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to build a WiFi picture frame with a Raspberry Pi) +[#]: via: (https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi) +[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) + +How to build a WiFi picture frame with a Raspberry Pi +====== +DIY a digital photo frame that streams photos from the cloud. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) + +Digital picture frames are really nice because they let you enjoy your photos without having to print them out. Plus, adding and removing digital files is a lot easier than opening a traditional frame and swapping the picture inside when you want to display a new photo. Even so, it's still a bit of overhead to remove your SD card, USB stick, or other storage from a digital picture frame, plug it into your computer, and copy new pictures onto it. + +An easier option is a digital picture frame that gets its pictures over WiFi, for example from a cloud service. Here's how to make one. + +### Gather your materials + + * Old [TFT][1] LCD screen + * HDMI-to-DVI cable (as the TFT screen supports DVI) + * Raspberry Pi 3 + * Micro SD card + * Raspberry Pi power supply + * Keyboard + * Mouse (optional) + + + +Connect the Raspberry Pi to the display using the cable and attach the power supply. + +### Install Raspbian + +**sudo raspi-config**. There I change the hostname (e.g., to **picframe** ) in Network Options and enable SSH to work remotely on the Raspberry Pi in Interfacing Options. Connect to the Raspberry Pi using (for example) . + +### Build and install the cloud client + +Download and flash Raspbian to the Micro SD card by following these [directions][2] . Plug the Micro SD card into the Raspberry Pi, boot it up, and configure your WiFi. My first action after a new Raspbian installation is usually running. There I change the hostname (e.g., to) in Network Options and enable SSH to work remotely on the Raspberry Pi in Interfacing Options. Connect to the Raspberry Pi using (for example) + +I use [Nextcloud][3] to synchronize my pictures, but you could use NFS, [Dropbox][4], or whatever else fits your needs to upload pictures to the frame. + +If you use Nextcloud, get a client for Raspbian by following these [instructions][5]. This is handy for placing new pictures on your picture frame and will give you the client application you may be familiar with on a desktop PC. When connecting the client application to your Nextcloud server, make sure to select only the folder where you'll store the images you want to be displayed on the picture frame. + +### Set up the slideshow + +The easiest way I've found to set up the slideshow is with a [lightweight slideshow project][6] built for exactly this purpose. There are some alternatives, like configuring a screensaver, but this application appears to be the simplest to set up. + +On your Raspberry Pi, download the binaries from the latest release, unpack them, and move them to an executable folder: + +``` +wget https://github.com/NautiluX/slide/releases/download/v0.9.0/slide_pi_stretch_0.9.0.tar.gz +tar xf slide_pi_stretch_0.9.0.tar.gz +mv slide_0.9.0/slide /usr/local/bin/ +``` + +Install the dependencies: + +``` +sudo apt install libexif12 qt5-default +``` + +Run the slideshow by executing the command below (don't forget to modify the path to your images). If you access your Raspberry Pi via SSH, set the **DISPLAY** variable to start the slideshow on the display attached to the Raspberry Pi. + +``` +DISPLAY=:0.0 slide -p /home/pi/nextcloud/picframe +``` + +### Autostart the slideshow + +To autostart the slideshow on Raspbian Stretch, create the following folder and add an **autostart** file to it: + +``` +mkdir -p /home/pi/.config/lxsession/LXDE/ +vi /home/pi/.config/lxsession/LXDE/autostart +``` + +Insert the following commands to autostart your slideshow. The **slide** command can be adjusted to your needs: + +``` +@xset s noblank +@xset s off +@xset -dpms +@slide -p -t 60 -o 200 -p /home/pi/nextcloud/picframe +``` + +Disable screen blanking, which the Raspberry Pi normally does after 10 minutes, by editing the following file: + +``` +vi /etc/lightdm/lightdm.conf +``` + +and adding these two lines to the end: + +``` +[SeatDefaults] +xserver-command=X -s 0 -dpms +``` + +### Configure a power-on schedule + +You can schedule your picture frame to turn on and off at specific times by using two simple cronjobs. For example, say you want it to turn on automatically at 7 am and turn off at 11 pm. Run **crontab -e** and insert the following two lines. + +``` +0 23 * * * /opt/vc/bin/tvservice -o + +0 7 * * * /opt/vc/bin/tvservice -p && sudo systemctl restart display-manager +``` + +Note that this won't turn the Raspberry Pi power's on and off; it will just turn off HDMI, which will turn the screen off. The first line will power off HDMI at 11 pm. The second line will bring the display back up and restart the display manager at 7 am. + +### Add a final touch + +By following these simple steps, you can create your own WiFi picture frame. If you want to give it a nicer look, build a wooden frame for the display. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi + +作者:[Manuel Dewald][a] +选题:[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/ntlx +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Thin-film-transistor_liquid-crystal_display +[2]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[3]: https://nextcloud.com/ +[4]: http://dropbox.com/ +[5]: https://github.com/nextcloud/client_theming#building-on-debian +[6]: https://github.com/NautiluX/slide/releases/tag/v0.9.0 From 62a36659a9eaf977c7c99c6fda16eea8f3fbe0e5 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:41:40 +0800 Subject: [PATCH 189/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190217=20Instal?= =?UTF-8?q?l=20Android=208.1=20Oreo=20on=20Linux=20To=20Run=20Apps=20&=20G?= =?UTF-8?q?ames=20sources/tech/20190217=20Install=20Android=208.1=20Oreo?= =?UTF-8?q?=20on=20Linux=20To=20Run=20Apps=20-=20Games.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...d 8.1 Oreo on Linux To Run Apps - Games.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md diff --git a/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md new file mode 100644 index 0000000000..88798037c5 --- /dev/null +++ b/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: 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. ) + +Install Android 8.1 Oreo on Linux To Run Apps & Games +====== + +![](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. + +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. + +### Installing Android x86 8.1 Oreo on Linux + +#### 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. + +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. + +To install QEMU on Ubuntu/Linux Mint/Debian: + +``` +sudo apt-get install qemu qemu-kvm libvirt-bin +``` + +To install QEMU on Fedora: + +``` +sudo dnf install qemu qemu-kvm +``` + +For other distributions, just search for the qemu and qemu-kvm packages and install them. + +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-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). + +Now, to start running the android system for the first time, run: + +``` +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]. + +After you run the above command, the android system will start: + +![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: + +![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: + +![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: + +![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. + +#### Booting and Using 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: + +``` +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. + +You should see the android booting menu now: + +![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: + +![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: + +![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: + +![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: + +![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: + +![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: + +![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 + +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. + +To do this, we’ll create a new file under /usr/share/applications called android.desktop with the following command: + +``` +sudo nano /usr/share/applications/android.desktop +``` + +And paste the following contents inside it (Right click and then paste): + +``` +[Desktop Entry] +Name=Android 8.1 +Comment=Run Android 8.1 Oreo on Linux using QEMU +Icon=phone +Exec=bash -c 'pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda /home/mhsabbagh/android.img' +Terminal=false +Type=Application +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). + +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. + +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: + +![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. + +Have you tried android x86 before? How was your experience with it? + + +-------------------------------------------------------------------------------- + +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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: http://www.android-x86.org/ +[2]: http://www.android-x86.org/download +[3]: https://fosspost.org/tutorials/use-qemu-test-operating-systems-distributions +[4]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-16.png?resize=694%2C548&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 40 android 8.1 oreo on linux) +[5]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-15.png?resize=673%2C537&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 42 android 8.1 oreo on linux) +[6]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-14.png?resize=769%2C469&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 44 android 8.1 oreo on linux) +[7]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-13.png?resize=767%2C466&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 46 android 8.1 oreo on linux) +[8]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-12.png?resize=750%2C460&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 48 android 8.1 oreo on linux) +[9]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-11.png?resize=754%2C456&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 50 android 8.1 oreo on linux) +[10]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-10.png?resize=850%2C559&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 52 android 8.1 oreo on linux) +[11]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-09.png?resize=850%2C569&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 54 android 8.1 oreo on linux) +[12]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-08.png?resize=850%2C562&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 56 android 8.1 oreo on linux) +[13]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-07-1.png?resize=850%2C561&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 58 android 8.1 oreo on linux) +[14]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-06.png?resize=850%2C569&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 60 android 8.1 oreo on linux) +[15]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-05.png?resize=850%2C559&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 62 android 8.1 oreo on linux) +[16]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-04.png?resize=850%2C553&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 64 android 8.1 oreo on linux) +[17]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-03.png?resize=850%2C571&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 66 android 8.1 oreo on linux) +[18]: https://i1.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-02.png?resize=850%2C555&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 68 android 8.1 oreo on linux) +[19]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/Android-8.1-Oreo-on-Linux-01.png?resize=850%2C557&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 70 android 8.1 oreo on linux) +[20]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Screenshot-at-2019-02-17-1539.png?resize=850%2C557&ssl=1 (Install Android 8.1 Oreo on Linux To Run Apps & Games 72 android 8.1 oreo on linux) From d5f60b3b62871078da0572d2ac3fe5a1d7d99a9f Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:48:36 +0800 Subject: [PATCH 190/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190215=204=20Me?= =?UTF-8?q?thods=20To=20Change=20The=20HostName=20In=20Linux=20sources/tec?= =?UTF-8?q?h/20190215=204=20Methods=20To=20Change=20The=20HostName=20In=20?= =?UTF-8?q?Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Methods To Change The HostName In Linux.md | 227 ++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 sources/tech/20190215 4 Methods To Change The HostName In Linux.md diff --git a/sources/tech/20190215 4 Methods To Change The HostName In Linux.md b/sources/tech/20190215 4 Methods To Change The HostName In Linux.md new file mode 100644 index 0000000000..ad95e05fae --- /dev/null +++ b/sources/tech/20190215 4 Methods To Change The HostName In Linux.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 Methods To Change The HostName In Linux) +[#]: via: (https://www.2daygeek.com/four-methods-to-change-the-hostname-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +4 Methods To Change The HostName In Linux +====== + +We had written an article yesterday in our website about **[changing hostname in Linux][1]**. + +Today we are going to show you that how to change the hostname using different methods. You can choose the best one for you. + +systemd systems comes with a handy tool called `hostnamectl` that allow us to manage the system hostname easily. + +It’s changing the hostname instantly and doesn’t required reboot when you use the native commands. + +But if you modify the hostname manually in any of the configuration file that requires reboot. + +In this article we will show you the four methods to change the hostname in systemd system. + +hostnamectl command allows to set three kind of hostname in Linux and the details are below. + + * **`Static:`** It’s static hostname which is added by the system admin. + * **`Transient/Dynamic:`** It’s assigned by DHCP or DNS server at run time. + * **`Pretty:`** It can be assigned by the system admin. It is a free-form of the hostname that represent the server in the pretty way like, “JBOSS UAT Server”. + + + +It can be done in the following four methods. + + * **`hostnamectl Command:`** hostnamectl command is controling the system hostname. + * **`nmcli Command:`** nmcli is a command-line tool for controlling NetworkManager. + * **`nmtui Command:`** nmtui is a text User Interface for controlling NetworkManager. + * **`/etc/hostname file:`** This file is containing the static system hostname. + + + +### Method-1: Change The HostName Using hostnamectl Command in Linux + +hostnamectl may be used to query and change the system hostname and related settings. + +Simple run the `hostnamectl` command to view the system hostname. + +``` +$ hostnamectl +or +$ hostnamectl status + + Static hostname: daygeek-Y700 + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b83230a2025d43547368d75bc + Boot ID: 267f264c448f000ea5aed47263c6de7f + Operating System: Manjaro Linux + Kernel: Linux 4.19.20-1-MANJARO + Architecture: x86-64 +``` + +If you would like to change the hostname, use the following command format. + +**The general syntax:** + +``` +$ hostnamectl set-hostname [YOUR NEW HOSTNAME] +``` + +Use the following command to change the hostname using hostnamectl command. In this example, i’m going to change the hostname from `daygeek-Y700` to `magi-laptop`. + +``` +$ hostnamectl set-hostname magi-laptop +``` + +You can view the updated hostname by running the following command. + +``` +$ hostnamectl + Static hostname: magi-laptop + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b83230a2025d43547368d75bc + Boot ID: 267f264c448f000ea5aed47263c6de7f + Operating System: Manjaro Linux + Kernel: Linux 4.19.20-1-MANJARO + Architecture: x86-64 +``` + +### Method-2: Change The HostName Using nmcli Command in Linux + +nmcli is a command-line tool for controlling NetworkManager and reporting network status. + +nmcli is used to create, display, edit, delete, activate, and deactivate network connections, as well as control and display network device status. Also, it allow us to change the hostname. + +Use the following format to view the current hostname using nmcli. + +``` +$ nmcli general hostname +daygeek-Y700 +``` + +**The general syntax:** + +``` +$ nmcli general hostname [YOUR NEW HOSTNAME] +``` + +Use the following command to change the hostname using nmcli command. In this example, i’m going to change the hostname from `daygeek-Y700` to `magi-laptop`. + +``` +$ nmcli general hostname magi-laptop +``` + +It’s taking effect without bouncing the below service. However, for safety purpose just restart the systemd-hostnamed service for the changes to take effect. + +``` +$ sudo systemctl restart systemd-hostnamed +``` + +Again run the same nmcli command to check the changed hostname. + +``` +$ nmcli general hostname +magi-laptop +``` + +### Method-3: Change The HostName Using nmtui Command in Linux + +nmtui is a curses‐based TUI application for interacting with NetworkManager. When starting nmtui, the user is prompted to choose the activity to perform unless it was specified as the first argument. + +Run the following command on terminal to launch the terminal user interface. + +``` +$ nmtui +``` + +Use the `Down Arrow Mark` to choose the `Set system hostname` option then hit the `Enter` button. +![][3] + +This is old hostname screenshot. +![][4] + +Just remove the olde one and update the new one then hit `OK` button. +![][5] + +It will show you the updated hostname in the screen and simple hit `OK` button to complete it. +![][6] + +Finally hit the `Quit` button to exit from the nmtui terminal. +![][7] + +It’s taking effect without bouncing the below service. However, for safety purpose just restart the systemd-hostnamed service for the changes to take effect. + +``` +$ sudo systemctl restart systemd-hostnamed +``` + +You can view the updated hostname by running the following command. + +``` +$ hostnamectl + Static hostname: daygeek-Y700 + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b83230a2025d43547368d75bc + Boot ID: 267f264c448f000ea5aed47263c6de7f + Operating System: Manjaro Linux + Kernel: Linux 4.19.20-1-MANJARO + Architecture: x86-64 +``` + +### Method-4: Change The HostName Using /etc/hostname File in Linux + +Alternatively, we can change the hostname by modifying the `/etc/hostname` file. But this method +requires server reboot for changes to take effect. + +Check the current hostname using /etc/hostname file. + +``` +$ cat /etc/hostname +daygeek-Y700 +``` + +To change the hostname, simple overwrite the file because it’s contains only the hostname alone. + +``` +$ sudo echo "magi-daygeek" > /etc/hostname + +$ cat /etc/hostname +magi-daygeek +``` + +Reboot the system by running the following command. + +``` +$ sudo init 6 +``` + +Finally verify the updated hostname using /etc/hostname file. + +``` +$ cat /etc/hostname +magi-daygeek +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/four-methods-to-change-the-hostname-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-change-set-hostname/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/02/four-methods-to-change-the-hostname-in-linux-1.png +[4]: https://www.2daygeek.com/wp-content/uploads/2019/02/four-methods-to-change-the-hostname-in-linux-2.png +[5]: https://www.2daygeek.com/wp-content/uploads/2019/02/four-methods-to-change-the-hostname-in-linux-3.png +[6]: https://www.2daygeek.com/wp-content/uploads/2019/02/four-methods-to-change-the-hostname-in-linux-4.png +[7]: https://www.2daygeek.com/wp-content/uploads/2019/02/four-methods-to-change-the-hostname-in-linux-5.png From c4adfb88f772aa4f35c4f1a8bfc79196efd2115e Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:52:25 +0800 Subject: [PATCH 191/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190214=20Top=20?= =?UTF-8?q?5=20podcasts=20for=20Linux=20news=20and=20tips=20sources/talk/2?= =?UTF-8?q?0190214=20Top=205=20podcasts=20for=20Linux=20news=20and=20tips.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Top 5 podcasts for Linux news and tips.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/talk/20190214 Top 5 podcasts for Linux news and tips.md diff --git a/sources/talk/20190214 Top 5 podcasts for Linux news and tips.md b/sources/talk/20190214 Top 5 podcasts for Linux news and tips.md new file mode 100644 index 0000000000..fb827bb39b --- /dev/null +++ b/sources/talk/20190214 Top 5 podcasts for Linux news and tips.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 podcasts for Linux news and tips) +[#]: via: (https://opensource.com/article/19/2/top-linux-podcasts) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +Top 5 podcasts for Linux news and tips +====== +A tried and tested podcast listener, shares his favorite Linux podcasts over the years, plus a couple of bonus picks. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguin-penguins.png?itok=5hlVDue7) + +Like many Linux enthusiasts, I listen to a lot of podcasts. I find my daily commute is the best time to get some time to myself and catch up on the latest tech news. Over the years, I have subscribed and unsubscribed to more show feeds than I care to think about and have distilled them down to the best of the best. + +Here are my top five Linux podcasts I think you should be listening to in 2019, plus a couple of bonus picks. + + 5. [**Late Night Linux**][1]—This podcast, hosted by Joe, [Félim][2], [Graham][3], and [Will][4] from the UK, is rough, ready, and pulls no punches. [Joe Ressington][5] is always ready to tell it how it is, and Félim is always quick with his opinions. It's presented in a casual conversation format—but not one to have one with the kids around, especially with subjects they are all passionate about! + + + 4. [**Ask Noah Show**][6]—This show was forked from the Linux Action Show after it ended. Hosted by [Noah Chelliah][7], it's presented in a radio talkback style and takes live calls from listeners—it's syndicated from a local radio station in Grand Forks, North Dakota. The podcast isn't purely about Linux, but Noah takes on technical challenges and solves them with Linux and answers listeners' questions about how to achieve good technical solutions using Linux. + + + 3. [**The Ubuntu Podcast**][8]—If you want the latest about Ubuntu, you can't go past this show. In another podcast with a UK twist, hosts [Alan Pope][9] (Popey), [Mark Johnson][10], and [Martin Wimpress][11] (Wimpy) present a funny and insightful view of the open source community with news directly from Ubuntu. + + + 2. [**Linux Action News**][12]—The title says it all: it's a news show for Linux. This show was spawned from the popular Linux Action Show and is broadcast by the [Jupiter Broadcasting Network][13], which has many other tech-related podcasts. Hosts Chris Fisher and [Joe Ressington][5] present the show in a more formal "evening news" style, which runs around 30 minutes long. If you want to get a quick weekly update on Linux and Linux-related news, this is the show for you. + + + 1. [**Linux Unplugged**][14]—Finally, coming in at the number one spot is the granddaddy of them all, Linux Unplugged. This show gets to the core of what being in the Linux community is all about. Presented as a casual panel-style discussion by [Chris Fisher][15] and [Wes Payne][16], the podcast includes an interactive voice chatroom where listeners can connect and be heard live on the show as it broadcasts. + + + +Well, there you have it, my current shortlist of Linux podcasts. It's likely to change in the near future, but for now, I am enjoying every minute these guys put together. + +### Bonus podcasts + +Here are two bonus podcasts you might want to check out. + +**[Choose Linux][17]** is a brand-new podcast that is tantalizing because of its hosts: Joe Ressington of Linux Action News, who is a long-time Linux veteran, and [Jason Evangelho][18], a Forbes writer who recently shot to fame in the open source community with his articles showcasing his introduction to Linux and open source. Living vicariously through Jason's introduction to Linux has been and will continue to be fun. + +[**Command Line Heroes**][19] is a podcast produced by Red Hat. It has a very high production standard and has a slightly different format to the shows I have previously mentioned, anchored by a single presenter, developer, and [CodeNewbie][20] founder [Saron Yitbarek][21], who presents the latest innovations in open source. Now in its second season and released fortnightly, I highly recommend that you start from the first episode of this podcast. It starts with a great intro to the O/S wars of the '90s and sets the foundations for the start of Linux. + +Do you have a favorite Linux podcast that isn't on this list? Please share it in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/top-linux-podcasts + +作者:[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://latenightlinux.com/ +[2]: https://twitter.com/felimwhiteley +[3]: https://twitter.com/degville +[4]: https://twitter.com/8none1 +[5]: https://twitter.com/JoeRessington +[6]: http://www.asknoahshow.com/ +[7]: https://twitter.com/kernellinux?lang=en +[8]: http://ubuntupodcast.org/ +[9]: https://twitter.com/popey +[10]: https://twitter.com/marxjohnson +[11]: https://twitter.com/m_wimpress +[12]: https://linuxactionnews.com/ +[13]: https://www.jupiterbroadcasting.com/ +[14]: https://linuxunplugged.com/ +[15]: https://twitter.com/ChrisLAS +[16]: https://twitter.com/wespayne +[17]: https://chooselinux.show +[18]: https://twitter.com/killyourfm +[19]: https://www.redhat.com/en/command-line-heroes +[20]: https://www.codenewbie.org/ +[21]: https://twitter.com/saronyitbarek From a8d5710267b5e126444bfe966f2943cab661aec7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 16:56:47 +0800 Subject: [PATCH 192/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190214=20Drinki?= =?UTF-8?q?ng=20coffee=20with=20AWK=20sources/tech/20190214=20Drinking=20c?= =?UTF-8?q?offee=20with=20AWK.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190214 Drinking coffee with AWK.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/tech/20190214 Drinking coffee with AWK.md diff --git a/sources/tech/20190214 Drinking coffee with AWK.md b/sources/tech/20190214 Drinking coffee with AWK.md new file mode 100644 index 0000000000..6cde1491d4 --- /dev/null +++ b/sources/tech/20190214 Drinking coffee with AWK.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drinking coffee with AWK) +[#]: via: (https://opensource.com/article/19/2/drinking-coffee-awk) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Drinking coffee with AWK +====== +Keep track of what your office mates owe for the coffee they drink with a simple AWK program. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) + +The following is based on a true story, although some names and details have been changed. + +> A long time ago, in a place far away, there was an office. The office did not, for various reasons, buy instant coffee. Some workers in that office got together and decided to institute the "Coffee Corner." +> +> A member of the Coffee Corner would buy some instant coffee, and the other members would pay them back. It came to pass that some people drank more coffee than others, so the level of a "half-member" was added: a half-member was allowed a limited number of coffees per week and would pay half of what a member paid. + +Managing this was a huge pain. I had just read The Unix Programming Environment and wanted to practice my [AWK][1] programming. So I volunteered to create a system. + +Step 1: I kept a database of members and their debt to the Coffee Corner. I did it in an AWK-friendly format, where fields are separated by colons: + +``` +member:john:1:22 +member:jane:0.5:33 +member:pratyush:0.5:17 +member:jing:1:27 +``` + +The first field above identifies what kind of row this is (member). The second field is the member's name (i.e., their email username without the @). The next field is their membership level (full=1 or half=0.5). The last field is their debt to the Coffee Corner. A positive number means they owe money, a negative number means the Coffee Corner owes them. + +Step 2: I kept a log of inputs to and outputs from the Coffee Corner: + +``` +payment:jane:33 +payment:pratyush:17 +bought:john:60 +payback:john:50 +``` + +Jane paid $33, Pratyush paid $17, John bought $60 worth of coffee, and the Coffee Corner paid John $50. + +Step 3: I was ready to write some code. The code would process the members and payments and spit out an updated members file with the new debts. + +``` +#!/usr/bin/env --split-string=awk -F: -f +``` + +**#!** ) line required some work! I used the **env** command to allow passing multiple arguments from the shebang: specifically, the **-F** command-line argument to AWK tells it what the field separator is. + +The shebang () line required some work! I used thecommand to allow passing multiple arguments from the shebang: specifically, thecommand-line argument to AWK tells it what the field separator is. + +An AWK program is a sequence of rules. (It can also contain function definitions, but I don't need any for the Coffee Corner.) + +The first rule reads the members file. When I run the command, I always give it the members file first, and the payments file second. It uses AWK associative arrays to record membership levels in the **members** array and current debt in the **debt** array. + +``` +$1 == "member" { +   members[$2]=$3 +   debt[$2]=$4 +   total_members += $3 +} +``` + +The second rule reduces the debt when a **payment** is recorded. + +``` +$1 == "payment" { +   debt[$2] -= $3 +} +``` + +**Payback** is the opposite: it increases the debt. This elegantly supports the case of accidentally giving someone too much money. + +``` +$1 == "payback" { +   debt[$2] += $3 +} +``` + +The most complicated part happens when someone buys ( **"bought"** ) instant coffee for the Coffee Club's use. It is treated as a payment and the person's debt is reduced by the appropriate amount. Next, it calculates the per-member fee. It iterates over all members and increases their debt, according to their level of membership. + +``` +$1 == "bought" { +   debt[$2] -= $3 +   per_member = $3/total_members +   for (x in members) { +       debt[x] += per_member * members[x] +   } +} +``` + +The **END** pattern is special: it happens exactly once, when AWK has no more lines to process. At this point, it spits out the new members file with updated debt levels. + +``` +END { + +   for (x in members) { + +       printf "%s:%s:%s\n", x, members[x], debt[x] + +   } + +} +``` + +Along with a script that iterates over the members and sends a reminder email to people to pay their dues (for positive debts), this system managed the Coffee Corner for quite a while. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/drinking-coffee-awk + +作者:[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://en.wikipedia.org/wiki/AWK From 862bf7bf51ee84cf065250b4cb062aea26819f09 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 17:02:33 +0800 Subject: [PATCH 193/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190213=20How=20?= =?UTF-8?q?to=20use=20Linux=20Cockpit=20to=20manage=20system=20performance?= =?UTF-8?q?=20sources/tech/20190213=20How=20to=20use=20Linux=20Cockpit=20t?= =?UTF-8?q?o=20manage=20system=20performance.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux Cockpit to manage system performance.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20190213 How to use Linux Cockpit to manage system performance.md diff --git a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md new file mode 100644 index 0000000000..0633b0b3ab --- /dev/null +++ b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Linux Cockpit to manage system performance) +[#]: via: (https://www.networkworld.com/article/3340038/linux/sitting-in-the-linux-cockpit.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to use Linux Cockpit to manage system performance +====== + +Linux Cockpit is a web-based interface that provides graphical administrative access to a system. Here's a look at what it allows you to control. + +![](https://images.idgesg.net/images/article/2019/02/cockpit_airline_airplane_control_pilot-by-southerlycourse-getty-100787904-large.jpg) + +If you haven't tried the relatively new Linux Cockpit, you might be surprised by all it can do. It's a user-friendly web-based console that provides some very easy ways to administer Linux systems — _through the **web**_. You can monitor system resources, add or remove accounts, monitor system usage, shut down the system and perform quite a few other tasks — all through a very accessible web connection. It's also very easy to set up and use. + +While many Linux sysadmins spend most of their time on the command line, access to a remote system using a tool like PuTTY doesn't always provide the most useful command output. Linux Cockpit provides graphs and easy-to-use forms for viewing performance measures and making changes to your systems. + +Linux Cockpit allows you to view many aspects of system performance and make configuration changes, though the task list may depend on the particular flavor of Linux that you are using. Some of the categories of tasks include the following: + + * Monitoring system activity (CPU, memory, disk IO and network traffics) — **System** + * Viewing system log entries — **Logs** + * Seeing how full your disk partitions are — **Storage** + * Watching networking activity (sent and received) — **Networking** + * Taking a look at user accounts — **Accounts** + * Checking the status of system services — **Services** + * Pulling up information on installed applications — **Applications** + * Viewing and installing available updates (if logged in as root) and restart the system if needed — **Software Updates** + * Opening and using a terminal window — **Terminal** + + + +Some Linux Cockpit installations will also allow you to run diagnostic reports, dump the kernel, examine SELinux (security) settings, and list subscriptions. + +Here's an example of system activity as displayed by Linux Cockpit: + +![cockpit activity][1] Sandra Henry-Stocker + +Linux Cockpit display of system activity + +### How to set up Linux Cockpit + +On some Linux installations (e.g., recent RHEL), Linux Cockpit may already be installed and ready for use. On others, you may have to take some easy steps to install it and make it accessible. + +On Ubuntu, for example, these commands should work: + +``` +$ sudo apt-get install cockpit +$ man cockpit <== just checking +$ sudo systemctl enable --now cockpit.socket +$ netstat -a | grep 9090 +tcp6 0 0 [::]:9090 [::]:* LISTEN +$ sudo systemctl enable --now cockpit.socket +$ sudo ufw allow 9090 +``` + +Once Linux Cockpit is enabled, point your browser at **https:// :9090**. + +A list of distributions that work with Cockpit along with installation instructions is available at [the Cockpit Project][2]. + +Linux Cockpit doesn't provide any recognition of **sudo** privileges without some additional configuration. If you are not allowed to make a change using the Cockpit interface, you will see one of those little red international prohibition signs imposed over the button you'd otherwise click on. + +To get sudo privileges working, you need to be sure that the user is in the **wheel** (RHEL) or **adm** (Debian) group in the **/etc/group** file, that the Server Administrator checkbox has been selected for this user account when logged into Cockpit as root and that the user selects "Reuse my password" when logging into Cockpit. + +It's nice to be able to get some graphical control over the Linux systems you administer even when they're thousands of miles away or lacking consoles. While I love working on the console, I like seeing a graph or a button now and then. Linux Cockpit provides a very useful interface for routine administrative tasks. + +Post updated Feb. 13, 11:30am ET + +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/3340038/linux/sitting-in-the-linux-cockpit.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://images.idgesg.net/images/article/2019/02/cockpit-activity-100787994-large.jpg +[2]: https://cockpit-project.org/running.html +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 7bc588489421cf9da46d5753354606a9c73a8bae Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 17:21:08 +0800 Subject: [PATCH 194/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20Ampers?= =?UTF-8?q?ands=20and=20File=20Descriptors=20in=20Bash=20sources/tech/2019?= =?UTF-8?q?0212=20Ampersands=20and=20File=20Descriptors=20in=20Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Ampersands and File Descriptors in Bash.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20190212 Ampersands and File Descriptors in Bash.md diff --git a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md new file mode 100644 index 0000000000..ae0f2ce3f0 --- /dev/null +++ b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ampersands and File Descriptors in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Ampersands and File Descriptors in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-coffee.png?itok=yChaT-47) + +In our quest to examine all the clutter (`&`, `|`, `;`, `>`, `<`, `{`, `[`, `(`, ), `]`, `}`, etc.) that is peppered throughout most chained Bash commands, [we have been taking a closer look at the ampersand symbol (`&`)][1]. + +[Last time, we saw how you can use `&` to push processes that may take a long time to complete into the background][1]. But, the &, in combination with angle brackets, can also be used to pipe output and input elsewhere. + +In the [previous tutorials on][2] [angle brackets][3], you saw how to use `>` like this: + +``` +ls > list.txt +``` + +to pipe the output from `ls` to the _list.txt_ file. + +Now we see that this is really shorthand for + +``` +ls 1> list.txt +``` + +And that `1`, in this context, is a file descriptor that points to the standard output (`stdout`). + +In a similar fashion `2` points to standard error (`stderr`), and in the following command: + +``` +ls 2> error.log +``` + +all error messages are piped to the _error.log_ file. + +To recap: `1>` is the standard output (`stdout`) and `2>` the standard error output (`stderr`). + +There is a third standard file descriptor, `0<`, the standard input (`stdin`). You can see it is an input because the arrow (`<`) is pointing into the `0`, while for `1` and `2`, the arrows (`>`) are pointing outwards. + +### What are the standard file descriptors good for? + +If you are following this series in order, you have already used the standard output (`1>`) several times in its shorthand form: `>`. + +Things like `stderr` (`2`) are also handy when, for example, you know that your command is going to throw an error, but what Bash informs you of is not useful and you don't need to see it. If you want to make a directory in your _home/_ directory, for example: + +``` +mkdir newdir +``` + +and if _newdir/_ already exists, `mkdir` will show an error. But why would you care? (Ok, there some circumstances in which you may care, but not always.) At the end of the day, _newdir_ will be there one way or another for you to fill up with stuff. You can supress the error message by pushing it into the void, which is _/dev/null_ : + +``` +mkdir newdir 2> /dev/null +``` + +This is not just a matter of " _let's not show ugly and irrelevant error messages because they are annoying,_ " as there may be circumstances in which an error message may cause a cascade of errors elsewhere. Say, for example, you want to find all the _.service_ files under _/etc_. You could do this: + +``` +find /etc -iname "*.service" +``` + +But it turns out that on most systems, many of the lines spat out by `find` show errors because a regular user does not have read access rights to some of the folders under _/etc_. It makes reading the correct output cumbersome and, if `find` is part of a larger script, it could cause the next command in line to bork. + +Instead, you can do this: + +``` +find /etc -iname "*.service" 2> /dev/null +``` + +And you get only the results you are looking for. + +### A Primer on File Descriptors + +There are some caveats to having separate file descriptors for `stdout` and `stderr`, though. If you want to store the output in a file, doing this: + +``` +find /etc -iname "*.service" 1> services.txt +``` + +would work fine because `1>` means " _send standard output, and only standard output (NOT standard error) somewhere_ ". + +But herein lies a problem: what if you *do* want to keep a record within the file of the errors along with the non-erroneous results? The instruction above won't do that because it ONLY writes the correct results from `find`, and + +``` +find /etc -iname "*.service" 2> services.txt +``` + +will ONLY write the errors. + +How do we get both? Try the following command: + +``` +find /etc -iname "*.service" &> services.txt +``` + +... and say hello to `&` again! + +We have been saying all along that `stdin` (`0`), `stdout` (`1`), and `stderr` (`2`) are _file descriptors_. A file descriptor is a special construct that points to a channel to a file, either for reading, or writing, or both. This comes from the old UNIX philosophy of treating everything as a file. Want to write to a device? Treat it as a file. Want to write to a socket and send data over a network? Treat it as a file. Want to read from and write to a file? Well, obviously, treat it as a file. + +So, when managing where the output and errors from a command goes, treat the destination as a file. Hence, when you open them to read and write to them, they all get file descriptors. + +This has interesting effects. You can, for example, pipe contents from one file descriptor to another: + +``` +find /etc -iname "*.service" 1> services.txt 2>&1 +``` + +This pipes `stderr` to `stdout` and `stdout` is piped to a file, _services.txt_. + +And there it is again: the `&`, signaling to Bash that `1` is the destination file descriptor. + +Another thing with the standard file descriptors is that, when you pipe from one to another, the order in which you do this is a bit counterintuitive. Take the command above, for example. It looks like it has been written the wrong way around. You may be reading it like this: " _pipe the output to a file and then pipe errors to the standard output._ " It would seem the error output comes to late and is sent when `1` is already done. + +But that is not how file descriptors work. A file descriptor is not a placeholder for the file, but for the _input and/or output channel_ to the file. In this case, when you do `1> services.txt`, you are saying " _open a write channel to services.txt and leave it open_ ". `1` is the name of the channel you are going to use, and it remains open until the end of the line. + +If you still think it is the wrong way around, try this: + +``` +find /etc -iname "*.service" 2>&1 1>services.txt +``` + +And notice how it doesn't work; notice how errors get piped to the terminal and only the non-erroneous output (that is `stdout`) gets pushed to `services.txt`. + +That is because Bash processes every result from `find` from left to right. Think about it like this: when Bash gets to `2>&1`, `stdout` (`1`) is still a channel that points to the terminal. If the result that `find` feeds Bash contains an error, it is popped into `2`, transferred to `1`, and, away it goes, off to the terminal! + +Then at the end of the command, Bash sees you want to open `stdout` as a channel to the _services.txt_ file. If no error has occurred, the result goes through `1` into the file. + +By contrast, in + +``` +find /etc -iname "*.service" 1>services.txt 2>&1 +``` + +`1` is pointing at `services.txt` right from the beginning, so anything that pops into `2` gets piped through `1`, which is already pointing to the final resting place in `services.txt`, and that is why it works. + +In any case, as mentioned above `&>` is shorthand for " _both standard output and standard error_ ", that is, `2>&1`. + +This is probably all a bit much, but don't worry about it. Re-routing file descriptors here and there is commonplace in Bash command lines and scripts. And, you'll be learning more about file descriptors as we progress through this series. See you next week! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash + +作者:[Paul 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://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash +[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash From 666291928458d7d9ab505b7c88fbe5cabbb706fb Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 17:24:13 +0800 Subject: [PATCH 195/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20Two=20?= =?UTF-8?q?graphical=20tools=20for=20manipulating=20PDFs=20on=20the=20Linu?= =?UTF-8?q?x=20desktop=20sources/tech/20190212=20Two=20graphical=20tools?= =?UTF-8?q?=20for=20manipulating=20PDFs=20on=20the=20Linux=20desktop.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... manipulating PDFs on the Linux desktop.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md diff --git a/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md b/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md new file mode 100644 index 0000000000..d1d640c30f --- /dev/null +++ b/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Two graphical tools for manipulating PDFs on the Linux desktop) +[#]: via: (https://opensource.com/article/19/2/manipulating-pdfs-linux) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Two graphical tools for manipulating PDFs on the Linux desktop +====== +PDF-Shuffler and PDF Chain are great tools for modifying PDFs in Linux. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4) + +With the way I talk and write about PDFs and tools for working with them, some people think I'm in love with the format. I'm not, for a variety of reasons I won't go into here. + +I won't go so far as saying PDFs are a necessary evil in my personal and professional life—rather they're a necessary not-so-good. Often I have to use PDFs, even though there are better alternatives for delivering documents. + +When I work with PDFs, usually at the day job and with one of those other operating systems, I fiddle with them using Adobe Acrobat. But what about when I have to work with PDFs on the Linux desktop? Let's take a look at two of the graphical tools I use to manipulate PDFs. + +### PDF-Shuffler + +As its name suggests, you can use [PDF-Shuffler][1] to move pages around in a PDF file. It can do a little more, but the software's capabilities are limited. That doesn't mean PDF-Shuffler isn't useful. It is. Very useful. + +You can use PDF-Shuffler to: + + * Extract pages from PDF files + * Add pages to a file + * Rearrange the pages in a file + + + +Be aware that PDF-Shuffler has a few dependencies, like pyPDF and python-gtk. Usually, installing it via a package manager is the fastest and least frustrating route. + +Let's say you want to extract pages from a PDF, maybe to act as a sample chapter from your book. Open the PDF file by selecting **File > Add**. + +![](https://opensource.com/sites/default/files/uploads/pdfshuffler-book.png) + +To extract pages 7 to 9, press Ctrl and click-select the pages. Then, right-click and select **Export selection**. + +![](https://opensource.com/sites/default/files/uploads/pdfshuffler-export.png) + +Choose the directory where you want to save the file, give it a name, and click **Save**. + +To add a file—for example, to add a cover or re-insert scanned, signed pages of a contract or application—open a PDF file, then select **File > Add** and find the PDF file that you want to add. Click **Open**. + +PDF-Shuffler has an annoying habit of adding pages at the end of the PDF file you're working on. Click and drag the page you added to where you want it to go in the file. You can only click and drag one page in a file at a time. + +![](https://opensource.com/sites/default/files/uploads/pdfshuffler-move.png) + +### PDF Chain + +I'm a big fan of [PDFtk][2], a command-line app for doing some interesting things with and to PDFs. Since I don't use it frequently, I don't remember all of PDFtk's commands and options. + +[PDF Chain][3] is a very good alternative to PDFtk's command line. It gives you one-click access to PDFtk's most frequently used commands. Without touching a menu, you can: + + * Merge PDFs (including rotating the pages of one or more files) + * Extract pages from a PDF and save them to individual files + * Add a background or watermark to a PDF + * Add attachments to a file + +![](https://opensource.com/sites/default/files/uploads/pdfchain1.png) + +You can also do more. Click on the **Tools** menu to: + + * Extract attachments from a PDF + * Compress or uncompress a file + * Extract the metadata from the file + * Fill in PDF forms from an external [data file][4] + * [Flatten][5] a PDF + * Drop [XML Forms Architecture][6] (XFA) data from PDF forms + + + +To be honest, I only use the commands to extract attachments and compress or uncompress PDFs with PDF Chain or PDFtk. The rest are pretty much terra incognita for me. + +### Summing up + +The number of tools available on Linux for working with PDFs never ceases to amaze me. And neither does the breadth and depth of their features and functions. I can usually find one, whether command line or graphical, that does what I need to do. For the most part, PDF Mod and PDF Chain work well for me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/manipulating-pdfs-linux + +作者:[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://savannah.nongnu.org/projects/pdfshuffler/ +[2]: https://en.wikipedia.org/wiki/PDFtk +[3]: http://pdfchain.sourceforge.net/ +[4]: http://www.verypdf.com/pdfform/fdf.htm +[5]: http://pdf-tips-tricks.blogspot.com/2009/03/flattening-pdf-layers.html +[6]: http://en.wikipedia.org/wiki/XFA From 1682cb72b4757ab99cbcfc9b1a9902925c72e09d Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 17:28:12 +0800 Subject: [PATCH 196/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20How=20?= =?UTF-8?q?To=20Check=20CPU,=20Memory=20And=20Swap=20Utilization=20Percent?= =?UTF-8?q?age=20In=20Linux=3F=20sources/tech/20190212=20How=20To=20Check?= =?UTF-8?q?=20CPU,=20Memory=20And=20Swap=20Utilization=20Percentage=20In?= =?UTF-8?q?=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nd Swap Utilization Percentage In Linux.md | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md diff --git a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md new file mode 100644 index 0000000000..24fc867ac0 --- /dev/null +++ b/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -0,0 +1,226 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Check CPU, Memory And Swap Utilization Percentage In Linux?) +[#]: via: (https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +How To Check CPU, Memory And Swap Utilization Percentage In Linux? +====== + +There is a lot of commands and options are available in Linux to check memory utilization but i don’t see much information to check about memory utilization percentage. + +Most of the times we are checking memory utilization alone and we won’t think about how much percentage is used. + +If you want to know those information then you are in the right page. + +We are here to help you out on this in details. + +This tutorial will help you to identify the memory utilization when you are facing high memory utilization frequently in Linux server. + +But the same time, you won’t be getting the clear utilization if you are using `free -m` or `free -g`. + +These format commands fall under Linux advanced commands. It will be very useful for Linux Experts and Middle Level Linux Users. + +### Method-1: How To Check Memory Utilization Percentage In Linux? + +We can use the following combination of commands to get this done. In this method, we are using combination of free and awk command to get the memory utilization percentage. + +If you are looking for other articles which is related to memory then navigate to the following link. Those are **[free Command][1]** , **[smem Command][2]** , **[ps_mem Command][3]** , **[vmstat Command][4]** and **[Multiple ways to check size of physical memory][5]**. + +For `Memory` Utilization Percentage without Percent Symbol: + +``` +$ free -t | awk 'NR == 2 {print "Current Memory Utilization is : " $3/$2*100}' +or +$ free -t | awk 'FNR == 2 {print "Current Memory Utilization is : " $3/$2*100}' + +Current Memory Utilization is : 20.4194 +``` + +For `Swap` Utilization Percentage without Percent Symbol: + +``` +$ free -t | awk 'NR == 3 {print "Current Swap Utilization is : " $3/$2*100}' +or +$ free -t | awk 'FNR == 3 {print "Current Swap Utilization is : " $3/$2*100}' + +Current Swap Utilization is : 0 +``` + +For `Memory` Utilization Percentage with Percent Symbol and two decimal places: + +``` +$ free -t | awk 'NR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' +or +$ free -t | awk 'FNR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' + +Current Memory Utilization is : 20.42% +``` + +For `Swap` Utilization Percentage with Percent Symbol and two decimal places: + +``` +$ free -t | awk 'NR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' +or +$ free -t | awk 'FNR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' + +Current Swap Utilization is : 0.00% +``` + +If you are looking for other articles which is related to memory then navigate to the following link. Those are **[Create/Extend Swap Partition using LVM][6]** , **[Multiple Ways To Create Or Extend Swap Space][7]** and **[Shell Script to automatically Create/Remove and Mount Swap File][8]**. + +free command output for better clarification: + +``` +$ free + total used free shared buff/cache available +Mem: 15867 3730 9868 1189 2269 10640 +Swap: 17454 0 17454 +Total: 33322 3730 27322 +``` + +Details are follow: + + * **`free:`** free is a standard command to check memory utilization in Linux. + * **`awk:`** awk is a powerful command which is specialized for textual data manipulation. + * **`FNR == 2:`** It gives the total number of records for each input file. Basically it’s used to select the given line (Here, it chooses the line number 2). + * **`NR == 2:`** It gives the total number of records processed. Basically it’s used to filter the given line (Here, it chooses the line number 2).. + * **`$3/$2*100:`** It divides column 2 with column 3 and it’s multiply the results with 100. + * **`printf:`** It used to format and print data. + * **`%.2f%:`** By default it prints floating point numbers with 6 decimal places. Use the following format to limit a decimal places. + + + +### Method-2: How To Check Memory Utilization Percentage In Linux? + +We can use the following combination of commands to get this done. In this method, we are using combination of free, grep and awk command to get the memory utilization percentage. + +For `Memory` Utilization Percentage without Percent Symbol: + +``` +$ free -t | grep Mem | awk '{print "Current Memory Utilization is : " $3/$2*100}' +Current Memory Utilization is : 20.4228 +``` + +For `Swap` Utilization Percentage without Percent Symbol: + +``` +$ free -t | grep Swap | awk '{print "Current Swap Utilization is : " $3/$2*100}' +Current Swap Utilization is : 0 +``` + +For `Memory` Utilization Percentage with Percent Symbol and two decimal places: + +``` +$ free -t | grep Mem | awk '{printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' +Current Memory Utilization is : 20.43% +``` + +For `Swap` Utilization Percentage with Percent Symbol and two decimal places: + +``` +$ free -t | grep Swap | awk '{printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' +Current Swap Utilization is : 0.00% +``` + +### Method-1: How To Check CPU Utilization Percentage In Linux? + +We can use the following combination of commands to get this done. In this method, we are using combination of top, print and awk command to get the CPU utilization percentage. + +If you are looking for other articles which is related to memory then navigate to the following link. Those are **[top Command][9]** , **[htop Command][10]** , **[atop Command][11]** and **[Glances Command][12]**. + +If it shows multiple CPU in the output then you need to use the following method. + +``` +$ top -b -n1 | grep ^%Cpu +%Cpu0 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 5.3 si, 0.0 st +%Cpu3 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu4 : 10.5 us, 15.8 sy, 0.0 ni, 73.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu5 : 0.0 us, 5.0 sy, 0.0 ni, 95.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu6 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu7 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +``` + +For `CPU` Utilization Percentage without Percent Symbol: + +``` +$ top -b -n1 | grep ^%Cpu | awk '{cpu+=$9}END{print "Current CPU Utilization is : " 100-cpu/NR}' +Current CPU Utilization is : 21.05 +``` + +For `CPU` Utilization Percentage with Percent Symbol and two decimal places: + +``` +$ top -b -n1 | grep ^%Cpu | awk '{cpu+=$9}END{printf("Current CPU Utilization is : %.2f%"), 100-cpu/NR}' +Current CPU Utilization is : 14.81% +``` + +### Method-2: How To Check CPU Utilization Percentage In Linux? + +We can use the following combination of commands to get this done. In this method, we are using combination of top, print/printf and awk command to get the CPU utilization percentage. + +If it shows all together CPU(s) in the single output then you need to use the following method. + +``` +$ top -b -n1 | grep ^%Cpu +%Cpu(s): 15.3 us, 7.2 sy, 0.8 ni, 69.0 id, 6.7 wa, 0.0 hi, 1.0 si, 0.0 st +``` + +For `CPU` Utilization Percentage without Percent Symbol: + +``` +$ top -b -n1 | grep ^%Cpu | awk '{print "Current CPU Utilization is : " 100-$8}' +Current CPU Utilization is : 5.6 +``` + +For `CPU` Utilization Percentage with Percent Symbol and two decimal places: + +``` +$ top -b -n1 | grep ^%Cpu | awk '{printf("Current CPU Utilization is : %.2f%"), 100-$8}' +Current CPU Utilization is : 5.40% +``` + +Details are follow: + + * **`top:`** top is one of the best command to check currently running process on Linux system. + * **`-b:`** -b option, allow the top command to switch in batch mode. It is useful when you run the top command from local system to remote system. + * **`-n1:`** Number-of-iterations + * **`^%Cpu:`** Filter the lines which starts with %Cpu + * **`awk:`** awk is a powerful command which is specialized for textual data manipulation. + * **`cpu+=$9:`** For each line, add column 9 to a variable ‘cpu’. + * **`printf:`** It used to format and print data. + * **`%.2f%:`** By default it prints floating point numbers with 6 decimal places. Use the following format to limit a decimal places. + * **`100-cpu/NR:`** Finally print the ‘CPU Average’ by subtracting 100, divided by the number of records. + + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage/ + +作者:[Vinoth 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.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/free-command-to-check-memory-usage-statistics-in-linux/ +[2]: https://www.2daygeek.com/smem-linux-memory-usage-statistics-reporting-tool/ +[3]: https://www.2daygeek.com/ps_mem-report-core-memory-usage-accurately-in-linux/ +[4]: https://www.2daygeek.com/linux-vmstat-command-examples-tool-report-virtual-memory-statistics/ +[5]: https://www.2daygeek.com/easy-ways-to-check-size-of-physical-memory-ram-in-linux/ +[6]: https://www.2daygeek.com/how-to-create-extend-swap-partition-in-linux-using-lvm/ +[7]: https://www.2daygeek.com/add-extend-increase-swap-space-memory-file-partition-linux/ +[8]: https://www.2daygeek.com/shell-script-create-add-extend-swap-space-linux/ +[9]: https://www.2daygeek.com/linux-top-command-linux-system-performance-monitoring-tool/ +[10]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/ +[11]: https://www.2daygeek.com/atop-system-process-performance-monitoring-tool/ +[12]: https://www.2daygeek.com/install-glances-advanced-real-time-linux-system-performance-monitoring-tool-on-centos-fedora-ubuntu-debian-opensuse-arch-linux/ From f5d5295214b36e9bf1380d631600f8ff1abb8b75 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 17:29:20 +0800 Subject: [PATCH 197/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190213=20How=20?= =?UTF-8?q?To=20Install,=20Configure=20And=20Use=20Fish=20Shell=20In=20Lin?= =?UTF-8?q?ux=3F=20sources/tech/20190213=20How=20To=20Install,=20Configure?= =?UTF-8?q?=20And=20Use=20Fish=20Shell=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..., Configure And Use Fish Shell In Linux.md | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md diff --git a/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md b/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md new file mode 100644 index 0000000000..a03335c6b6 --- /dev/null +++ b/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md @@ -0,0 +1,264 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install, Configure And Use Fish Shell In Linux?) +[#]: via: (https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Install, Configure And Use Fish Shell In Linux? +====== + +Every Linux administrator might heard the word called shell. + +Do you know what is shell? Do you know what is the role for shell in Linux? How many shell is available in Linux? + +A shell is a program that provides an interface between a user and kernel. + +kernel is a heart of the Linux operating system that manage everything between user and operating system (OS). + +Shell is available for all the users when they launch the terminal. + +Once the terminal launched then user can run any commands which is available for him. + +When shell completes the command execution then you will be getting the output on the terminal window. + +Bash stands for Bourne Again Shell is the default shell which is running on most of the Linux distribution on today’s. + +It’s very popular and has a lot of features. Today we are going to discuss about the fish shell. + +### What Is Fish Shell? + +[Fish][1] stands for friendly interactive shell, is a fully-equipped, smart and user-friendly command line shell for Linux which comes with some handy features that is not available in most of the shell. + +The features are Autosuggestion, Sane Scripting, Man Page Completions, Web Based configuration and Glorious VGA Color. Are you curious to test it? if so, go ahead and install it by following the below installation steps. + +### How To Install Fish Shell In Linux? + +It’s very simple to install but it doesn’t available in most of the distributions except few. However, it can be easily installed by using the following [fish repository][2]. + +For **`Arch Linux`** based systems, use **[Pacman Command][3]** to install fish shell. + +``` +$ sudo pacman -S fish +``` + +For **`Ubuntu 16.04/18.04`** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install fish shell. + +``` +$ sudo apt-add-repository ppa:fish-shell/release-3 +$ sudo apt-get update +$ sudo apt-get install fish +``` + +For **`Fedora`** system, use **[DNF Command][6]** to install fish shell. + +For Fedora 29 System: + +``` +$ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_29/shells:fish:release:3.repo +$ sudo dnf install fish +``` + +For Fedora 28 System: + +``` +$ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_28/shells:fish:release:3.repo +$ sudo dnf install fish +``` + +For **`Debian`** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install fish shell. + +For Debian 9 System: + +``` +$ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_9.0/Release.key -O Release.key +$ sudo apt-key add - < Release.key +$ sudo echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_9.0/ /' > /etc/apt/sources.list.d/shells:fish:release:3.list +$ sudo apt-get update +$ sudo apt-get install fish +``` + +For Debian 8 System: + +``` +$ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_8.0/Release.key -O Release.key +$ sudo apt-key add - < Release.key +$ sudo echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_8.0/ /' > /etc/apt/sources.list.d/shells:fish:release:3.list +$ sudo apt-get update +$ sudo apt-get install fish +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][7]** to install fish shell. + +For RHEL 7 System: + +``` +$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RHEL_7/shells:fish:release:3.repo +$ sudo yum install fish +``` + +For RHEL 6 System: + +``` +$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RedHat_RHEL-6/shells:fish:release:3.repo +$ sudo yum install fish +``` + +For CentOS 7 System: + +``` +$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo +$ sudo yum install fish +``` + +For CentOS 6 System: + +``` +$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_6/shells:fish:release:2.repo +$ sudo yum install fish +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][8]** to install fish shell. + +``` +$ sudo zypper addrepo https://download.opensuse.org/repositories/shells:/fish:/release:/3/openSUSE_Leap_42.3/shells:fish:release:3.repo +$ suod zypper refresh +$ sudo zypper install fish +``` + +### How To Use Fish Shell? + +Once you have successfully installed the fish shell. Simply type `fish` on your terminal, which will automatically switch to the fish shell from your default bash shell. + +``` +$ fish +``` + +![][10] + +### Auto Suggestions + +When you type any commands in the fish shell, it will auto suggest a command in a light grey color after typing few letters. +![][11] + +Once you got a suggestion then simple hit the `Left Arrow Mark` to complete it instead of typing the full command. +![][12] + +Instantly you can access the previous history based on the command by pressing `Up Arrow Mark` after typing a few letters. It’s similar to bash shell `CTRL+r` option. + +### Tab Completions + +If you would like to see if there are any other possibilities for the given command then simple press the `Tab` button once after typing a few letters. +![][13] + +Press the `Tab` button one more time to see the full lists. +![][14] + +### Syntax highlighting + +fish performs syntax highlighting, that you can see when you are typing any commands in the terminal. Invalid commands are colored by `RED color`. +![][15] + +The same way valid commands are shown in a different color. Also, fish will underline valid file paths when you type and it doesn’t show the underline if the path is not valid. +![][16] + +### Web based configuration + +There is a cool feature is available in the fish shell, that allow us to set colors, prompt, functions, variables, history and bindings via web browser. + +Run the following command on your terminal to start the web configuration interface. Simply press `Ctrl+c` to exit it. + +``` +$ fish_config +Web config started at 'file:///home/daygeek/.cache/fish/web_config-86ZF5P.html'. Hit enter to stop. +qt5ct: using qt5ct plugin +^C +Shutting down. +``` + +![][17] + +### Man Page Completions + +Other shells support programmable completions, but only fish generates them automatically by parsing your installed man pages. + +To do so, run the below command. + +``` +$ fish_update_completions +Parsing man pages and writing completions to /home/daygeek/.local/share/fish/generated_completions/ + 3466 / 3466 : zramctl.8.gz +``` + +### How To Set Fish as default shell + +If you would like to test the fish shell for some times then you can set the fish shell as your default shell instead of switching it every time. + +If so, first get the fish shell location by using the below command. + +``` +$ whereis fish +fish: /usr/bin/fish /etc/fish /usr/share/fish /usr/share/man/man1/fish.1.gz +``` + +Change your default shell as a fish shell by running the following command. + +``` +$ chsh -s /usr/bin/fish +``` + +![][18] + +`Make note:` Just verify whether the fish shell is added into `/etc/shells` directory or not. If no, then run the following command to append it. + +``` +$ echo /usr/bin/fish | sudo tee -a /etc/shells +``` + +Once you have done the testing and if you would like to come back to the bash shell permanently then use the following command. + +For temporary: + +``` +$ bash +``` + +For permanent: + +``` +$ chsh -s /bin/bash +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/ + +作者:[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://fishshell.com/ +[2]: https://download.opensuse.org/repositories/shells:/fish:/release:/ +[3]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[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/dnf-command-examples-manage-packages-fedora-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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[10]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-1.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-2.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-5.png +[13]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-3.png +[14]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-4.png +[15]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-6.png +[16]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-8.png +[17]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-9.png +[18]: https://www.2daygeek.com/wp-content/uploads/2019/02/linux-fish-shell-friendly-interactive-shell-7.png From 605b659963675264c929d1d8f7a2aa032a336f55 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Mon, 18 Feb 2019 17:30:18 +0800 Subject: [PATCH 198/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index 76ff85fae3..980df58d89 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -8,16 +8,21 @@ [#]: author: (Dan Barker https://opensource.com/users/barkerd427) 7 CI/CD tools for sysadmins +系统管理员的 7 个 CI/CD 工具 ====== An easy guide to the top open source continuous integration, continuous delivery, and continuous deployment tools. +一篇简单指南:常见的开源持续集成、持续交付和持续部署工具。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) Continuous integration, continuous delivery, and continuous deployment (CI/CD) have all existed in the developer community for many years. Some organizations have involved their operations counterparts, but many haven't. For most organizations, it's imperative for their operations teams to become just as familiar with CI/CD tools and practices as their development compatriots are. +虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 CI/CD practices can equally apply to infrastructure and third-party applications and internally developed applications. Also, there are many different tools but all use similar models. And possibly most importantly, leading your company into this new practice will put you in a strong position within your company, and you'll be a beacon for others to follow. +在基础设施、第三方应用和内部开发应用上,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有相似的设计模型。也许最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,你将成为他人学习的榜样。 Some organizations have been using CI/CD practices on infrastructure, with tools like [Ansible][1], [Chef][2], or [Puppet][3], for several years. Other tools, like [Test Kitchen][4], allow tests to be performed on infrastructure that will eventually host applications. In fact, those tests can even deploy the application into a production-like environment and execute application-level tests with production loads in more advanced configurations. However, just getting to the point of being able to test the infrastructure individually is a huge feat. Terraform can also use Test Kitchen for even more [ephemeral][5] and [idempotent][6] infrastructure configurations than some of the original configuration-management tools. Add in Linux containers and Kubernetes, and you can now test full infrastructure and application deployments with prod-like specs and resources that come and go in hours rather than months or years. Everything is wiped out before being deployed and tested again. + However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. For example, I regularly write a newsletter within my company, and I maintain it in version control using [MJML][7]. I needed to be able to host a web version, and some folks liked being able to get a PDF, so I built a [pipeline][8]. Now when I create a new newsletter, I submit it for a merge request in GitLab. This automatically creates an index.html with links to HTML and PDF versions of the newsletter. The HTML and PDF files are also created in the pipeline. None of this is published until someone comes and reviews these artifacts. Then, GitLab Pages publishes the website and I can pull down the HTML to send as a newsletter. In the future, I'll automatically send the newsletter when the merge request is merged or after a special approval step. This seems simple, but it has saved me a lot of time. This is really at the core of what these tools can do for you. They will save you time. From ca44f54802d060ec9376234e57b2f06e8222083d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Feb 2019 17:58:25 +0800 Subject: [PATCH 199/813] TSL:20190201 Top 5 Linux Distributions for New Users.md --- ...Top 5 Linux Distributions for New Users.md | 121 ------------------ ...Top 5 Linux Distributions for New Users.md | 111 ++++++++++++++++ 2 files changed, 111 insertions(+), 121 deletions(-) delete mode 100644 sources/tech/20190201 Top 5 Linux Distributions for New Users.md create mode 100644 translated/tech/20190201 Top 5 Linux Distributions for New Users.md diff --git a/sources/tech/20190201 Top 5 Linux Distributions for New Users.md b/sources/tech/20190201 Top 5 Linux Distributions for New Users.md deleted file mode 100644 index 0a7f7151fe..0000000000 --- a/sources/tech/20190201 Top 5 Linux Distributions for New Users.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 5 Linux Distributions for New Users) -[#]: via: (https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) - -Top 5 Linux Distributions for New Users -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin-main.jpg?itok=ASgr0mOP) - -Linux has come a long way from its original offering. But, no matter how often you hear how easy Linux is now, there are still skeptics. To back up this claim, the desktop must be simple enough for those unfamiliar with Linux to be able to make use of it. And, the truth is that plenty of desktop distributions make this a reality. - -### No Linux knowledge required - -It might be simple to misconstrue this as yet another “best user-friendly Linux distributions” list. That is not what we’re looking at here. What’s the difference? For my purposes, the defining line is whether or not Linux actually plays into the usage. In other words, could you set a user in front of a desktop operating system and have them be instantly at home with its usage? No Linux knowledge required. - -Believe it or not, some distributions do just that. I have five I’d like to present to you here. You’ve probably heard of all of them. They might not be your distribution of choice, but you can guarantee that they slide Linux out of the spotlight and place the user front and center. - -Let’s take a look at the chosen few. - -### Elementary OS - -The very philosophy of Elementary OS is centered around how people actually use their desktops. The developers and designers have gone out of their way to create a desktop that is as simple as possible. In the process, they’ve de-Linux’d Linux. That is not to say they’ve removed Linux from the equation. No. Instead, what they’ve done is create an operating system that is about as neutral as you’ll find. Elementary OS is streamlined in such a way as to make sure everything is perfectly logical. From the single Dock to the clear-to-anyone Applications menu, this is a desktop that doesn’t say to the user, “You’re using Linux!” In fact, the layout itself is reminiscent of Mac, but with the addition of a simple app menu (Figure 1). - -![Elementary OS Juno][2] - -Figure 1: The Elementary OS Juno Application menu in action. - -[Used with permission][3] - -Another important aspect of Elementary OS that places it on this list is that it’s not nearly as flexible as some other desktop distributions. Sure, some users would balk at that, but having a desktop that doesn’t throw every bell and whistle at the user makes for a very familiar environment -- one that neither requires or allows a lot of tinkering. That aspect of the OS goes a long way to make the platform familiar to new users. - -And like any modern Linux desktop distribution, Elementary OS includes and App Store, called AppCenter, where users can install all the applications they need, without ever having to touch the command line. - -### Deepin - -Deepin not only gets my nod for one of the most beautiful desktops on the market, it’s also just as easy to adopt as any desktop operating system available. With a very simplistic take on the desktop interface, there’s very little in the way of users with zero Linux experience getting up to speed on its usage. In fact, you’d be hard-pressed to find a user who couldn’t instantly start using the Deepin desktop. The only possible hitch in that works might be the sidebar control center (Figure 2). - -![][5] - -Figure 2: The Deepin sidebar control panel. - -[Used with permission][3] - -But even that sidebar control panel is as intuitive as any other configuration tool on the market. And anyone that has used a mobile device will be instantly at home with the layout. As for opening applications, Deepin takes a macOS Launchpad approach with the Launcher. This button is in the usual far right position on the desktop dock, so users will immediately gravitate to that, understanding that it is probably akin to the standard “Start” menu. - -In similar fashion as Elementary OS (and most every Linux distribution on the market), Deepin includes an app store (simply called “Store”), where plenty of apps can be installed with ease. - -### Ubuntu - -You knew it was coming. Ubuntu is most often ranked at the top of most user-friendly Linux lists. Why? Because it’s one of the chosen few where a knowledge of Linux simply isn’t necessary to get by on the desktop. Prior to the adoption of GNOME (and the ousting of Unity), that wouldn’t have been the case. Why? Because Unity often needed a bit of tweaking to get it to the point where a tiny bit of Linux knowledge wasn’t necessary (Figure 3). Now that Ubuntu has adopted GNOME, and tweaked it to the point where an understanding of GNOME isn’t even necessary, this desktop makes Linux take a back seat to simplicity and usability. - -![Ubuntu 18.04][7] - -Figure 3: The Ubuntu 18.04 desktop is instantly familiar. - -[Used with permission][3] - -Unlike Elementary OS, Ubuntu doesn’t hold the user back. So anyone who wants more from their desktop, can have it. However, the out of the box experience is enough for just about any user type. Anyone looking for a desktop that makes the user unaware as to just how much power they have at their fingertips, could certainly do worse than Ubuntu. - -### Linux Mint - -I will preface this by saying I’ve never been the biggest fan of Linux Mint. It’s not that I don’t respect what the developers are doing, it’s more an aesthetic. I prefer modern-looking desktop environments. But that old school desktop metaphor (found in the default Cinnamon desktop) is perfectly familiar to nearly anyone who uses it. With a taskbar, start button, system tray, and desktop icons (Figure 4), Linux Mint offers an interface that requires zero learning curve. In fact, some users might be initially fooled into thinking they are working with a Windows 7 clone. Even the updates warning icon will look instantly familiar to users. - -![Linux Mint ][9] - -Figure 4: The Linux Mint Cinnamon desktop is very Windows 7-ish. - -[Used with permission][3] - -Because Linux Mint benefits from being based on Ubuntu, it’ll not only enjoy an immediate familiarity, but a high usability. No matter if you have even the slightest understanding of the underlying platform, users will feel instantly at home on Linux Mint. - -### Ubuntu Budgie - -Our list concludes with a distribution that also does a fantastic job of making the user forget they are using Linux, and makes working with the usual tools a simple, beautiful thing. Melding the Budgie Desktop with Ubuntu makes for an impressively easy to use distribution. And although the layout of the desktop (Figure 5) might not be the standard fare, there is no doubt the acclimation takes no time. In fact, outside of the Dock defaulting to the left side of the desktop, Ubuntu Budgie has a decidedly Elementary OS look to it. - -![Budgie][11] - -Figure 5: The Budgie desktop is as beautiful as it is simple. - -[Used with permission][3] - -The System Tray/Notification area in Ubuntu Budgie offers a few more features than the usual fare: Features such as quick access to Caffeine (a tool to keep your desktop awake), a Quick Notes tool (for taking simple notes), Night Lite switch, a Places drop-down menu (for quick access to folders), and of course the Raven applet/notification sidebar (which is similar to, but not quite as elegant as, the Control Center sidebar in Deepin). Budgie also includes an application menu (top left corner), which gives users access to all of their installed applications. Open an app and the icon will appear in the Dock. Right-click that app icon and select Keep in Dock for even quicker access. - -Everything about Ubuntu Budgie is intuitive, so there’s practically zero learning curve involved. It doesn’t hurt that this distribution is as elegant as it is easy to use. - -### Give One A Chance - -And there you have it, five Linux distributions that, each in their own way, offer a desktop experience that any user would be instantly familiar with. Although none of these might be your choice for top distribution, it’s hard to argue their value when it comes to users who have no familiarity with Linux. - -Learn more about Linux through the free ["Introduction to Linux" ][12]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users - -作者:[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.linux.com/files/images/elementaryosjpg-2 -[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/elementaryos_0.jpg?itok=KxgNUvMW (Elementary OS Juno) -[3]: https://www.linux.com/licenses/category/used-permission -[4]: https://www.linux.com/files/images/deepinjpg -[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin.jpg?itok=VV381a9f -[6]: https://www.linux.com/files/images/ubuntujpg-1 -[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntu_1.jpg?itok=bax-_Tsg (Ubuntu 18.04) -[8]: https://www.linux.com/files/images/linuxmintjpg -[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/linuxmint.jpg?itok=8sPon0Cq (Linux Mint ) -[10]: https://www.linux.com/files/images/budgiejpg-0 -[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/budgie_0.jpg?itok=zcf-AHmj (Budgie) -[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20190201 Top 5 Linux Distributions for New Users.md b/translated/tech/20190201 Top 5 Linux Distributions for New Users.md new file mode 100644 index 0000000000..90ea392aaa --- /dev/null +++ b/translated/tech/20190201 Top 5 Linux Distributions for New Users.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 5 Linux Distributions for New Users) +[#]: via: (https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +5 个面向新手的 Linux 发行版 +====== + +> 5 个可使用新用户如归家般感觉的发行版。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin-main.jpg?itok=ASgr0mOP) + +从最初的 Linux 到现在,Linux 已经发展了很长一段路。但是,无论你曾经多少次听说过使用 Linux 现在有多容易,仍然会表示怀疑的人。而要真的承担得其这份声明,桌面必须足够简单,以便不熟悉 Linux 的人也能够使用它。事实上大量的桌面发行版使这成为了现实。 + +### 无需 Linux 知识 + +将这个清单误解为又一个“最佳用户友好型 Linux 发行版”的清单可能很简单。但这不是我们要在这里看到的。这二者有什么不同?就我的目的而言,定义的界限是 Linux 是否真正起到了使用的作用。换句话说,你是否可以将这个桌面操作系统放在一个用户面前,并让他们应用自如而无需 Linux 知识呢? + +不管你相信与否,有些发行版就能做到。这里我将介绍给你 5 个这样的发行版。这些或许你全都听说过。它们或许不是你所选择的发行版,但你可以保证它们无需过多关注,而将用户放在眼前。 + +我们来看看选中的几个。 + +### Elementary OS + +Elementary OS 的理念主要围绕人们如何实际使用他们的桌面。开发人员和设计人员不遗余力地创建尽可能简单的桌面。在这个过程中,他们致力于将 Linux 去 Linux 化。这并不是说他们已经从这个等式中删除了 Linux。不,恰恰相反,他们所做的就是创建一个与你所发现的一样中立的操作系统。Elementary OS 是如此顺畅以确保一切都完美合理。从单个 Dock 到每个人都清晰明了的应用程序菜单,这是一个桌面,而不用提醒用户说,“你正在使用 Linux!” 事实上,其布局本身就让人联想到 Mac,但附加了一个简单的应用程序菜单(图 1)。 + +![Elementary OS Juno][2] + +*图 1:Elementary OS Juno 应用菜单* + +将 Elementary OS 放在此列表中的另一个重要原因是它不像其他桌面发行版那样灵活。当然,有些用户会对此不以为然,但是如果桌面没有向用户扔出各种花哨的定制诱惑,那么就会形成一个非常熟悉的环境:一个既不需要也不允许大量修修补补的环境。操作系统在让新用户熟悉该平台这一方面还有很长的路要走。 + +与任何现代 Linux 桌面发行版一样,Elementary OS 包括 App Store,也称为 AppCenter,用户可以在其中安装所需的所有应用程序,而无需触及命令行。 + +### Deepin + +Deepin 不仅得到了市场上最漂亮的台式机之一的赞誉,它也像任何桌面操作系统一样容易采用。其桌面界面非常简单,对于毫无 Linux 经验的用户来说,它的上手速度非常快。事实上,你很难找到无法立即上手使用 Deepin 桌面的用户。而这里唯一可能的障碍可能是其侧边栏控制中心(图 2)。 + +![][5] + +*图 2:Deepin 的侧边栏控制编码* + +但即使是侧边栏控制面板,也像市场上的任何其他配置工具一样直观。使用移动设备的任何人对于这种布局都很熟悉。至于打开应用程序,Deepin 的启动器采用了 macOS Launchpad 的方式。此按钮位于桌面底座上通常最右侧的位置,因此用户将立即就可以会心,知道它可能类似于标准的“开始”菜单。 + +与 Elementary OS(以及市场上大多数 Linux 发行版)类似,Deepin 也包含一个应用程序商店(简称为“商店”),可以轻松安装大量应用程序。 + +### Ubuntu + +你知道肯定有它。Ubuntu 通常在大多数用户友好的 Linux 列表中排名第一。为什么?因为它是少数几个不需要了解 Linux 就能使用的桌面之一。但在采用 GNOME(和 Unity 谢幕)之前,情况并非如此。为什么?因为 Unity 经常需要进行一些调整才能达到不需要一点 Linux 知识的程度(图 3)。现在 Ubuntu 已经采用了 GNOME,并将其调整到甚至不需要懂得 GNOME 的程度,这个桌面使得对 Linux 的简单性和可用性处于次要地位。 + +![Ubuntu 18.04][7] + +*图 3:Ubuntu 18.04 桌面可使用马上熟悉起来* + +与 Elementary OS 不同,Ubuntu 不会让用户半路放弃。因此,任何想从桌面上获得更多信息的人都可以拥有它。但是,开箱即用的体验对于任何用户类型都是足够的。任何一个让用户不知道他们触手可及的力量有多少的桌面,肯定不如 Ubuntu。 + +### Linux Mint + +我需要首先声明,我从来都不是 Linux Mint 的忠实粉丝。这并不是说我不尊重开发者的工作,这更多的是一种审美观点。我更喜欢现代的桌面环境。但是,旧式学校计算机桌面的隐喻(可以在默认的 Cinnamon 桌面中找到)让几乎每个人使用它的人都格外熟悉。Linux Mint 使用任务栏、开始按钮、系统托盘和桌面图标(图 4),提供了一个需要零学习曲线的界面。事实上,一些用户最初可能会被愚弄,以为他们正在使用Windows 7 的克隆。甚至是它的更新警告图标也会让用户感到非常熟悉。 + +![Linux Mint ][9] + +*图 4:Linux Mint 的 Cinnamon 桌面非常像 Windows 7* + +因为 Linux Mint 受益于其所基于的 Ubuntu,它不仅会让你马上熟悉起来,而且具有很高的可用性。无论你是否对底层平台有所了解,用户都会立即感受到宾至如归的感觉。 + +### Ubuntu Budgie + +我们的列表将以这样一个发行版做结,它也能让用户忘记他们正在使用 Linux,并且使用常用工具变得简单、美观。使 Ubuntu 融合 Budgie 桌面可以实现以令人印象深刻的易用发行版。虽然其桌面布局(图 5)可能不太一样,但毫无疑问,适应这个环境并不会浪费时间。实际上,在 Dock 外面默认为桌面的左侧,Ubuntu Budgie 确实看起来像 Elementary OS。 + +![Budgie][11] + +*图 5:Budgie 桌面既漂亮又简单* + +Ubuntu Budgie 中的系统托盘/通知区域提供了一些不太寻常的功能,比如:快速访问 Caffeine(一种保持桌面清醒的工具)、快速笔记工具(用于记录简单笔记)、Night Lite 开关、原地下拉菜单(用于快速访问文件夹),当然还有 Raven 小程序/通知侧边栏(与 Deepin 中的控制中心侧边栏类似,但不太优雅)。Budgie 还包括一个应用程序菜单(左上角),用户可以访问所有已安装的应用程序。打开一个应用程序,该图标将出现在 Dock 中。右键单击该应用程序图标,然后选择“保留在 Dock”以便更快地访问。 + +Ubuntu Budgie 的一切都很直观,所以几乎没有学习曲线。这种发行版既优雅又易于使用,这并没有什么坏处。 + +### 选择一个吧 + +至此介绍了 5 个 Linux 发行版,它们各自以自己的方式提供了让任何用户即刻熟悉的桌面体验。虽然这些可能不是你选择顶级发行版的选择,但对于那些不熟悉 Linux 的用户来说,很难否定它们的价值。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users + +作者:[Jack Wallen][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.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/files/images/elementaryosjpg-2 +[2]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/elementaryos_0.jpg?itok=KxgNUvMW (Elementary OS Juno) +[3]: https://www.linux.com/licenses/category/used-permission +[4]: https://www.linux.com/files/images/deepinjpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin.jpg?itok=VV381a9f +[6]: https://www.linux.com/files/images/ubuntujpg-1 +[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntu_1.jpg?itok=bax-_Tsg (Ubuntu 18.04) +[8]: https://www.linux.com/files/images/linuxmintjpg +[9]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/linuxmint.jpg?itok=8sPon0Cq (Linux Mint ) +[10]: https://www.linux.com/files/images/budgiejpg-0 +[11]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/budgie_0.jpg?itok=zcf-AHmj (Budgie) +[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From ddf3d38d48c301f486612427dc47256c5db46b16 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Feb 2019 18:45:59 +0800 Subject: [PATCH 200/813] translating by lujun9972 --- .../tech/20190103 How to use Magit to manage Git projects.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190103 How to use Magit to manage Git projects.md b/sources/tech/20190103 How to use Magit to manage Git projects.md index dbcb63d736..ae3585e131 100644 --- a/sources/tech/20190103 How to use Magit to manage Git projects.md +++ b/sources/tech/20190103 How to use Magit to manage Git projects.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lujun9972) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -76,7 +76,7 @@ via: https://opensource.com/article/19/1/how-use-magit 作者:[Sachin Patil][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lujun9972](https://github.com/lujun9972) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a28ae82ea7cc2971c05a52f538b3e9f14f735e3f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Feb 2019 21:40:43 +0800 Subject: [PATCH 201/813] PRF:20190207 10 Methods To Create A File In Linux.md @dianbanjiu --- ...07 10 Methods To Create A File In Linux.md | 120 ++++++++---------- 1 file changed, 56 insertions(+), 64 deletions(-) diff --git a/translated/tech/20190207 10 Methods To Create A File In Linux.md b/translated/tech/20190207 10 Methods To Create A File In Linux.md index 4f3e94ad31..0e0c831de2 100644 --- a/translated/tech/20190207 10 Methods To Create A File In Linux.md +++ b/translated/tech/20190207 10 Methods To Create A File In Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: (dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 Methods To Create A File In Linux) @@ -10,47 +10,36 @@ 在 Linux 上创建文件的 10 个方法 ====== -我们都知道,在 Linux 上,包括设备在内的一切都是文件。 +我们都知道,在 Linux 上,包括设备在内的一切都是文件。Linux 管理员每天应该会多次执行文件创建活动(可能是 20 次,50 次,甚至是更多,这依赖于他们的环境)。如果你想 [在Linux上创建一个特定大小的文件][1],查看前面的这个链接。 -Linux 管理员每天应该会多次执行文件创建活动(可能是 20 次,50 次,甚至是更多,这依赖于他们的环境)。 +高效创建一个文件是非常重要的能力。为什么我说高效?如果你了解一些高效进行你当前活动的方式,你就可以事半功倍。这将会节省你很多的时间。你可以把这些有用的时间用到到其他重要的事情上。 -如果你想 **[在Linux上创建一个特定大小的文件][1]**,查看前面的这个链接。 - -高效创建一个文件是非常重要的。为什么我说高效?如果你了解一些高效进行你当前活动的方式,你就可以事半功倍。 - -这将会节省你很多的时间。你可以把这些有用的时间用到到其他重要的事情上。 - -我下面将会介绍多个在 Linux 上创建文件的方法。我建议你选择几个简单高效的来辅助你的工作。 - -你不必安装下列的任何一个命令,因为它们已经作为 Linux 核心工具的一部分安装到你的系统上了。 +我下面将会介绍多个在 Linux 上创建文件的方法。我建议你选择几个简单高效的来辅助你的工作。你不必安装下列的任何一个命令,因为它们已经作为 Linux 核心工具的一部分安装到你的系统上了。 创建文件可以通过以下六个方式来完成。 - * **`重定向符号 (>):`** 标准重定向符允许我们创建一个 0KB 的空文件。 - * **`touch:`** 如果文件不存在的话,touch 命令将会创建一个 0KB 的空文件。 - * **`echo:`** echo 命令通过一个参数显示文本的某行。 - * **`printf:`** printf 命令用于显示在终端给定的文本。 - * **`cat:`** 它串联并打印文件到标准输出。 - * **`vi/vim:`** Vim 是一个向上兼容 Vi 的文本编辑器。它常用于编辑各种类型的纯文本。 - * **`nano:`** nano 是一个简小且用户友好的编辑器。它复制了 Pico 的外观和优点,而且还是免费的。 - * **`head:`** head 用于打印一个文件开头的一部分。 - * **`tail:`** tail 用于打印一个文件的最后一部分。 - * **`truncate:`** truncate 用于缩小或者扩展文件的尺寸到指定大小。 + * `>`:标准重定向符允许我们创建一个 0KB 的空文件。 + * `touch`:如果文件不存在的话,`touch` 命令将会创建一个 0KB 的空文件。 + * `echo`:通过一个参数显示文本的某行。 + * `printf`:用于显示在终端给定的文本。 + * `cat`:它串联并打印文件到标准输出。 + * `vi`/`vim`:Vim 是一个向上兼容 Vi 的文本编辑器。它常用于编辑各种类型的纯文本。 + * `nano`:是一个简小且用户友好的编辑器。它复制了 `pico` 的外观和优点,但它是自由软件。 + * `head`:用于打印一个文件开头的一部分。 + * `tail`:用于打印一个文件的最后一部分。 + * `truncate`:用于缩小或者扩展文件的尺寸到指定大小。 - - -### 在 Linux 上使用重定向符(>>)创建一个文件 +### 在 Linux 上使用重定向符(>)创建一个文件 标准重定向符允许我们创建一个 0KB 的空文件。它通常用于重定向一个命令的输出到一个新文件中。在没有命令的情况下使用重定向符号时,它会创建一个文件。 -但是它不允许你在创建文件时向其中输入任何文本。然而它对于不是很勤劳的管理员是非常简单有用的。只需要输入重定向符后面跟着你想要的文件名。 -(译者注:在输入下面的命令回车后,该命令并不会立刻中断,回车后你其实还可以继续输入一些文本,而这些文本都会被记录到你所创建的文章中去。在输入完成后,你可以使用 Ctrl+C 或者 Ctrl+D 来结束输入) +但是它不允许你在创建文件时向其中输入任何文本。然而它对于不是很勤劳的管理员是非常简单有用的。只需要输入重定向符后面跟着你想要的文件名。 ``` $ > daygeek.txt ``` -使用 ls 命令查看刚刚创建的文件。 +使用 `ls` 命令查看刚刚创建的文件。 ``` $ ls -lh daygeek.txt @@ -59,15 +48,15 @@ $ ls -lh daygeek.txt ### 在 Linux 上使用 touch 命令创建一个文件 -touch 命令常用于将每个文件的访问和修改时间更新为当前时间。 +`touch` 命令常用于将每个文件的访问和修改时间更新为当前时间。 -如果指定的文件名不存在,将会创建一个新的文件。touch 不允许我们在创建文件的同时向其中输入一些文本。它默认创建一个 0KB 的空文件。 +如果指定的文件名不存在,将会创建一个新的文件。`touch` 不允许我们在创建文件的同时向其中输入一些文本。它默认创建一个 0KB 的空文件。 ``` $ touch daygeek1.txt ``` -使用 ls 命令查看刚刚创建的文件。 +使用 `ls` 命令查看刚刚创建的文件。 ``` $ ls -lh daygeek1.txt @@ -76,7 +65,7 @@ $ ls -lh daygeek1.txt ### 在 Linux 上使用 echo 命令创建一个文件 -echo 内置于大多数的操作系统中。它常用于脚本,批处理文件,以及作为插入文本的单个命令的一部分。 +`echo` 内置于大多数的操作系统中。它常用于脚本、批处理文件,以及作为插入文本的单个命令的一部分。 它允许你在创建一个文件时就向其中输入一些文本。当然也允许你在之后向其中输入一些文本。 @@ -84,27 +73,27 @@ echo 内置于大多数的操作系统中。它常用于脚本,批处理文件 $ echo "2daygeek.com is a best Linux blog to learn Linux" > daygeek2.txt ``` -使用 ls 命令查看刚刚创建的文件。 +使用 `ls` 命令查看刚刚创建的文件。 ``` $ ls -lh daygeek2.txt -rw-rw-r-- 1 daygeek daygeek 49 Feb 4 02:04 daygeek2.txt ``` -可以使用 cat 命令查看文件的内容。 +可以使用 `cat` 命令查看文件的内容。 ``` $ cat daygeek2.txt 2daygeek.com is a best Linux blog to learn Linux ``` -你可以使用两个重定向符 (>>) 添加其他内容到同一个文件。 +你可以使用两个重定向符 (`>>`) 添加其他内容到同一个文件。 ``` $ echo "It's FIVE years old blog" >> daygeek2.txt ``` -你可以使用 cat 命令查看添加的内容。 +你可以使用 `cat` 命令查看添加的内容。 ``` $ cat daygeek2.txt @@ -113,35 +102,36 @@ It's FIVE years old blog ``` ### 在 Linux 上使用 printf 命令创建一个新的文件 -printf 命令也可以以类似 echo 的方式执行。 -printf 命令常用来显示在终端窗口给出的字符串。printf 可以有格式说明符,转义序列或普通字符。 +`printf` 命令也可以以类似 `echo` 的方式执行。 + +`printf` 命令常用来显示在终端窗口给出的字符串。`printf` 可以有格式说明符、转义序列或普通字符。 ``` $ printf "2daygeek.com is a best Linux blog to learn Linux\n" > daygeek3.txt ``` -使用 ls 命令查看刚刚创建的文件。 +使用 `ls` 命令查看刚刚创建的文件。 ``` $ ls -lh daygeek3.txt -rw-rw-r-- 1 daygeek daygeek 48 Feb 4 02:12 daygeek3.txt ``` -使用 cat 命令查看文件的内容。 +使用 `cat` 命令查看文件的内容。 ``` $ cat daygeek3.txt 2daygeek.com is a best Linux blog to learn Linux ``` -你可以使用两个重定向符 (>>) 添加其他的内容到同一个文件中去。 +你可以使用两个重定向符 (`>>`) 添加其他的内容到同一个文件中去。 ``` $ printf "It's FIVE years old blog\n" >> daygeek3.txt ``` -你可以使用 cat 命令查看这个文件中添加的内容。 +你可以使用 `cat` 命令查看这个文件中添加的内容。 ``` $ cat daygeek3.txt @@ -150,11 +140,10 @@ It's FIVE years old blog ``` ### 在 Linux 中使用 cat 创建一个文件 -cat 表示串联(concatenate)。在 Linux 经常用于读取一个文件中的数据。 -cat 是在类 Unix 系统中最常使用的命令之一。 它提供了三个与文本文件相关的功能:显示一个文件的内容,组合多个文件的内容到一个输出以及创建一个新的文件。 -(译者注:如果 cat 命令后如果不带任何文件的话,下面的命令在回车后也不会立刻结束,回车后的操作同上面的重定向符中的注解) +`cat` 表示串联concatenate。在 Linux 经常用于读取一个文件中的数据。 +`cat` 是在类 Unix 系统中最常使用的命令之一。它提供了三个与文本文件相关的功能:显示一个文件的内容、组合多个文件的内容到一个输出以及创建一个新的文件。(LCTT 译注:如果 `cat` 命令后如果不带任何文件的话,下面的命令在回车后也不会立刻结束,回车后的操作可以按 `Ctrl-C` 或 `Ctrl-D` 来结束。) ``` $ cat > daygeek4.txt @@ -162,14 +151,14 @@ $ cat > daygeek4.txt It's FIVE years old blog ``` -使用 ls 命令查看创建的文件。 +使用 `ls` 命令查看创建的文件。 ``` $ ls -lh daygeek4.txt -rw-rw-r-- 1 daygeek daygeek 74 Feb 4 02:18 daygeek4.txt ``` -使用 cat 命令查看文件的内容。 +使用 `cat` 命令查看文件的内容。 ``` $ cat daygeek4.txt @@ -177,14 +166,14 @@ $ cat daygeek4.txt It's FIVE years old blog ``` -如果你想向同一个文件中添加其他内容,使用两个连接的重定向符(>>)。 +如果你想向同一个文件中添加其他内容,使用两个连接的重定向符(`>>`)。 ``` $ cat >> daygeek4.txt This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. ``` -你可以使用 cat 命令查看添加的内容。 +你可以使用 `cat` 命令查看添加的内容。 ``` $ cat daygeek4.txt @@ -194,9 +183,10 @@ This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. ``` ### 在 Linux 上使用 vi/vim 命令创建一个文件 -Vim 是一个向上兼容 Vi 的文本编辑器。它通常用来编辑所有种类的纯文本。在编辑程序时特别有用。 -vim 中有很多功能可以用于编辑单个文件。 +`vim` 是一个向上兼容 `vi` 的文本编辑器。它通常用来编辑所有种类的纯文本。在编辑程序时特别有用。 + +`vim` 中有很多功能可以用于编辑单个文件。 ``` $ vi daygeek5.txt @@ -205,14 +195,14 @@ $ vi daygeek5.txt It's FIVE years old blog ``` -使用 ls 查看刚才创建的文件。 +使用 `ls` 查看刚才创建的文件。 ``` $ ls -lh daygeek5.txt -rw-rw-r-- 1 daygeek daygeek 75 Feb 4 02:23 daygeek5.txt ``` -使用 cat 命令查看文件的内容。 +使用 `cat` 命令查看文件的内容。 ``` $ cat daygeek5.txt @@ -221,7 +211,8 @@ It's FIVE years old blog ``` ### 在 Linux 上使用 nano 命令创建一个文件 -Nano 是一个编辑器,它是一个免费的 Pico 的克隆。nano 是一个小且用户友好的编辑器。它复制了 Pico 的外观及优点,并且是一个免费的应用,它添加了 Pico 缺乏的一系列特性,像是打开多个文件,每行滚动,撤销/重做,语法高亮,行号等等。 + +`nano` 是一个编辑器,它是一个自由版本的 `pico` 克隆。`nano` 是一个小且用户友好的编辑器。它复制了 `pico` 的外观及优点,并且是一个自由软件,它添加了 `pico` 缺乏的一系列特性,像是打开多个文件、逐行滚动、撤销/重做、语法高亮、行号等等。 ``` $ nano daygeek6.txt @@ -231,13 +222,14 @@ It's FIVE years old blog This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. ``` -使用 ls 命令查看创建的文件。 +使用 `ls` 命令查看创建的文件。 ``` $ ls -lh daygeek6.txt -rw-rw-r-- 1 daygeek daygeek 148 Feb 4 02:26 daygeek6.txt ``` -使用 cat 命令来查看一个文件的内容。 + +使用 `cat` 命令来查看一个文件的内容。 ``` $ cat daygeek6.txt @@ -248,13 +240,13 @@ This website is maintained by Magesh M, It's licensed under CC BY-NC 4.0. ### 在 Linux 上使用 head 命令创建一个文件 -head 命令通常用于输出一个文件开头的一部分。它默认会打印一个文件的开头 10 行到标准输出。如果有多个文件,则每个文件前都会有一个标题,用来表示文件名。 +`head` 命令通常用于输出一个文件开头的一部分。它默认会打印一个文件的开头 10 行到标准输出。如果有多个文件,则每个文件前都会有一个标题,用来表示文件名。 ``` $ head -c 0K /dev/zero > daygeek7.txt ``` -使用 ls 命令查看创建的文件。 +使用 `ls` 命令查看创建的文件。 ``` $ ls -lh daygeek7.txt @@ -263,13 +255,13 @@ $ ls -lh daygeek7.txt ### 在 Linux 上使用 tail 创建一个文件 -tail 命令通常用来输出一个文件最后的一部分。它默认会打印每个文件的最后 10 行到标准输出。如果有多个文件,则每个文件前都会有一个标题,用来表示文件名。 +`tail` 命令通常用来输出一个文件最后的一部分。它默认会打印每个文件的最后 10 行到标准输出。如果有多个文件,则每个文件前都会有一个标题,用来表示文件名。 ``` $ tail -c 0K /dev/zero > daygeek8.txt ``` -使用 ls 命令查看创建的文件。 +使用 `ls` 命令查看创建的文件。 ``` $ ls -lh daygeek8.txt @@ -278,13 +270,13 @@ $ ls -lh daygeek8.txt ### 在 Linux 上使用 truncate 命令创建一个文件 -truncate 命令通常用作将一个文件的尺寸缩小或者扩展为某个指定的尺寸。 +`truncate` 命令通常用作将一个文件的尺寸缩小或者扩展为某个指定的尺寸。 ``` $ truncate -s 0K daygeek9.txt ``` -使用 ls 命令检查创建的文件。 +使用 `ls` 命令检查创建的文件。 ``` $ ls -lh daygeek9.txt @@ -314,7 +306,7 @@ via: https://www.2daygeek.com/linux-command-to-create-a-file/ 作者:[Vinoth Kumar][a] 选题:[lujun9972][b] 译者:[dianbanjiu](https://github.com/dianbanjiu) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From db77ba4c2c2b5b9582f2d775475e933a32c861ef Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Feb 2019 21:41:33 +0800 Subject: [PATCH 202/813] PUB:20190207 10 Methods To Create A File In Linux.md @dianbanjiu https://linux.cn/article-10549-1.html --- .../20190207 10 Methods To Create A File In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190207 10 Methods To Create A File In Linux.md (99%) diff --git a/translated/tech/20190207 10 Methods To Create A File In Linux.md b/published/20190207 10 Methods To Create A File In Linux.md similarity index 99% rename from translated/tech/20190207 10 Methods To Create A File In Linux.md rename to published/20190207 10 Methods To Create A File In Linux.md index 0e0c831de2..ef7d8e8228 100644 --- a/translated/tech/20190207 10 Methods To Create A File In Linux.md +++ b/published/20190207 10 Methods To Create A File In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10549-1.html) [#]: subject: (10 Methods To Create A File In Linux) [#]: via: (https://www.2daygeek.com/linux-command-to-create-a-file/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) From f6aa4d147d21322883bc4b38d34b86d74fa9a3c2 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Mon, 18 Feb 2019 22:02:06 +0800 Subject: [PATCH 203/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index 980df58d89..2e44d62197 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -18,10 +18,10 @@ Continuous integration, continuous delivery, and continuous deployment (CI/CD) h 虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 CI/CD practices can equally apply to infrastructure and third-party applications and internally developed applications. Also, there are many different tools but all use similar models. And possibly most importantly, leading your company into this new practice will put you in a strong position within your company, and you'll be a beacon for others to follow. -在基础设施、第三方应用和内部开发应用上,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有相似的设计模型。也许最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,你将成为他人学习的榜样。 +无论是基础设施、第三方应用还是内部开发应用,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有相似的设计模型。而且可能最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,成为他人学习的榜样。 Some organizations have been using CI/CD practices on infrastructure, with tools like [Ansible][1], [Chef][2], or [Puppet][3], for several years. Other tools, like [Test Kitchen][4], allow tests to be performed on infrastructure that will eventually host applications. In fact, those tests can even deploy the application into a production-like environment and execute application-level tests with production loads in more advanced configurations. However, just getting to the point of being able to test the infrastructure individually is a huge feat. Terraform can also use Test Kitchen for even more [ephemeral][5] and [idempotent][6] infrastructure configurations than some of the original configuration-management tools. Add in Linux containers and Kubernetes, and you can now test full infrastructure and application deployments with prod-like specs and resources that come and go in hours rather than months or years. Everything is wiped out before being deployed and tested again. - +一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在用于生产的基础设施上运行测试。事实上,如果使用更高级的配置方法,甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建可复用的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在几小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建这些测试也非常容易。 However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. From fa656009ad00fb07be5df9841ba8284aaa4f5e7d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Feb 2019 23:31:03 +0800 Subject: [PATCH 204/813] PRF:20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @wxy --- ...ux on VirtualBox- Quickest - Safest Way.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md index 0f32ec9991..2df0ccb6d4 100644 --- a/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md +++ b/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) @@ -10,11 +10,11 @@ 在 VirtualBox 上安装 Kali Linux 的最安全快捷的方式 ====== -> 本教程将向你展示如何以最快的方式在 Windows 和 Linux 上的 VirtualBox 上安装 Kali Linux。 +> 本教程将向你展示如何以最快的方式在运行于 Windows 和 Linux 上的 VirtualBox 上安装 Kali Linux。 [Kali Linux][1] 是最好的[黑客][2] 和安全爱好者的 Linux 发行版之一。 -由于它涉及像黑客这样的敏感话题,它就像一把双刃剑。我们过去在一篇详细的 Kali Linux 点评中对此进行了讨论,所以我不会再次赘述。 +由于它涉及像黑客这样的敏感话题,它就像一把双刃剑。我们过去在一篇详细的 [Kali Linux 点评](https://linux.cn/article-10198-1.html)中对此进行了讨论,所以我不会再次赘述。 虽然你可以通过替换现有的操作系统来安装 Kali Linux,但通过虚拟机使用它将是一个更好、更安全的选择。 @@ -36,11 +36,11 @@ 而且,最好的是,即使你碰巧使用 Linux 发行版作为主要操作系统,相同的步骤也完全适用! -想知道怎么样做吗? 让我们来看看… +想知道怎么样做吗?让我们来看看… ### 在 VirtualBox 上安装 Kali Linux 的逐步指导 -我们将使用专为 VirtualBox 制作的定制 Kali Linux 镜像。当然,你还可以下载 Kali Linux 的 ISO 文件并创建一个新的虚拟机,但是为什么在你有一个简单的替代方案时这样做呢? +我们将使用专为 VirtualBox 制作的定制 Kali Linux 镜像。当然,你还可以下载 Kali Linux 的 ISO 文件并创建一个新的虚拟机,但是为什么在你有一个简单的替代方案时还要这样做呢? #### 1、下载并安装 VirtualBox @@ -48,7 +48,7 @@ - [下载 VirtualBox](https://www.virtualbox.org/wiki/Downloads) -下载了安装程序后,只需双击它即可安装 VirtualBox。 在 Ubuntu / Fedora Linux 上安装 VirtualBox 也是一样的。 +下载了安装程序后,只需双击它即可安装 VirtualBox。在 Ubuntu / Fedora Linux 上安装 VirtualBox 也是一样的。 #### 2、下载就绪的 Kali Linux 虚拟镜像 @@ -64,7 +64,7 @@ VirtualBox 成功安装后,前往 [Offensive Security 的下载页面][5] 下 以下是如何导入 Kali Linux 的 VirtualBox 镜像: -**步骤 1**:启动 VirtualBox。你会注意到有一个 “Import”,点击它。 +**步骤 1**:启动 VirtualBox。你会注意到有一个 “Import” 按钮,点击它。 ![virtualbox import][9] @@ -78,7 +78,7 @@ VirtualBox 成功安装后,前往 [Offensive Security 的下载页面][5] 下 选择好之后,点击 “Next” 进行处理。 -**步骤 3**:现在,你将看到要导入的这个虚拟机的设置。你可以自定义它们,这是你的自由。如果你使用默认设置,也没关系。 +**步骤 3**:现在,你将看到要导入的这个虚拟机的设置。你可以自定义它们,这是你的自由。如果你想使用默认设置,也没关系。 你需要选择具有足够存储空间的路径。我永远不会在 Windows 上推荐使用 C:驱动器。 @@ -86,11 +86,11 @@ VirtualBox 成功安装后,前往 [Offensive Security 的下载页面][5] 下 *以 VDI 方式导入硬盘驱动器* -这里, VDI 方式的硬盘驱动器是指通过分配存储空间集来虚拟安装硬盘驱动器。 +这里,VDI 方式的硬盘驱动器是指通过分配其存储空间设置来实际挂载该硬盘驱动器。 完成设置后,点击 “Import” 并等待一段时间。 -**步骤 4**:你现在将看到这个虚拟机已经列出了。 所以,只需点击“Start”即可启动它。 +**步骤 4**:你现在将看到这个虚拟机已经列出了。所以,只需点击 “Start” 即可启动它。 你最初可能会因 USB 端口 2.0 控制器支持而出现错误,你可以将其禁用以解决此问题,或者只需按照屏幕上的说明安装其他软件包进行修复即可。现在就完成了! @@ -98,21 +98,21 @@ VirtualBox 成功安装后,前往 [Offensive Security 的下载页面][5] 下 *运行于 VirtualBox 中的 Kali Linux* -我希望本指南可以帮助你在 VirtualBox 上轻松安装 Kali Linux。当然,Kali Linux 有很多有用的工具可用于渗透测试 - 祝你好运! +我希望本指南可以帮助你在 VirtualBox 上轻松安装 Kali Linux。当然,Kali Linux 有很多有用的工具可用于渗透测试 —— 祝你好运! **提示**:Kali Linux 和 Ubuntu 都是基于 Debian 的。如果你在使用 Kali Linux 时遇到任何问题或错误,可以按照互联网上针对 Ubuntu 或 Debian 的教程进行操作。 ### 赠品:免费的 Kali Linux 指南手册 -如果你刚刚开始使用 Kali Linux,那么了解如何使用 Kali Linux 将是一个好主意。 +如果你刚刚开始使用 Kali Linux,那么了解如何使用 Kali Linux 是一个好主意。 Kali Linux 背后的公司 Offensive Security 已经创建了一本指南,介绍了 Linux 的基础知识,Kali Linux 的基础知识、配置和设置。它还有一些关于渗透测试和安全工具的章节。 -基本上,它拥有你开始使用 Kali Linux 所需知道的一切。最棒的是这本书可以免费下载。 +基本上,它拥有你开始使用 Kali Linux 时所需知道的一切。最棒的是这本书可以免费下载。 - [免费下载 Kali Linux 揭秘](https://kali.training/downloads/Kali-Linux-Revealed-1st-edition.pdf) -如果你遇到问题或想分享 VirtualBox 上运行 Kali Linux 的经验,请在下面的评论中告诉我们。 +如果你遇到问题或想分享在 VirtualBox 上运行 Kali Linux 的经验,请在下面的评论中告诉我们。 -------------------------------------------------------------------------------- @@ -121,7 +121,7 @@ via: https://itsfoss.com/install-kali-linux-virtualbox 作者:[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 62a1bc1c9cbd682e29ca61d65e7e5cc04b9a558f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Feb 2019 23:31:41 +0800 Subject: [PATCH 205/813] PUB:20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @wxy https://linux.cn/article-10550-1.html --- ...talling Kali Linux on VirtualBox- Quickest - Safest Way.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md (99%) diff --git a/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/published/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md similarity index 99% rename from translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md rename to published/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md index 2df0ccb6d4..830ff13fd9 100644 --- a/translated/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md +++ b/published/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10550-1.html) [#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) [#]: via: (https://itsfoss.com/install-kali-linux-virtualbox) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From e4f15c503979b0987c582e0b257bb3f5d90b896e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 Feb 2019 09:02:03 +0800 Subject: [PATCH 206/813] translated --- ...r It, a flexible to-do list application.md | 60 ------------------- ...r It, a flexible to-do list application.md | 59 ++++++++++++++++++ 2 files changed, 59 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md create mode 100644 translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md diff --git a/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md b/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md deleted file mode 100644 index cd5d3c63ed..0000000000 --- a/sources/tech/20190122 Get started with Go For It, a flexible to-do list application.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Go For It, a flexible to-do list application) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-go-for-it) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with Go For It, a flexible to-do list application -====== -Go For It, the tenth in our series on open source tools that will make you more productive in 2019, builds on the Todo.txt system to help you get more things done. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the tenth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Go For It - -Sometimes what a person needs to be productive isn't a fancy kanban board or a set of notes, but a simple, straightforward to-do list. Something that is as basic as "add item to list, check it off when done." And for that, the [plain-text Todo.txt system][1] is possibly one of the easiest to use, and it's supported on almost every system out there. - -![](https://opensource.com/sites/default/files/uploads/go-for-it_1_1.png) - -[Go For It][2] is a simple, easy-to-use graphical interface for Todo.txt. It can be used with an existing file, if you are already using Todo.txt, and will create both a to-do and a done file if you aren't. It allows drag-and-drop ordering of tasks, allowing users to organize to-do items in the order they want to execute them. It also supports priorities, projects, and contexts, as outlined in the [Todo.txt format guidelines][3]. And, it can filter tasks by context or project simply by clicking on the project or context in the task list. - -![](https://opensource.com/sites/default/files/uploads/go-for-it_2.png) - -At first, Go For It may look the same as just about any other Todo.txt program, but looks can be deceiving. The real feature that sets Go For It apart is that it includes a built-in [Pomodoro Technique][4] timer. Select the task you want to complete, switch to the Timer tab, and click Start. When the task is done, simply click Done, and it will automatically reset the timer and pick the next task on the list. You can pause and restart the timer as well as click Skip to jump to the next task (or break). It provides a warning when 60 seconds are left for the current task. The default time for tasks is set at 25 minutes, and the default time for breaks is set at five minutes. You can adjust this in the Settings screen, as well as the location of the directory containing your Todo.txt and done.txt files. - -![](https://opensource.com/sites/default/files/uploads/go-for-it_3.png) - -Go For It's third tab, Done, allows you to look at the tasks you've completed and clean them out when you want. Being able to look at what you've accomplished can be very motivating and a good way to get a feel for where you are in a longer process. - -![](https://opensource.com/sites/default/files/uploads/go-for-it_4.png) - -It also has all of Todo.txt's other advantages. Go For It's list is accessible by other programs that use the same format, including [Todo.txt's original command-line tool][5] and any [add-ons][6] you've installed. - -Go For It seeks to be a simple tool to help manage your to-do list and get those items done. If you already use Todo.txt, Go For It is a fantastic addition to your toolkit, and if you don't, it's a really good way to start using one of the simplest and most flexible systems available. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-go-for-it - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: http://todotxt.org/ -[2]: http://manuel-kehl.de/projects/go-for-it/ -[3]: https://github.com/todotxt/todo.txt -[4]: https://en.wikipedia.org/wiki/Pomodoro_Technique -[5]: https://github.com/todotxt/todo.txt-cli -[6]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory diff --git a/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md b/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md new file mode 100644 index 0000000000..e11d991541 --- /dev/null +++ b/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Go For It, a flexible to-do list application) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-go-for-it) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 Go For It,一个灵活的待办事项列表程序 +====== +Go For It,是我们开源工具系列中的第十个工具,它将使你在 2019 年更高效,它在 Todo.txt 系统的基础上构建,以帮助你完成更多工作。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 10 个工具来帮助你在 2019 年更有效率。 + +### Go For It + +有时,人们要高效率需要的不是一个花哨的看板或一组笔记,而是一个简单,直接的待办事项清单。像“将项目添加到列表中,在完成后检查”一样基本的东西。为此,[纯文本 Todo.txt 系统][1]可能是最容易使用的系统之一,几乎所有系统都支持它。 + +![](https://opensource.com/sites/default/files/uploads/go-for-it_1_1.png) + +[Go For It][2] 是一个简单易用的 Todo.txt 图形界面。如果你已经在使用 Todo.txt,它可以与现有文件一起使用,如果还没有,那么可以同时创建待办事项和完成事项。它允许拖放任务排序,允许用户按照他们想要执行的顺序组织待办事项。它还支持 [Todo.txt 格式指南][3]中所述的优先级,项目和上下文。而且,只需单击任务列表中的项目或者上下文就可通过它们过滤任务。 + +![](https://opensource.com/sites/default/files/uploads/go-for-it_2.png) + +一开始,Go For It 可能看起来与任何其他 Todo.txt 程序相同,但外观可能是骗人的。将 Go For It 与其他真正区分开的功能是它包含一个内置的[番茄工作法][4]计时器。选择要完成的任务,切换到“计时器”选项卡,然后单击“启动”。任务完成后,只需单击“完成”,它将自动重置计时器并选择列表中的下一个任务。你可以暂停并重新启动计时器,也可以单击“跳过”跳转到下一个任务(或中断)。当当前任务剩余 60 秒时,它会发出警告。任务的默认时间设置为25分钟,中断的默认时间设置为五分钟。你可以在“设置”页面中调整,同时还能调整 Todo.txt 和 done.txt 文件的目录的位置。 + +![](https://opensource.com/sites/default/files/uploads/go-for-it_3.png) + +Go For It 的第三个选项卡“已完成”,允许你查看已完成的任务并在需要时将其清除。能够看到你已经完成的可能是非常激励的,也是一种了解你在更长的过程中进度的好方法。 + +![](https://opensource.com/sites/default/files/uploads/go-for-it_4.png) + +它还有 Todo.txt 的所有其他优点。Go For It 的列表可以被其他使用相同格式的程序访问,包括 [Todo.txt 的原始命令行工具][5]和任何已安装的[附加组件][6]。 + +Go For It 旨在成为一个简单的工具来帮助管理你的待办事项列表并完成这些项目。如果你已经使用过 Todo.txt,那么 Go For It 是你的工具箱的绝佳补充,如果你还没有,这是一个尝试最简单、最灵活系统之一的好机会。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-go-for-it + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://todotxt.org/ +[2]: http://manuel-kehl.de/projects/go-for-it/ +[3]: https://github.com/todotxt/todo.txt +[4]: https://en.wikipedia.org/wiki/Pomodoro_Technique +[5]: https://github.com/todotxt/todo.txt-cli +[6]: https://github.com/todotxt/todo.txt-cli/wiki/Todo.sh-Add-on-Directory From e8e4b8f98f1d1ecd17366a25e485929c73663975 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 Feb 2019 09:09:05 +0800 Subject: [PATCH 207/813] translating --- ...Video Editor Aiming to Take On Biggies Like Final Cut Pro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md index 989cd0d60f..b77873dc58 100644 --- a/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md +++ b/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 602e3565a86fc048c1f38ead71c93995b8f6c9d4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Feb 2019 10:59:59 +0800 Subject: [PATCH 208/813] APL:20190214 Drinking coffee with AWK.md --- sources/tech/20190214 Drinking coffee with AWK.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190214 Drinking coffee with AWK.md b/sources/tech/20190214 Drinking coffee with AWK.md index 6cde1491d4..2889d04388 100644 --- a/sources/tech/20190214 Drinking coffee with AWK.md +++ b/sources/tech/20190214 Drinking coffee with AWK.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9c7ab767f98350e650a13b80ad406b2a52a5e937 Mon Sep 17 00:00:00 2001 From: sndnvaps Date: Tue, 19 Feb 2019 11:36:56 +0800 Subject: [PATCH 209/813] Translating --- .../20190208 3 Ways to Install Deb Files on Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md b/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md index 55c1067d12..3b84d85c62 100644 --- a/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md +++ b/sources/tech/20190208 3 Ways to Install Deb Files on Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (sndnvaps) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a1faf5347cd4419b3024a6bb6c136bde93b9f5c2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Feb 2019 12:37:25 +0800 Subject: [PATCH 210/813] TSL:20190214 Drinking coffee with AWK.md --- .../tech/20190214 Drinking coffee with AWK.md | 124 ------------------ .../tech/20190214 Drinking coffee with AWK.md | 119 +++++++++++++++++ 2 files changed, 119 insertions(+), 124 deletions(-) delete mode 100644 sources/tech/20190214 Drinking coffee with AWK.md create mode 100644 translated/tech/20190214 Drinking coffee with AWK.md diff --git a/sources/tech/20190214 Drinking coffee with AWK.md b/sources/tech/20190214 Drinking coffee with AWK.md deleted file mode 100644 index 2889d04388..0000000000 --- a/sources/tech/20190214 Drinking coffee with AWK.md +++ /dev/null @@ -1,124 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Drinking coffee with AWK) -[#]: via: (https://opensource.com/article/19/2/drinking-coffee-awk) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Drinking coffee with AWK -====== -Keep track of what your office mates owe for the coffee they drink with a simple AWK program. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) - -The following is based on a true story, although some names and details have been changed. - -> A long time ago, in a place far away, there was an office. The office did not, for various reasons, buy instant coffee. Some workers in that office got together and decided to institute the "Coffee Corner." -> -> A member of the Coffee Corner would buy some instant coffee, and the other members would pay them back. It came to pass that some people drank more coffee than others, so the level of a "half-member" was added: a half-member was allowed a limited number of coffees per week and would pay half of what a member paid. - -Managing this was a huge pain. I had just read The Unix Programming Environment and wanted to practice my [AWK][1] programming. So I volunteered to create a system. - -Step 1: I kept a database of members and their debt to the Coffee Corner. I did it in an AWK-friendly format, where fields are separated by colons: - -``` -member:john:1:22 -member:jane:0.5:33 -member:pratyush:0.5:17 -member:jing:1:27 -``` - -The first field above identifies what kind of row this is (member). The second field is the member's name (i.e., their email username without the @). The next field is their membership level (full=1 or half=0.5). The last field is their debt to the Coffee Corner. A positive number means they owe money, a negative number means the Coffee Corner owes them. - -Step 2: I kept a log of inputs to and outputs from the Coffee Corner: - -``` -payment:jane:33 -payment:pratyush:17 -bought:john:60 -payback:john:50 -``` - -Jane paid $33, Pratyush paid $17, John bought $60 worth of coffee, and the Coffee Corner paid John $50. - -Step 3: I was ready to write some code. The code would process the members and payments and spit out an updated members file with the new debts. - -``` -#!/usr/bin/env --split-string=awk -F: -f -``` - -**#!** ) line required some work! I used the **env** command to allow passing multiple arguments from the shebang: specifically, the **-F** command-line argument to AWK tells it what the field separator is. - -The shebang () line required some work! I used thecommand to allow passing multiple arguments from the shebang: specifically, thecommand-line argument to AWK tells it what the field separator is. - -An AWK program is a sequence of rules. (It can also contain function definitions, but I don't need any for the Coffee Corner.) - -The first rule reads the members file. When I run the command, I always give it the members file first, and the payments file second. It uses AWK associative arrays to record membership levels in the **members** array and current debt in the **debt** array. - -``` -$1 == "member" { -   members[$2]=$3 -   debt[$2]=$4 -   total_members += $3 -} -``` - -The second rule reduces the debt when a **payment** is recorded. - -``` -$1 == "payment" { -   debt[$2] -= $3 -} -``` - -**Payback** is the opposite: it increases the debt. This elegantly supports the case of accidentally giving someone too much money. - -``` -$1 == "payback" { -   debt[$2] += $3 -} -``` - -The most complicated part happens when someone buys ( **"bought"** ) instant coffee for the Coffee Club's use. It is treated as a payment and the person's debt is reduced by the appropriate amount. Next, it calculates the per-member fee. It iterates over all members and increases their debt, according to their level of membership. - -``` -$1 == "bought" { -   debt[$2] -= $3 -   per_member = $3/total_members -   for (x in members) { -       debt[x] += per_member * members[x] -   } -} -``` - -The **END** pattern is special: it happens exactly once, when AWK has no more lines to process. At this point, it spits out the new members file with updated debt levels. - -``` -END { - -   for (x in members) { - -       printf "%s:%s:%s\n", x, members[x], debt[x] - -   } - -} -``` - -Along with a script that iterates over the members and sends a reminder email to people to pay their dues (for positive debts), this system managed the Coffee Corner for quite a while. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/drinking-coffee-awk - -作者:[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://en.wikipedia.org/wiki/AWK diff --git a/translated/tech/20190214 Drinking coffee with AWK.md b/translated/tech/20190214 Drinking coffee with AWK.md new file mode 100644 index 0000000000..21215fcf00 --- /dev/null +++ b/translated/tech/20190214 Drinking coffee with AWK.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drinking coffee with AWK) +[#]: via: (https://opensource.com/article/19/2/drinking-coffee-awk) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +用 AWK 喝咖啡 +====== +> 用一个简单的 AWK 程序跟踪你的同事所喝咖啡的欠款。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) + +以下基于一个真实的故事,虽然一些名字和细节有所改变。 + +> 很久以前,在一个遥远的地方,有一间~~庙~~(划掉)办公室。由于各种原因,这个办公室没有购买速溶咖啡。所以那个办公室的一些人聚在一起决定建立“咖啡角”。 +> +> 咖啡角的一名成员会购买一些速溶咖啡,而其他成员会付给他钱。有人喝咖啡比其他人多,所以增加了“半成员”的级别:半成员每周允许喝的咖啡限量,并可以支付其它成员支付的一半。 + +管理这事非常操心。而我刚读过《Unix 编程环境》这本书,想练习一下我的 [AWK][1] 编程技能,所以我自告奋勇创建了一个系统。 + +第 1 步:我用一个数据库来记录成员及其应支付给咖啡角的欠款。我是以 AWK 便于处理的格式记录的,其中字段用冒号分隔: + +``` +member:john:1:22 +member:jane:0.5:33 +member:pratyush:0.5:17 +member:jing:1:27 +``` + +上面的第一个字段标识了这是哪一种行(`member`)。第二个字段是成员的名字(即他们的电子邮件用户名,但没有 @ )。下一个字段是其成员级别(成员 = 1,或半会员 = 0.5)。最后一个字段是他们欠咖啡角的钱。正数表示他们欠咖啡角钱,负数表示咖啡角欠他们。 + +第 2 步:我记录了咖啡角的收入和支出: + +``` +payment:jane:33 +payment:pratyush:17 +bought:john:60 +payback:john:50 +``` + +Jane 付款 $33,Pratyush 付款 $17,John 买了价值 $60 的咖啡,而咖啡角还款给 John $50。 + +第 3 步:我准备写一些代码,用来处理成员和付款,并生成记录了新欠账的更新的成员文件。 + +``` +#!/usr/bin/env --split-string=awk -F: -f +``` + +释伴行(`#!`)需要做一些调整,我使用 `env` 命令来允许从释伴行传递多个参数:具体来说,AWK 的 `-F` 命令行参数会告诉它字段分隔符是什么。 + +AWK 程序就是一个规则序列(也可以包含函数定义,但是对于这个咖啡角应用来说不需要) + +第一条规则读取该成员文件。当我运行该命令时,我总是首先给它的是成员文件,然后是付款文件。它使用 AWK 关联数组来在 `members` 数组中记录成员级别,以及在 `debt` 数组中记录当前欠账。 + +``` +$1 == "member" { +   members[$2]=$3 +   debt[$2]=$4 +   total_members += $3 +} +``` + +第二条规则在记录付款时减少欠账。 + +``` +$1 == "payment" { +   debt[$2] -= $3 +} +``` + +还款则相反:它增加欠账。这可以优雅地支持意外地给了某人太多钱的情况。 + +``` +$1 == "payback" { +   debt[$2] += $3 +} +``` + +最复杂的部分出现在有人购买速溶咖啡供咖啡角使用时。它被视为付款,并且该人的债务减少了适当的金额。接下来,它计算每个会员的费用。它根据成员的级别对所有成员进行迭代并增加欠款 + +``` +$1 == "bought" { +   debt[$2] -= $3 +   per_member = $3/total_members +   for (x in members) { +       debt[x] += per_member * members[x] +   } +} +``` + +`END` 模式很特殊:当 AWK 没有更多的数据要处理时,它会一次性执行。此时,它会使用更新的欠款数生成新的成员文件。 + +``` +END { +   for (x in members) { +       printf "%s:%s:%s\n", x, members[x], debt[x] +   } +} +``` + +除了一个遍历成员文件,并向人们发送提醒电子邮件以支付他们的会费(积极清账)的脚本外,这个系统管理咖啡角相当一段时间。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/drinking-coffee-awk + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/AWK From 8fbc52a232d9b75c72e75640e1ebe4c440032896 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Feb 2019 17:32:39 +0800 Subject: [PATCH 211/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190212=20Top=20?= =?UTF-8?q?10=20Best=20Linux=20Media=20Server=20Software=20sources/tech/20?= =?UTF-8?q?190212=20Top=2010=20Best=20Linux=20Media=20Server=20Software.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Top 10 Best Linux Media Server Software.md | 229 ++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sources/tech/20190212 Top 10 Best Linux Media Server Software.md diff --git a/sources/tech/20190212 Top 10 Best Linux Media Server Software.md b/sources/tech/20190212 Top 10 Best Linux Media Server Software.md new file mode 100644 index 0000000000..8fcea6343a --- /dev/null +++ b/sources/tech/20190212 Top 10 Best Linux Media Server Software.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 10 Best Linux Media Server Software) +[#]: via: (https://itsfoss.com/best-linux-media-server) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Top 10 Best Linux Media Server Software +====== + +Did someone tell you that Linux is just for programmers? That is so wrong! You have got a lot of great tools for [digital artists][1], [writers][2] and musicians. + +We have covered such tools in the past. Today it’s going to be slightly different. Instead of creating new digital content, let’s talk about consuming it. + +You have probably heard of media servers? Basically these software (and sometimes gadgets) allow you to view your local or cloud media (music, videos etc) in an intuitive interface. You can even use it to stream the content to other devices on your network. Sort of your personal Netflix. + +In this article, we will talk about the best media software available for Linux that you can use as a media player or as a media server software – as per your requirements. + +Some of these applications can also be used with Google’s Chromecast and Amazon’s Firestick. + +### Best Media Server Software for Linux + +![Best Media Server Software for Linux][3] + +The mentioned Linux media server software are in no particular order of ranking. + +I have tried to provide installation instructions for Ubuntu and Debian based distributions. It’s not possible to list installation steps for all Linux distributions for all the media servers mentioned here. Please take no offence for that. + +A couple of software in this list are not open source. If that’s the case, I have highlighted it appropriately. + +### 1\. Kodi + +![Kodi Media Server][4] + +Kod is one of the most popular media server software and player. Recently, Kodi 18.0 dropped in with a bunch of improvements that includes the support for Digital Rights Management (DRM) decryption, game emulators, ROMs, voice control, and more. + +It is a completely free and open source software. An active community for discussions and support exists as well. The user interface for Kodi is beautiful. I haven’t had the chance to use it in its early days – but I was amazed to see such a good UI for a Linux application. + +It has got great playback support – so you can add any supported 3rd party media service for the content or manually add the ripped video files to watch. + +#### How to install Kodi + +Type in the following commands in the terminal to install the latest version of Kodi via its [official PPA][5]. + +``` +sudo apt-get install software-properties-common +sudo add-apt-repository ppa:team-xbmc/ppa +sudo apt-get update +sudo apt-get install kodi +``` + +To know more about installing a development build or upgrading Kodi, refer to the [official installation guide][6]. + +### 2\. Plex + +![Plex Media Server][7] + +Plex is yet another impressive media player or could be used as a media server software. It is a great alternative to Kodi for the users who mostly utilize it to create an offline network of their media collection to sync and watch across multiple devices. + +Unlike Kodi, **Plex is not entirely open source**. It does offer a free account in order to use it. In addition, it offers premium pricing plans to unlock more features and have a greater control over your media while also being able to get a detailed insight on who/what/how Plex is being used. + +If you are an audiophile, you would love the integration of Plex with [TIDAL][8] music streaming service. You can also set up Live TV by adding it to your tuner. + +#### How to install Plex + +You can simply download the .deb file available on their official webpage and install it directly (or using [GDebi][9]) + +### 3\. Jellyfin + +![Emby media server][10] + +Yet another open source media server software with a bunch of features. [Jellyfin][11] is actually a fork of Emby media server. It may be one of the best out there available for ‘free’ but the multi-platform support still isn’t there yet. + +You can run it on a browser or utilize Chromecast – however – you will have to wait if you want the Android app or if you want it to support several devices. + +#### How to install Jellyfin + +Jellyfin provides a [detailed documentation][12] on how to install it from the binary packages/image available for Linux, Docker, and more. + +You will also find it easy to install it from the repository via the command line for Debian-based distribution. Check out their [installation guide][13] for more information. + +### 4\. LibreELEC + +![libreELEC][14] + +LibreELEC is an interesting media server software which is based on Kodi v18.0. They have recently released a new version (9.0.0) with a complete overhaul of the core OS support, hardware compatibility and user experience. + +Of course, being based on Kodi, it also has the DRM support. In addition, you can utilize its generic Linux builds or the special ones tailored for Raspberry Pi builds, WeTek devices, and more. + +#### How to install LibreELEC + +You can download the installer from their [official site][15]. For detailed instructions on how to use it, please refer to the [installation guide][16]. + +### 5\. OpenFLIXR Media Server + +![OpenFLIXR Media Server][17] + +Want something similar that compliments Plex media server but also compatible with VirtualBox or VMWare? You got it! + +OpenFLIXR is an automated media server software which integrates with Plex to provide all the features along with the ability to auto download TV shows and movies from Torrents. It even fetches the subtitles automatically giving you a seamless experience when coupled with Plex media software. + +You can also automate your home theater with this installed. In case you do not want to run it on a physical instance, it supports VMware, VirtualBox and Hyper-V as well. The best part is – it is an open source solution and based on Ubuntu Server. + +#### How to install OpenFLIXR + +The best way to do it is by installing VirtualBox – it will be easier. After you do that, just download it from the [official website][18] and import it. + +### 6\. MediaPortal + +![MediaPortal][19] + +MediaPortal is just another open source simple media server software with a decent user interface. It all depends on your personal preference – event though I would recommend Kodi over this. + +You can play DVDs, stream videos on your local network, and listen to music as well. It does not offer a fancy set of features but the ones you will mostly need. + +It gives you the option to choose from two different versions (one that is stable and the second which tries to incorporate new features – could be unstable). + +#### How to install MediaPotal + +Depending on what you want to setup (A TV-server only or a complete server setup), follow the [official setup guide][20] to install it properly. + +### 7\. Gerbera + +![Gerbera Media Center][21] + +A simple implementation for a media server to be able to stream using your local network. It does support transcoding which will convert the media in the format your device supports. + +If you have been following the options for media server form a very long time, then you might identify this as the rebranded (and improved) version of MediaTomb. Even though it is not a popular choice among the Linux users – it is still something usable when all fails or for someone who prefers a straightforward and a basic media server. + +#### How to install Gerbera + +Type in the following commands in the terminal to install it on any Ubuntu-based distro: + +``` +sudo apt install gerbera +``` + +For other Linux distributions, refer to the [documentation][22]. + +### 8\. OSMC (Open Source Media Center) + +![OSMC Open Source Media Center][23] + +It is an elegant-looking media server software originally based on Kodi media center. I was quite impressed with the user interface. It is simple and robust, being a free and open source solution. In a nutshell, all the essential features you would expect in a media server software. + +You can also opt in to purchase OSMC’s flagship device. It will play just about anything up to 4K standards with HD audio. In addition, it supports Raspberry Pi builds and 1st-gen Apple TV. + +#### How to install OSMC + +If your device is compatible, you can just select your operating system and download the device installer from the official [download page][24] and create a bootable image to install. + +### 9\. Universal Media Server + +![][25] + +Yet another simple addition to this list. Universal Media Server does not offer any fancy features but just helps you transcode / stream video and audio without needing much configuration. + +It supports Xbox 360, PS 3, and just about any other [DLNA][26]-capable devices. + +#### How to install Universal Media Center + +You can find all the packages listed on [FossHub][27] but you should follow the [official forum][28] to know more about how to install the package that you downloaded from the website. + +### 10\. Red5 Media Server + +![Red5 Media Server][29]Image Credit: [Red5 Server][30] + +A free and open source media server tailored for enterprise usage. You can use it for live streaming solutions – no matter if it is for entertainment or just video conferencing. + +They also offer paid licensing options for mobiles and high scalability. + +#### How to install Red5 + +Even though it is not the quickest installation method, follow the [installation guide on GitHub][31] to get started with the server without needing to tinker around. + +### Wrapping Up + +Every media server software listed here has its own advantages – you should pick one up and try the one which suits your requirement. + +Did we miss any of your favorite media server software? Let us know about it in the comments below! + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-linux-media-server + +作者:[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-graphic-design-software/ +[2]: https://itsfoss.com/open-source-tools-writers/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/best-media-server-linux.png?resize=800%2C450&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kodi-18-media-server.jpg?fit=800%2C450&ssl=1 +[5]: https://itsfoss.com/ppa-guide/ +[6]: https://kodi.wiki/view/HOW-TO:Install_Kodi_for_Linux +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/plex.jpg?fit=800%2C368&ssl=1 +[8]: https://tidal.com/ +[9]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/emby-server.jpg?fit=800%2C373&ssl=1 +[11]: https://jellyfin.github.io/ +[12]: https://jellyfin.readthedocs.io/en/latest/ +[13]: https://jellyfin.readthedocs.io/en/latest/administrator-docs/installing/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/libreelec.jpg?resize=800%2C600&ssl=1 +[15]: https://libreelec.tv/downloads_new/ +[16]: https://libreelec.wiki/libreelec_usb-sd_creator +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/openflixr-media-server.jpg?fit=800%2C449&ssl=1 +[18]: http://www.openflixr.com/#Download +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/mediaportal.jpg?ssl=1 +[20]: https://www.team-mediaportal.com/wiki/display/MediaPortal1/Quick+Setup +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/gerbera-server-softwarei.jpg?fit=800%2C583&ssl=1 +[22]: http://docs.gerbera.io/en/latest/install.html +[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/osmc-server.jpg?fit=800%2C450&ssl=1 +[24]: https://osmc.tv/download/ +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/universal-media-server.jpg?ssl=1 +[26]: https://en.wikipedia.org/wiki/Digital_Living_Network_Alliance +[27]: https://www.fosshub.com/Universal-Media-Server.html?dwl=UMS-7.8.0.tgz +[28]: https://www.universalmediaserver.com/forum/viewtopic.php?t=10275 +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/red5.jpg?resize=800%2C364&ssl=1 +[30]: https://www.red5server.com/ +[31]: https://github.com/Red5/red5-server/wiki/Installation-on-Linux +[32]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/best-media-server-linux.png?fit=800%2C450&ssl=1 From 3f6dbebbf676241863fc88e471a48992ed4d0666 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Tue, 19 Feb 2019 17:34:32 +0800 Subject: [PATCH 212/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index 2e44d62197..fb5a4997d3 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -21,20 +21,26 @@ CI/CD practices can equally apply to infrastructure and third-party applications 无论是基础设施、第三方应用还是内部开发应用,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有相似的设计模型。而且可能最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,成为他人学习的榜样。 Some organizations have been using CI/CD practices on infrastructure, with tools like [Ansible][1], [Chef][2], or [Puppet][3], for several years. Other tools, like [Test Kitchen][4], allow tests to be performed on infrastructure that will eventually host applications. In fact, those tests can even deploy the application into a production-like environment and execute application-level tests with production loads in more advanced configurations. However, just getting to the point of being able to test the infrastructure individually is a huge feat. Terraform can also use Test Kitchen for even more [ephemeral][5] and [idempotent][6] infrastructure configurations than some of the original configuration-management tools. Add in Linux containers and Kubernetes, and you can now test full infrastructure and application deployments with prod-like specs and resources that come and go in hours rather than months or years. Everything is wiped out before being deployed and tested again. -一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在用于生产的基础设施上运行测试。事实上,如果使用更高级的配置方法,甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建可复用的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在几小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建这些测试也非常容易。 +一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在用于生产的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建可复用的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. +当然,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数开发流水线都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 For example, I regularly write a newsletter within my company, and I maintain it in version control using [MJML][7]. I needed to be able to host a web version, and some folks liked being able to get a PDF, so I built a [pipeline][8]. Now when I create a new newsletter, I submit it for a merge request in GitLab. This automatically creates an index.html with links to HTML and PDF versions of the newsletter. The HTML and PDF files are also created in the pipeline. None of this is published until someone comes and reviews these artifacts. Then, GitLab Pages publishes the website and I can pull down the HTML to send as a newsletter. In the future, I'll automatically send the newsletter when the merge request is merged or after a special approval step. This seems simple, but it has saved me a lot of time. This is really at the core of what these tools can do for you. They will save you time. +举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[流水线][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在流水线里同时生成。这些文件不会被直接发布出去,除非有人来检查确认。GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求通过或者在特殊的审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 The key is creating tools to work in the abstract so that they can apply to multiple problems with little change. I should also note that what I created required almost no code except [some light HTML templating][9], some [node to loop through the HTML files][10], and some more [node to populate the index page with all the HTML pages and PDFs][11]. +关键是要在抽象层创建出工具,这样它们稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成 index 页面的 nodejs 代码][11]。 Some of this might look a little complex, but most of it was taken from the tutorials of the different tools I'm using. And many developers are happy to work with you on these types of things, as they might also find them useful when they're done. The links I've provided are to a newsletter we plan to start for [DevOps KC][12], and all the code for creating the site comes from the work I did on our internal newsletter. +这其中一些东西可能看起来有点复杂,但其中大部分都来源于我使用的不同工具的教学文档。而且很多开发人员也乐意跟你合作干这些事,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 Many of the tools listed below can offer this type of interaction, but some offer a slightly different model. The emerging model in this space is that of a declarative description of a pipeline in something like YAML with each stage being ephemeral and idempotent. Many of these systems also ensure correct sequencing by creating a [directed acyclic graph][13] (DAG) over the different stages of the pipeline. +下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明性的语言如 YAML 来描述一个流水线,其中的每个阶段都是短暂而幂等的。许多系统还会创建有向无环图(DAG),来确保流水线上不同阶段的排序正确。 These stages are often run in Linux containers and can do anything you can do in a container. Some tools, like [Spinnaker][14], focus only on the deployment component and offer some operational features that others don't normally include. [Jenkins][15] has generally kept pipelines in an XML format and most interactions occur within the GUI, but more recent implementations have used a [domain specific language][16] (DSL) using [Groovy][17]. Further, Jenkins jobs normally execute on nodes with a special Java agent installed and consist of a mix of plugins and pre-installed components. + Jenkins introduced pipelines in its tool, but they were a bit challenging to use and contained several caveats. Recently, the creator of Jenkins decided to move the community toward a couple different initiatives that will hopefully breathe new life into the project—which is the one that really brought CI/CD to the masses. I think its most interesting initiative is creating a Cloud Native Jenkins that can turn a Kubernetes cluster into a Jenkins CI/CD platform. As you learn more about these tools and start bringing these practices into your company or your operations division, you'll quickly gain followers. You will increase your own productivity as well as that of others. We all have years of backlog to get to—how much would your co-workers love if you could give them enough time to start tackling that backlog? Not only that, but your customers will start to see increased application reliability, and your management will see you as a force multiplier. That certainly can't hurt during your next salary negotiation or when interviewing with all your new skills. @@ -62,12 +68,16 @@ However, if you're developing open source code, you can use the SaaS version of ### Jenkins Jenkins is the original, the venerable, de facto standard in CI/CD. If you haven't already, you need to read "[Jenkins: Shifting Gears][27]" from Kohsuke, the creator of Jenkins and CTO of CloudBees. It sums up all of my feelings about Jenkins and the community from the last decade. What he describes is something that has been needed for several years, and I'm happy CloudBees is taking the lead on this transformation. Jenkins will be a bit overwhelming to most non-developers and has long been a burden on its administrators. However, these are items they're aiming to fix. +Jenkins在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我强烈建议你读一读这篇文章:"[Jenkins: Shifting Gears][27]",作者 Kohsuke 是 Jenkins 的创始人兼 CloudBees 公司 CTO。这篇文章总结了我在过去十年里对 Jenkins 及其社区的感受。他在文中阐述了一些这几年呼声很高的需求,我很乐意看到 CloudBees 引领这场变革。长期以来,Jenkins 对于非开发人员来说有点难以接受,并且一直是其管理员的重担。还好,这些问题正是他们想要着手解决的。 [Jenkins Configuration as Code][28] (JCasC) should help fix the complex configuration issues that have plagued admins for years. This will allow for a zero-touch configuration of Jenkins masters through a YAML file, similar to other CI/CD systems. [Jenkins Evergreen][29] aims to make this process even easier by providing predefined Jenkins configurations based on different use cases. These distributions should be easier to maintain and upgrade than the normal Jenkins distribution. +[Jenkins 配置既代码][28](JCasC)应该可以帮助管理员解决困扰了他们多年的配置复杂性问题。与其他 CI/CD 系统类似,只需要修改一个简单的 YAML 文件就可以完成 Jenkins 主节点的配置工作。[Jenkins Evergreen][29] 的出现让配置工作变得更加轻松,它提供了很多预设的使用场景,你只管套用就可以了。这些发行版会比官方的标准版本 Jenkins 更容易维护和升级。 Jenkins 2 introduced native pipeline functionality with two types of pipelines, which [I discuss][30] in a LISA17 presentation. Neither is as easy to navigate as YAML when you're doing something simple, but they're quite nice for doing more complex tasks. +Jenkins 2 引入了两种原生的流水线(pipeline)功能,我在 LISA(一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 [Jenkins X][31] is the full transformation of Jenkins and will likely be the implementation of Cloud Native Jenkins (or at least the thing most users see when using Cloud Native Jenkins). It will take JCasC and Evergreen and use them at their best natively on Kubernetes. These are exciting times for Jenkins, and I look forward to its innovation and continued leadership in this space. +[Jenkins X][31] 是 Jenkins 的一个全新变种,用来实现云端原生 Jenkins(至少在用户看来是这样)。它会使用 JCasC 及 Evergreen,并且和 Kubernetes 整合的更加紧密。对于 Jenkins 来说这是个令人激动的时刻,我很乐意看到它在这一领域的创新,并且继续发挥领袖作用。 ### Concourse CI From bd0a66dd80c80c35d86dd2315076fbe41369718c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Feb 2019 17:37:17 +0800 Subject: [PATCH 213/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20How=20?= =?UTF-8?q?To=20Restore=20Sudo=20Privileges=20To=20A=20User=20sources/tech?= =?UTF-8?q?/20190218=20How=20To=20Restore=20Sudo=20Privileges=20To=20A=20U?= =?UTF-8?q?ser.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ow To Restore Sudo Privileges To A User.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 sources/tech/20190218 How To Restore Sudo Privileges To A User.md diff --git a/sources/tech/20190218 How To Restore Sudo Privileges To A User.md b/sources/tech/20190218 How To Restore Sudo Privileges To A User.md new file mode 100644 index 0000000000..8e6f6db66f --- /dev/null +++ b/sources/tech/20190218 How To Restore Sudo Privileges To A User.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Restore Sudo Privileges To A User) +[#]: via: (https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Restore Sudo Privileges To A User +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/restore-sudo-privileges-720x340.png) + +The other day I was testing how to [**add a regular user to sudo group and remove the given privileges**][1] to make him as a normal user again on Ubuntu. While testing, I removed my administrative user from the **‘sudo’ group**. As you already know, a user should be in sudo group to do any administrative tasks. But, I had only one super user and I already took out his sudo privileges. Whenever I run a command with sudo prefix, I encountered an error – “ **sk is not in the sudoers file. This incident will be reported** “. I can’t do any administrative tasks. I couldn’t switch to root user using ‘sudo su’ command. As you know already, root user is disabled by default in Ubuntu, so I can’t log in as root user either. Have you ever been in a situation like this? No worries! This brief tutorial explains how to restore sudo privileges to a user on Linux. I tested this on Ubuntu 18.04 system, but it might work on other Linux distributions as well. + +### Restore Sudo Privileges + +Boot your Linux system into recovery mode. + +To do so, restart your system and press and hold the **SHIFT** key while booting. You will see the grub boot menu. Choose **“Advanced options for Ubuntu”** from the boot menu list. + +![][3] + +In the next screen, choose **“recovery mode”** option and hit ENTER: + +![][4] + +Next, choose **“Drop to root shell prompt”** option and hit ENTER key: + +![][5] + +You’re now in recovery mode as root user. + +![][6] + +Type the following command to mount root (/) file system in read/write mode. + +``` +mount -o remount,rw / +``` + +Now, add the user that you removed from the sudo group. + +In my case, I am adding the user called ‘sk’ to the sudo group using the following command: + +``` +adduser sk sudo +``` + +![][7] + +Then, type **exit** to return back to the recovery menu. Select **Resume** to start your Ubuntu system. + +![][8] + +Press ENTER to continue to log-in normal mode: + +![][9] + +Now check if the sudo privileges have been restored. + +To do so, type the following command from the Terminal. + +``` +$ sudo -l -U sk +``` + +Sample output: + +``` +[sudo] password for sk: +Matching Defaults entries for sk on ubuntuserver: +env_reset, mail_badpass, +secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin + +User sk may run the following commands on ubuntuserver: +(ALL : ALL) ALL +``` + +As you see in the above message, the user sk can run all commands with sudo prefix. Congratulations! You have successfully restored the sudo privileges to the user. + +#### There are also other possibilities for causing broken sudo + +Please note that I actually did it on purpose. I removed myself from the sudo group and fixed the broken sudo privileges as described above. Don’t do this if you have only one sudo user. And, this method will work only on systems that you have physical access. If it is remote server or vps, it is very difficult to fix it. You might require your hosting provider’s help. + +Also, there are two other possibilities for causing broken sudo. + + * The /etc/sudoers file might have been altered. + * You or someone might have changed the permission of /etc/sudoers file. + + + +If you have done any one or all of the above mentioned things and ended up with broken sudo, try the following solutions. + +**Solution 1:** + +If you have altered the contents of /etc/sudoers file, go to the recovery mode as described earlier. + +Backup the existing /etc/sudoers file before making any changes. + +``` +cp /etc/sudoers /etc/sudoers.bak +``` + +Then, open /etc/sudoers file: + +``` +visudo +``` + +Make the changes in the file to look like this: + +``` +# +# This file MUST be edited with the 'visudo' command as root. +# +# Please consider adding local content in /etc/sudoers.d/ instead of +# directly modifying this file. +# +# See the man page for details on how to write a sudoers file. +# +Defaults env_reset +Defaults mail_badpass +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" + +# Host alias specification + +# User alias specification + +# Cmnd alias specification + +# User privilege specification +root ALL=(ALL:ALL) ALL + +# Members of the admin group may gain root privileges +%admin ALL=(ALL) ALL + +# Allow members of group sudo to execute any command +%sudo ALL=(ALL:ALL) ALL + +# See sudoers(5) for more information on "#include" directives: + +#includedir /etc/sudoers.d +``` + +Once you modified the contents to reflect like this, press **CTRL+X** and **y** save and close the file. + +Finally, type ‘exit’ and select **Resume** to start your Ubuntu system to exit from the recovery mode and continue booting as normal user. + +Now, try to use run any command with sudo prefix to verify if the sudo privileges are restored. + +**Solution 2:** + +If you changed the permission of the /etc/sudoers file, this method will fix the broken sudo issue. + +From the recovery mode, run the following command to set the correct permission to /etc/sudoers file: + +``` +chmod 0440 /etc/sudoers +``` + +Once you set the proper permission to the file, type ‘exit’ and select **Resume** to start your Ubuntu system in normal mode. Finally, verify if you can able to run any sudo command. + +**Suggested read:** + +And, that’s all for now. Hope this was useful . More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/ + +作者:[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]: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-1.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-2.png +[5]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-3.png +[6]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-4.png +[7]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-5-1.png +[8]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-6.png +[9]: http://www.ostechnix.com/wp-content/uploads/2019/02/fix-broken-sudo-7.png From d0f459493ba6bf6c61545fc5443c0468b4926438 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Feb 2019 17:40:11 +0800 Subject: [PATCH 214/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20Emoji-?= =?UTF-8?q?Log:=20A=20new=20way=20to=20write=20Git=20commit=20messages=20s?= =?UTF-8?q?ources/tech/20190218=20Emoji-Log-=20A=20new=20way=20to=20write?= =?UTF-8?q?=20Git=20commit=20messages.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... A new way to write Git commit messages.md | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md diff --git a/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md b/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md new file mode 100644 index 0000000000..e821337a60 --- /dev/null +++ b/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emoji-Log: A new way to write Git commit messages) +[#]: via: (https://opensource.com/article/19/2/emoji-log-git-commit-messages) +[#]: author: (Ahmad Awais https://opensource.com/users/mrahmadawais) + +Emoji-Log: A new way to write Git commit messages +====== +Add context to your commits with Emoji-Log. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji_tech_keyboard.jpg?itok=ncBNKZFl) + +I'm a full-time open source developer—or, as I like to call it, an 🎩 open sourcerer. I've been working with open source software for over a decade and [built hundreds][1] of open source software applications. + +I also am a big fan of the Don't Repeat Yourself (DRY) philosophy and believe writing better Git commit messages—ones that are contextual enough to serve as a changelog for your open source software—is an important component of DRY. One of the many workflows I've written is [Emoji-Log][2], a straightforward, open source Git commit log standard. It improves the developer experience (DX) by using emoji to create better Git commit messages. + +I've used Emoji-Log while building the [VSCode Tips & Tricks repo][3], my 🦄 [Shades of Purple VSCode theme repo][4], and even an [automatic changelog][5] that looks beautiful. + +### Emoji-Log's philosophy + +I like emoji (which is, in fact, the plural of emoji). I like 'em a lot. Programming, code, geeks/nerds, open source… all of that is inherently dull and sometimes boring. Emoji help me add colors and emotions to the mix. There's nothing wrong with wanting to attach feelings to the 2D, flat, text-based world of code. + +Instead of memorizing [hundreds of emoji][6], I've learned it's better to keep the categories small and general. Here's the philosophy that guides writing commit messages with Emoji-Log: + + 1. **Imperative** + * Make your Git commit messages imperative. + * Write commit message like you're giving an order. + * e.g., Use ✅ **Add** instead of ❌ **Added** + * e.g., Use ✅ **Create** instead of ❌ **Creating** + 2. **Rules** + * A small number of categories are easy to memorize. + * Nothing more, nothing less + * e.g. **📦 NEW** , **👌 IMPROVE** , **🐛 FIX** , **📖 DOC** , **🚀 RELEASE** , and **✅ TEST** + 3. **Actions** + * Make Git commits based on actions you take. + * Use a good editor like [VSCode][7] to commit the right files with commit messages. + + + +### Writing commit messages + +Use only the following Git commit messages. The simple and small footprint is the key to Emoji-Logo. + + 1. **📦 NEW: IMPERATIVE_MESSAGE** + * Use when you add something entirely new. + * e.g., **📦 NEW: Add Git ignore file** + 2. **👌 IMPROVE: IMPERATIVE_MESSAGE** + * Use when you improve/enhance piece of code like refactoring etc. + * e.g., **👌 IMPROVE: Remote IP API Function** + 3. **🐛 FIX: IMPERATIVE_MESSAGE** + * Use when you fix a bug. Need I say more? + * e.g., **🐛 FIX: Case converter** + 4. **📖 DOC: IMPERATIVE_MESSAGE** + * Use when you add documentation, like README.md or even inline docs. + * e.g., **📖 DOC: API Interface Tutorial** + 5. **🚀 RELEASE: IMPERATIVE_MESSAGE** + * Use when you release a new version. e.g., **🚀 RELEASE: Version 2.0.0** + 6. **✅ TEST: IMPERATIVE_MESSAGE** + * Use when you release a new version. + * e.g., **✅ TEST: Mock User Login/Logout** + + + +That's it for now. Nothing more, nothing less. + +### Emoji-Log functions + +For quick prototyping, I have made the following functions that you can add to your **.bashrc** / **.zshrc** files to use Emoji-Log quickly. + +``` +#.# Better Git Logs. + +### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log). + + + +# Git Commit, Add all and Push — in one step. + +function gcap() { +    git add . && git commit -m "$*" && git push +} + +# NEW. +function gnew() { +    gcap "📦 NEW: $@" +} + +# IMPROVE. +function gimp() { +    gcap "👌 IMPROVE: $@" +} + +# FIX. +function gfix() { +    gcap "🐛 FIX: $@" +} + +# RELEASE. +function grlz() { +    gcap "🚀 RELEASE: $@" +} + +# DOC. +function gdoc() { +    gcap "📖 DOC: $@" +} + +# TEST. +function gtst() { +    gcap "✅ TEST: $@" +} +``` + +To install these functions for the [fish shell][8], run the following commands: + +``` +function gcap; git add .; and git commit -m "$argv"; and git push; end; +function gnew; gcap "📦 NEW: $argv"; end +function gimp; gcap "👌 IMPROVE: $argv"; end; +function gfix; gcap "🐛 FIX: $argv"; end; +function grlz; gcap "🚀 RELEASE: $argv"; end; +function gdoc; gcap "📖 DOC: $argv"; end; +function gtst; gcap "✅ TEST: $argv"; end; +funcsave gcap +funcsave gnew +funcsave gimp +funcsave gfix +funcsave grlz +funcsave gdoc +funcsave gtst +``` + +If you prefer, you can paste these aliases directly in your **~/.gitconfig** file: + +``` +# Git Commit, Add all and Push — in one step. +cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f" + +# NEW. +new = "!f() { git cap \"📦 NEW: $@\"; }; f" +# IMPROVE. +imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f" +# FIX. +fix = "!f() { git cap \"🐛 FIX: $@\"; }; f" +# RELEASE. +rlz = "!f() { git cap \"🚀 RELEASE: $@\"; }; f" +# DOC. +doc = "!f() { git cap \"📖 DOC: $@\"; }; f" +# TEST. +tst = "!f() { git cap \"✅ TEST: $@\"; }; f" +``` + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/emoji-log-git-commit-messages + +作者:[Ahmad Awais][a] +选题:[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/mrahmadawais +[b]: https://github.com/lujun9972 +[1]: https://github.com/ahmadawais +[2]: https://github.com/ahmadawais/Emoji-Log/ +[3]: https://github.com/ahmadawais/VSCode-Tips-Tricks +[4]: https://github.com/ahmadawais/shades-of-purple-vscode/commits/master +[5]: https://github.com/ahmadawais/shades-of-purple-vscode/blob/master/CHANGELOG.md +[6]: https://gitmoji.carloscuesta.me/ +[7]: https://VSCode.pro +[8]: https://en.wikipedia.org/wiki/Friendly_interactive_shell From 9bfa0f28288c71c4ce4dd450db6631c5728103e8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Feb 2019 17:41:22 +0800 Subject: [PATCH 215/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190104=20Three?= =?UTF-8?q?=20Ways=20To=20Reset=20And=20Change=20Forgotten=20Root=20Passwo?= =?UTF-8?q?rd=20on=20RHEL=207/CentOS=207=20Systems=20sources/tech/20190104?= =?UTF-8?q?=20Three=20Ways=20To=20Reset=20And=20Change=20Forgotten=20Root?= =?UTF-8?q?=20Password=20on=20RHEL=207-CentOS=207=20Systems.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oot Password on RHEL 7-CentOS 7 Systems.md | 254 ++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 sources/tech/20190104 Three Ways To Reset And Change Forgotten Root Password on RHEL 7-CentOS 7 Systems.md diff --git a/sources/tech/20190104 Three Ways To Reset And Change Forgotten Root Password on RHEL 7-CentOS 7 Systems.md b/sources/tech/20190104 Three Ways To Reset And Change Forgotten Root Password on RHEL 7-CentOS 7 Systems.md new file mode 100644 index 0000000000..6619cfe65a --- /dev/null +++ b/sources/tech/20190104 Three Ways To Reset And Change Forgotten Root Password on RHEL 7-CentOS 7 Systems.md @@ -0,0 +1,254 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Three Ways To Reset And Change Forgotten Root Password on RHEL 7/CentOS 7 Systems) +[#]: via: (https://www.2daygeek.com/linux-reset-change-forgotten-root-password-in-rhel-7-centos-7/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +Three Ways To Reset And Change Forgotten Root Password on RHEL 7/CentOS 7 Systems +====== + +If you are forget to remember your root password for RHEL 7 and CentOS 7 systems and want to reset the forgotten root password? + +If so, don’t worry we are here to help you out on this. + +Navigate to the following link if you want to **[reset forgotten root password on RHEL 6/CentOS 6][1]**. + +This is generally happens when you use different password in vast environment or if you are not maintaining the proper inventory. + +Whatever it is. No issues, we will help you through this article. + +It can be done in many ways but we are going to show you the best three methods which we tried many times for our clients. + +In Linux servers there are three different users are available. These are, Normal User, System User and Super User. + +As everyone knows the Root user is known as super user in Linux and Administrator is in Windows. + +We can’t perform any major activity without root password so, make sure you should have the right root password when you perform any major tasks. + +If you don’t know or don’t have it, try to reset using one of the below method. + + * Reset Forgotten Root Password By Booting into Single User Mode using `rd.break` + * Reset Forgotten Root Password By Booting into Single User Mode using `init=/bin/bash` + * Reset Forgotten Root Password By Booting into Rescue Mode + + + +### Method-1: Reset Forgotten Root Password By Booting into Single User Mode + +Just follow the below procedure to reset the forgotten root password in RHEL 7/CentOS 7 systems. + +To do so, reboot your system and follow the instructions carefully. + +**`Step-1:`** Reboot your system and interrupt at the boot menu by hitting **`e`** key to modify the kernel arguments. +![][3] + +**`Step-2:`** In the GRUB options, find `linux16` word and add the `rd.break` word in the end of the file then press `Ctrl+x` or `F10` to boot into single user mode. +![][4] + +**`Step-3:`** At this point of time, your root filesystem will be mounted in Read only (RO) mode to /sysroot. Run the below command to confirm this. + +``` +# mount | grep root +``` + +![][5] + +**`Step-4:`** Based on the above output, i can say that i’m in single user mode and my root file system is mounted in read only mode. + +It won’t allow you to make any changes on your system until you mount the root filesystem with Read and write (RW) mode to /sysroot. To do so, use the following command. + +``` +# mount -o remount,rw /sysroot +``` + +![][6] + +**`Step-5:`** Currently your file systems are mounted as a temporary partition. Now, your command prompt shows **switch_root:/#**. + +Run the following command to get into a chroot jail so that /sysroot is used as the root of the file system. + +``` +# chroot /sysroot +``` + +![][7] + +**`Step-6:`** Now you can able to reset the root password with help of `passwd` command. + +``` +# echo "CentOS7$#123" | passwd --stdin root +``` + +![][8] + +**`Step-7:`** By default CentOS 7/RHEL 7 use SELinux in enforcing mode, so create a following hidden file which will automatically perform a relabel of all files on next boot. + +It allow us to fix the context of the **/etc/shadow** file. + +``` +# touch /.autorelabel +``` + +![][9] + +**`Step-8:`** Issue `exit` twice to exit from the chroot jail environment and reboot the system. +![][10] + +**`Step-9:`** Now you can login to your system with your new password. +![][11] + +### Method-2: Reset Forgotten Root Password By Booting into Single User Mode + +Alternatively we can use the below procedure to reset the forgotten root password in RHEL 7/CentOS 7 systems. + +**`Step-1:`** Reboot your system and interrupt at the boot menu by hitting **`e`** key to modify the kernel arguments. +![][3] + +**`Step-2:`** In the GRUB options, find `rhgb quiet` word and replace with the `init=/bin/bash` or `init=/bin/sh` word then press `Ctrl+x` or `F10` to boot into single user mode. + +Screenshot for **`init=/bin/bash`**. +![][12] + +Screenshot for **`init=/bin/sh`**. +![][13] + +**`Step-3:`** At this point of time, your root system will be mounted in Read only mode to /. Run the below command to confirm this. + +``` +# mount | grep root +``` + +![][14] + +**`Step-4:`** Based on the above ouput, i can say that i’m in single user mode and my root file system is mounted in read only (RO) mode. + +It won’t allow you to make any changes on your system until you mount the root file system with Read and write (RW) mode. To do so, use the following command. + +``` +# mount -o remount,rw / +``` + +![][15] + +**`Step-5:`** Now you can able to reset the root password with help of `passwd` command. + +``` +# echo "RHEL7$#123" | passwd --stdin root +``` + +![][16] + +**`Step-6:`** By default CentOS 7/RHEL 7 use SELinux in enforcing mode, so create a following hidden file which will automatically perform a relabel of all files on next boot. + +It allow us to fix the context of the **/etc/shadow** file. + +``` +# touch /.autorelabel +``` + +![][17] + +**`Step-7:`** Finally `Reboot` the system. + +``` +# exec /sbin/init 6 +``` + +![][18] + +**`Step-9:`** Now you can login to your system with your new password. +![][11] + +### Method-3: Reset Forgotten Root Password By Booting into Rescue Mode + +Alternatively, we can reset the forgotten Root password for RHEL 7 and CentOS 7 systems using Rescue mode. + +**`Step-1:`** Insert the bootable media through USB or DVD drive which is compatible for you and reboot your system. It will take to you to the below screen. + +Hit `Troubleshooting` to launch the `Rescue` mode. +![][19] + +**`Step-2:`** Choose `Rescue a CentOS system` and hit `Enter` button. +![][20] + +**`Step-3:`** Here choose `1` and the rescue environment will now attempt to find your Linux installation and mount it under the directory `/mnt/sysimage`. +![][21] + +**`Step-4:`** Simple hit `Enter` to get a shell. +![][22] + +**`Step-5:`** Run the following command to get into a chroot jail so that /mnt/sysimage is used as the root of the file system. + +``` +# chroot /mnt/sysimage +``` + +![][23] + +**`Step-6:`** Now you can able to reset the root password with help of **passwd** command. + +``` +# echo "RHEL7$#123" | passwd --stdin root +``` + +![][24] + +**`Step-7:`** By default CentOS 7/RHEL 7 use SELinux in enforcing mode, so create a following hidden file which will automatically perform a relabel of all files on next boot. +It allow us to fix the context of the /etc/shadow file. + +``` +# touch /.autorelabel +``` + +![][25] + +**`Step-8:`** Remove the bootable media then initiate the reboot. + +**`Step-9:`** Issue `exit` twice to exit from the chroot jail environment and reboot the system. +![][26] + +**`Step-10:`** Now you can login to your system with your new password. +![][11] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-reset-change-forgotten-root-password-in-rhel-7-centos-7/ + +作者:[Prakash Subramanian][a] +选题:[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/prakash/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-reset-change-forgotten-root-password-in-rhel-6-centos-6/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-2.png +[4]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-3.png +[5]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-5.png +[6]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-6.png +[7]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-8.png +[8]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-10.png +[9]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-10a.png +[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-11.png +[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-12.png +[12]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-1.png +[13]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-1a.png +[14]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-3.png +[15]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-4.png +[16]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-5.png +[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-6.png +[18]: https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-7.png +[19]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-1.png +[20]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-2.png +[21]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-3.png +[22]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-4.png +[23]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-5.png +[24]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-6.png +[25]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-7.png +[26]: https://www.2daygeek.com/wp-content/uploads/2018/12/rescue-reset-forgotten-root-password-on-rhel-7-centos-7-8.png From 204715adaa4c18dadcc57a00a92a8c04d738cd7c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Feb 2019 21:38:25 +0800 Subject: [PATCH 216/813] PRF:20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qhwdw 这几篇翻译质量很高 --- ...atory - Raspberry Pi- Lesson 7 Screen02.md | 92 +++++++------------ 1 file changed, 33 insertions(+), 59 deletions(-) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md index 6d6086d1ab..6ecff706b2 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @@ -1,26 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 7 Screen02) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) -计算机实验室 – 树莓派:课程 7 屏幕02 +计算机实验室之树莓派:课程 7 屏幕02 ====== -屏幕02 课程在屏幕01 的基础上构建,它教你如何绘制线和一个生成伪随机数的小特性。假设你已经有了 [课程6:屏幕01][1] 的操作系统代码,我们将以它为基础来构建。 +屏幕02 课程在屏幕01 的基础上构建,它教你如何绘制线和一个生成伪随机数的小特性。假设你已经有了 [课程 6:屏幕01][1] 的操作系统代码,我们将以它为基础来构建。 ### 1、点 现在,我们的屏幕已经正常工作了,现在开始去创建一个更实用的图像,是水到渠成的事。如果我们能够绘制出更实用的图形那就更好了。如果我们能够在屏幕上的两点之间绘制一条线,那我们就能够组合这些线绘制出更复杂的图形了。 -``` -为了绘制出更复杂的图形,一些方法使用一个着色函数而不是一个颜色去绘制。每个点都能够调用着色函数来确定在那里用什么颜色去绘制。 -``` +我们将尝试用汇编代码去实现它,但在开始时,我们确实需要使用一些其它的函数去辅助。我们需要一个这样的函数,我将调用 `SetPixel` 去修改指定像素的颜色,而在寄存器 `r0` 和 `r1` 中提供输入。如果我们写出的代码可以在任意内存中而不仅仅是屏幕上绘制图形,这将在以后非常有用,因此,我们首先需要一些控制真实绘制位置的方法。我认为实现上述目标的最好方法是,能够有一个内存片段用于保存将要绘制的图形。我应该最终得到的是一个存储地址,它通常指向到自上次的帧缓存结构上。我们将一直在我们的代码中使用这个绘制方法。这样,如果我们想在我们的操作系统的另一部分绘制一个不同的图像,我们就可以生成一个不同结构的地址值,而使用的是完全相同的代码。为简单起见,我们将使用另一个数据片段去控制我们绘制的颜色。 -我们将尝试用汇编代码去实现它,但在开始时,我们确实需要使用一些其它的函数去帮助它。我们需要一个函数,我将调用 `SetPixel` 去修改指定像素的颜色,在寄存器 `r0` 和 `r1` 中提供输入。如果我们写出的代码可以在任意内存中而不仅仅是屏幕上绘制图形,这将在以后非常有用,因此,我们首先需要一些控制真实绘制位置的方法。我认为实现上述目标的最好方法是,能够有一个内存片段用于保存将要绘制的图形。我应该最终使用它来保存地址,这个地址就是指向到自上次以来的帧缓存结构上。我们将在后面的代码中使用这个绘制方法。这样,如果我们想在我们的操作系统的另一部分绘制一个不同的图像,我们就可以生成一个不同结构的地址值,而使用的是完全相同的代码。为简单起见,我们将使用另一个数据片段去控制我们绘制的颜色。 +> 为了绘制出更复杂的图形,一些方法使用一个着色函数而不是一个颜色去绘制。每个点都能够调用着色函数来确定在那里用什么颜色去绘制。 复制下列代码到一个名为 `drawing.s` 的新文件中。 @@ -52,11 +50,9 @@ mov pc,lr 这段代码就是我上面所说的一对函数以及它们的数据。我们将在 `main.s` 中使用它们,在绘制图像之前去控制在何处绘制什么内容。 -``` -构建一个通用方法,比如 `SetPixel`,我们将在它之上构建另一个方法是一个很好的创意。但我们必须要确保这个方法很快,因为我们要经常使用它。 -``` +我们的下一个任务是去实现一个 `SetPixel` 方法。它需要带两个参数,像素的 x 和 y 轴,并且它应该要使用 `graphicsAddress` 和 `foreColour`,我们只定义精确控制在哪里绘制什么图像即可。如果你认为你能立即实现这些,那么去动手实现吧,如果不能,按照我们提供的步骤,按示例去实现它。 -我们的下一个任务是去实现一个 `SetPixel` 方法。它需要带两个参数,像素的 x 和 y 轴,并且它应该会使用 `graphicsAddress` 和 `foreColour`,我们只定义精确控制在哪里绘制什么图像即可。如果你认为你能立即实现这些,那么去动手实现吧,如果不能,按照我们提供的步骤,按示例去实现它。 +> 构建一个通用方法,比如 `SetPixel`,我们将在它之上构建另一个方法是一个很好的想法。但我们必须要确保这个方法很快,因为我们要经常使用它。 1. 加载 `graphicsAddress`。 2. 检查像素的 x 和 y 轴是否小于宽度和高度。 @@ -64,11 +60,10 @@ mov pc,lr 4. 加载 `foreColour`。 5. 保存到地址。 - - 上述步骤实现如下: -1. +1、加载 `graphicsAddress`。 + ```assembly .globl DrawPixel DrawPixel: @@ -79,7 +74,8 @@ ldr addr,=graphicsAddress ldr addr,[addr] ``` -2. +2、记住,宽度和高度被各自保存在帧缓冲偏移量的 0 和 4 处。如有必要可以参考 `frameBuffer.s`。 + ```assembly height .req r3 ldr height,[addr,#4] @@ -95,9 +91,8 @@ cmp px,width movhi pc,lr ``` -记住,宽度和高度被各自保存在帧缓冲偏移量的 0 和 4 处。如有必要可以参考 `frameBuffer.s`。 +3、确实,这段代码是专用于高色值帧缓存的,因为我使用一个逻辑左移操作去计算地址。你可能希望去编写一个不需要专用的高色值帧缓冲的函数版本,记得去更新 `SetForeColour` 的代码。它实现起来可能更复杂一些。 -3. ```assembly ldr addr,[addr,#32] add width,#1 @@ -108,22 +103,18 @@ add addr, px,lsl #1 .unreq px ``` -```assembly -mla dst,reg1,reg2,reg3 将寄存器 `reg1` 和 `reg2` 中的值相乘,然后将结果与寄存器 `reg3` 中的值相加,并将结果的低 32 位保存到 dst 中。 -``` +> `mla dst,reg1,reg2,reg3` 将寄存器 `reg1` 和 `reg2` 中的值相乘,然后将结果与寄存器 `reg3` 中的值相加,并将结果的低 32 位保存到 `dst` 中。 -确实,这段代码是专用于高色值帧缓存的,因为我使用一个逻辑左移操作去计算地址。你可能希望去编写一个不需要专用的高色值帧缓冲的函数版本,记得去更新 `SetForeColour` 的代码。它实现起来可能更复杂一些。 - -4. +4、这是专用于高色值的。 + ```assembly fore .req r3 ldr fore,=foreColour ldrh fore,[fore] ``` -以上是专用于高色值的。 +5、这是专用于高色值的。 -5. ```assembly strh fore,[addr] .unreq fore @@ -131,22 +122,15 @@ strh fore,[addr] mov pc,lr ``` -以上是专用于高色值的。 - - - - ### 2、线 问题是,线的绘制并不是你所想像的那么简单。到目前为止,你必须认识到,编写一个操作系统时,几乎所有的事情都必须我们自己去做,绘制线条也不例外。我建议你们花点时间想想如何在任意两点之间绘制一条线。 -``` -在我们日常编程中,我们对像除法这样的运算通常懒得去优化。但是操作系统不同,它必须高效,因此我们要始终专注于如何让事情做的尽可能更好。 -``` - 我估计大多数的策略可能是去计算线的梯度,并沿着它来绘制。这看上去似乎很完美,但它事实上是个很糟糕的主意。主要问题是它涉及到除法,我们知道在汇编中,做除法很不容易,并且还要始终记录小数,这也很困难。事实上,在这里,有一个叫布鲁塞姆的算法,它非常适合汇编代码,因为它只使用加法、减法和位移运算。 +> 在我们日常编程中,我们对像除法这样的运算通常懒得去优化。但是操作系统不同,它必须高效,因此我们要始终专注于如何让事情做的尽可能更好。 +. > 我们从定义一个简单的直线绘制算法开始,代码如下: > @@ -199,7 +183,7 @@ mov pc,lr > end if > ``` > -> 这个算法用来表示你可能想像到的那些东西。变量 `error` 用来记录你离实线的距离。沿着 x 轴每走一步,这个 `error` 的值都会增加,而沿着 y 轴每走一步,这个 `error` 值就会减 1 个单位。`error` 是用于测量距离 y 轴的距离。 +> 这个算法用来表示你可能想像到的那些东西。变量 `error` 用来记录你离实线的距离。沿着 x 轴每走一步,这个 `error` 的值都会增加,而沿着 y 轴每走一步,这个 `error` 值就会减 1 个单位。`error` 是用于测量距离 y 轴的距离。 > > 虽然这个算法是有效的,但它存在一个重要的问题,很明显,我们使用了小数去保存 `error`,并且也使用了除法。所以,一个立即要做的优化将是去改变 `error` 的单位。这里并不需要用特定的单位去保存它,只要我们每次使用它时都按相同数量去伸缩即可。所以,我们可以重写这个算法,通过在所有涉及 `error` 的等式上都简单地乘以 `deltay`,从面让它简化。下面只展示主要的循环: > @@ -267,10 +251,9 @@ mov pc,lr > 你可能需要一些时间来搞明白它。在每一步中,我们都认为它正确地在 x 和 y 中移动。我们通过检查来做到这一点,如果我们在 x 或 y 轴上移动,`error` 的数量会变低,那么我们就继续这样移动。 > +. -``` -布鲁塞姆算法是在 1962 年由 Jack Elton Bresenham 开发,当时他 24 岁,正在攻读博士学位。 -``` +> 布鲁塞姆算法是在 1962 年由 Jack Elton Bresenham 开发,当时他 24 岁,正在攻读博士学位。 用于画线的布鲁塞姆算法可以通过以下的伪代码来描述。以下伪代码是文本,它只是看起来有点像是计算机指令而已,但它却能让程序员实实在在地理解算法,而不是为机器可读。 @@ -370,35 +353,28 @@ pixelLoop$: ### 3、随机性 -到目前,我们可以绘制线条了。虽然我们可以使用它来绘制图片及诸如此类的东西(你可以随意去做!),我想应该借此机会引入计算机中随机性的概念。我将这样去做,选择一对随机的坐标,然后从最后一对坐标用渐变色绘制一条线到那个点。我这样做纯粹是认为它看起来很漂亮。 +到目前,我们可以绘制线条了。虽然我们可以使用它来绘制图片及诸如此类的东西(你可以随意去做!),我想应该借此机会引入计算机中随机性的概念。我将这样去做,选择一对随机的坐标,然后从上一对坐标用渐变色绘制一条线到那个点。我这样做纯粹是认为它看起来很漂亮。 -``` -硬件随机数生成器是在安全中使用很少,可预测的随机数序列可能影响某些加密的安全。 -``` +那么,总结一下,我们如何才能产生随机数呢?不幸的是,我们并没有产生随机数的一些设备(这种设备很罕见)。因此只能利用我们目前所学过的操作,需要我们以某种方式来发明“随机数”。你很快就会意识到这是不可能的。各种操作总是给出定义好的结果,用相同的寄存器运行相同的指令序列总是给出相同的答案。而我们要做的是推导出一个伪随机序列。这意味着数字在外人看来是随机的,但实际上它是完全确定的。因此,我们需要一个生成随机数的公式。其中有人可能会想到很垃圾的数学运算,比如:4x2! / 64,而事实上它产生的是一个低质量的随机数。在这个示例中,如果 x 是 0,那么答案将是 0。看起来很愚蠢,我们需要非常谨慎地选择一个能够产生高质量随机数的方程式。 -那么,总结一下,我们如何才能产生随机数呢?不幸的是,我们并没有产生随机数的一些设备(这种设备很罕见)。因此只能利用我们目前所学过的操作,需要我们以某种方式来发明`随机数`。你很快就会意识到这是不可能的。操作总是给出定义好的结果,用相同的寄存器运行相同的指令序列总是给出相同的答案。而我们要做的是推导出一个伪随机序列。这意味着数字在外人看来是随机的,但实际上它是完全确定的。因此,我们需要一个生成随机数的公式。其中有人可能会想到很垃圾的数学运算,比如:4x2! / 64,而事实上它产生的是一个低质量的随机数。在这个示例中,如果 x 是 0,那么答案将是 0。看起来很愚蠢,我们需要非常谨慎地选择一个能够产生高质量随机数的方程式。 - -``` -这类讨论经常寻求一个问题,那就是我们所谓的随机数到底是什么?通常从统计学的角度来说的随机性是:一组没有明显模式或属性能够概括它的数的序列。 -``` +> 硬件随机数生成器很少用在安全中,因为可预测的随机数序列可能影响某些加密的安全。 我将要教给你的方法叫“二次同余发生器”。这是一个非常好的选择,因为它能够在 5 个指令中实现,并且能够产生一个从 0 到 232-1 之间的看似很随机的数字序列。 不幸的是,对为什么使用如此少的指令能够产生如此长的序列的原因的研究,已经远超出了本课程的教学范围。但我还是鼓励有兴趣的人去研究它。它的全部核心所在就是下面的二次方程,其中 `xn` 是产生的第 `n` 个随机数。 +> 这类讨论经常寻求一个问题,那就是我们所谓的随机数到底是什么?通常从统计学的角度来说的随机性是:一组没有明显模式或属性能够概括它的数的序列。 + +``` x_(n+1) = ax_(n)^2 + bx_(n) + c mod 2^32 +``` 这个方程受到以下的限制: 1. a 是偶数 - 2. b = a + 1 mod 4 - 3. c 是奇数 - - - 如果你之前没有见到过 `mod` 运算,我来解释一下,它的意思是被它后面的数相除之后的余数。比如 `b = a + 1 mod 4` 的意思是 `b` 是 `a + 1` 除以 `4` 的余数,因此,如果 `a` 是 12,那么 `b` 将是 `1`,因为 `a + 1` 是 13,而 `13` 除以 4 的结果是 3 余 1。 复制下列代码到名为 `random.s` 的文件中。 @@ -431,15 +407,13 @@ OK,现在我们有了所有我们需要的函数,我们来试用一下它们 3. 调用 `random` 去产生下一个 x 坐标,使用最后一个随机数作为输入。 4. 调用 `random` 再次去生成下一个 y 坐标,使用你生成的 x 坐标作为输入。 5. 更新最后的随机数为 y 坐标。 - 6. 使用 `colour` 值调用 `SetForeColour`,接着增加 `colour` 值。如果它大于 FFFF~16~,确保它返回为 0。 - 7. 我们生成的 x 和 y 坐标将介于 0 到 FFFFFFFF~16~。通过将它们逻辑右移 22 位,将它们转换为介于 0 到 1023~10~ 之间的数。 - 8. 检查 y 坐标是否在屏幕上。验证 y 坐标是否介于 0 到 767~10~ 之间。如果不在这个区间,返回到第 3 步。 + 6. 使用 `colour` 值调用 `SetForeColour`,接着增加 `colour` 值。如果它大于 FFFF~16~,确保它返回为 0。 + 7. 我们生成的 x 和 y 坐标将介于 0 到 FFFFFFFF16。通过将它们逻辑右移 22 位,将它们转换为介于 0 到 102310 之间的数。 + 8. 检查 y 坐标是否在屏幕上。验证 y 坐标是否介于 0 到 76710 之间。如果不在这个区间,返回到第 3 步。 9. 从最后的 x 坐标和 y 坐标到当前的 x 坐标和 y 坐标之间绘制一条线。 10. 更新最后的 x 和 y 坐标去为当前的坐标。 11. 返回到第 3 步。 - - 一如既往,你可以在下载页面上找到这个解决方案。 在你完成之后,在树莓派上做测试。你应该会看到一系列颜色递增的随机线条以非常快的速度出现在屏幕上。它一直持续下去。如果你的代码不能正常工作,请查看我们的排错页面。 @@ -453,11 +427,11 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html 作者:[Alex Chadwick][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.cl.cam.ac.uk [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html +[1]: https://linux.cn/article-10540-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html From 33796170700e7c2a788f40c681dca36b177aa668 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Feb 2019 21:39:16 +0800 Subject: [PATCH 217/813] PUB:20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @qhwdw https://linux.cn/article-10551-1.html --- ...6 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md (99%) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md similarity index 99% rename from translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md rename to published/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md index 6ecff706b2..f5ba5f5237 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md +++ b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10551-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 7 Screen02) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) From c6b2409b8aaa3ef5b144679f0fa02e6889edf93b Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Feb 2019 22:23:54 +0800 Subject: [PATCH 218/813] translating by lujun9972 --- .../20181216 Schedule a visit with the Emacs psychiatrist.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md b/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md index 6d72cda348..e96da9aeea 100644 --- a/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md +++ b/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lujun9972) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -47,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-eliza 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lujun9972](https://github.com/lujun9972) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e474451c0354ec20e06fc19fcf50c1359aa442ef Mon Sep 17 00:00:00 2001 From: mySoul Date: Wed, 20 Feb 2019 03:56:06 +0800 Subject: [PATCH 219/813] Update 20190123 Book Review- Fundamentals of Linux.md --- ...0123 Book Review- Fundamentals of Linux.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sources/talk/20190123 Book Review- Fundamentals of Linux.md b/sources/talk/20190123 Book Review- Fundamentals of Linux.md index 5e0cffd9bc..fc05d96fec 100644 --- a/sources/talk/20190123 Book Review- Fundamentals of Linux.md +++ b/sources/talk/20190123 Book Review- Fundamentals of Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (mySoul8012) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,48 +7,47 @@ [#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review) [#]: author: (John Paul https://itsfoss.com/author/john/) -Book Review: Fundamentals of Linux +书评:linux的基础知识 ====== +有很多很棒的书籍涵盖了Linux的基础知识以及它的工作原理,今天,我们将会书评这样一本书,讨论的主题为Oliver Pelz所写的[linux的基础知识][1],由[PacktPub][2]发布。 -There are many great books that cover the basics of what Linux is and how it works. Today, I will be taking a look at one such book. Today, the subject of our discussion is [Fundamentals of Linux][1] by Oliver Pelz and is published by [PacktPub][2]. +[Oliver Pelz][3] 是一位超过十年软件开发人员和系统管理员经验人员,同时拥有生物信息学学位证书。 -[Oliver Pelz][3] has over ten years of experience as a software developer and a system administrator. He holds a degree in bioinformatics. - -### What is the book ‘Fundamentals of Linux’ about? +### 什么是linux基础知识一书 ![Fundamental of Linux books][4] +正如可以从标题中猜到那样,该书(Linux基础知识)的目标是为读者打下一个了解Linux命令行的坚实基础。这本书一共有两百多页。因此它专注于教授用户日常遇到的问题,以及任务。本书为想要成为Linux管理员的读者而书写。 -As can be guessed from the title, the goal of Fundamentals of Linux is to give the reader a strong foundation from which to learn about the Linux command line. The book is a little over two hundred pages long, so it only focuses on teaching the everyday tasks and problems that users commonly encounter. The book is designed for readers who want to become Linux administrators. +第一章首先概述了虚拟化。本书作者指导了读者如何在[VirtualBox][6]中创建[CentOS][5]实例。如何克隆实例,如何使用快照。并且同时你也会学习到如何通过SSH命令连接到虚拟机。 -The first chapter starts out by giving an overview of virtualization. From there the author instructs how to create a virtual instance of [CentOS][5] in [VirtualBox][6], how to clone it, and how to use snapshots. You will also learn how to connect to the virtual machines via SSH. +第二章介绍了Linux的命令行的基础知识,包括shell GLOB模式,shell扩展,如何使用包含空格和特殊字符的文件名称。如何来获取命令手册的帮助页面。如何使用`sed`, `awk`这两个命令。如何浏览Linux的文件系统。 -The second chapter covers the basics of the Linux command line. This includes shell globbing, shell expansion, how to work with file names that contain spaces or special characters. It also explains how to interpret a command’s manual page, as well as, how to use `sed`, `awk`, and to navigate the Linux file system. +第三章更深入的介绍了Linux文件系统。您将了解如何在Linux中链接文件,以及如何搜索它们。您还将获得用户,组,以及文件权限的概述。由于本章的重点介绍了如何与文件进行交互。因此还将会介绍如何从命令行中读取文本文件,以及如何使用vim编辑器。 -The third chapter takes a more in-depth look at the Linux file system. You will learn how files are linked in Linux and how to search for them. You will also be given an overview of users, groups and file permissions. Since the chapter focuses on interacting with files, it tells how to read text files from the command line, as well as, an overview of how to use the VIM editor. +第四章重点介绍了如何使用命令行。以及涵盖的重要命令。如`cat`, `sort`, `awk`. `tee`, `tar`,`rsync`, `nmap`, `htop`等。您还将会了解这些命令的流程,以及如何相互使用,还将介绍Bash shell脚本。 -Chapter four focuses on using the command line. It covers important commands, such as `cat`, `sort`, `awk`. `tee`, `tar`, `rsync`, `nmap`, `htop` and more. You will learn what processes are and how they communicate with each other. This chapter also includes an introduction to Bash shell scripting. +第五章同时也是本书的最后一章,将会介绍Linux和其他高级命令,以及网络的概念。本书的作者讨论了Linux如何处理网络并提供使用多个虚拟机的示例。同时还将会介绍如何安装新的程序,如何设置防火墙。 -The fifth and final chapter covers networking on Linux and other advanced command line concepts. The author discusses how Linux handles networking and gives examples using multiple virtual machines. He also covers how to install new programs and how to set up a firewall. +### 关于这本书的想法 -### Thoughts on the book +Linux的基础知识可能看起来很见到,但是涵盖了相当多的信息。同时也将会获得如何使用命令行所需要的知识的一切。 -Fundamentals of Linux might seem short at five chapters and a little over two hundred pages. However, quite a bit of information is covered. You are given everything that you need to get going on the command line. +使用本书的时候,需要注意一件事情,即,本书专注于对命令行的关注,没有任何关于如何使用图形化的用户界面的任何教程。这是因为在Linux中有太多不同的桌面环境,以及很多的类似的操作系统。因此很难编写一本可以涵盖所有变量的书。部分原因还因为本书的面向的用户群体为Linux管理员。 -The book’s sole focus on the command line is one thing to keep in mind. You won’t get any information on how to use a graphical user interface. That is partially because Linux has so many different desktop environments and so many similar system applications that it would be hard to write a book that could cover all of the variables. It is also partially because the book is aimed at potential Linux administrators. +当我看到作者使用Centos教授Linux的时候有点惊讶。我原本以为他会使用更为常见的Linux的发行版本,例如Ubuntu,Debian或者Fedora。原因在于Centos是为服务器设计的发行版本。随着时间的推移变化很小。能够为Linux的基础知识打下一个非常坚实的基础。 -I was kinda surprised to see that the author used [CentOS][7] to teach Linux. I would have expected him to use a more common Linux distro, like Ubuntu, Debian, or Fedora. However, because it is a distro designed for servers very little changes over time, so it is a very stable basis for a course on Linux basics. +自己使用Linux已经操作五年了。我大部分时间都在使用桌面版本的Linux。我有些时候会使用命令行操作。但我并没有花太多的时间在哪里。我使用鼠标执行了本书中很多的操作。现在呢。我同时也知道了如何通过终端做出同样的事情。这种方式不会改变我完成任务的路径。但是会更加帮助自己理解幕后发生的事情。 -I’ve used Linux for over half a decade. I spent most of that time using desktop Linux. I dove into the terminal when I needed to, but didn’t spend lots of time there. I have performed many of the actions covered in this book using a mouse. Now, I know how to do the same things via the terminal. It won’t change the way I do my tasks, but it will help me understand what goes on behind the curtain. +如果您刚刚使用Linux,或者计划使用。我不会推荐您阅读这本书。这可能有点绝对化。但是如何您已经花了一些时间在Linux上。或者可以快速掌握某种技术语言。那么这本书很适合你。 -If you have either just started using Linux or are planning to do so in the future, I would not recommend this book. It might be a little overwhelming. If you have already spent some time with Linux or can quickly grasp the technical language, this book may very well be for you. +如果您认为本书适合您的学习需求。您可以从以下链接获取到该书。 -If you think this book is apt for your learning needs, you can get the book from the link below: +我们将在未来几个月内尝试查看更多Linux书籍,敬请关注我们。 -We will be trying to review more Linux books in coming months so stay tuned with us. +你最喜欢的关于Linux的入门书籍是什么?请在下面的评论中告诉我们。 -What is your favorite introductory book on Linux? Let us know in the comments below. +如果您发现这篇文章很有趣,请花一点时间在社交媒体,黑客新闻或[Reddit][8]上分享 -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][8]. -------------------------------------------------------------------------------- From 597752f108578a9572066113372bf4d2ace70ed2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 Feb 2019 08:59:12 +0800 Subject: [PATCH 220/813] translated --- ... open source document management system.md | 62 ------------------- ... open source document management system.md | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md create mode 100644 translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md diff --git a/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md deleted file mode 100644 index f26fcf5a30..0000000000 --- a/sources/tech/20190124 Get started with LogicalDOC, an open source document management system.md +++ /dev/null @@ -1,62 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with LogicalDOC, an open source document management system) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-logicaldoc) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Get started with LogicalDOC, an open source document management system -====== -Keep better track of document versions with LogicalDOC, the 12th in our series on open source tools that will make you more productive in 2019. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the 12th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### LogicalDOC - -Part of being productive is being able to find what you need when you need it. We've all seen directories full of similar files with similar names, a result of renaming them every time a document changes to keep track of all the versions. For example, my wife is a writer, and she often saves document revisions with new names before she sends them to reviewers. - -![](https://opensource.com/sites/default/files/uploads/logicaldoc-1.png) - -A coder's natural solution to this problem—Git or another version control tool—won't work for document creators because the systems used for code often don't play nice with the formats used by commercial text editors. And before someone says, "just change formats," [that isn't an option for everyone][1]. Also, many version control tools are not very friendly for the less technically inclined. In large organizations, there are tools to solve this problem, but they also require the resources of a large organization to run, manage, and support them. - -![](https://opensource.com/sites/default/files/uploads/logicaldoc-2.png) - -[LogicalDOC CE][2] is an open source document management system built to solve this problem. It allows users to check in, check out, version, search, and lock document files and keeps a history of versions, similar to the version control tools used by coders. - -LogicalDOC can be [installed][3] on Linux, MacOS, and Windows using a Java-based installer. During installation, you'll be prompted for details on the database where its data will be stored and have an option for a local-only file store. You'll get the URL and a default username and password to access the server as well as an option to save a script to automate future installations. - -After you log in, LogicalDOC's default screen lists the documents you have tagged, checked out, and any recent notes on them. Switching to the Documents tab will show the files you have access to. You can upload documents by selecting a file through the interface or using drag and drop. If you upload a ZIP file, LogicalDOC will expand it and add its individual files to the repository. - -![](https://opensource.com/sites/default/files/uploads/logicaldoc-3.png) - -Right-clicking on a file will bring up a menu of options to check out files, lock files against changes, and do a whole host of other things. Checking out a file downloads it to your local machine where it can be edited. A checked-out file cannot be modified by anyone else until it's checked back in. When the file is checked back in (using the same menu), the user can add tags to the version and is required to comment on what was done to it. - -![](https://opensource.com/sites/default/files/uploads/logicaldoc-4.png) - -Going back and looking at earlier versions is as easy as downloading them from the Versions page. There are also import and export options for some third-party services, with [Dropbox][4] support built-in. - -Document management is not just for big companies that can afford expensive solutions. LogicalDOC helps you keep track of the documents you're using with a revision history and a safe repository for documents that are otherwise difficult to manage. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-logicaldoc - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: http://www.antipope.org/charlie/blog-static/2013/10/why-microsoft-word-must-die.html -[2]: https://www.logicaldoc.com/download-logicaldoc-community -[3]: https://docs.logicaldoc.com/en/installation -[4]: https://dropbox.com diff --git a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md new file mode 100644 index 0000000000..b49933414c --- /dev/null +++ b/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with LogicalDOC, an open source document management system) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-logicaldoc) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +开始使用 LogicalDOC,一个开源文档管理系统 +====== +使用 LogicalDOC 更好地跟踪文档版本,这是我们开源工具系列中的第 12 个工具,它将使你在 2019 年更高效。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 12 个工具来帮助你在 2019 年更有效率。 + +### LogicalDOC + +高效的一部分是能够在你需要时找到你需要的东西。我们都看到过充满类似名称文件的目录, 这是每次更改文档时为跟踪所有版本而重命名这些文件的结果。例如,我的妻子是一名作家,她在将文档发送给审稿人之前,她经常使用新名称保存文档修订版。 + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-1.png) + +程序员对此一个自然的解决方案是 Git 或者其他版本控制器,这个不适用于文档作者,因为用于代码的系统通常不能很好地兼容商业文本编辑器使用的格式。之前有人说,“只是更改格式”,[这不是每个人的选择][1]。同样,许多版本控制工具对于非技术人员来说并不是非常友好。在大型组织中,有一些工具可以解决此问题,但它们还需要大型组织的资源来运行、管理和支持它们。 + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-2.png) + +[LogicalDOC CE][2] 是为解决此问题而编写的开源文档管理系统。它允许用户签入、签出、查看版本、搜索和锁定文档,并保留版本历史记录,类似于程序员使用的版本控制工具。 + +LogicalDOC 可在 Linux、MacOS 和 Windows 上[安装][3],使用基于 Java 的安装程序。在安装中,系统将提示你提供数据库存储文职,并提供仅限本地文件存储的选项。你将获得访问服务器的 URL 和默认用户名和密码,以及保存用于自动安装脚本选项。 + +登录后,LogicalDOC 的默认页面会列出你已标记、签出的文档以及有关它们的最新说明。切换到“文档”选项卡将显示你有权访问的文件。你可以在界面中选择文件或使用拖放来上传文档。如果你上传 ZIP 文件,LogicalDOC 会解压它,并将其中的文件添加到仓库中。 + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-3.png) + +右键单击文件将显示一个菜单选项,包括检出文件、锁定文件以防止更改,以及执行大量其他操作。签出文件会将其下载到用于编辑的本地计算机。在重新签入之前,其他任何人都无法修改签出文件。当重新签入文件时(使用相同的菜单),用户可以向版本添加标签,并且需要评论对其执行的操作。 + +![](https://opensource.com/sites/default/files/uploads/logicaldoc-4.png) + +查看早期版本只需在“版本”页面下载就行。对于某些第三方服务,它还有导入和导出选项,内置 [Dropbox][4] 支持。 + +文档管理不仅仅是对能够负担得起昂贵解决方案的大公司。LogicalDOC 可帮助你追踪文档的版本历史,并为难以管理的文档提供了安全的仓库。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-logicaldoc + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://www.antipope.org/charlie/blog-static/2013/10/why-microsoft-word-must-die.html +[2]: https://www.logicaldoc.com/download-logicaldoc-community +[3]: https://docs.logicaldoc.com/en/installation +[4]: https://dropbox.com From 932ddb88f49ca019a5fdbb140919f20b0d526382 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 Feb 2019 09:03:07 +0800 Subject: [PATCH 221/813] translating --- ...ow To Grant And Remove Sudo Privileges To Users On Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md index 0a21ec0e60..56e8bd0abc 100644 --- a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md +++ b/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From de577b5908141b0eda43575224f513e55d0e2051 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:26:58 +0800 Subject: [PATCH 222/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=205=20Go?= =?UTF-8?q?od=20Open=20Source=20Speech=20Recognition/Speech-to-Text=20Syst?= =?UTF-8?q?ems=20sources/tech/20190219=205=20Good=20Open=20Source=20Speech?= =?UTF-8?q?=20Recognition-Speech-to-Text=20Systems.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eech Recognition-Speech-to-Text Systems.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20190219 5 Good Open Source Speech Recognition-Speech-to-Text Systems.md diff --git a/sources/tech/20190219 5 Good Open Source Speech Recognition-Speech-to-Text Systems.md b/sources/tech/20190219 5 Good Open Source Speech Recognition-Speech-to-Text Systems.md new file mode 100644 index 0000000000..c7609f5022 --- /dev/null +++ b/sources/tech/20190219 5 Good Open Source Speech Recognition-Speech-to-Text Systems.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Good Open Source Speech Recognition/Speech-to-Text Systems) +[#]: via: (https://fosspost.org/lists/open-source-speech-recognition-speech-to-text) +[#]: author: (Simon James https://fosspost.org/author/simonjames) + +5 Good Open Source Speech Recognition/Speech-to-Text Systems +====== + +![](https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/open-source-speech-recognition-speech-to-text.png?resize=1237%2C527&ssl=1) + +A speech-to-text (STT) system is as its name implies; A way of transforming the spoken words via sound into textual files that can be used later for any purpose. + +Speech-to-text technology is extremely useful. It can be used for a lot of applications such as a automation of transcription, writing books/texts using your own sound only, enabling complicated analyses on information using the generated textual files and a lot of other things. + +In the past, the speech-to-text technology was dominated by proprietary software and libraries; Open source alternatives didn’t exist or existed with extreme limitations and no community around. This is changing, today there are a lot of open source speech-to-text tools and libraries that you can use right now. + +Here we list 5 of them. + +### Open Source Speech Recognition Libraries + +#### Project DeepSpeech + +![5 Good Open Source Speech Recognition/Speech-to-Text Systems 15 open source speech recognition][1] + +This project is made by Mozilla; The organization behind the Firefox browser. It’s a 100% free and open source speech-to-text library that also implies the machine learning technology using TensorFlow framework to fulfill its mission. + +In other words, you can use it to build training models yourself to enhance the underlying speech-to-text technology and get better results, or even to bring it to other languages if you want. You can also easily integrate it to your other machine learning projects that you are having on TensorFlow. Sadly it sounds like the project is currently only supporting English by default. + +It’s also available in many languages such as Python (3.6); Which allows you to have it working in seconds: + +``` +pip3 install deepspeech +deepspeech --model models/output_graph.pbmm --alphabet models/alphabet.txt --lm models/lm.binary --trie models/trie --audio my_audio_file.wav +``` + +You can also install it using npm: + +``` +npm install deepspeech +``` + +For more information, refer to the [project’s homepage][2]. + +#### Kaldi + +![5 Good Open Source Speech Recognition/Speech-to-Text Systems 17 open source speech recognition][3] + +Kaldi is an open source speech recognition software written in C++, and is released under the Apache public license. It works on Windows, macOS and Linux. Its development started back in 2009. + +Kaldi’s main features over some other speech recognition software is that it’s extendable and modular; The community is providing tons of 3rd-party modules that you can use for your tasks. Kaldi also supports deep neural networks, and offers an [excellent documentation on its website][4]. + +While the code is mainly written in C++, it’s “wrapped” by Bash and Python scripts. So if you are looking just for the basic usage of converting speech to text, then you’ll find it easy to accomplish that via either Python or Bash. + +[Project’s homepage][5]. + +#### Julius + +![5 Good Open Source Speech Recognition/Speech-to-Text Systems 19 open source speech recognition][6] + +Probably one of the oldest speech recognition software ever; It’s development started in 1991 at the University of Kyoto, and then its ownership was transferred to an independent project team in 2005. + +Julius main features include its ability to perform real-time STT processes, low memory usage (Less than 64MB for 20000 words), ability to produce N-best/Word-graph output, ability to work as a server unit and a lot more. This software was mainly built for academic and research purposes. It is written in C, and works on Linux, Windows, macOS and even Android (on smartphones). + +Currently it supports both English and Japanese languages only. The software is probably availbale to install easily in your Linux distribution’s repository; Just search for julius package in your package manager. The latest version was [released][7] around one and half months ago. + +[Project’s homepage][8]. + +#### Wav2Letter++ + +![5 Good Open Source Speech Recognition/Speech-to-Text Systems 21 open source speech recognition][9] + +If you are looking for something modern, then this one is for you. Wav2Letter++ is an open source speech recognition software that was released by Facebook’s AI Research Team just 2 months ago. The code is released under the BSD license. + +Facebook is [describing][10] its library as “the fastest state-of-the-art speech recognition system available”. The concepts on which this tool is built makes it optimized for performance by default; Facebook’s also-new machine learning library [FlashLight][11] is used as the underlying core of Wav2Letter++. + +Wav2Letter++ needs you first to build a training model for the language you desire by yourself in order to train the algorithms on it. No pre-built support of any language (including English) is available; It’s just a machine-learning-driven tool to convert speech to text. It was written in C++, hence the name (Wav2Letter++). + +[Project’s homepage][12]. + +#### DeepSpeech2 + +![5 Good Open Source Speech Recognition/Speech-to-Text Systems 23 open source speech recognition][13] + +Researchers at the Chinese giant Baidu are also working on their own speech-to-text engine, called DeepSpeech2. It’s an end-to-end open source engine that uses the “PaddlePaddle” deep learning framework for converting both English & Mandarin Chinese languages speeches into text. The code is released under BSD license. + +The engine can be trained on any model and for any language you desire. The models are not released with the code; You’ll have to build them yourself, just like the other software. DeepSpeech2’s source code is written in Python; So it should be easy for you to get familiar with it if that’s the language you use. + +[Project’s homepage][14]. + +### Conclusion + +The speech recognition category is still mainly dominated by proprietary software giants like Google and IBM (which do provide their own closed-source commercial services for this), but the open source alternatives are promising. Those 5 open source speech recognition engines should get you going in building your application, all of them are still under heavy development by time. In few years, we expect open source to become the norm for those technologies just like in the other industries. + +If you have any other recommendations for this list, or comments in general, we’d love to hear them below! + +** + +Shares + + +-------------------------------------------------------------------------------- + +via: https://fosspost.org/lists/open-source-speech-recognition-speech-to-text + +作者:[Simon James][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fosspost.org/author/simonjames +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/hero_speech-machine-learning2.png?resize=820%2C280&ssl=1 (5 Good Open Source Speech Recognition/Speech-to-Text Systems 16 open source speech recognition) +[2]: https://github.com/mozilla/DeepSpeech +[3]: https://i0.wp.com/fosspost.org/wp-content/uploads/2019/02/Screenshot-at-2019-02-19-1134.png?resize=591%2C138&ssl=1 (5 Good Open Source Speech Recognition/Speech-to-Text Systems 18 open source speech recognition) +[4]: http://kaldi-asr.org/doc/index.html +[5]: http://kaldi-asr.org +[6]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/mic_web.png?resize=385%2C100&ssl=1 (5 Good Open Source Speech Recognition/Speech-to-Text Systems 20 open source speech recognition) +[7]: https://github.com/julius-speech/julius/releases +[8]: https://github.com/julius-speech/julius +[9]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/fully_convolutional_ASR.png?resize=850%2C177&ssl=1 (5 Good Open Source Speech Recognition/Speech-to-Text Systems 22 open source speech recognition) +[10]: https://code.fb.com/ai-research/wav2letter/ +[11]: https://github.com/facebookresearch/flashlight +[12]: https://github.com/facebookresearch/wav2letter +[13]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/ds2.png?resize=850%2C313&ssl=1 (5 Good Open Source Speech Recognition/Speech-to-Text Systems 24 open source speech recognition) +[14]: https://github.com/PaddlePaddle/DeepSpeech From cb224c138ed39b2ac6ae3e3538f93de605f53372 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:34:10 +0800 Subject: [PATCH 223/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180926=20HTTP:?= =?UTF-8?q?=20Brief=20History=20of=20HTTP=20sources/tech/20180926=20HTTP-?= =?UTF-8?q?=20Brief=20History=20of=20HTTP.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180926 HTTP- Brief History of HTTP.md | 286 ++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 sources/tech/20180926 HTTP- Brief History of HTTP.md diff --git a/sources/tech/20180926 HTTP- Brief History of HTTP.md b/sources/tech/20180926 HTTP- Brief History of HTTP.md new file mode 100644 index 0000000000..ef6fde90e6 --- /dev/null +++ b/sources/tech/20180926 HTTP- Brief History of HTTP.md @@ -0,0 +1,286 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (HTTP: Brief History of HTTP) +[#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) +[#]: author: (Ilya Grigorik https://www.igvita.com/) + +HTTP: Brief History of HTTP +====== + +### Introduction + +The Hypertext Transfer Protocol (HTTP) is one of the most ubiquitous and widely adopted application protocols on the Internet: it is the common language between clients and servers, enabling the modern web. From its simple beginnings as a single keyword and document path, it has become the protocol of choice not just for browsers, but for virtually every Internet-connected software and hardware application. + +In this chapter, we will take a brief historical tour of the evolution of the HTTP protocol. A full discussion of the varying HTTP semantics is outside the scope of this book, but an understanding of the key design changes of HTTP, and the motivations behind each, will give us the necessary background for our discussions on HTTP performance, especially in the context of the many upcoming improvements in HTTP/2. + +### §HTTP 0.9: The One-Line Protocol + +The original HTTP proposal by Tim Berners-Lee was designed with simplicity in mind as to help with the adoption of his other nascent idea: the World Wide Web. The strategy appears to have worked: aspiring protocol designers, take note. + +In 1991, Berners-Lee outlined the motivation for the new protocol and listed several high-level design goals: file transfer functionality, ability to request an index search of a hypertext archive, format negotiation, and an ability to refer the client to another server. To prove the theory in action, a simple prototype was built, which implemented a small subset of the proposed functionality: + + * Client request is a single ASCII character string. + + * Client request is terminated by a carriage return (CRLF). + + * Server response is an ASCII character stream. + + + + * Server response is a hypertext markup language (HTML). + + * Connection is terminated after the document transfer is complete. + + + + +However, even that sounds a lot more complicated than it really is. What these rules enable is an extremely simple, Telnet-friendly protocol, which some web servers support to this very day: + +``` +$> telnet google.com 80 + +Connected to 74.125.xxx.xxx + +GET /about/ + +(hypertext response) +(connection closed) +``` + +The request consists of a single line: `GET` method and the path of the requested document. The response is a single hypertext document—no headers or any other metadata, just the HTML. It really couldn’t get any simpler. Further, since the previous interaction is a subset of the intended protocol, it unofficially acquired the HTTP 0.9 label. The rest, as they say, is history. + +From these humble beginnings in 1991, HTTP took on a life of its own and evolved rapidly over the coming years. Let us quickly recap the features of HTTP 0.9: + + * Client-server, request-response protocol. + + * ASCII protocol, running over a TCP/IP link. + + * Designed to transfer hypertext documents (HTML). + + * The connection between server and client is closed after every request. + + +``` +Popular web servers, such as Apache and Nginx, still support the HTTP 0.9 protocol—in part, because there is not much to it! If you are curious, open up a Telnet session and try accessing google.com, or your own favorite site, via HTTP 0.9 and inspect the behavior and the limitations of this early protocol. +``` + +### §HTTP/1.0: Rapid Growth and Informational RFC + +The period from 1991 to 1995 is one of rapid coevolution of the HTML specification, a new breed of software known as a "web browser," and the emergence and quick growth of the consumer-oriented public Internet infrastructure. + +``` +##### §The Perfect Storm: Internet Boom of the Early 1990s + +Building on Tim Berner-Lee’s initial browser prototype, a team at the National Center of Supercomputing Applications (NCSA) decided to implement their own version. With that, the first popular browser was born: NCSA Mosaic. One of the programmers on the NCSA team, Marc Andreessen, partnered with Jim Clark to found Mosaic Communications in October 1994. The company was later renamed Netscape, and it shipped Netscape Navigator 1.0 in December 1994. By this point, it was already clear that the World Wide Web was bound to be much more than just an academic curiosity. + +In fact, that same year the first World Wide Web conference was organized in Geneva, Switzerland, which led to the creation of the World Wide Web Consortium (W3C) to help guide the evolution of HTML. Similarly, a parallel HTTP Working Group (HTTP-WG) was established within the IETF to focus on improving the HTTP protocol. Both of these groups continue to be instrumental to the evolution of the Web. + +Finally, to create the perfect storm, CompuServe, AOL, and Prodigy began providing dial-up Internet access to the public within the same 1994–1995 time frame. Riding on this wave of rapid adoption, Netscape made history with a wildly successful IPO on August 9, 1995—the Internet boom had arrived, and everyone wanted a piece of it! +``` + +The growing list of desired capabilities of the nascent Web and their use cases on the public Web quickly exposed many of the fundamental limitations of HTTP 0.9: we needed a protocol that could serve more than just hypertext documents, provide richer metadata about the request and the response, enable content negotiation, and more. In turn, the nascent community of web developers responded by producing a large number of experimental HTTP server and client implementations through an ad hoc process: implement, deploy, and see if other people adopt it. + +From this period of rapid experimentation, a set of best practices and common patterns began to emerge, and in May 1996 the HTTP Working Group (HTTP-WG) published RFC 1945, which documented the "common usage" of the many HTTP/1.0 implementations found in the wild. Note that this was only an informational RFC: HTTP/1.0 as we know it is not a formal specification or an Internet standard! + +Having said that, an example HTTP/1.0 request should look very familiar: + +``` +$> telnet website.org 80 + +Connected to xxx.xxx.xxx.xxx + +GET /rfc/rfc1945.txt HTTP/1.0 +User-Agent: CERN-LineMode/2.15 libwww/2.17b3 +Accept: */* + +HTTP/1.0 200 OK +Content-Type: text/plain +Content-Length: 137582 +Expires: Thu, 01 Dec 1997 16:00:00 GMT +Last-Modified: Wed, 1 May 1996 12:45:26 GMT +Server: Apache 0.84 + +(plain-text response) +(connection closed) +``` + + 1. Request line with HTTP version number, followed by request headers + + 2. Response status, followed by response headers + + + + +The preceding exchange is not an exhaustive list of HTTP/1.0 capabilities, but it does illustrate some of the key protocol changes: + + * Request may consist of multiple newline separated header fields. + + * Response object is prefixed with a response status line. + + * Response object has its own set of newline separated header fields. + + * Response object is not limited to hypertext. + + * The connection between server and client is closed after every request. + + + + +Both the request and response headers were kept as ASCII encoded, but the response object itself could be of any type: an HTML file, a plain text file, an image, or any other content type. Hence, the "hypertext transfer" part of HTTP became a misnomer not long after its introduction. In reality, HTTP has quickly evolved to become a hypermedia transport, but the original name stuck. + +In addition to media type negotiation, the RFC also documented a number of other commonly implemented capabilities: content encoding, character set support, multi-part types, authorization, caching, proxy behaviors, date formats, and more. + +``` +Almost every server on the Web today can and will still speak HTTP/1.0. Except that, by now, you should know better! Requiring a new TCP connection per request imposes a significant performance penalty on HTTP/1.0; see [Three-Way Handshake][1], followed by [Slow-Start][2]. +``` + +### §HTTP/1.1: Internet Standard + +The work on turning HTTP into an official IETF Internet standard proceeded in parallel with the documentation effort around HTTP/1.0 and happened over a period of roughly four years: between 1995 and 1999. In fact, the first official HTTP/1.1 standard is defined in RFC 2068, which was officially released in January 1997, roughly six months after the publication of HTTP/1.0. Then, two and a half years later, in June of 1999, a number of improvements and updates were incorporated into the standard and were released as RFC 2616. + +The HTTP/1.1 standard resolved a lot of the protocol ambiguities found in earlier versions and introduced a number of critical performance optimizations: keepalive connections, chunked encoding transfers, byte-range requests, additional caching mechanisms, transfer encodings, and request pipelining. + +With these capabilities in place, we can now inspect a typical HTTP/1.1 session as performed by any modern HTTP browser and client: + +``` +$> telnet website.org 80 +Connected to xxx.xxx.xxx.xxx + +GET /index.html HTTP/1.1 +Host: website.org +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) +Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 +Accept-Encoding: gzip,deflate,sdch +Accept-Language: en-US,en;q=0.8 +Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 +Cookie: __qca=P0-800083390... (snip) + +HTTP/1.1 200 OK +Server: nginx/1.0.11 +Connection: keep-alive +Content-Type: text/html; charset=utf-8 +Via: HTTP/1.1 GWA +Date: Wed, 25 Jul 2012 20:23:35 GMT +Expires: Wed, 25 Jul 2012 20:23:35 GMT +Cache-Control: max-age=0, no-cache +Transfer-Encoding: chunked + +100 + +(snip) + +100 +(snip) + +0 + +GET /favicon.ico HTTP/1.1 +Host: www.website.org +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) +Accept: */* +Referer: http://website.org/ +Connection: close +Accept-Encoding: gzip,deflate,sdch +Accept-Language: en-US,en;q=0.8 +Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 +Cookie: __qca=P0-800083390... (snip) + +HTTP/1.1 200 OK +Server: nginx/1.0.11 +Content-Type: image/x-icon +Content-Length: 3638 +Connection: close +Last-Modified: Thu, 19 Jul 2012 17:51:44 GMT +Cache-Control: max-age=315360000 +Accept-Ranges: bytes +Via: HTTP/1.1 GWA +Date: Sat, 21 Jul 2012 21:35:22 GMT +Expires: Thu, 31 Dec 2037 23:55:55 GMT +Etag: W/PSA-GAu26oXbDi + +(icon data) +(connection closed) +``` + + 1. Request for HTML file, with encoding, charset, and cookie metadata + + 2. Chunked response for original HTML request + + 3. Number of octets in the chunk expressed as an ASCII hexadecimal number (256 bytes) + + 4. End of chunked stream response + + 5. Request for an icon file made on same TCP connection + + 6. Inform server that the connection will not be reused + + 7. Icon response, followed by connection close + + + + +Phew, there is a lot going on in there! The first and most obvious difference is that we have two object requests, one for an HTML page and one for an image, both delivered over a single connection. This is connection keepalive in action, which allows us to reuse the existing TCP connection for multiple requests to the same host and deliver a much faster end-user experience; see [Optimizing for TCP][3]. + +To terminate the persistent connection, notice that the second client request sends an explicit `close` token to the server via the `Connection` header. Similarly, the server can notify the client of the intent to close the current TCP connection once the response is transferred. Technically, either side can terminate the TCP connection without such signal at any point, but clients and servers should provide it whenever possible to enable better connection reuse strategies on both sides. + +``` +HTTP/1.1 changed the semantics of the HTTP protocol to use connection keepalive by default. Meaning, unless told otherwise (via `Connection: close` header), the server should keep the connection open by default. + +However, this same functionality was also backported to HTTP/1.0 and enabled via the `Connection: Keep-Alive` header. Hence, if you are using HTTP/1.1, technically you don’t need the `Connection: Keep-Alive` header, but many clients choose to provide it nonetheless. +``` + +Additionally, the HTTP/1.1 protocol added content, encoding, character set, and even language negotiation, transfer encoding, caching directives, client cookies, plus a dozen other capabilities that can be negotiated on each request. + +We are not going to dwell on the semantics of every HTTP/1.1 feature. This is a subject for a dedicated book, and many great ones have been written already. Instead, the previous example serves as a good illustration of both the quick progress and evolution of HTTP, as well as the intricate and complicated dance of every client-server exchange. There is a lot going on in there! + +``` +For a good reference on all the inner workings of the HTTP protocol, check out O’Reilly’s HTTP: The Definitive Guide by David Gourley and Brian Totty. +``` + +### §HTTP/2: Improving Transport Performance + +Since its publication, RFC 2616 has served as a foundation for the unprecedented growth of the Internet: billions of devices of all shapes and sizes, from desktop computers to the tiny web devices in our pockets, speak HTTP every day to deliver news, video, and millions of other web applications we have all come to depend on in our lives. + +What began as a simple, one-line protocol for retrieving hypertext quickly evolved into a generic hypermedia transport, and now a decade later can be used to power just about any use case you can imagine. Both the ubiquity of servers that can speak the protocol and the wide availability of clients to consume it means that many applications are now designed and deployed exclusively on top of HTTP. + +Need a protocol to control your coffee pot? RFC 2324 has you covered with the Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)—originally an April Fools’ Day joke by IETF, and increasingly anything but a joke in our new hyper-connected world. + +> The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol that can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. +> +> RFC 2616: HTTP/1.1, June 1999 + +The simplicity of the HTTP protocol is what enabled its original adoption and rapid growth. In fact, it is now not unusual to find embedded devices—sensors, actuators, and coffee pots alike—using HTTP as their primary control and data protocols. But under the weight of its own success and as we increasingly continue to migrate our everyday interactions to the Web—social, email, news, and video, and increasingly our entire personal and job workspaces—it has also begun to show signs of stress. Users and web developers alike are now demanding near real-time responsiveness and protocol performance from HTTP/1.1, which it simply cannot meet without some modifications. + +To meet these new challenges, HTTP must continue to evolve, and hence the HTTPbis working group announced a new initiative for HTTP/2 in early 2012: + +> There is emerging implementation experience and interest in a protocol that retains the semantics of HTTP without the legacy of HTTP/1.x message framing and syntax, which have been identified as hampering performance and encouraging misuse of the underlying transport. +> +> The working group will produce a specification of a new expression of HTTP’s current semantics in ordered, bi-directional streams. As with HTTP/1.x, the primary target transport is TCP, but it should be possible to use other transports. +> +> HTTP/2 charter, January 2012 + +The primary focus of HTTP/2 is on improving transport performance and enabling both lower latency and higher throughput. The major version increment sounds like a big step, which it is and will be as far as performance is concerned, but it is important to note that none of the high-level protocol semantics are affected: all HTTP headers, values, and use cases are the same. + +Any existing website or application can and will be delivered over HTTP/2 without modification: you do not need to modify your application markup to take advantage of HTTP/2. The HTTP servers will have to speak HTTP/2, but that should be a transparent upgrade for the majority of users. The only difference if the working group meets its goal, should be that our applications are delivered with lower latency and better utilization of the network link! + +Having said that, let’s not get ahead of ourselves. Before we get to the new HTTP/2 protocol features, it is worth taking a step back and examining our existing deployment and performance best practices for HTTP/1.1. The HTTP/2 working group is making fast progress on the new specification, but even if the final standard was already done and ready, we would still have to support older HTTP/1.1 clients for the foreseeable future—realistically, a decade or more. + +-------------------------------------------------------------------------------- + +via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol + +作者:[Ilya Grigorik][a] +选题:[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.igvita.com/ +[b]: https://github.com/lujun9972 +[1]: https://hpbn.co/building-blocks-of-tcp/#three-way-handshake +[2]: https://hpbn.co/building-blocks-of-tcp/#slow-start +[3]: https://hpbn.co/building-blocks-of-tcp/#optimizing-for-tcp From 4dcd18ba7cb57ed06d321d63093be09cdfdb6a84 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:39:50 +0800 Subject: [PATCH 224/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20Logica?= =?UTF-8?q?l=20&=20in=20Bash=20sources/tech/20190219=20Logical=20-=20in=20?= =?UTF-8?q?Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20190219 Logical - in Bash.md | 227 +++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 sources/tech/20190219 Logical - in Bash.md diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md new file mode 100644 index 0000000000..adc8e4c465 --- /dev/null +++ b/sources/tech/20190219 Logical - in Bash.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Logical & in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Logical & in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) + +One would think you could dispatch `&` in two articles. Turns out you can't. While [the first article dealt with using `&` at the end of commands to push them into the background][1] and then diverged into explaining process management, the second article saw [`&` being used as a way to refer to file descriptors][2], which led us to seeing how, combined with `<` and `>`, you can route inputs and outputs from and to different places. + +This means we haven't even touched on `&` as an AND operator, so let's do that now. + +### & is a Bitwise Operator + +If you are at all familiar with binary operations, you will have heard of AND and OR. These are bitwise operations that operate on individual bits of a binary number. In Bash, you use `&` as the AND operator and `|` as the OR operator: + +**AND** + +``` +0 & 0 = 0 + +0 & 1 = 0 + +1 & 0 = 0 + +1 & 1 = 1 +``` + +**OR** + +``` +0 | 0 = 0 + +0 | 1 = 1 + +1 | 0 = 1 + +1 | 1 = 1 +``` + +You can test this by ANDing any two numbers and outputting the result with `echo`: + +``` +$ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 + +2 + +$ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 + +96 +``` + +The same goes for OR (`|`): + +``` +$ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 + +3 + +$ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 + +121 +``` + +Three things about this: + + 1. You use `(( ... ))` to tell Bash that what goes between the double brackets is some sort of arithmetic or logical operation. `(( 2 + 2 ))`, `(( 5 % 2 ))` (`%` being the [modulo][3] operator) and `((( 5 % 2 ) + 1))` (equals 3) will all work. + 2. [Like with variables][4], `$` extracts the value so you can use it. + 3. For once spaces don't matter: `((2+3))` will work the same as `(( 2+3 ))` and `(( 2 + 3 ))`. + 4. Bash only operates with integers. Trying to do something like this `(( 5 / 2 ))` will give you "2", and trying to do something like this `(( 2.5 & 7 ))` will result in an error. Then again, using anything but integers in a bitwise operation (which is what we are talking about now) is generally something you wouldn't do anyway. + + + +**TIP:** If you want to check what your decimal number would look like in binary, you can use _bc_ , the command-line calculator that comes preinstalled with most Linux distros. For example, using: + +``` +bc <<< "obase=2; 97" +``` + +will convert `97` to binary (the _o_ in `obase` stands for _output_ ), and ... + +``` +bc <<< "ibase=2; 11001011" +``` + +will convert `11001011` to decimal (the _i_ in `ibase` stands for _input_ ). + +### && is a Logical Operator + +Although it uses the same logic principles as its bitwise cousin, Bash's `&&` operator can only render two results: 1 ("true") and 0 ("false"). For Bash, any number not 0 is “true” and anything that equals 0 is “false.” What is also false is anything that is not a number: + +``` +$ echo $(( 4 && 5 )) # Both non-zero numbers, both true = true + +1 + +$ echo $(( 0 && 5 )) # One zero number, one is false = false + +0 + +$ echo $(( b && 5 )) # One of them is not number, one is false = false + +0 +``` + +The OR counterpart for `&&` is `||` and works exactly as you would expect. + +All of this is simple enough... until it comes to a command's exit status. + +### && is a Logical Operator for Command Exit Status + +[As we have seen in previous articles][2], as a command runs, it outputs error messages. But, more importantly for today's discussion, it also outputs a number when it ends. This number is called an _exit code_ , and if it is 0, it means the command did not encounter any problem during its execution. If it is any other number, it means something, somewhere, went wrong, even if the command completed. + +So 0 is good, any other number is bad, and, in the context of exit codes, 0/good means "true" and everything else means “false.” Yes, this is **the exact contrary of what you saw in the logical operations above** , but what are you gonna do? Different contexts, different rules. The usefulness of this will become apparent soon enough. + +Moving on. + +Exit codes are stored _temporarily_ in the [special variable][5] `?` \-- yes, I know: another confusing choice. Be that as it may, [remember that in our article about variables][4], and we said that you read the value in a variable using a the `$` symbol. So, if you want to know if a command has run without a hitch, you have to read `?` as soon as the command finishes and before running anything else. + +Try it with: + +``` +$ find /etc -iname "*.service" + +find: '/etc/audisp/plugins.d': Permission denied + +/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service + +/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service + +[etcetera] +``` + +[As you saw in the previous article][2], running `find` over _/etc_ as a regular user will normally throw some errors when it tries to read subdirectories for which you do not have access rights. + +So, if you execute... + +``` +echo $? +``` + +... right after `find`, it will print a `1`, indicating that there were some errors. + +(Notice that if you were to run `echo $?` a second time in a row, you'd get a `0`. This is because `$?` would contain the exit code of `echo $?`, which, supposedly, will have executed correctly. So the first lesson when using `$?` is: **use`$?` straight away** or store it somewhere safe -- like in another variable, or you will lose it). + +One immediate use of `?` is to fold it into a list of chained commands and bork the whole thing if anything fails as Bash runs through it. For example, you may be familiar with the process of building and compiling the source code of an application. You can run them on after another by hand like this: + +``` +$ configure + +. + +. + +. + +$ make + +. + +. + +. + +$ make install + +. + +. + +. +``` + +You can also put all three on one line... + +``` +$ configure; make; make install +``` + +... and hope for the best. + +The disadvantage of this is that if, say, `configure` fails, Bash will still try and run `make` and `sudo make install`, even if there is nothing to make or, indeed, install. + +The smarter way of doing it is like this: + +``` +$ configure && make && make install +``` + +This takes the exit code from each command and uses it as an operand in a chained `&&` operation. + +But, and here's the kicker, Bash knows the whole thing is going to fail if `configure` returns a non-zero result. If that happens, it doesn't have to run `make` to check its exit code, since the result is going to be false no matter what. So, it forgoes `make` and just passes a non-zero result onto the next step of the operation. And, as `configure && make` delivers false, Bash doesn't have to run `make install` either. This means that, in a long chain of commands, you can join them with `&&`, and, as soon as one fails, you can save time as the rest of the commands get canceled immediately. + +You can do something similar with `||`, the OR logical operator, and make Bash continue processing chained commands if only one of a pair completes. + +In view of all this (along with the stuff we covered earlier), you should now have a clearer idea of what the command line we set at the beginning of [this article does][1]: + +``` +mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & +``` + +So, assuming you are running the above from a directory for which you have read and write privileges, what it does it do and how does it do it? How does it avoid unseemly and potentially execution-breaking errors? Next week, apart from giving you the solution, we'll be dealing with brackets: curly, curvy and straight. Don't miss it! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash + +作者:[Paul 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://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[2]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash +[3]: https://en.wikipedia.org/wiki/Modulo_operation +[4]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise +[5]: https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html From 7540b36389bfd81849dfcacd9aaf87502a3bbbe3 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:42:04 +0800 Subject: [PATCH 225/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How=20?= =?UTF-8?q?our=20non-profit=20works=20openly=20to=20make=20education=20acc?= =?UTF-8?q?essible=20sources/talk/20190219=20How=20our=20non-profit=20work?= =?UTF-8?q?s=20openly=20to=20make=20education=20accessible.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rks openly to make education accessible.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sources/talk/20190219 How our non-profit works openly to make education accessible.md diff --git a/sources/talk/20190219 How our non-profit works openly to make education accessible.md b/sources/talk/20190219 How our non-profit works openly to make education accessible.md new file mode 100644 index 0000000000..eee670610c --- /dev/null +++ b/sources/talk/20190219 How our non-profit works openly to make education accessible.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How our non-profit works openly to make education accessible) +[#]: via: (https://opensource.com/open-organization/19/2/building-curriculahub) +[#]: author: (Tanner Johnson https://opensource.com/users/johnsontanner3) + +How our non-profit works openly to make education accessible +====== +To build an open access education hub, our team practiced the same open methods we teach our students. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Education_2_OpenAccess_1040x584_12268077_0614MM.png?itok=xb96iaHe) + +I'm lucky to work with a team of impressive students at Duke University who are leaders in their classrooms and beyond. As members of [CSbyUs][1], a non-profit and student-run organization based at Duke, we connect university students to middle school students, mostly from [title I schools][2] across North Carolina's Research Triangle Park. Our mission is to fuel future change agents from under-resourced learning environments by fostering critical technology skills for thriving in the digital age. + +The CSbyUs Tech R&D team (TRD for short) recently set an ambitious goal to build and deploy a powerful web application over the course of one fall semester. Our team of six knew we had to do something about our workflow to ship a product by winter break. In our middle school classrooms, we teach our learners to use agile methodologies and design thinking to create mobile applications. On the TRD team, we realized we needed to practice what we preach in those classrooms to ship a quality product by semester's end. + +This is the story of how and why we utilized the principles we teach our students in order to deploy technology that will scale our mission and make our teaching resources open and accessible. + +### Setting the scene + +For the past two years, CSbyUs has operated "on the ground," connecting Duke undergraduates to Durham middle schools via after-school programming. After teaching and evaluating several iterations of our unique, student-centered mobile app development curriculum, we saw promising results. Our middle schoolers were creating functional mobile apps, connecting to their mentors, and leaving the class more confident in their computer science skills. Naturally, we wondered how to expand our programming. + +We knew we should take our own advice and lean into web-based technologies to share our work, but we weren't immediately sure what problem we needed to solve. Ultimately, we decided to create a web app that serves as a centralized hub for open source and open access digital education curricula. "CurriculaHub" (name inspired by GitHub) would be the defining pillar of CSbyUs's new website, where educators could share and adapt resources. + +But the vision and implementation didn't happen overnight. + +Given our sense of urgency and the potential of "CurriculaHub," we wanted to start this project with a well defined plan. The stakes were (and are) high, so planning, albeit occasionally tedious, was critical to our success. Like the curriculum we teach, we scaffolded our workflow process with design thinking and agile methodology, two critical 21st century frameworks we often fail to practice in higher ed. + +What follows is a step-wise explanation of our design thinking process, starting from inspiration and ending in a shipped prototype. + +``` +This is the story of how and why we utilized the principles we teach our students in order to deploy technology that will scale our mission and make our teaching resources open and accessible. +``` + +### Our Process + +#### **Step 1: Pre-Work** + +In order to understand the why to our what, you have to know who our team is. + +The members of this team are busy. All of us contribute to CSbyUs beyond our TRD-related responsibilities. As an organization with lofty goals beyond creating a web-based platform, we have to reconcile our "on the ground" commitments (i.e., curriculum curation, research and evaluation, mentorship training and practice, presentations at conferences, etc.) with our "in the cloud" technological goals. + +In addition to balancing time across our organization, we have to be flexible in the ways we communicate. As a remote member of the team, I'm writing this post from Spain, but the rest of our team is based in North Carolina, adding collaboration challenges. + +Before diving into development (or even problem identification), we knew we had to set some clear expectations for how we'd operate as a team. We took a note from our curriculum team's book and started with some [rules of engagement][3]. This is actually [a well-documented approach][4] to setting up a team's [social contract][5] used by teams across the tech space. During a summer internship at IBM, I remember pre-project meetings where my manager and team spent more than an hour clarifying principles of interaction. Whenever we faced uncertainty in our team operations, we'd pull out the rules of engagement and clear things up almost immediately. (An aside: I've found this strategy to be wildly effective not only in my teams, but in all relationships). + +Considering the remote nature of our team, one of our favorite tools is Slack. We use it for almost everything. We can't have sticky-note brainstorms, so we create Slack brainstorm threads. In fact, that's exactly what we did to generate our rules of engagement. One [open source principle we take to heart is transparency][6]; Slack allows us to archive and openly share our thought processes and decision-making steps with the rest of our team. + +#### **Step 2: Empathy Research** + +We're all here for unique reasons, but we find a common intersection: the desire to broaden equity in access to quality digital era education. + +Each member of our team has been lucky enough to study at Duke. We know how it feels to have limitless opportunities and the support of talented peers and renowned professors. But we're mindful that this isn't normal. Across the country and beyond, these opportunities are few and far between. Where they do exist, they're confined within the guarded walls of higher institutes of learning or come with a lofty price tag. + +While our team members' common desire to broaden access is clear, we work hard to root our decisions in research. So our team begins each semester [reviewing][7] [research][8] that justifies our existence. TRD works with CRD (curriculum research and development) and TT (teaching team), our two other CSbyUs sub-teams, to discuss current trends in digital education access, their systemic roots, and novel approaches to broaden access and make materials relevant to learners. We not only perform research collaboratively at the beginning of the semester but also implement weekly stand-up research meetings with the sub-teams. During these, CRD often presents new findings we've gleaned from interviewing current teachers and digging into the current state of access in our local community. They are our constant source of data-driven, empathy-fueling research. + +Through this type of empathy-based research, we have found that educators interested in student-centered teaching and digital era education lack a centralized space for proven and adaptable curricula and lesson plans. The bureaucracy and rigid structures that shape classroom learning in the United States makes reshaping curricula around the personal needs of students daunting and seemingly impossible. As students, educators, and technologists, we wondered how we might unleash the creativity and agency of others by sharing our own resources and creating an online ecosystem of support. + +#### **Step 3: Defining the Problem** + +We wanted to avoid [scope creep][9] caused by a poorly defined mission and vision (something that happens too often in some organizations). We needed structures to define our goals and maintain clarity in scope. Before imagining our application features, we knew we'd have to start with defining our north star. We would generate a clear problem statement to which we could refer throughout development. + +Before imagining our application features, we knew we'd have to start with defining our north star. + +This is common practice for us. Before committing to new programming, new partnerships, or new changes, the CSbyUs team always refers back to our mission and vision and asks, "Does this make sense?" (in fact, we post our mission and vision to the top of every meeting minutes document). If it fits and we have capacity to pursue it, we go for it. And if we don't, then we don't. In the case of a "no," we are always sure to document what and why because, as engineers know, [detailed logs are almost always a good decision][10]. TRD gleaned that big-picture wisdom and implemented a group-defined problem statement to guide our sub-team mission and future development decisions. + +To formulate a single, succinct problem statement, we each began by posting our own takes on the problem. Then, during one of our weekly [30-minute-no-more-no-less stand-up meetings][11], we identified commonalities and differences, ultimately [merging all our ideas into one][12]. Boiled down, we identified that there exist massive barriers for educators, parents, and students to share, modify, and discuss open source and accessible curricula. And of course, our mission would be to break down those barriers with user-centered technology. This "north star" lives as a highly visible document in our Google Drive, which has influenced our feature prioritization and future directions. + +#### **Step 4: Ideating a Solution** + +With our problem defined and our rules of engagement established, we were ready to imagine a solution. + +We believe that effective structures can ensure meritocracy and community. Sometimes, certain personalities dominate team decision-making and leave little space for collaborative input. To avoid that pitfall and maximize our equality of voice, we tend to use "offline" individual brainstorms and merge collective ideas online. It's the same process we used to create our rules of engagement and problem statement. In the case of ideating a solution, we started with "offline" brainstorms of three [S.M.A.R.T. goals][13]. Those goals would be ones we could achieve as a software development team (specifically because the CRD and TT teams offer different skill sets) and address our problem statement. Finally, we wrote these goals in a meeting minutes document, clustering common goals and ultimately identifying themes that describe our application features. In the end, we identified three: support, feedback, and open source curricula. + +From here, we divided ourselves into sub-teams, repeating the goal-setting process with those teams—but in a way that was specific to our features. And if it's not obvious by now, we realized a web-based platform would be the most optimal and scalable solution for supporting students, educators, and parents by providing a hub for sharing and adapting proven curricula. + +To work efficiently, we needed to be adaptive, reinforcing structures that worked and eliminating those that didn't. For example, we put a lot of effort in crafting meeting agendas. We strive to include only those subjects we must discuss in-person and table everything else for offline discussions on Slack or individually organized calls. We practice this in real time, too. During our regular meetings on Google Hangouts, if someone brings up a topic that isn't highly relevant or urgent, the current stand-up lead (a role that rotates weekly) "parking lots" it until the end of the meeting. If we have space at the end, we pull from the parking lot, and if not, we reserve that discussion for a Slack thread. + +This prioritization structure has led to massive gains in meeting efficiency and a focus on progress updates, shared technical hurdle discussions, collective decision-making, and assigning actionable tasks (the next-steps a person has committed to taking, documented with their name attached for everyone to view). + +#### **Step 5: Prototyping** + +This is where the fun starts. + +Our team was only able to unite new people with highly varied experience through the power of open principles and methodologies. + +Given our requirements—like an interactive user experience, the ability to collaborate on blogs and curricula, and the ability to receive feedback from our users—we began identifying the best technologies. Ultimately, we decided to build our web app with a ReactJS frontend and a Ruby on Rails backend. We chose these due to the extensive documentation and active community for both, and the well-maintained libraries that bridge the relationship between the two (e.g., react-on-rails). Since we chose Rails for our backend, it was obvious from the start that we'd work within a Model-View-Controller framework. + +Most of us didn't have previous experience with web development, neither on the frontend nor the backend. So, getting up and running with either technology independently presented a steep learning curve, and gluing the two together only steepened it. To centralize our work, we use an open-access GitHub repository. Given our relatively novice experience in web development, our success hinged on extremely efficient and open collaborations. + +And to explain that, we need to revisit the idea of structures. Some of ours include peer code reviews—where we can exchange best-practices and reusable solutions, maintaining up-to-date tech and user documentation so we can look back and understand design decisions—and (my personal favorite) our questions bot on Slack, which gently reminds us to post and answer questions in a separate Slack #questions channel. + +We've also dabbled with other strategies, like instructional videos for generating basic React components and rendering them in Rails Views. I tried this and in my first video, [I covered a basic introduction to our repository structure][14] and best practices for generating React components. While this proved useful, our team has since realized the wealth of online resources that document various implementations of these technologies robustly. Also, we simply haven't had enough time (but we might revisit them in the future—stay tuned). + +We're also excited about our cloud-based implementation. We use Heroku to host our application and manage data storage. In next iterations, we plan to both expand upon our current features and configure a continuous iteration/continuous development pipeline using services like Jenkins integrated with GitHub. + +#### **Step 6: Testing** + +Since we've [just deployed][1], we are now in a testing stage. Our goals are to collect user feedback across our feature domains and our application experience as a whole, especially as they interact with our specific audiences. Given our original constraints (namely, time and people power), this iteration is the first of many to come. For example, future iterations will allow for individual users to register accounts and post external curricula directly on our site without going through the extra steps of email. We want to scale and maximize our efficiency, and that's part of the recipe we'll deploy in future iterations. As for user testing: We collect user feedback via our contact form, via informal testing within our team, and via structured focus groups. [We welcome your constructive feedback and collaboration][15]. + +Our team was only able to unite new people with highly varied experience through the power of open principles and methodologies. Luckily enough, each one I described in this post is adaptable to virtually every team. + +Regardless of whether you work—on a software development team, in a classroom, or, heck, [even in your family][16]—principles like transparency and community are almost always the best foundation for a successful organization. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/2/building-curriculahub + +作者:[Tanner Johnson][a] +选题:[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/johnsontanner3 +[b]: https://github.com/lujun9972 +[1]: http://csbyus.org +[2]: https://www2.ed.gov/programs/titleiparta/index.html +[3]: https://docs.google.com/document/d/1tqV6B6Uk-QB7Psj1rX9tfCyW3E64_v6xDlhRZ-L2rq0/edit +[4]: https://www.atlassian.com/team-playbook/plays/rules-of-engagement +[5]: https://openpracticelibrary.com/practice/social-contract/ +[6]: https://opensource.com/open-organization/resources/open-org-definition +[7]: https://services.google.com/fh/files/misc/images-of-computer-science-report.pdf +[8]: https://drive.google.com/file/d/1_iK0ZRAXVwGX9owtjUUjNz3_2kbyYZ79/view?usp=sharing +[9]: https://www.pmi.org/learning/library/top-five-causes-scope-creep-6675 +[10]: https://www.codeproject.com/Articles/42354/The-Art-of-Logging#what +[11]: https://opensource.com/open-organization/16/2/6-steps-running-perfect-30-minute-meeting +[12]: https://docs.google.com/document/d/1wdPRvFhMKPCrwOG2CGp7kP4rKOXrJKI77CgjMfaaXnk/edit?usp=sharing +[13]: https://www.projectmanager.com/blog/how-to-create-smart-goals +[14]: https://www.youtube.com/watch?v=52kvV0plW1E +[15]: http://csbyus.org/ +[16]: https://opensource.com/open-organization/15/11/what-our-families-teach-us-about-organizational-life From 6718bf04e62ef99eae2604f61bb89ea22eac5b1a Mon Sep 17 00:00:00 2001 From: AnDJ <363787371@qq.com> Date: Wed, 20 Feb 2019 09:48:37 +0800 Subject: [PATCH 226/813] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ow to Change User Password in Ubuntu -Beginner-s Tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md index d1c179123b..30691f7d5d 100644 --- a/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md +++ b/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (An-DJ ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d54b59199c5428ff91a0f6d599dd1e26c52a74b2 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:51:21 +0800 Subject: [PATCH 227/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20SPEED?= =?UTF-8?q?=20TEST:=20x86=20vs.=20ARM=20for=20Web=20Crawling=20in=20Python?= =?UTF-8?q?=20sources/tech/20190218=20SPEED=20TEST-=20x86=20vs.=20ARM=20fo?= =?UTF-8?q?r=20Web=20Crawling=20in=20Python.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... x86 vs. ARM for Web Crawling in Python.md | 533 ++++++++++++++++++ 1 file changed, 533 insertions(+) create mode 100644 sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md diff --git a/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md b/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md new file mode 100644 index 0000000000..86b5230d2d --- /dev/null +++ b/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md @@ -0,0 +1,533 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SPEED TEST: x86 vs. ARM for Web Crawling in Python) +[#]: via: (https://blog.dxmtechsupport.com.au/speed-test-x86-vs-arm-for-web-crawling-in-python/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +SPEED TEST: x86 vs. ARM for Web Crawling in Python +====== + +![][1] + +Can you imagine if your job was to trawl competitor websites and jot prices down by hand, again and again and again? You’d burn your whole office down by lunchtime. + +So, little wonder web crawlers are huge these days. They can keep track of customer sentiment and trending topics, monitor job openings, real estate transactions, UFC results, all sorts of stuff. + +For those of a certain bent, this is fascinating stuff. Which is how I found myself playing around with [Scrapy][2], an open source web crawling framework written in Python. + +Being wary of the potential to do something catastrophic to my computer while poking with things I didn’t understand, I decided to install it on my main machine but a Raspberry Pi. + +And wouldn’t you know it? It actually didn’t run too shabby on the little tacker. Maybe this is a good use case for an ARM server? + +Google had no solid answer. The nearest thing I found was [this Drupal hosting drag race][3], which showed an ARM server outperforming a much more expensive x86 based account. + +That was definitely interesting. I mean, isn’t a web server kind of like a crawler in reverse? But with one operating on a LAMP stack and the other on a Python interpreter, it’s hardly the exact same thing. + +So what could I do? Only one thing. Get some VPS accounts and make them race each other. + +### What’s the Deal With ARM Processors? + +ARM is now the most popular CPU architecture in the world. + +But it’s generally seen as something you’d opt for to save money and battery life, rather than a serious workhorse. + +It wasn’t always that way: this CPU was designed in Cambridge, England to power the fiendishly expensive [Acorn Archimedes][4]. This was the most powerful desktop computer in the world, and by a long way too: it was multiple times the speed of the fastest 386. + +Acorn, like Commodore and Atari, somewhat ignorantly believed that the making of a great computer company was in the making of great computers. Bill Gates had a better idea. He got DOS on as many x86 machines – of the most widely varying quality and expense – as he could. + +Having the best user base made you the obvious platform for third party developers to write software for; having all the software support made yours the most useful computer. + +Even Apple nearly bit the dust. All the $$$$ were in building a better x86 chip, this was the architecture that ended up being developed for serious computing. + +That wasn’t the end for ARM though. Their chips weren’t just fast, they could run well without drawing much power or emitting much heat. That made them a preferred technology in set top boxes, PDAs, digital cameras, MP3 players, and basically anything that either used a battery or where you’d just rather avoid the noise of a large fan. + +So it was that Acorn spun off ARM, who began an idiosyncratic business model that continues to today: ARM doesn’t actually manufacture any chips, they license their intellectual property to others who do. + +Which is more or less how they ended up in so many phones and tablets. When Linux was ported to the architecture, the door opened to other open source technologies, which is how we can run a web crawler on these chips today. + +#### ARM in the Server Room + +Some big names, like [Microsoft][5] and [Cloudflare][6], have placed heavy bets on the British Bulldog for their infrastructure. But for those of us with more modest budgets, the options are fairly sparse. + +In fact, when it comes to cheap and cheerful VPS accounts that you can stick on the credit card for a few bucks a month, for years the only option was [Scaleway][7]. + +This changed a few months ago when public cloud heavyweight [AWS][8] launched its own ARM processor: the [AWS Graviton][9]. + +I decided to grab one of each, and race them against the most similar Intel offering from the same provider. + +### Looking Under the Hood + +So what are we actually racing here? Let’s jump right in. + +#### Scaleway + +Scaleway positions itself as “designed for developers”. And you know what? I think that’s fair enough: it’s definitely been a good little sandbox for developing and prototyping. + +The dirt simple product offering and clean, easy dashboard guides you from home page to bash shell in minutes. That makes it a strong option for small businesses, freelancers and consultants who just want to get straight into a good VPS at a great price to run some crawls. + +The ARM account we will be using is their [ARM64-2GB][10], which costs 3 euros a month and has 4 Cavium ThunderX cores. This launched in 2014 as the first server-class ARMv8 processor, but is now looking a bit middle-aged, having been superseded by the younger, prettier ThunderX2. + +The x86 account we will be comparing it to is the [1-S][11], which costs a more princely 4 euros a month and has 2 Intel Atom C3995 cores. Intel’s Atom range is a low power single-threaded system on chip design, first built for laptops and then adapted for server use. + +These accounts are otherwise fairly similar: they each have 2 gigabytes of memory, 50 gigabytes of SSD storage and 200 Mbit/s bandwidth. The disk drives possibly differ, but with the crawls we’re going to run here, this won’t come into play, we’re going to be doing everything in memory. + +When I can’t use a package manager I’m familiar with, I become angry and confused, a bit like an autistic toddler without his security blanket, entirely beyond reasoning or consolation, it’s quite horrendous really, so both of these accounts will use Debian Stretch. + +#### Amazon Web Services + +In the same length of time as it takes you to give Scaleway your credit card details, launch a VPS, add a sudo user and start installing dependencies, you won’t even have gotten as far as registering your AWS account. You’ll still be reading through the product pages trying to figure out what’s going on. + +There’s a serious breadth and depth here aimed at enterprises and others with complicated or specialised needs. + +The AWS Graviton we wanna drag race is part of AWS’s “Elastic Compute Cloud” or EC2 range. I’ll be running it as an on-demand instance, which is the most convenient and expensive way to use EC2. AWS also operates a [spot market][12], where you get the server much cheaper if you can be flexible about when it runs. There’s also a [mid-priced option][13] if you want to run it 24/7. + +Did I mention that AWS is complicated? Anyhoo.. + +The two accounts we’re comparing are [a1.medium][14] and [t2.small][15]. They both offer 2GB of RAM. Which begs the question: WTF is a vCPU? Confusingly, it’s a different thing on each account. + +On the a1.medium account, a vCPU is a single core of the new AWS Graviton chip. This was built by Annapurna Labs, an Israeli chip maker bought by Amazon in 2015. This is a single-threaded 64-bit ARMv8 core exclusive to AWS. This has an on-demand price of 0.0255 US dollars per hour. + +Our t2.small account runs on an Intel Xeon – though exactly which Xeon chip it is, I couldn’t really figure out. This has two threads per core – though we’re not really getting the whole core, or even the whole thread. + +Instead we’re getting a “baseline performance of 20%, with the ability to burst above that baseline using CPU credits”. Which makes sense in principle, though it’s completely unclear to me what to actually expect from this. The on-demand price for this account is 0.023 US dollars per hour. + +I couldn’t find Debian in the image library here, so both of these accounts will run Ubuntu 18.04. + +### Beavis and Butthead Do Moz’s Top 500 + +To test these VPS accounts, I need a crawler to run – one that will let the CPU stretch its legs a bit. One way to do this would be to just hammer a few websites with as many requests as fast as possible, but that’s not very polite. What we’ll do instead is a broad crawl of many websites at once. + +So it’s in tribute to my favourite physicist turned filmmaker, Mike Judge, that I wrote beavis.py. This crawls Moz’s Top 500 Websites to a depth of 3 pages to count how many times the words “wood” and “ass” occur anywhere within the HTML source. + +Not all 500 websites will actually get crawled here – some will be excluded by robots.txt and others will require javascript to follow links and so on. But it’s a wide enough crawl to keep the CPU busy. + +Python’s [global interpreter lock][16] means that beavis.py can only make use of a single CPU thread. To test multi-threaded we’re going to have to launch multiple spiders as seperate processes. + +This is why I wrote butthead.py. Any true fan of the show knows that, as crude as Butthead was, he was always slightly more sophisticated than Beavis. + +Splitting the crawl into multiple lists of start pages and allowed domains might slightly impact what gets crawled – fewer external links to other websites in the top 500 will get followed. But every crawl will be different anyway, so we will count how many pages are scraped as well as how long they take. + +### Installing Scrapy on an ARM Server + +Installing Scrapy is basically the same on each architecture. You install pip and various other dependencies, then install Scrapy from pip. + +Installing Scrapy from pip to an ARM device does take noticeably longer though. I’m guessing this is because it has to compile the binary parts from source. + +Once Scrapy is installed, I ran it from the shell to check that it’s fetching pages. + +On Scaleway’s ARM account, there seemed to be a hitch with the service_identity module: it was installed but not working. This issue had come up on the Raspberry Pi as well, but not the AWS Graviton. + +Not to worry, this was easily fixed with the following command: + +``` +sudo pip3 install service_identity --force --upgrade +``` + +Then we were off and racing! + +### Single Threaded Crawls + +The Scrapy docs say to try to [keep your crawls running between 80-90% CPU usage][17]. In practice, it’s hard – at least it is with the script I’ve written. What tends to happen is that the CPU gets very busy early in the crawl, drops a little bit and then rallies again. + +The last part of the crawl, where most of the domains have been finished, can go on for quite a few minutes, which is frustrating, because at that point it feels like more a measure of how big the last website is than anything to do with the processor. + +So please take this for what it is: not a state of the art benchmarking tool, but a short and slightly balding Australian in his underpants running some scripts and watching what happens. + +So let’s get down to brass tacks. We’ll start with the Scaleway crawls. + +| VPS | Account | Time | Pages | Scraped | Pages/Hour | €/million | pages | +| --------- | ------- | ------- | ------ | ---------- | ---------- | --------- | ----- | +| Scaleway | | | | | | | | +| ARM64-2GB | 108m | 59.27s | 38,205 | 21,032.623 | 0.28527 | | | +| --------- | ------- | ------- | ------ | ---------- | ---------- | --------- | ----- | +| Scaleway | | | | | | | | +| 1-S | 97m | 44.067s | 39,476 | 24,324.648 | 0.33011 | | | + +I kept an eye on the CPU use of both of these crawls using [top][18]. Both crawls hit 100% CPU use at the beginning, but the ThunderX chip was definitely redlining a lot more. That means these figures understate how much faster the Atom core crawls than the ThunderX. + +While I was watching CPU use in top, I could also see how much RAM was in use – this increased as the crawl continued. The ARM account used 14.7% at the end of the crawl, while the x86 was at 15%. + +Watching the logs of these crawls, I also noticed a lot more pages timing out and going missing when the processor was maxed out. That makes sense – if the CPU’s too busy to respond to everything then something’s gonna go missing. + +That’s not such a big deal when you’re just racing the things to see which is fastest. But in a real-world situation, with business outcomes at stake in the quality of your data, it’s probably worth having a little bit of headroom. + +And what about AWS? + +| VPS Account | Time | Pages Scraped | Pages / Hour | $ / Million Pages | +| ----------- | ---- | ------------- | ------------ | ----------------- | +| a1.medium | 100m 39.900s | 41,294 | 24,612.725 | 1.03605 | +| t2.small | 78m 53.171s | 41,200 | 31,336.286 | 0.73397 | + +I’ve included these results for sake of comparison with the Scaleway crawls, but these crawls were kind of a bust. Monitoring the CPU use – this time through the AWS dashboard rather than through top – showed that the script wasn’t making good use of the available processing power on either account. + +This was clearest with the a1.medium account – it hardly even got out of bed. It peaked at about 45% near the beginning and then bounced around between 20% and 30% for the rest. + +What’s intriguing to me about this is that the exact same script ran much slower on the ARM processor – and that’s not because it hit a limit of the Graviton’s CPU power. It had oodles of headroom left. Even the Intel Atom core managed to finish, and that was maxing out for some of the crawl. The settings were the same in the code, the way they were being handled differently on the different architecture. + +It’s a bit of a black box to me whether that’s something inherent to the processor itself, the way the binaries were compiled, or some interaction between the two. I’m going to speculate that we might have seen the same thing on the Scaleway ARM VPS, if we hadn’t hit the limit of the CPU core’s processing power first. + +It was harder to know how the t2.small account was doing. The crawl sat at about 20%, sometimes going as high as 35%. Was that it meant by “baseline performance of 20%, with the ability to burst to a higher level”? I had no idea. But I could see on the dashboard I wasn’t burning through any CPU credits. + +Just to make extra sure, I installed [stress][19] and ran it for a few minutes; sure enough, this thing could do 100% if you pushed it. + +Clearly, I was going to need to crank the settings up on both these processors to make them sweat a bit, so I set CONCURRENT_REQUESTS to 5000 and REACTOR_THREADPOOL_MAXSIZE to 120 and ran some more crawls. + +| VPS Account | Time | Pages Scraped | Pages/hr | $/10000 Pages | +| ----------- | ---- | ------------- | -------- | ------------- | +| a1.medium | 46m 13.619s | 40,283 | 52,285.047 | 0.48771 | +| t2.small | 41m7.619s | 36,241 | 52,871.857 | 0.43501 | +| t2.small (No CPU credits) | 73m 8.133s | 34,298 | 28,137.8891 | 0.81740 | + +The a1 instance hit 100% usage about 5 minutes into the crawl, before dropping back to 80% use for another 20 minutes, climbing up to 96% again and then dropping down again as it was wrapping things up. That was probably about as well-tuned as I was going to get it. + +The t2 instance hit 50% early in the crawl and stayed there for until it was nearly done. With 2 threads per core, 50% CPU use is one thread maxed out. + +Here we see both accounts produce similar speeds. But the Xeon thread was redlining for most of the crawl, and the Graviton was not. I’m going to chalk this up as a slight win for the Graviton. + +But what about once you’ve burnt through all your CPU credits? That’s probably the fairer comparison – to only use them as you earn them. I wanted to test that as well. So I ran stress until all the CPU credits were exhausted and ran the crawl again. + +With no credits in the bank, the CPU usage maxed out at 27% and stayed there. So many pages ended up going missing that it actually performed worse than when on the lower settings. + +### Multi Threaded Crawls + +Dividing our crawl up between multiple spiders in separate processes offers a few more options to make use of the available cores. + +I first tried dividing everything up between 10 processes and launching them all at once. This turned out to be slower than just dividing them up into 1 process per core. + +I got the best result by combining these methods – dividing the crawl up into 10 processes and then launching 1 process per core at the start and then the rest as these crawls began to wind down. + +To make this even better, you could try to minimise the problem of the last lingering crawler by making sure the longest crawls start first. I actually attempted to do this. + +Figuring that the number of links on the home page might be a rough proxy for how large the crawl would be, I built a second spider to count them and then sort them in descending order of number of outgoing links. This preprocessing worked well and added a little over a minute. + +It turned out though that blew the crawling time out beyond two hours! Putting all the most link heavy websites together in the same process wasn’t a great idea after all. + +You might effectively deal with this by tweaking the number of domains per process as well – or by shuffling the list after it’s ordered. That’s a bit much for Beavis and Butthead though. + +So I went back to my earlier method that had worked somewhat well: + +| VPS Account | Time | Pages Scraped | Pages/hr | €/10,000 pages | +| ----------- | ---- | ------------- | -------- | -------------- | +| Scaleway ARM64-2GB | 62m 10.078s | 36,158 | 34,897.0719 | 0.17193 | +| Scaleway 1-S | 60m 56.902s | 36,725 | 36,153.5529 | 0.22128 | + +After all that, using more cores did speed up the crawl. But it’s hardly a matter of just halving or quartering the time taken. + +I’m certain that a more experienced coder could better optimise this to take advantage of all the cores. But, as far as “out of the box” Scrapy performance goes, it seems to be a lot easier to speed up a crawl by using faster threads rather than by throwing more cores at it. + +As it is, the Atom has scraped slightly more pages in slightly less time. On a value for money metric, you could possibly say that the ThunderX is ahead. Either way, there’s not a lot of difference here. + +### Everything You Always Wanted to Know About Ass and Wood (But Were Afraid to Ask) + +After scraping 38,205 pages, our crawler found 24,170,435 mentions of ass and 54,368 mentions of wood. + +![][20] + +Considered on its own, this is a respectable amount of wood. + +But when you set it against the sheer quantity of ass we’re dealing with here, the wood looks miniscule. + +### The Verdict + +From what’s visible to me at the moment, it looks like the CPU architecture you use is actually less important than how old the processor is. The AWS Graviton from 2018 was the winner here in single-threaded performance. + +You could of course argue that the Xeon still wins, core for core. But then you’re not really going dollar for dollar anymore, or even thread for thread. + +The Atom from 2017, on the other hand, comfortably bested the ThunderX from 2014. Though, on the value for money metric, the ThunderX might be the clear winner. Then again, if you can run your crawls on Amazon’s spot market, the Graviton is still ahead. + +All in all, I think this shows that, yes, you can crawl the web with an ARM device, and it can compete on both performance and price. + +Whether the difference is significant enough for you to turn what you’re doing upside down is a whole other question of course. Certainly, if you’re already on the AWS cloud – and your code is portable enough – then it might be worthwhile testing out their a1 instances. + +Hopefully we will see more ARM options on the public cloud in near future. + +### The Scripts + +This is my first real go at doing anything in either Python or Scrapy. So this might not be great code to learn from. Some of what I’ve done here – such as using global variables – is definitely a bit kludgey. + +Still, I want to be transparent about my methods, so here are my scripts. + +To run them, you’ll need Scrapy installed and you will need the CSV file of [Moz’s top 500 domains][21]. To run butthead.py you will also need [psutil][22]. + +##### beavis.py + +``` +import scrapy +from scrapy.spiders import CrawlSpider, Rule +from scrapy.linkextractors import LinkExtractor +from scrapy.crawler import CrawlerProcess + +ass = 0 +wood = 0 +totalpages = 0 + +def getdomains(): + + moz500file = open('top500.domains.05.18.csv') + + domains = [] + moz500csv = moz500file.readlines() + + del moz500csv[0] + + for csvline in moz500csv: + leftquote = csvline.find('"') + rightquote = leftquote + csvline[leftquote + 1:].find('"') + domains.append(csvline[leftquote + 1:rightquote]) + + return domains + +def getstartpages(domains): + + startpages = [] + + for domain in domains: + startpages.append('http://' + domain) + + return startpages + +class AssWoodItem(scrapy.Item): + ass = scrapy.Field() + wood = scrapy.Field() + url = scrapy.Field() + +class AssWoodPipeline(object): + def __init__(self): + self.asswoodstats = [] + + def process_item(self, item, spider): + self.asswoodstats.append((item.get('url'), item.get('ass'), item.get('wood'))) + + def close_spider(self, spider): + asstally, woodtally = 0, 0 + + for asswoodcount in self.asswoodstats: + asstally += asswoodcount[1] + woodtally += asswoodcount[2] + + global ass, wood, totalpages + ass = asstally + wood = woodtally + totalpages = len(self.asswoodstats) + +class BeavisSpider(CrawlSpider): + name = "Beavis" + allowed_domains = getdomains() + start_urls = getstartpages(allowed_domains) + #start_urls = [ 'http://medium.com' ] + custom_settings = { + 'DEPTH_LIMIT': 3, + 'DOWNLOAD_DELAY': 3, + 'CONCURRENT_REQUESTS': 1500, + 'REACTOR_THREADPOOL_MAXSIZE': 60, + 'ITEM_PIPELINES': { '__main__.AssWoodPipeline': 10 }, + 'LOG_LEVEL': 'INFO', + 'RETRY_ENABLED': False, + 'DOWNLOAD_TIMEOUT': 30, + 'COOKIES_ENABLED': False, + 'AJAXCRAWL_ENABLED': True + } + + rules = ( Rule(LinkExtractor(), callback='parse_asswood'), ) + + def parse_asswood(self, response): + if isinstance(response, scrapy.http.TextResponse): + item = AssWoodItem() + item['ass'] = response.text.casefold().count('ass') + item['wood'] = response.text.casefold().count('wood') + item['url'] = response.url + yield item + + +if __name__ == '__main__': + + process = CrawlerProcess({ + 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' + }) + + process.crawl(BeavisSpider) + process.start() + + print('Uhh, that was, like, ' + str(totalpages) + ' pages crawled.') + print('Uh huhuhuhuh. It said ass ' + str(ass) + ' times.') + print('Uh huhuhuhuh. It said wood ' + str(wood) + ' times.') +``` + +##### butthead.py + +``` +import scrapy, time, psutil +from scrapy.spiders import CrawlSpider, Rule, Spider +from scrapy.linkextractors import LinkExtractor +from scrapy.crawler import CrawlerProcess +from multiprocessing import Process, Queue, cpu_count + +ass = 0 +wood = 0 +totalpages = 0 +linkcounttuples =[] + +def getdomains(): + + moz500file = open('top500.domains.05.18.csv') + + domains = [] + moz500csv = moz500file.readlines() + + del moz500csv[0] + + for csvline in moz500csv: + leftquote = csvline.find('"') + rightquote = leftquote + csvline[leftquote + 1:].find('"') + domains.append(csvline[leftquote + 1:rightquote]) + + return domains + +def getstartpages(domains): + + startpages = [] + + for domain in domains: + startpages.append('http://' + domain) + + return startpages + +class AssWoodItem(scrapy.Item): + ass = scrapy.Field() + wood = scrapy.Field() + url = scrapy.Field() + +class AssWoodPipeline(object): + def __init__(self): + self.asswoodstats = [] + + def process_item(self, item, spider): + self.asswoodstats.append((item.get('url'), item.get('ass'), item.get('wood'))) + + def close_spider(self, spider): + asstally, woodtally = 0, 0 + + for asswoodcount in self.asswoodstats: + asstally += asswoodcount[1] + woodtally += asswoodcount[2] + + global ass, wood, totalpages + ass = asstally + wood = woodtally + totalpages = len(self.asswoodstats) + + +class ButtheadSpider(CrawlSpider): + name = "Butthead" + custom_settings = { + 'DEPTH_LIMIT': 3, + 'DOWNLOAD_DELAY': 3, + 'CONCURRENT_REQUESTS': 250, + 'REACTOR_THREADPOOL_MAXSIZE': 30, + 'ITEM_PIPELINES': { '__main__.AssWoodPipeline': 10 }, + 'LOG_LEVEL': 'INFO', + 'RETRY_ENABLED': False, + 'DOWNLOAD_TIMEOUT': 30, + 'COOKIES_ENABLED': False, + 'AJAXCRAWL_ENABLED': True + } + + rules = ( Rule(LinkExtractor(), callback='parse_asswood'), ) + + + def parse_asswood(self, response): + if isinstance(response, scrapy.http.TextResponse): + item = AssWoodItem() + item['ass'] = response.text.casefold().count('ass') + item['wood'] = response.text.casefold().count('wood') + item['url'] = response.url + yield item + +def startButthead(domainslist, urlslist, asswoodqueue): + crawlprocess = CrawlerProcess({ + 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' + }) + + crawlprocess.crawl(ButtheadSpider, allowed_domains = domainslist, start_urls = urlslist) + crawlprocess.start() + asswoodqueue.put( (ass, wood, totalpages) ) + + +if __name__ == '__main__': + asswoodqueue = Queue() + domains=getdomains() + startpages=getstartpages(domains) + processlist =[] + cores = cpu_count() + + for i in range(10): + domainsublist = domains[i * 50:(i + 1) * 50] + pagesublist = startpages[i * 50:(i + 1) * 50] + p = Process(target = startButthead, args = (domainsublist, pagesublist, asswoodqueue)) + processlist.append(p) + + for i in range(cores): + processlist[i].start() + + time.sleep(180) + + i = cores + + while i != 10: + time.sleep(60) + if psutil.cpu_percent() < 66.7: + processlist[i].start() + i += 1 + + for i in range(10): + processlist[i].join() + + for i in range(10): + asswoodtuple = asswoodqueue.get() + ass += asswoodtuple[0] + wood += asswoodtuple[1] + totalpages += asswoodtuple[2] + + print('Uhh, that was, like, ' + str(totalpages) + ' pages crawled.') + print('Uh huhuhuhuh. It said ass ' + str(ass) + ' times.') + print('Uh huhuhuhuh. It said wood ' + str(wood) + ' times.') +``` + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/speed-test-x86-vs-arm-for-web-crawling-in-python/ + +作者:[James Mawson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://blog.dxmtechsupport.com.au/author/james-mawson/ +[b]: https://github.com/lujun9972 +[1]: https://blog.dxmtechsupport.com.au/wp-content/uploads/2019/02/quadbike-1024x683.jpg +[2]: https://scrapy.org/ +[3]: https://www.info2007.net/blog/2018/review-scaleway-arm-based-cloud-server.html +[4]: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ +[5]: https://www.computerworld.com/article/3178544/microsoft-windows/microsoft-and-arm-look-to-topple-intel-in-servers.html +[6]: https://www.datacenterknowledge.com/design/cloudflare-bets-arm-servers-it-expands-its-data-center-network +[7]: https://www.scaleway.com/ +[8]: https://aws.amazon.com/ +[9]: https://www.theregister.co.uk/2018/11/27/amazon_aws_graviton_specs/ +[10]: https://www.scaleway.com/virtual-cloud-servers/#anchor_arm +[11]: https://www.scaleway.com/virtual-cloud-servers/#anchor_starter +[12]: https://aws.amazon.com/ec2/spot/pricing/ +[13]: https://aws.amazon.com/ec2/pricing/reserved-instances/ +[14]: https://aws.amazon.com/ec2/instance-types/a1/ +[15]: https://aws.amazon.com/ec2/instance-types/t2/ +[16]: https://wiki.python.org/moin/GlobalInterpreterLock +[17]: https://docs.scrapy.org/en/latest/topics/broad-crawls.html +[18]: https://linux.die.net/man/1/top +[19]: https://linux.die.net/man/1/stress +[20]: https://blog.dxmtechsupport.com.au/wp-content/uploads/2019/02/Screenshot-from-2019-02-16-17-01-08.png +[21]: https://moz.com/top500 +[22]: https://pypi.org/project/psutil/ From c78fd6129d137cbd6fb39191e455d5adc142f67c Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:55:12 +0800 Subject: [PATCH 228/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How=20?= =?UTF-8?q?to=20List=20Installed=20Packages=20on=20Ubuntu=20and=20Debian?= =?UTF-8?q?=20[Quick=20Tip]=20sources/tech/20190219=20How=20to=20List=20In?= =?UTF-8?q?stalled=20Packages=20on=20Ubuntu=20and=20Debian=20-Quick=20Tip.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ackages on Ubuntu and Debian -Quick Tip.md | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md diff --git a/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md new file mode 100644 index 0000000000..8e0dcf8f7a --- /dev/null +++ b/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to List Installed Packages on Ubuntu and Debian [Quick Tip]) +[#]: via: (https://itsfoss.com/list-installed-packages-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to List Installed Packages on Ubuntu and Debian [Quick Tip] +====== + +So you [installed Ubuntu and started using][1] it extensively. Somewhere down the line, you are bound to lose the track of the software that you had installed over the time. + +That’s perfectly normal. No one expects you to remember all the packages installed on your system. But the question arises, how to know what packages have been installed? How to see the installed packages? + +### List installed packages in Ubuntu and Debian + +![List installed Packages][2] + +If you use [apt command][3] extensively, you would probably expect a command like apt list installed packages. You are not entirely wrong here. + +While [apt-get command][4] doesn’t have a straightforward option like apt-get list installed packages, apt has a command for this. + +``` +apt list --installed +``` + +This will list all the packages that have been installed using apt. It will also list the packages that were installed as a dependency. Which means that not only you’ll have the applications you installed, you’ll also have a huge list of libraries and other packages that you didn’t install directly. + +![List installed packages in Ubuntu with apt command][5]Listing installed packages with apt command + +Since the list of installed packages is a huge one, it would be a better idea to use grep and filter the output for a certain package. + +``` +apt list --installed | grep program_name +``` + +Note that the above method also lists the [applications installed with .deb files][6]. That’s cool, isn’t it? + +If you have read my [apt vs apt-get comparison][7] article, you probably already know that both apt and apt-get basically use [dpkg][8]. This means you can use dpkg command to list all the installed packages in Debian. + +``` +dpkg-query -l +``` + +You can filter the output with grep again to search for a specific package. + +![Listing installed packages with dpkg command][9]![Listing installed packages with dpkg command][9]Listing installed packages with dpkg + +So far, you have dealt with applications installed with Debian’s package manager. What about Snap and Flatpak applications? How to list them because they are not accessible with apt and dpkg? + +To show all the [Snap packages][10] installed on your system, use this command: + +``` +snap list +``` + +Snap list also indicates which applications are from a verified publisher with a green tick. + +![List installed packages with snap][11]Listing installed Snap packages + +To list all the [Flatpak packages][12] installed on your system, use this: + +``` +flatpak list +``` + +Let me summarize it for you. + +Summary + +To list packages using apt command: + +**apt** **list –installed** + +To list packages using dpkg command: + +**dpkg-query -l** + +To list Snap packages installed on your system: + +**snap list** + +To list Flatpak packages installed on your system: + +**flatpak list** + +### List the recently installed packages + +So far you saw the list of installed packages in alphabetical order. What if you want to see the packages that have been installed recently? + +Thankfully, a Linux system keeps a log of everything that happens in your system. You can refer to the logs to see the recently installed packages. + +There are a couple of ways to do this. You can either use the dpkg command’s log or the apt command’s log. + +You’ll have to use grep command to filter the result to list the installed packages only. + +``` +grep " install " /var/log/dpkg.log +``` + +This will list all the packages including the dependencies that were installed recently on your system along with the time of installation. + +``` +2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1 +2019-02-13 21:03:02 install xdg-desktop-portal:amd64 0.11-1 +2019-02-13 21:03:02 install libostree-1-1:amd64 2018.8-0ubuntu0.1 +2019-02-13 21:03:02 install flatpak:amd64 1.0.6-0ubuntu0.1 +2019-02-13 21:03:02 install xdg-desktop-portal-gtk:amd64 0.11-1 +2019-02-14 11:49:10 install qml-module-qtquick-window2:amd64 5.9.5-0ubuntu1.1 +2019-02-14 11:49:10 install qml-module-qtquick2:amd64 5.9.5-0ubuntu1.1 +2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1 +``` + +You can also use the history of apt command. This will show only the programs that you installed using apt command. It won’t show the dependencies installed with it, though the details are present in the logs. Sometimes, you just want to see that, right? + +``` +grep " install " /var/log/apt/history.log +``` + +The output should be something like this: + +``` +Commandline: apt install pinta +Commandline: apt install pinta +Commandline: apt install tmux +Commandline: apt install terminator +Commandline: apt install moreutils +Commandline: apt install ubuntu-make +Commandline: apt install flatpak +Commandline: apt install cool-retro-term +Commandline: apt install ubuntu-software +``` + +![List recently installed packages][13]Listing recently installed packages + +The history log of apt is quite useful because it shows the time when the apt command was run, the user who ran the command and the packages that were installed by a command. + +### Bonus Tip: Show installed applications in Software Center + +If you are not comfortable with the terminal and the commands, you still has a way to see the applications installed on your system. + +You can open the Software Center and click on the Installed tab. You’ll see the list of applications that have been installed on your system. + +![List Installed Software in Ubuntu Software Center][14]Showing installed applications in Software Center + +It won’t show the libraries and other command line stuff though but perhaps you don’t want to see that as you are more GUI centric. Otherwise, you can always use the Synaptic Package Manager. + +**That’s it** + +I hope this quick little tutorial helped you to see the list of installed packages on Ubuntu and Debian based distributions. + +If you have questions or suggestions to improve this article, please leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/list-installed-packages-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/getting-started-with-ubuntu/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/apt-command-guide/ +[4]: https://itsfoss.com/apt-get-linux-guide/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages-in-ubuntu-with-apt.png?resize=800%2C407&ssl=1 +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://itsfoss.com/apt-vs-apt-get-difference/ +[8]: https://wiki.debian.org/dpkg +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages-with-dpkg.png?ssl=1 +[10]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-snap-packages.png?ssl=1 +[12]: https://itsfoss.com/flatpak-guide/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-list-recently-installed-packages.png?resize=800%2C187&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/installed-software-ubuntu.png?ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages.png?fit=800%2C450&ssl=1 From db1707b1175f8d41be0fa4e86fa2968001974892 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:57:52 +0800 Subject: [PATCH 229/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=203=20to?= =?UTF-8?q?ols=20for=20viewing=20files=20at=20the=20command=20line=20sourc?= =?UTF-8?q?es/tech/20190219=203=20tools=20for=20viewing=20files=20at=20the?= =?UTF-8?q?=20command=20line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s for viewing files at the command line.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20190219 3 tools for viewing files at the command line.md diff --git a/sources/tech/20190219 3 tools for viewing files at the command line.md b/sources/tech/20190219 3 tools for viewing files at the command line.md new file mode 100644 index 0000000000..1443d3bfa9 --- /dev/null +++ b/sources/tech/20190219 3 tools for viewing files at the command line.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 tools for viewing files at the command line) +[#]: via: (https://opensource.com/article/19/2/view-files-command-line) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +3 tools for viewing files at the command line +====== +Take a look at less, Antiword, and odt2txt, three utilities for viewing files in the terminal. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) + +I always say you don't need to use the command line to use Linux effectively—I know many Linux users who never crack open a terminal window and are quite happy. However, even though I don't consider myself a techie, I spend about 20% of my computing time at the command line, manipulating files, processing text, and using utilities. + +One thing I often do in a terminal window is viewing files, whether text or word processor files. Sometimes it's just easier to use a command line utility than to fire up a text editor or a word processor. + +Here are three of the utilities I use to view files at the command line. + +### less + +The beauty of [less][1] is that it's easy to use and it breaks the files you're viewing down into discrete chunks (or pages), which makes them easier to read. You use it to view text files at the command line, such as a README, an HTML file, a LaTeX file, or anything else in plaintext. I took a look at less in a [previous article][2]. + +To use less, just type: + +``` +less file_name +``` + +![](https://opensource.com/sites/default/files/uploads/less.png) + +Scroll down through the file by pressing the spacebar or PgDn key on your keyboard. You can move up through a file by pressing the PgUp key. To stop viewing the file, press the Q key on your keyboard. + +### Antiword + +[Antiword][3] is great little utility that you can use to that can convert Word documents to plaintext. If you want, you can also convert them to [PostScript][4] or [PDF][5]. For this article, let's just stick with the conversion to text. + +Antiword can read and convert files created with versions of Word from 2.0 to 2003. It doesn't read DOCX files—if you try, Antiword displays an error message that what you're trying to read is a ZIP file. That's technically correct, but it's still frustrating. + +To view a Word document using Antiword, type the following command: + +``` +antiword file_name.doc +``` + +Antiword converts the document to text and displays it in the terminal window. Unfortunately, it doesn't break the document into pages in the terminal. You can, though, redirect Antiword's output to a utility like less or [more][6] to paginate it. Do that by typing the following command: + +``` +antiword file_name.doc | less +``` + +If you're new to the command line, the | is called a pipe. That's what does the redirection. + +![](https://opensource.com/sites/default/files/uploads/antiword.png) + +### odt2txt + +Being a good open source citizen, you'll want to use as many open formats as possible. For your word processing needs, you might deal with [ODT][7] files (used by such word processors as LibreOffice Writer and AbiWord) instead of Word files. Even if you don't, you might run into ODT files. And they're easy to view at the command line, even if you don't have Writer or AbiWord installed on your computer. + +How? With a little utility called [odt2txt][8]. As you've probably guessed, odt2txt converts an ODT file to plaintext. To use it, run the command: + +``` +odt2txt file_name.odt +``` + +Like Antiword, odt2txt converts the document to text and displays it in the terminal window. And, like Antiword, it doesn't page the document. Once again, though, you can pipe the output from odt2txt to a utility like less or more using the following command: + +``` +odt2txt file_name.odt | more +``` + +![](https://opensource.com/sites/default/files/uploads/odt2txt.png) + +Do you have a favorite utility for viewing files at the command line? Feel free to share it with the community by leaving a comment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/view-files-command-line + +作者:[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://www.gnu.org/software/less/ +[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line +[3]: http://www.winfield.demon.nl/ +[4]: http://en.wikipedia.org/wiki/PostScript +[5]: http://en.wikipedia.org/wiki/Portable_Document_Format +[6]: https://opensource.com/article/19/1/more-text-files-linux +[7]: http://en.wikipedia.org/wiki/OpenDocument +[8]: https://github.com/dstosberg/odt2txt From daf015f7363b7297f50981670f3cdf4824d860a7 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 09:58:30 +0800 Subject: [PATCH 230/813] translating by lujun9972 --- .../tech/20180128 Get started with Org mode without Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20180128 Get started with Org mode without Emacs.md b/sources/tech/20180128 Get started with Org mode without Emacs.md index 75a5bcb092..bc760180cb 100644 --- a/sources/tech/20180128 Get started with Org mode without Emacs.md +++ b/sources/tech/20180128 Get started with Org mode without Emacs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lujun9972) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -62,7 +62,7 @@ via: https://opensource.com/article/19/1/productivity-tool-org-mode 作者:[Kevin Sonney][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lujun9972](https://github.com/lujun9972) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dcfe44126f360027217a5946032e35652abb0588 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 10:02:44 +0800 Subject: [PATCH 231/813] PRF:20190208 How To Install And Use PuTTY On Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 翻译很用心,赞! --- ...8 How To Install And Use PuTTY On Linux.md | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/translated/tech/20190208 How To Install And Use PuTTY On Linux.md b/translated/tech/20190208 How To Install And Use PuTTY On Linux.md index 62f6f5ae1a..c403a83079 100644 --- a/translated/tech/20190208 How To Install And Use PuTTY On Linux.md +++ b/translated/tech/20190208 How To Install And Use PuTTY On Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Install And Use PuTTY On Linux) @@ -12,7 +12,7 @@ ![](https://www.ostechnix.com/wp-content/uploads/2019/02/putty-720x340.png) -PuTTY 是一个免费、开源且支持包括 SSH、Telnet 和 Rlogin 在内的多种协议的 GUI 客户端。一般来说,Windows 管理员们会把 PuTTY 当成 SSH 或 Telnet 客户端来在本地 Windows 系统和远程 Linux 服务器之间建立连接。不过,PuTTY 可不是 Windows 的独占软件。它在 Linux 用户之中也是很流行的。本篇文章将会告诉你如何在 Linux 中安装并使用 PuTTY。 +PuTTY 是一个自由开源且支持包括 SSH、Telnet 和 Rlogin 在内的多种协议的 GUI 客户端。一般来说,Windows 管理员们会把 PuTTY 当成 SSH 或 Telnet 客户端来在本地 Windows 系统和远程 Linux 服务器之间建立连接。不过,PuTTY 可不是 Windows 的独占软件。它在 Linux 用户之中也是很流行的。本篇文章将会告诉你如何在 Linux 中安装并使用 PuTTY。 ### 在 Linux 中安装 PuTTY @@ -60,11 +60,11 @@ PuTTY 的默认界面长这个样子: ### 使用 PuTTY 访问远程 Linux 服务器 -请在左侧面板点击 **会话** 选项卡,输入远程主机名(或 IP 地址)。然后,请选择连接类型(比如 Telnet、Rlogin 以及 SSH 等)。根据你选择的连接类型,PuTTY 会自动选择对应连接类型的默认端口号(比如 SSH 是 22、Telnet 是 23),如果你修改了默认端口号,别忘了手动把它输入到 **端口** 里。在这里,我用 SSH 连接到远程主机。在输入所有信息后,请点击 **打开**。 +请在左侧面板点击 “Session” 选项卡,输入远程主机名(或 IP 地址)。然后,请选择连接类型(比如 Telnet、Rlogin 以及 SSH 等)。根据你选择的连接类型,PuTTY 会自动选择对应连接类型的默认端口号(比如 SSH 是 22、Telnet 是 23),如果你修改了默认端口号,别忘了手动把它输入到 “Port” 里。在这里,我用 SSH 连接到远程主机。在输入所有信息后,请点击 “Open”。 ![通过 SSH 连接](http://www.ostechnix.com/wp-content/uploads/2019/02/putty-1.png) -如果这是你首次连接到这个远程主机,PuTTY 会显示一个安全警告,问你是否信任你连接到的远程主机。点击 **接受** 即可将远程主机的密钥加入 PuTTY 的储存当中: +如果这是你首次连接到这个远程主机,PuTTY 会显示一个安全警告,问你是否信任你连接到的远程主机。点击 “Accept” 即可将远程主机的密钥加入 PuTTY 的缓存当中: ![PuTTY 安全警告][2] @@ -74,63 +74,60 @@ PuTTY 的默认界面长这个样子: #### 使用密钥验证访问远程主机 -一些 Linux 管理员可能在服务器上配置了密钥认证。举个例子,在用 PuTTY 访问 AMS instances 的时候,你需要指定密钥文件的位置。PuTTY 可以使用它自己的格式(**.ppk** 文件)来进行公钥验证。 +一些 Linux 管理员可能在服务器上配置了密钥认证。举个例子,在用 PuTTY 访问 AMS 实例的时候,你需要指定密钥文件的位置。PuTTY 可以使用它自己的格式(`.ppk` 文件)来进行公钥验证。 -首先输入主机名或 IP。之后,在 **分类** 选项卡中,展开 **连接**,再展开 **SSH**,然后选择 **认证**,之后便可选择 **.ppk** 密钥文件了。 +首先输入主机名或 IP。之后,在 “Category” 选项卡中,展开 “Connection”,再展开 “SSH”,然后选择 “Auth”,之后便可选择 `.ppk` 密钥文件了。 ![][3] -点击接受来关闭安全提示。然后,输入远程主机的密码片段(如果密钥被密码片段保护)来建立连接。 +点击 “Accept” 来关闭安全提示。然后,输入远程主机的密码(如果密钥被密码保护)来建立连接。 #### 保存 PuTTY 会话 有些时候,你可能需要多次连接到同一个远程主机,你可以保存这些会话并在之后不输入信息访问他们。 -请输入主机名(或 IP 地址),并提供一个会话名称,然后点击 **保存**。如果你有密钥文件,请确保你在点击保存按钮之前指定它们。 +请输入主机名(或 IP 地址),并提供一个会话名称,然后点击 “Save”。如果你有密钥文件,请确保你在点击 “Save” 按钮之前指定它们。 ![][4] -现在,你可以通过选择 **已保存的会话**,然后点击 **Load**,再点击 **打开** 来启动连接。 +现在,你可以通过选择 “Saved sessions”,然后点击 “Load”,再点击 “Open” 来启动连接。 -#### 使用 pscpPuTTY Secure Copy Client 来将文件传输到远程主机中 +#### 使用 PuTTY 安全复制客户端(pscp)来将文件传输到远程主机中 -通常来说,Linux 用户和管理员会使用 **scp** 这个命令行工具来从本地往远程主机传输文件。不过 PuTTY 给我们提供了一个叫做 PuTTY 安全拷贝客户端PuTTY Secure Copy Client(简写为 **PSCP**)的工具来干这个事情。如果你的本地主机运行的是 Windows,你可能需要这个工具。PSCP 在 Windows 和 Linux 下都是可用的。 +通常来说,Linux 用户和管理员会使用 `scp` 这个命令行工具来从本地往远程主机传输文件。不过 PuTTY 给我们提供了一个叫做 PuTTY 安全复制客户端PuTTY Secure Copy Client(简写为 `pscp`)的工具来干这个事情。如果你的本地主机运行的是 Windows,你可能需要这个工具。PSCP 在 Windows 和 Linux 下都是可用的。 -使用这个命令来将 **file.txt** 从本地的 Arch Linux 拷贝到远程的 Ubuntu 上: +使用这个命令来将 `file.txt` 从本地的 Arch Linux 拷贝到远程的 Ubuntu 上: ```shell pscp -i test.ppk file.txt sk@192.168.225.22:/home/sk/ ``` -让我们来拆分这个命令: +让我们来分析这个命令: - * **-i test.ppk** : 访问远程主机的密钥文件; - * **file.txt** : 要拷贝到远程主机的文件; - * **sk@192.168.225.22** : 远程主机的用户名与 IP; - * **/home/sk/** : 目标路径。 + * `-i test.ppk`:访问远程主机所用的密钥文件; + * `file.txt`:要拷贝到远程主机的文件; + * `sk@192.168.225.22`:远程主机的用户名与 IP; + * `/home/sk/`:目标路径。 - - -要拷贝一个目录,请使用 **-r**Recursive 参数: +要拷贝一个目录,请使用 `-r`(递归Recursive)参数: ```shell pscp -i test.ppk -r dir/ sk@192.168.225.22:/home/sk/ ``` -要使用 pscp 传输文件,请执行以下命令: +要使用 `pscp` 传输文件,请执行以下命令: ```shell pscp -i test.ppk c:\documents\file.txt.txt sk@192.168.225.22:/home/sk/ ``` -你现在应该了解了 PuTTY 是什么,知道了如何安装它和如何使用它。同时,你也学习到了如何使用 pscp 程序在本地和远程主机上传输文件。 +你现在应该了解了 PuTTY 是什么,知道了如何安装它和如何使用它。同时,你也学习到了如何使用 `pscp` 程序在本地和远程主机上传输文件。 以上便是所有了,希望这篇文章对你有帮助。 干杯! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/ @@ -138,7 +135,7 @@ via: https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/ 作者:[SK][a] 选题:[lujun9972][b] 译者:[zhs852](https://github.com/zhs852) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ccca7c8b971907fd1a6b6c8d17d9a11f38c11241 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 10:03:34 +0800 Subject: [PATCH 232/813] PUB:20190208 How To Install And Use PuTTY On Linux.md @zhs852 https://linux.cn/article-10552-1.html --- .../20190208 How To Install And Use PuTTY On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190208 How To Install And Use PuTTY On Linux.md (98%) diff --git a/translated/tech/20190208 How To Install And Use PuTTY On Linux.md b/published/20190208 How To Install And Use PuTTY On Linux.md similarity index 98% rename from translated/tech/20190208 How To Install And Use PuTTY On Linux.md rename to published/20190208 How To Install And Use PuTTY On Linux.md index c403a83079..a4615d4b78 100644 --- a/translated/tech/20190208 How To Install And Use PuTTY On Linux.md +++ b/published/20190208 How To Install And Use PuTTY On Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10552-1.html) [#]: subject: (How To Install And Use PuTTY On Linux) [#]: via: (https://www.ostechnix.com/how-to-install-and-use-putty-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 3578c737f4da6cc3df90b13938522a56adb38a5b Mon Sep 17 00:00:00 2001 From: guevaraya Date: Wed, 20 Feb 2019 10:46:21 +0800 Subject: [PATCH 233/813] Update 20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领翻译 --- ...o List Installed Packages on Ubuntu and Debian -Quick Tip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md index 8e0dcf8f7a..8c58f6a4be 100644 --- a/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md +++ b/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( guevaraya) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d3b0f6ec527195f59745496f74f14786a5244b4e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 10:58:13 +0800 Subject: [PATCH 234/813] PRF:20190201 Top 5 Linux Distributions for New Users.md @wxy --- ...Top 5 Linux Distributions for New Users.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/tech/20190201 Top 5 Linux Distributions for New Users.md b/translated/tech/20190201 Top 5 Linux Distributions for New Users.md index 90ea392aaa..977d630c72 100644 --- a/translated/tech/20190201 Top 5 Linux Distributions for New Users.md +++ b/translated/tech/20190201 Top 5 Linux Distributions for New Users.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 5 Linux Distributions for New Users) @@ -10,23 +10,23 @@ 5 个面向新手的 Linux 发行版 ====== -> 5 个可使用新用户如归家般感觉的发行版。 +> 5 个可使用新用户有如归家般感觉的发行版。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/deepin-main.jpg?itok=ASgr0mOP) -从最初的 Linux 到现在,Linux 已经发展了很长一段路。但是,无论你曾经多少次听说过使用 Linux 现在有多容易,仍然会表示怀疑的人。而要真的承担得其这份声明,桌面必须足够简单,以便不熟悉 Linux 的人也能够使用它。事实上大量的桌面发行版使这成为了现实。 +从最初的 Linux 到现在,Linux 已经发展了很长一段路。但是,无论你曾经多少次听说过现在使用 Linux 有多容易,仍然会有表示怀疑的人。而要真的承担得其这份声明,桌面必须足够简单,以便不熟悉 Linux 的人也能够使用它。事实上大量的桌面发行版使这成为了现实。 ### 无需 Linux 知识 -将这个清单误解为又一个“最佳用户友好型 Linux 发行版”的清单可能很简单。但这不是我们要在这里看到的。这二者有什么不同?就我的目的而言,定义的界限是 Linux 是否真正起到了使用的作用。换句话说,你是否可以将这个桌面操作系统放在一个用户面前,并让他们应用自如而无需 Linux 知识呢? +将这个清单误解为又一个“最佳用户友好型 Linux 发行版”的清单可能很简单。但这不是我们要在这里看到的。这二者之间有什么不同?就我的目的而言,定义的界限是 Linux 是否真正起到了使用的作用。换句话说,你是否可以将这个桌面操作系统放在一个用户面前,并让他们应用自如而无需懂得 Linux 知识呢? -不管你相信与否,有些发行版就能做到。这里我将介绍给你 5 个这样的发行版。这些或许你全都听说过。它们或许不是你所选择的发行版,但你可以保证它们无需过多关注,而将用户放在眼前。 +不管你相信与否,有些发行版就能做到。这里我将介绍给你 5 个这样的发行版。这些或许你全都听说过。它们或许不是你所选择的发行版,但可以向你保证它们无需过多关注,而是将用户放在眼前的。 我们来看看选中的几个。 ### Elementary OS -Elementary OS 的理念主要围绕人们如何实际使用他们的桌面。开发人员和设计人员不遗余力地创建尽可能简单的桌面。在这个过程中,他们致力于将 Linux 去 Linux 化。这并不是说他们已经从这个等式中删除了 Linux。不,恰恰相反,他们所做的就是创建一个与你所发现的一样中立的操作系统。Elementary OS 是如此顺畅以确保一切都完美合理。从单个 Dock 到每个人都清晰明了的应用程序菜单,这是一个桌面,而不用提醒用户说,“你正在使用 Linux!” 事实上,其布局本身就让人联想到 Mac,但附加了一个简单的应用程序菜单(图 1)。 +[Elementary OS](https://elementary.io/) 的理念主要围绕人们如何实际使用他们的桌面。开发人员和设计人员不遗余力地创建尽可能简单的桌面。在这个过程中,他们致力于去 Linux 化的 Linux。这并不是说他们已经从这个等式中删除了 Linux。不,恰恰相反,他们所做的就是创建一个与你所发现的一样的中立的操作系统。Elementary OS 是如此流畅,以确保一切都完美合理。从单个 Dock 到每个人都清晰明了的应用程序菜单,这是一个桌面,而不用提醒用户说,“你正在使用 Linux!” 事实上,其布局本身就让人联想到 Mac,但附加了一个简单的应用程序菜单(图 1)。 ![Elementary OS Juno][2] @@ -34,35 +34,35 @@ Elementary OS 的理念主要围绕人们如何实际使用他们的桌面。开 将 Elementary OS 放在此列表中的另一个重要原因是它不像其他桌面发行版那样灵活。当然,有些用户会对此不以为然,但是如果桌面没有向用户扔出各种花哨的定制诱惑,那么就会形成一个非常熟悉的环境:一个既不需要也不允许大量修修补补的环境。操作系统在让新用户熟悉该平台这一方面还有很长的路要走。 -与任何现代 Linux 桌面发行版一样,Elementary OS 包括 App Store,也称为 AppCenter,用户可以在其中安装所需的所有应用程序,而无需触及命令行。 +与任何现代 Linux 桌面发行版一样,Elementary OS 包括了应用商店,称为 AppCenter,用户可以在其中安装所需的所有应用程序,而无需触及命令行。 -### Deepin +### 深度操作系统 -Deepin 不仅得到了市场上最漂亮的台式机之一的赞誉,它也像任何桌面操作系统一样容易采用。其桌面界面非常简单,对于毫无 Linux 经验的用户来说,它的上手速度非常快。事实上,你很难找到无法立即上手使用 Deepin 桌面的用户。而这里唯一可能的障碍可能是其侧边栏控制中心(图 2)。 +[深度操作系统](https://www.deepin.org/)不仅得到了市场上最漂亮的台式机之一的赞誉,它也像任何桌面操作系统一样容易上手。其桌面界面非常简单,对于毫无 Linux 经验的用户来说,它的上手速度非常快。事实上,你很难找到无法立即上手使用 Deepin 桌面的用户。而这里唯一可能的障碍可能是其侧边栏控制中心(图 2)。 ![][5] *图 2:Deepin 的侧边栏控制编码* -但即使是侧边栏控制面板,也像市场上的任何其他配置工具一样直观。使用移动设备的任何人对于这种布局都很熟悉。至于打开应用程序,Deepin 的启动器采用了 macOS Launchpad 的方式。此按钮位于桌面底座上通常最右侧的位置,因此用户将立即就可以会心,知道它可能类似于标准的“开始”菜单。 +但即使是侧边栏控制面板,也像市场上的任何其他配置工具一样直观。任何使用过移动设备的人对于这种布局都很熟悉。至于打开应用程序,Deepin 的启动器采用了 macOS Launchpad 的方式。此按钮位于桌面底座上通常最右侧的位置,因此用户立即就可以会意,知道它可能类似于标准的“开始”菜单。 -与 Elementary OS(以及市场上大多数 Linux 发行版)类似,Deepin 也包含一个应用程序商店(简称为“商店”),可以轻松安装大量应用程序。 +与 Elementary OS(以及市场上大多数 Linux 发行版)类似,深度操作系统也包含一个应用程序商店(简称为“商店”),可以轻松安装大量应用程序。 ### Ubuntu -你知道肯定有它。Ubuntu 通常在大多数用户友好的 Linux 列表中排名第一。为什么?因为它是少数几个不需要了解 Linux 就能使用的桌面之一。但在采用 GNOME(和 Unity 谢幕)之前,情况并非如此。为什么?因为 Unity 经常需要进行一些调整才能达到不需要一点 Linux 知识的程度(图 3)。现在 Ubuntu 已经采用了 GNOME,并将其调整到甚至不需要懂得 GNOME 的程度,这个桌面使得对 Linux 的简单性和可用性处于次要地位。 +你知道肯定有它。[Ubuntu](https://www.ubuntu.com/) 通常在大多数用户友好的 Linux 列表中占据首位。因为它是少数几个不需要懂得 Linux 就能使用的桌面之一。但在采用 GNOME(和 Unity 谢幕)之前,情况并非如此。因为 Unity 经常需要进行一些调整才能达到一点 Linux 知识都不需要的程度(图 3)。现在 Ubuntu 已经采用了 GNOME,并将其调整到甚至不需要懂得 GNOME 的程度,这个桌面使得对 Linux 的简单性和可用性的要求不再是迫切问题。 ![Ubuntu 18.04][7] *图 3:Ubuntu 18.04 桌面可使用马上熟悉起来* -与 Elementary OS 不同,Ubuntu 不会让用户半路放弃。因此,任何想从桌面上获得更多信息的人都可以拥有它。但是,开箱即用的体验对于任何用户类型都是足够的。任何一个让用户不知道他们触手可及的力量有多少的桌面,肯定不如 Ubuntu。 +与 Elementary OS 不同,Ubuntu 对用户毫无阻碍。因此,任何想从桌面上获得更多信息的人都可以拥有它。但是,其开箱即用的体验对于任何类型的用户都是足够的。任何一个让用户不知道他们触手可及的力量有多少的桌面,肯定不如 Ubuntu。 ### Linux Mint -我需要首先声明,我从来都不是 Linux Mint 的忠实粉丝。这并不是说我不尊重开发者的工作,这更多的是一种审美观点。我更喜欢现代的桌面环境。但是,旧式学校计算机桌面的隐喻(可以在默认的 Cinnamon 桌面中找到)让几乎每个人使用它的人都格外熟悉。Linux Mint 使用任务栏、开始按钮、系统托盘和桌面图标(图 4),提供了一个需要零学习曲线的界面。事实上,一些用户最初可能会被愚弄,以为他们正在使用Windows 7 的克隆。甚至是它的更新警告图标也会让用户感到非常熟悉。 +我需要首先声明,我从来都不是 [Linux Mint](https://linuxmint.com/) 的忠实粉丝。但这并不是说我不尊重开发者的工作,而更多的是一种审美观点。我更喜欢现代化的桌面环境。但是,旧式的学校计算机桌面的隐喻(可以在默认的 Cinnamon 桌面中找到)可以让几乎每个人使用它的人都格外熟悉。Linux Mint 使用任务栏、开始按钮、系统托盘和桌面图标(图 4),提供了一个需要零学习曲线的界面。事实上,一些用户最初可能会被愚弄,以为他们正在使用 Windows 7 的克隆版。甚至是它的更新警告图标也会让用户感到非常熟悉。 -![Linux Mint ][9] +![Linux Mint][9] *图 4:Linux Mint 的 Cinnamon 桌面非常像 Windows 7* @@ -70,19 +70,19 @@ Deepin 不仅得到了市场上最漂亮的台式机之一的赞誉,它也像 ### Ubuntu Budgie -我们的列表将以这样一个发行版做结,它也能让用户忘记他们正在使用 Linux,并且使用常用工具变得简单、美观。使 Ubuntu 融合 Budgie 桌面可以实现以令人印象深刻的易用发行版。虽然其桌面布局(图 5)可能不太一样,但毫无疑问,适应这个环境并不会浪费时间。实际上,在 Dock 外面默认为桌面的左侧,Ubuntu Budgie 确实看起来像 Elementary OS。 +我们的列表将以这样一个发行版做结:它也能让用户忘记他们正在使用 Linux,并且使用常用工具变得简单、美观。使 Ubuntu 融合 Budgie 桌面可以构成一个令人印象深刻的易用发行版。虽然其桌面布局(图 5)可能不太一样,但毫无疑问,适应这个环境并不需要浪费时间。实际上,除了 Dock 默认居于桌面的左侧,[Ubuntu Budgie](https://ubuntubudgie.org/) 确实看起来像 Elementary OS。 ![Budgie][11] *图 5:Budgie 桌面既漂亮又简单* -Ubuntu Budgie 中的系统托盘/通知区域提供了一些不太寻常的功能,比如:快速访问 Caffeine(一种保持桌面清醒的工具)、快速笔记工具(用于记录简单笔记)、Night Lite 开关、原地下拉菜单(用于快速访问文件夹),当然还有 Raven 小程序/通知侧边栏(与 Deepin 中的控制中心侧边栏类似,但不太优雅)。Budgie 还包括一个应用程序菜单(左上角),用户可以访问所有已安装的应用程序。打开一个应用程序,该图标将出现在 Dock 中。右键单击该应用程序图标,然后选择“保留在 Dock”以便更快地访问。 +Ubuntu Budgie 中的系统托盘/通知区域提供了一些不太多见的功能,比如:快速访问 Caffeine(一种保持桌面清醒的工具)、快速笔记工具(用于记录简单笔记)、Night Lite 开关、原地下拉菜单(用于快速访问文件夹),当然还有 Raven 小程序/通知侧边栏(与深度操作系统中的控制中心侧边栏类似,但不太优雅)。Budgie 还包括一个应用程序菜单(左上角),用户可以访问所有已安装的应用程序。打开一个应用程序,该图标将出现在 Dock 中。右键单击该应用程序图标,然后选择“保留在 Dock”以便更快地访问。 -Ubuntu Budgie 的一切都很直观,所以几乎没有学习曲线。这种发行版既优雅又易于使用,这并没有什么坏处。 +Ubuntu Budgie 的一切都很直观,所以几乎没有学习曲线。这种发行版既优雅又易于使用,不能再好了。 ### 选择一个吧 -至此介绍了 5 个 Linux 发行版,它们各自以自己的方式提供了让任何用户即刻熟悉的桌面体验。虽然这些可能不是你选择顶级发行版的选择,但对于那些不熟悉 Linux 的用户来说,很难否定它们的价值。 +至此介绍了 5 个 Linux 发行版,它们各自以自己的方式提供了让任何用户都马上熟悉的桌面体验。虽然这些可能不是你对顶级发行版的选择,但对于那些不熟悉 Linux 的用户来说,却不能否定它们的价值。 -------------------------------------------------------------------------------- @@ -91,7 +91,7 @@ via: https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users 作者:[Jack Wallen][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 e36ce8bf8d1980bd9bd9c5d7e228f9f7953c5b0c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 10:58:49 +0800 Subject: [PATCH 235/813] PUB:20190201 Top 5 Linux Distributions for New Users.md @wxy https://linux.cn/article-10553-1.html --- .../20190201 Top 5 Linux Distributions for New Users.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190201 Top 5 Linux Distributions for New Users.md (99%) diff --git a/translated/tech/20190201 Top 5 Linux Distributions for New Users.md b/published/20190201 Top 5 Linux Distributions for New Users.md similarity index 99% rename from translated/tech/20190201 Top 5 Linux Distributions for New Users.md rename to published/20190201 Top 5 Linux Distributions for New Users.md index 977d630c72..5641dd8796 100644 --- a/translated/tech/20190201 Top 5 Linux Distributions for New Users.md +++ b/published/20190201 Top 5 Linux Distributions for New Users.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10553-1.html) [#]: subject: (Top 5 Linux Distributions for New Users) [#]: via: (https://www.linux.com/blog/learn/2019/2/top-5-linux-distributions-new-users) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) From d78eb42a616629ac4bf7ff9991e3f7cefbafabd6 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 20 Feb 2019 13:30:59 +0800 Subject: [PATCH 236/813] Translating 7 steps for hunting down Python code bugs. --- ...0208 7 steps for hunting down Python code bugs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 2c83e02fe1..4781e06f9b 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -14,19 +14,19 @@ 在周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经移动了的通知。 -结果这些日志被转移到你获取不到的地方,但他们正在转移到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。它应该会在几天内完成。我知道,这完全不符合实际情况,对吧?Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking. +结果这些日志被转移到你获取不到的地方,但他们正在转移到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。它应该会在几天内完成。我知道,这完全不符合实际情况,对吧?然而不,日志或者日志消息似乎经常在错误的时间出现缺少。在我们追踪错误前,一个忠告:经常检查你的日志保证他们在你认为它们该在的地方并记录你认为它们该记的东西。当你不看的时候,这些东西会发生令人惊讶的变化。 -OK, so you found the logs or tried the call, and indeed, the customer has found a bug. Maybe you even think you know where the bug is. +好的,所以你寻找了日志或者尝试了呼叫运维,而客户确实发现了一个错误。可能你甚至认为你知道错误在哪儿。 -You immediately open the file you think might be the problem and start poking around. +你立即打开你认为可能有问题的文件并开始寻找。 -### 1. Don't touch your code yet +### 1. 不要碰你的代码 Go ahead and look at it, maybe even come up with a hypothesis. But before you start mucking about in the code, take that call that creates the bug and turn it into a test. This will be an integration test because although you may have suspicions, you do not yet know exactly where the problem is. Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. -### 2. Write a failing test +### 2. 编写错误的测试 Now that you have a failing test or maybe a test with an error, it is time to troubleshoot. But before you do that, let's do a review of the stack, as this makes troubleshooting easier. @@ -44,7 +44,7 @@ If you are fuzzy on the stack, I highly recommend playing around on [Python Tuto Now, if something goes wrong with your Python program, the interpreter helpfully prints out the stack for you. This means that whatever the program was doing at the moment it became apparent that something went wrong is on the bottom. -### 3. Always check the bottom of the stack first +### 3. 始终先检查 stack 的底部 Not only is the bottom of the stack where you can see which error occurred, but often the last line of the stack is where you can find the issue. If the bottom doesn't help, and your code has not been linted in a while, it is amazing how helpful it can be to run. I recommend pylint or flake8. More often than not, it points right to where there is an error that I have been overlooking. From 11b705f478cbdf65c4248c709e82ab0a1326597f Mon Sep 17 00:00:00 2001 From: guevaraya Date: Wed, 20 Feb 2019 15:40:39 +0800 Subject: [PATCH 237/813] Update and rename sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md to translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 请审阅校对 --- ...ackages on Ubuntu and Debian -Quick Tip.md | 184 ------------------ ...ackages on Ubuntu and Debian -Quick Tip.md | 180 +++++++++++++++++ 2 files changed, 180 insertions(+), 184 deletions(-) delete mode 100644 sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md create mode 100644 translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md diff --git a/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md deleted file mode 100644 index 8c58f6a4be..0000000000 --- a/sources/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md +++ /dev/null @@ -1,184 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( guevaraya) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to List Installed Packages on Ubuntu and Debian [Quick Tip]) -[#]: via: (https://itsfoss.com/list-installed-packages-ubuntu) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to List Installed Packages on Ubuntu and Debian [Quick Tip] -====== - -So you [installed Ubuntu and started using][1] it extensively. Somewhere down the line, you are bound to lose the track of the software that you had installed over the time. - -That’s perfectly normal. No one expects you to remember all the packages installed on your system. But the question arises, how to know what packages have been installed? How to see the installed packages? - -### List installed packages in Ubuntu and Debian - -![List installed Packages][2] - -If you use [apt command][3] extensively, you would probably expect a command like apt list installed packages. You are not entirely wrong here. - -While [apt-get command][4] doesn’t have a straightforward option like apt-get list installed packages, apt has a command for this. - -``` -apt list --installed -``` - -This will list all the packages that have been installed using apt. It will also list the packages that were installed as a dependency. Which means that not only you’ll have the applications you installed, you’ll also have a huge list of libraries and other packages that you didn’t install directly. - -![List installed packages in Ubuntu with apt command][5]Listing installed packages with apt command - -Since the list of installed packages is a huge one, it would be a better idea to use grep and filter the output for a certain package. - -``` -apt list --installed | grep program_name -``` - -Note that the above method also lists the [applications installed with .deb files][6]. That’s cool, isn’t it? - -If you have read my [apt vs apt-get comparison][7] article, you probably already know that both apt and apt-get basically use [dpkg][8]. This means you can use dpkg command to list all the installed packages in Debian. - -``` -dpkg-query -l -``` - -You can filter the output with grep again to search for a specific package. - -![Listing installed packages with dpkg command][9]![Listing installed packages with dpkg command][9]Listing installed packages with dpkg - -So far, you have dealt with applications installed with Debian’s package manager. What about Snap and Flatpak applications? How to list them because they are not accessible with apt and dpkg? - -To show all the [Snap packages][10] installed on your system, use this command: - -``` -snap list -``` - -Snap list also indicates which applications are from a verified publisher with a green tick. - -![List installed packages with snap][11]Listing installed Snap packages - -To list all the [Flatpak packages][12] installed on your system, use this: - -``` -flatpak list -``` - -Let me summarize it for you. - -Summary - -To list packages using apt command: - -**apt** **list –installed** - -To list packages using dpkg command: - -**dpkg-query -l** - -To list Snap packages installed on your system: - -**snap list** - -To list Flatpak packages installed on your system: - -**flatpak list** - -### List the recently installed packages - -So far you saw the list of installed packages in alphabetical order. What if you want to see the packages that have been installed recently? - -Thankfully, a Linux system keeps a log of everything that happens in your system. You can refer to the logs to see the recently installed packages. - -There are a couple of ways to do this. You can either use the dpkg command’s log or the apt command’s log. - -You’ll have to use grep command to filter the result to list the installed packages only. - -``` -grep " install " /var/log/dpkg.log -``` - -This will list all the packages including the dependencies that were installed recently on your system along with the time of installation. - -``` -2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1 -2019-02-13 21:03:02 install xdg-desktop-portal:amd64 0.11-1 -2019-02-13 21:03:02 install libostree-1-1:amd64 2018.8-0ubuntu0.1 -2019-02-13 21:03:02 install flatpak:amd64 1.0.6-0ubuntu0.1 -2019-02-13 21:03:02 install xdg-desktop-portal-gtk:amd64 0.11-1 -2019-02-14 11:49:10 install qml-module-qtquick-window2:amd64 5.9.5-0ubuntu1.1 -2019-02-14 11:49:10 install qml-module-qtquick2:amd64 5.9.5-0ubuntu1.1 -2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1 -``` - -You can also use the history of apt command. This will show only the programs that you installed using apt command. It won’t show the dependencies installed with it, though the details are present in the logs. Sometimes, you just want to see that, right? - -``` -grep " install " /var/log/apt/history.log -``` - -The output should be something like this: - -``` -Commandline: apt install pinta -Commandline: apt install pinta -Commandline: apt install tmux -Commandline: apt install terminator -Commandline: apt install moreutils -Commandline: apt install ubuntu-make -Commandline: apt install flatpak -Commandline: apt install cool-retro-term -Commandline: apt install ubuntu-software -``` - -![List recently installed packages][13]Listing recently installed packages - -The history log of apt is quite useful because it shows the time when the apt command was run, the user who ran the command and the packages that were installed by a command. - -### Bonus Tip: Show installed applications in Software Center - -If you are not comfortable with the terminal and the commands, you still has a way to see the applications installed on your system. - -You can open the Software Center and click on the Installed tab. You’ll see the list of applications that have been installed on your system. - -![List Installed Software in Ubuntu Software Center][14]Showing installed applications in Software Center - -It won’t show the libraries and other command line stuff though but perhaps you don’t want to see that as you are more GUI centric. Otherwise, you can always use the Synaptic Package Manager. - -**That’s it** - -I hope this quick little tutorial helped you to see the list of installed packages on Ubuntu and Debian based distributions. - -If you have questions or suggestions to improve this article, please leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/list-installed-packages-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/getting-started-with-ubuntu/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages.png?resize=800%2C450&ssl=1 -[3]: https://itsfoss.com/apt-command-guide/ -[4]: https://itsfoss.com/apt-get-linux-guide/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages-in-ubuntu-with-apt.png?resize=800%2C407&ssl=1 -[6]: https://itsfoss.com/install-deb-files-ubuntu/ -[7]: https://itsfoss.com/apt-vs-apt-get-difference/ -[8]: https://wiki.debian.org/dpkg -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages-with-dpkg.png?ssl=1 -[10]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-snap-packages.png?ssl=1 -[12]: https://itsfoss.com/flatpak-guide/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-list-recently-installed-packages.png?resize=800%2C187&ssl=1 -[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/installed-software-ubuntu.png?ssl=1 -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages.png?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md new file mode 100644 index 0000000000..cba74fd894 --- /dev/null +++ b/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @@ -0,0 +1,180 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to List Installed Packages on Ubuntu and Debian [Quick Tip]) +[#]: via: (https://itsfoss.com/list-installed-packages-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何索引 Ubuntu 和 Debian 上已安装的软件包 [快速提示] +====== + +当你安装了 [Ubuntu 并想好好用一用][1]。但在将来某个时候,你肯定会遇到忘记曾经安装了那些软件包。 + +这个是完全正常。没有人要求你把系统里所有已安装的软件包都记住。但是问题是,如何才能知道已经安装了哪些软件包?如何查看安装过的软件包呢? + +### 索引 Ubuntu 和 Debian 上已安装的软件包 + +![索引已安装的软件包][2] + +如果你经常用 [apt 命令][3],你可能会注意到 apt 可以索引已安装的软件包。这里说对了一点。 + + +[apt-get 命令] 没有类似索引已安装软件包的简单的选项,但是 apt 有一个这样的命令: +``` +apt list --installed +``` +这个会显示 apt 命令安装的所有的软件包。同时也会包含由于依赖被安装的软件包。也就是说不仅会包含你曾经安装的程序,而且会包含大量库文件和间接安装的软件包。 + +![用 atp 命令索引显示已安装的软件包][5] 用 atp 命令索引显示已安装的软件包 + +由于索引出来的已安装的软件包太多,用 grep 过滤特定的软件包是一个比较好的办法。 +``` +apt list --installed | grep program_name +``` + +如上命令也可以检索出 .deb 格式的软件包文件。是不是很酷?不是吗? + +如果你阅读过 [apt 与 apt-get 对比][7]的文章,你可能已经知道 apt 和 apt-get 命令都是基于 [dpkg][8]。也就是说用 dpkg 命令可以索引 Debian 系统的所有已经安装的软件包。 + +``` +dpkg-query -l +``` +你可以用 grep 命令检索指定的软件包。 + +![用 dpkg 命令索引显示已经安装的软件包][9]![用 dpkg 命令索引显示已经安装的软件包][9]用 dpkg 命令索引显示已经安装的软件包 + + +现在你可以搞定索引 Debian 的软件包管理器安装的应用了。那 Snap 和 Flatpak 这个两种应用呢?如何索引他们?因为他们不能被 apt 和 dpkg 访问。 + +显示系统里所有已经安装的 [Snap 软件包][10],可以这个命令: + +``` +snap list +``` +Snap 可以用绿色勾号索引显示经过认证的发布者。 +![索引已经安装的 Snap 软件包][11]索引已经安装的 Snap 软件包 + +显示系统里所有已安装的 [Flatpak 软件包][12],可以用这个命令: + +``` +flatpak list +``` + +让我来个汇总: + + +用 apt 命令显示已安装软件包: + +**apt** **list –installed** + +用 dpkg 命令显示已安装软件包: + +**dpkg-query -l** + +索引系统里 Snap 已安装软件包: + +**snap list** + +索引系统里 Flatpak 已安装软件包: + +**flatpak list** + +### 显示最近安装的软件包 + +现在你已经看过以字母顺序索引的已经安装软件包了。如何显示最近已经安装的软件包? + +幸运的是,Linux 系统保存了所有发生事件的日志。你可以参考最近安装软件包的日志。 + +有两个方法可以来做。用 dpkg 命令的日志或者 apt 命令的日志。 + +你仅仅需要用 grep 命令过滤已经安装的软件包日志。 + +``` +grep " install " /var/log/dpkg.log +``` + +这会显示所有的软件安装包,其中包括最近安装的过程中被依赖的软件包。 + +``` +2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1 +2019-02-13 21:03:02 install xdg-desktop-portal:amd64 0.11-1 +2019-02-13 21:03:02 install libostree-1-1:amd64 2018.8-0ubuntu0.1 +2019-02-13 21:03:02 install flatpak:amd64 1.0.6-0ubuntu0.1 +2019-02-13 21:03:02 install xdg-desktop-portal-gtk:amd64 0.11-1 +2019-02-14 11:49:10 install qml-module-qtquick-window2:amd64 5.9.5-0ubuntu1.1 +2019-02-14 11:49:10 install qml-module-qtquick2:amd64 5.9.5-0ubuntu1.1 +2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1 +``` + +你也可以查看 apt历史命令日志。这个仅会显示用 apt 命令安装的的程序。但不会显示被依赖安装的软件包,详细的日志在日志里可以看到。有时你只是想看看对吧? + +``` +grep " install " /var/log/apt/history.log +``` + +具体的显示如下: + +``` +Commandline: apt install pinta +Commandline: apt install pinta +Commandline: apt install tmux +Commandline: apt install terminator +Commandline: apt install moreutils +Commandline: apt install ubuntu-make +Commandline: apt install flatpak +Commandline: apt install cool-retro-term +Commandline: apt install ubuntu-software +``` + +![显示最近已安装的软件包][13]显示最近已安装的软件包 + +apt 的历史日志非常有用。因为他显示了什么时候执行了 apt 命令,哪个用户执行的命令以及安装的软件包名 + +### 小贴士: 在软件中心显示已安装的程序包名 + +如果你觉得终端和命令行交互不友好,可以有一个方法查看系统的程序名。 + +可以打开软件中心,然后点击已安装标签。你可以看到系统上已经安装的程序包名 + +![Ubuntu 软件中心显示已安装的软件包][14] 在软件中心显示已安装的软件包 + +这个不会显示库和其他命令行的东西,有可能你也不想看到他们,因为你是大量交互都是在 GUI,相反你可以一直用 Synaptic 软件包管理器。 + +**结束语** + +我希望这个简易的教程可以帮你查看 Ubuntu 和 基于 Debian 的发行版的已安装软件包。 + +如果你对本文有什么问题或建议,请在下面留言。 + + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/list-installed-packages-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[校对者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/getting-started-with-ubuntu/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/apt-command-guide/ +[4]: https://itsfoss.com/apt-get-linux-guide/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages-in-ubuntu-with-apt.png?resize=800%2C407&ssl=1 +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://itsfoss.com/apt-vs-apt-get-difference/ +[8]: https://wiki.debian.org/dpkg +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages-with-dpkg.png?ssl=1 +[10]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-snap-packages.png?ssl=1 +[12]: https://itsfoss.com/flatpak-guide/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-list-recently-installed-packages.png?resize=800%2C187&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/installed-software-ubuntu.png?ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/list-installed-packages.png?fit=800%2C450&ssl=1 From ce912b78296f80cd6c4c3448c01b21d81b54e944 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 16:25:58 +0800 Subject: [PATCH 238/813] PRF:20190206 4 cool new projects to try in COPR for February 2019.md @geekpi --- ...ojects to try in COPR for February 2019.md | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md b/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md index 2edb446699..b69d776127 100644 --- a/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md +++ b/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md @@ -1,25 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 cool new projects to try in COPR for February 2019) [#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/) [#]: author: (Dominik Turecek https://fedoramagazine.org) -2019 年 2 月 COPR 中 4 个值得尝试很酷的新项目 +COPR 仓库中 4 个很酷的新软件(2019.2) ====== ![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) COPR 是个人软件仓库[集合][1],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不被 Fedora 基础设施不支持或没有被该项目所签名。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 - 这是 COPR 中一组新的有趣项目。 ### CryFS -[CryFS][2] 是一个加密文件系统。它设计用于云存储,主要用于 Dropbox,尽管它也可以与其他存储提供商一起使用。CryFS 不仅加密文件系统中的文件,还会加密元数据、文件大小和目录结构。 +[CryFS][2] 是一个加密文件系统。它设计与云存储一同使用,主要是 Dropbox,尽管它也可以与其他存储提供商一起使用。CryFS 不仅加密文件系统中的文件,还会加密元数据、文件大小和目录结构。 #### 安装说明 @@ -32,13 +31,13 @@ sudo dnf install cryfs ### Cheat -[Cheat][3] 是一个用于在命令行中查看各种备忘录的工具,用来提醒仅偶尔使用的程序的使用方法。对于许多 Linux 程序,cheat 提供了来自手册页的压缩后的信息,主要关注最常用的示例。除了内置的备忘录,cheat 允许你编辑现有的备忘录或从头开始创建新的备忘录。 +[Cheat][3] 是一个用于在命令行中查看各种备忘录的工具,用来提醒仅偶尔使用的程序的使用方法。对于许多 Linux 程序,`cheat` 提供了来自手册页的精简后的信息,主要关注最常用的示例。除了内置的备忘录,`cheat` 允许你编辑现有的备忘录或从头开始创建新的备忘录。 ![][4] #### 安装说明 -仓库目前为 Fedora 28、29 和 Rawhide 以及 EPEL 7 提供 cheat。要安装 cheat,请使用以下命令: +仓库目前为 Fedora 28、29 和 Rawhide 以及 EPEL 7 提供 `cheat`。要安装 `cheat`,请使用以下命令: ``` sudo dnf copr enable tkorbar/cheat @@ -47,20 +46,20 @@ sudo dnf install cheat ### Setconf -[setconf][5] 是一个简单的程序,作为 sed 的替代方案,用于对配置文件进行更改。setconf 唯一能做的就是找到指定文件中的密钥并更改其值。setconf 仅提供一些选项来更改其行为 - 例如,取消更改行的注释。 +[setconf][5] 是一个简单的程序,作为 `sed` 的替代方案,用于对配置文件进行更改。`setconf` 唯一能做的就是找到指定文件中的密钥并更改其值。`setconf` 仅提供很少的选项来更改其行为 - 例如,取消更改行的注释。 #### 安装说明 -仓库目前为 Fedora 27、28 和 29 提供 setconf。要安装 setconf,请使用以下命令: +仓库目前为 Fedora 27、28 和 29 提供 `setconf`。要安装 `setconf`,请使用以下命令: ``` sudo dnf copr enable jamacku/setconf sudo dnf install setconf ``` -### Reddit Terminal Viewer +### Reddit 终端查看器 -[Reddit Terminal Viewer][6],或称为 rtv,提供了从终端浏览 Reddit 的界面。它提供了 Reddit 的基本功能,因此你可以登录到你的帐户,查看 subreddits、评论、点赞和发现新主题。但是,rtv 目前不支持 Reddit 标签。 +[Reddit 终端查看器][6],或称为 `rtv`,提供了从终端浏览 Reddit 的界面。它提供了 Reddit 的基本功能,因此你可以登录到你的帐户,查看 subreddits、评论、点赞和发现新主题。但是,rtv 目前不支持 Reddit 标签。 ![][7] @@ -81,7 +80,7 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february- 作者:[Dominik Turecek][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 743ad2ab51ce2fcdb89c95def3522732c8149c74 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 16:26:38 +0800 Subject: [PATCH 239/813] PUB:20190206 4 cool new projects to try in COPR for February 2019.md @geekpi https://linux.cn/article-10554-1.html --- ...06 4 cool new projects to try in COPR for February 2019.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190206 4 cool new projects to try in COPR for February 2019.md (98%) diff --git a/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md b/published/20190206 4 cool new projects to try in COPR for February 2019.md similarity index 98% rename from translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md rename to published/20190206 4 cool new projects to try in COPR for February 2019.md index b69d776127..92523ddb46 100644 --- a/translated/tech/20190206 4 cool new projects to try in COPR for February 2019.md +++ b/published/20190206 4 cool new projects to try in COPR for February 2019.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10554-1.html) [#]: subject: (4 cool new projects to try in COPR for February 2019) [#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-february-2019/) [#]: author: (Dominik Turecek https://fedoramagazine.org) From b87f3d41d4561f3235c3d070a2adbb92ae275560 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 17:25:55 +0800 Subject: [PATCH 240/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020120911=20Doug?= =?UTF-8?q?=20Bolden,=20Dunnet=20(IF)=20sources/talk/20120911=20Doug=20Bol?= =?UTF-8?q?den,=20Dunnet=20(IF).md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talk/20120911 Doug Bolden, Dunnet (IF).md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/talk/20120911 Doug Bolden, Dunnet (IF).md diff --git a/sources/talk/20120911 Doug Bolden, Dunnet (IF).md b/sources/talk/20120911 Doug Bolden, Dunnet (IF).md new file mode 100644 index 0000000000..c856dc5be0 --- /dev/null +++ b/sources/talk/20120911 Doug Bolden, Dunnet (IF).md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Doug Bolden, Dunnet (IF)) +[#]: via: (http://www.wyrmis.com/games/if/dunnet.html) +[#]: author: (W Doug Bolden http://www.wyrmis.com) + +Doug Bolden, Dunnet (IF) +====== + +### Dunnet (IF) + +#### Review + +When I began becoming a semi-serious hobbyist of IF last year, I mostly focused on Infocom, Adventures Unlimited, other Scott Adams based games, and freeware titles. I went on to buy some from Malinche. I picked up _1893_ and _Futureboy_ and (most recnetly) _Treasures of a Slave Kingdom_. I downloaded a lot of free games from various sites. With all of my research and playing, I never once read anything that talked about a game being bundled with Emacs. + +Partially, this is because I am a Vim guy. But I used to use Emacs. Kind of a lot. For probably my first couple of years with Linux. About as long as I have been a diehard Vim fan, now. I just never explored, it seems. + +I booted up Emacs tonight, and my fonts were hosed. Still do not know exactly why. I surfed some menus to find out what was going wrong and came across a menu option called "Adventure" under Games, which I assumed (I know, I know) meant the Crowther and Woods and 1977 variety. When I clicked it tonight, thinking that it has been a few months since I chased a bird around with a cage in a mine so I can fight off giant snakes or something, I was brought up text involving ends of roads and shovels. Trees, if shaken, that kill me with a coconut. This was not the game I thought it was. + +I dug around (or, in purely technical terms, typed "help") and got directed to [this website][1]. Well, here was an IF I had never touched before. Brand spanking new to me. I had planned to play out some _ToaSK_ tonight, but figured that could wait. Besides, I was not quite in the mood for the jocular fun of S. John Ross's commerical IF outing. I needed something a little more direct, and this apparently it. + +Most of the game plays out just like the _Colossal Cave Adventure_ cousins of the oldschool (generally commercial) IF days. There are items you pick. Each does a single task (well, there could be one exception to this, I guess). You collect treasures. Winning is a combination of getting to the end and turning in the treasures. The game slightly tweaks the formula by allowing multiple drop off points for the treasures. Since there is a weight limit, though, you usually have to drop them off at a particular time to avoid getting stuck. At several times, your "item cache" is flushed, so to speak, meaning you have to go back and replay earlier portions to find out how to bring things foward. Damage to items can occur to stop you from being able to play. Replaying is pretty much unavoidable, unless you guess outcomes just right. + +It also inherits many problems from the era it came. There is a twisty maze. I'm not sure how big it is. I just cheated and looked up a walkthrough for the maze portion. I plan on going back and replaying up to the maze bit and mapping it out, though. I was just mentally and physically beat when I played and knew that I was going to have to call it quits on the game for the night or cheat through the maze. I'm glad I cheated, because there are some interesting things after the maze. + +It also has the same sort of stilted syntax and variable levels of description that the original _Adventure_ had. Looking at one item might give you "there is nothing special about that" while looking at another might give you a sentence of flavor text. Several things mentioned in the background do not exist to the parser, which some do. Part of game play is putting up with experimenting. This includes, in cases, a tendency of room descriptions to be written from the perspective of the first time you enter. I know that the Classroom found towards the end of the game does not mention the South exit, either. There are possibly other times this occured that I didn't notice. + +It's final issue, again coming out of the era it was designed, is random death syndrome. This is not too common, but there are a few places where things that have no initially apparent fatal outcome lead to one anyhow. In some ways, this "fatal outcome" is just the game reaching an unwinnable state. For an example of the former, type "shake trees" in the first room. For an example of the latter, send either the lamp, the key, or the shovel through the ftp without switching ftp modes first. At least with the former, there is a sense of exploration in finding out new ways to die. In IF, creative deaths is a form of victory in their own right. + +_Dunnet_ has a couple of differences from most IF. The former difference is minor. There are little odd descriptions throughout the game. "This room is red" or "The towel has a picture of Snoopy one it" or "There is a cliff here" that do not seem to have an immediate effect on the game. Sure, you can jump over the cliff (and die, obviously) but but it still comes off as a bright spot in the standard description matrix. Towards the end, you will be forced to bring back these details. It makes a neat little diversion of looking around and exploring things. Most of the details are cute and/or add to the surreality of the game overall. + +The other big difference, and the one that greatly increased both my annoyance with and my enjoyment of the game, revolves around the two-three computer oriented scenes in the game. You have to type commands into two different computers throughout. One is a VAX and the other is, um, something like a PC (I forget). In both cases, there are clues to be found by knowing your way around the interface. This is a game for computer folk, so most who play it will have a sense of how to type "ls" or "dir" depending on the OS. But not all, will. Beating the game requires a general sense of computer literacy. You must know what types are in ftp. You must know how to determine what type a file is. You must know how to read a text file on a DOS style prompt. You must know something about protocols and etiquette for logging into ftp servers. All this sort of thing. If you do, or are willing to learn (I looked up some of the stuff online) then you can get past this portion with no problem. But this can be like the maze to some people, requiring several replays to get things right. + +The end result is a quirky but fun game that I wish I had known about before because now I have the feeling that my computer is hiding other secrets from me. Glad to have played. Will likely play again to see how many ways I can die. + +-------------------------------------------------------------------------------- + +via: http://www.wyrmis.com/games/if/dunnet.html + +作者:[W Doug Bolden][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.wyrmis.com +[b]: https://github.com/lujun9972 +[1]: http://www.driver-aces.com/ronnie.html From 88c85103d604dbeb6b0d0cb05ea4b61dd4cb4a06 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Wed, 20 Feb 2019 17:30:37 +0800 Subject: [PATCH 241/813] Update 20181220 7 CI-CD tools for sysadmins.md --- .../20181220 7 CI-CD tools for sysadmins.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index fb5a4997d3..8c51dda1ce 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -24,34 +24,39 @@ Some organizations have been using CI/CD practices on infrastructure, with tools 一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在用于生产的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建可复用的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. -当然,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数开发流水线都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 +当然,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数开发管道(pipeline)都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 For example, I regularly write a newsletter within my company, and I maintain it in version control using [MJML][7]. I needed to be able to host a web version, and some folks liked being able to get a PDF, so I built a [pipeline][8]. Now when I create a new newsletter, I submit it for a merge request in GitLab. This automatically creates an index.html with links to HTML and PDF versions of the newsletter. The HTML and PDF files are also created in the pipeline. None of this is published until someone comes and reviews these artifacts. Then, GitLab Pages publishes the website and I can pull down the HTML to send as a newsletter. In the future, I'll automatically send the newsletter when the merge request is merged or after a special approval step. This seems simple, but it has saved me a lot of time. This is really at the core of what these tools can do for you. They will save you time. -举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[流水线][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在流水线里同时生成。这些文件不会被直接发布出去,除非有人来检查确认。GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求通过或者在特殊的审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 +举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[管道][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在管道里同时生成。这些文件不会被直接发布出去,除非有人来检查确认。GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求通过或者在特殊的审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 The key is creating tools to work in the abstract so that they can apply to multiple problems with little change. I should also note that what I created required almost no code except [some light HTML templating][9], some [node to loop through the HTML files][10], and some more [node to populate the index page with all the HTML pages and PDFs][11]. 关键是要在抽象层创建出工具,这样它们稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成 index 页面的 nodejs 代码][11]。 Some of this might look a little complex, but most of it was taken from the tutorials of the different tools I'm using. And many developers are happy to work with you on these types of things, as they might also find them useful when they're done. The links I've provided are to a newsletter we plan to start for [DevOps KC][12], and all the code for creating the site comes from the work I did on our internal newsletter. -这其中一些东西可能看起来有点复杂,但其中大部分都来源于我使用的不同工具的教学文档。而且很多开发人员也乐意跟你合作干这些事,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 +这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也乐意跟你合作干这些事,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 Many of the tools listed below can offer this type of interaction, but some offer a slightly different model. The emerging model in this space is that of a declarative description of a pipeline in something like YAML with each stage being ephemeral and idempotent. Many of these systems also ensure correct sequencing by creating a [directed acyclic graph][13] (DAG) over the different stages of the pipeline. -下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明性的语言如 YAML 来描述一个流水线,其中的每个阶段都是短暂而幂等的。许多系统还会创建有向无环图(DAG),来确保流水线上不同阶段的排序正确。 +下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明性的语言如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段能正确排序。 These stages are often run in Linux containers and can do anything you can do in a container. Some tools, like [Spinnaker][14], focus only on the deployment component and offer some operational features that others don't normally include. [Jenkins][15] has generally kept pipelines in an XML format and most interactions occur within the GUI, but more recent implementations have used a [domain specific language][16] (DSL) using [Groovy][17]. Further, Jenkins jobs normally execute on nodes with a special Java agent installed and consist of a mix of plugins and pre-installed components. - +这些阶段一般运行在 Linux 容器里,和普通的容器没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件而且提供一些其他工具没有的操作特性。[Jenkins][15] 通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用 [领域专用语言(DSL)][16] 如[Groovy][17]。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点会装一个专门的 Java 程序还有一堆混杂的插件和预装组件。 Jenkins introduced pipelines in its tool, but they were a bit challenging to use and contained several caveats. Recently, the creator of Jenkins decided to move the community toward a couple different initiatives that will hopefully breathe new life into the project—which is the one that really brought CI/CD to the masses. I think its most interesting initiative is creating a Cloud Native Jenkins that can turn a Kubernetes cluster into a Jenkins CI/CD platform. +Jenkins 在自己的工具里引入了管道的概念,但使用起来却并不轻松,甚至包含一些禁区。最近,Jenkins 的创始人决定带领社区向新的方向前进,希望能为这个项目注入新的活力,把 CI/CD 真正推广开(译者注:详见后面的 Jenkins 章节)。我认为其中最有意思的想法是构建一个云原生 Jenkins,能把 Kubernetes 集群转变成 Jenkins CI/CD 平台。 As you learn more about these tools and start bringing these practices into your company or your operations division, you'll quickly gain followers. You will increase your own productivity as well as that of others. We all have years of backlog to get to—how much would your co-workers love if you could give them enough time to start tackling that backlog? Not only that, but your customers will start to see increased application reliability, and your management will see you as a force multiplier. That certainly can't hurt during your next salary negotiation or when interviewing with all your new skills. +当你更多地了解这些工具并把实践带入你的公司和运维部门,你很快就会有追随者,因为你有办法提升自己和别人的工作效率。我们都有多年积累下来的技术债要解决,如果你能给同事们提供足够的时间来处理这些积压的工作,他们该会有多感激呢?不止如此,你的客户也会开始看到应用稳定性的提升,管理层会把你看作得力干将,你也会在下次谈薪资待遇或参加面试时更有底气。 Let's dig into the tools a bit more. We'll briefly cover each one and share links to more information. +让我们开始深入了解这些工具吧,我们将对每个工具做简短的介绍,并分享一些有用的链接。 ### GitLab CI GitLab is a fairly new entrant to the CI/CD space, but it's already achieved the top spot in the [Forrester Wave for Continuous Integration Tools][20]. That's a huge achievement in such a crowded and highly qualified field. What makes GitLab CI so great? It uses a YAML file to describe the entire pipeline. It also has a functionality called Auto DevOps that allows for simpler projects to have a pipeline built automatically with multiple tests built-in. This system uses [Herokuish buildpacks][21] to determine the language and how to build the application. Some languages can also manage databases, which is a real game-changer for building new applications and getting them deployed to production from the beginning of the development process. The system has native integrations into Kubernetes and will deploy your application automatically into a Kubernetes cluster using one of several different deployment methodologies, like percentage-based rollouts and blue-green deployments. +GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。这在一个高水平、竞争激烈的领域里是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。它还有一个功能叫做 Auto DevOps,可以为简单的工程自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 整合地很紧密,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 In addition to its CI functionality, GitLab offers many complementary features like operations and monitoring with Prometheus deployed automatically with your application; portfolio and project management using GitLab Issues, Epics, and Milestones; security checks built into the pipeline with the results provided as an aggregate across multiple projects; and the ability to edit code right in GitLab using the WebIDE, which can even provide a preview or execute part of a pipeline for faster feedback. +除了它的持续集成功能,GitLab 还提供了许多值得称赞的特性,比如: ### GoCD @@ -74,7 +79,7 @@ Jenkins在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我 [Jenkins 配置既代码][28](JCasC)应该可以帮助管理员解决困扰了他们多年的配置复杂性问题。与其他 CI/CD 系统类似,只需要修改一个简单的 YAML 文件就可以完成 Jenkins 主节点的配置工作。[Jenkins Evergreen][29] 的出现让配置工作变得更加轻松,它提供了很多预设的使用场景,你只管套用就可以了。这些发行版会比官方的标准版本 Jenkins 更容易维护和升级。 Jenkins 2 introduced native pipeline functionality with two types of pipelines, which [I discuss][30] in a LISA17 presentation. Neither is as easy to navigate as YAML when you're doing something simple, but they're quite nice for doing more complex tasks. -Jenkins 2 引入了两种原生的流水线(pipeline)功能,我在 LISA(一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 +Jenkins 2 引入了两种原生的管道(pipeline)功能,我在 LISA(一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 [Jenkins X][31] is the full transformation of Jenkins and will likely be the implementation of Cloud Native Jenkins (or at least the thing most users see when using Cloud Native Jenkins). It will take JCasC and Evergreen and use them at their best natively on Kubernetes. These are exciting times for Jenkins, and I look forward to its innovation and continued leadership in this space. [Jenkins X][31] 是 Jenkins 的一个全新变种,用来实现云端原生 Jenkins(至少在用户看来是这样)。它会使用 JCasC 及 Evergreen,并且和 Kubernetes 整合的更加紧密。对于 Jenkins 来说这是个令人激动的时刻,我很乐意看到它在这一领域的创新,并且继续发挥领袖作用。 From 560d52bb5031acf27bf7289b3f6160f49e2a307f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 17:38:33 +0800 Subject: [PATCH 242/813] PRF:20190214 Drinking coffee with AWK.md @wxy --- .../tech/20190214 Drinking coffee with AWK.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20190214 Drinking coffee with AWK.md b/translated/tech/20190214 Drinking coffee with AWK.md index 21215fcf00..8f6ef0bc12 100644 --- a/translated/tech/20190214 Drinking coffee with AWK.md +++ b/translated/tech/20190214 Drinking coffee with AWK.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Drinking coffee with AWK) @@ -9,7 +9,7 @@ 用 AWK 喝咖啡 ====== -> 用一个简单的 AWK 程序跟踪你的同事所喝咖啡的欠款。 +> 用一个简单的 AWK 程序跟踪你的同事喝咖啡的欠款。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) @@ -63,7 +63,7 @@ $1 == "member" { } ``` -第二条规则在记录付款时减少欠账。 +第二条规则在记录付款(`payment`)时减少欠账。 ``` $1 == "payment" { @@ -71,7 +71,7 @@ $1 == "payment" { } ``` -还款则相反:它增加欠账。这可以优雅地支持意外地给了某人太多钱的情况。 +还款(`payback`)则相反:它增加欠账。这可以优雅地支持意外地给了某人太多钱的情况。 ``` $1 == "payback" { @@ -79,7 +79,7 @@ $1 == "payback" { } ``` -最复杂的部分出现在有人购买速溶咖啡供咖啡角使用时。它被视为付款,并且该人的债务减少了适当的金额。接下来,它计算每个会员的费用。它根据成员的级别对所有成员进行迭代并增加欠款 +最复杂的部分出现在有人购买(`bought`)速溶咖啡供咖啡角使用时。它被视为付款(`payment`),并且该人的债务减少了适当的金额。接下来,它计算每个会员的费用。它根据成员的级别对所有成员进行迭代并增加欠款 ``` $1 == "bought" { @@ -101,7 +101,7 @@ END { } ``` -除了一个遍历成员文件,并向人们发送提醒电子邮件以支付他们的会费(积极清账)的脚本外,这个系统管理咖啡角相当一段时间。 +再配合一个遍历成员文件,并向人们发送提醒电子邮件以支付他们的会费(积极清账)的脚本,这个系统管理咖啡角相当一段时间。 -------------------------------------------------------------------------------- @@ -110,7 +110,7 @@ via: https://opensource.com/article/19/2/drinking-coffee-awk 作者:[Moshe Zadka][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 e2811981ac376508b805d944e2c93e3b49b5ecbb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 17:39:34 +0800 Subject: [PATCH 243/813] PUB:20190214 Drinking coffee with AWK.md @wxy https://linux.cn/article-10555-1.html --- .../tech => published}/20190214 Drinking coffee with AWK.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190214 Drinking coffee with AWK.md (98%) diff --git a/translated/tech/20190214 Drinking coffee with AWK.md b/published/20190214 Drinking coffee with AWK.md similarity index 98% rename from translated/tech/20190214 Drinking coffee with AWK.md rename to published/20190214 Drinking coffee with AWK.md index 8f6ef0bc12..eb83412bbd 100644 --- a/translated/tech/20190214 Drinking coffee with AWK.md +++ b/published/20190214 Drinking coffee with AWK.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10555-1.html) [#]: subject: (Drinking coffee with AWK) [#]: via: (https://opensource.com/article/19/2/drinking-coffee-awk) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 13045005d90051682dfe25ddf6ca7facde2b455d Mon Sep 17 00:00:00 2001 From: mingming Date: Wed, 20 Feb 2019 19:16:24 +0800 Subject: [PATCH 244/813] add --- .../talk/20190123 Book Review- Fundamentals of Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20190123 Book Review- Fundamentals of Linux.md (100%) diff --git a/sources/talk/20190123 Book Review- Fundamentals of Linux.md b/translated/talk/20190123 Book Review- Fundamentals of Linux.md similarity index 100% rename from sources/talk/20190123 Book Review- Fundamentals of Linux.md rename to translated/talk/20190123 Book Review- Fundamentals of Linux.md From 9197e7eff92ea3cbc1c4d1c4e6381dbe03a9bf6c Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 20:21:18 +0800 Subject: [PATCH 245/813] translate done: 20180128 Get started with Org mode without Emacs.md --- ...Get started with Org mode without Emacs.md | 78 ------------------- ...Get started with Org mode without Emacs.md | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20180128 Get started with Org mode without Emacs.md create mode 100644 translated/tech/20180128 Get started with Org mode without Emacs.md diff --git a/sources/tech/20180128 Get started with Org mode without Emacs.md b/sources/tech/20180128 Get started with Org mode without Emacs.md deleted file mode 100644 index bc760180cb..0000000000 --- a/sources/tech/20180128 Get started with Org mode without Emacs.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with Org mode without Emacs) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-org-mode) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with Org mode without Emacs -====== -No, you don't need Emacs to use Org, the 16th in our series on open source tools that will make you more productive in 2019. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the 16th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### Org (without Emacs) - -[Org mode][1] (or just Org) is not in the least bit new, but there are still many people who have never used it. They would love to try it out to get a feel for how Org can help them be productive. But the biggest barrier is that Org is associated with Emacs, and many people think one requires the other. Not so! Org can be used with a variety of other tools and editors once you understand the basics. - -![](https://opensource.com/sites/default/files/uploads/org-1.png) - -Org, at its very heart, is a structured text file. It has headers, subheaders, and keywords that allow other tools to parse files into agendas and to-do lists. Org files can be edited with any flat-text editor (e.g., [Vim][2], [Atom][3], or [Visual Studio Code][4]), and many have plugins that help create and manage Org files. - -A basic Org file looks something like this: - -``` -* Task List -** TODO Write Article for Day 16 - Org w/out emacs -   DEADLINE: <2019-01-25 12:00> -*** DONE Write sample org snippet for article -    - Include at least one TODO and one DONE item -    - Show notes -    - Show SCHEDULED and DEADLINE -*** TODO Take Screenshots -** Dentist Appointment -   SCHEDULED: <2019-01-31 13:30-14:30> -``` - -Org uses an outline format that uses ***** as bullets to indicate an item's level. Any item that begins with the word TODO (yes, in all caps) is just that—a to-do item. The work DONE indicates it is completed. SCHEDULED and DEADLINE indicate dates and times relevant to the item. If there's no time in either field, the item is considered an all-day event. - -With the right plugins, your favorite text editor becomes a powerhouse of productivity and organization. For example, the [vim-orgmode][5] plugin's features include functions to create Org files, syntax highlighting, and key commands to generate agendas and comprehensive to-do lists across files. - -![](https://opensource.com/sites/default/files/uploads/org-2.png) - -The Atom [Organized][6] plugin adds a sidebar on the right side of the screen that shows the agenda and to-do items in Org files. It can read from multiple files by default with a path set up in the configuration options. The Todo sidebar allows you to click on a to-do item to mark it done, then automatically updates the source Org file. - -![](https://opensource.com/sites/default/files/uploads/org-3.png) - -There are also a whole host of tools that "speak Org" to help keep you productive. With libraries in Python, Perl, PHP, NodeJS, and more, you can develop your own scripts and tools. And, of course, there is also [Emacs][7], which has Org support within the core distribution. - -![](https://opensource.com/sites/default/files/uploads/org-4.png) - -Org mode is one of the best tools for keeping on track with what needs to be done and when. And, contrary to myth, it doesn't need Emacs, just a text editor. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-org-mode - -作者:[Kevin Sonney][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://opensource.com/users/ksonney (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://orgmode.org/ -[2]: https://www.vim.org/ -[3]: https://atom.io/ -[4]: https://code.visualstudio.com/ -[5]: https://github.com/jceb/vim-orgmode -[6]: https://atom.io/packages/organized -[7]: https://www.gnu.org/software/emacs/ diff --git a/translated/tech/20180128 Get started with Org mode without Emacs.md b/translated/tech/20180128 Get started with Org mode without Emacs.md new file mode 100644 index 0000000000..c61600bd52 --- /dev/null +++ b/translated/tech/20180128 Get started with Org mode without Emacs.md @@ -0,0 +1,78 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(Get started with Org mode without Emacs) +[#]:via:(https://opensource.com/article/19/1/productivity-tool-org-mode) +[#]:author:(Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +在没有 Emacs 的情况下开始使用 Org mode +====== +不,你不需要 Emacs 也能用 Org,这是我开源工具系列的第 16 集,将会让你在 2019 年变得更加有生产率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +每到年初似乎总有这么一个疯狂的冲动来寻找提高生产率的方法。新年决心,正确地开始一年的冲动,以及"向前看"的态度都是这种冲动的表现。软件推荐通常都会选择闭源和专利软件。但这不是必须的。 + +这是我 2019 年改进生产率的 19 个新工具中的第 16 个。 + +### Org (非 Emacs) + +[Org mode][1] (或者就是 Org) 并不是新鲜货,但依然有许多人没有用过。他们很乐意试用一下以体验 Org 是如何改善生产率的。但最大的障碍来自于 Org 是与 Emacs 相沟联的,而且很多人都认为两者缺一不可。并不是这样的!一旦你理解了其基础,Org 就可以与各种其他工具和编辑器一起使用。 + +![](https://opensource.com/sites/default/files/uploads/org-1.png) + +Org,本质上,是一个结构化的文本文件。它有标题,子标题,以及各种关键字,其他工具可以根据这些关键字将文件解析成日程表和代办列表。Org 文件可以被任何纯文本编辑器编辑(例如。,[Vim][2],[Atom][3],或 [Visual Studio Code][4]),而且很多编辑器都有插件可以帮你创建和管理 Org 文件。 + +一个基础的 Org 文件看起来是这样的: + +``` +* Task List +** TODO Write Article for Day 16 - Org w/out emacs +   DEADLINE: <2019-01-25 12:00> +*** DONE Write sample org snippet for article +    - Include at least one TODO and one DONE item +    - Show notes +    - Show SCHEDULED and DEADLINE +*** TODO Take Screenshots +** Dentist Appointment +   SCHEDULED: <2019-01-31 13:30-14:30> +``` + +Org 是一种大纲格式,它使用 ***** 作为标识指明事项的级别。任何以 TODO( 是的,全大些) 开头的事项都代办事项。标注为 DONE 的工作表示该工作已经完成。SCHEDULED 和 DEADLINE 标识与该事务相关的日期和时间。如何任何地方都没有时间,则该事务被视为全天活动。 + +使用正确的插件,你喜欢的文本编辑器可以成为一个充满生产率和组织能力的强大工具。例如,[vim-orgmode][5] 插件拥有函数来创建 Org 文件,语法高亮,以及各种用来生成跨文件的日程和综合代办事项列表的关键命令。 + +![](https://opensource.com/sites/default/files/uploads/org-2.png) + +Atom 的 [Organized][6] 插件在屏幕右边添加一个侧边栏,用来现实 Org 文件中的日程和代办事项。默认情况下它从配置项中设置的路径中读取多个 Org 文件。Todo 侧边栏允许你通过点击未完事项来将其标记为已完成,它会自动更新源 Org 文件。 + +![](https://opensource.com/sites/default/files/uploads/org-3.png) + +还有一大堆 Org 工具可以帮助你保持生产率。使用 Python,Perl,PHP,NodeJS 等库,你可以开发自己的脚本和工具。当然,少不了 [Emacs][7],它的核心功能就包括支持 Org。 + +![](https://opensource.com/sites/default/files/uploads/org-4.png) + +Org mode 是跟踪需要完成的工作和时间的最好工具之一。而且,与传闻相反,它无需 Emacs,任何一个文本编辑器都行。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-org-mode + +作者:[Kevin Sonney][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://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://orgmode.org/ +[2]: https://www.vim.org/ +[3]: https://atom.io/ +[4]: https://code.visualstudio.com/ +[5]: https://github.com/jceb/vim-orgmode +[6]: https://atom.io/packages/organized +[7]: https://www.gnu.org/software/emacs/ From f10a1ba564892804e4b334d857ccf6e3469f2595 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Feb 2019 20:24:02 +0800 Subject: [PATCH 246/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190131=2019=20d?= =?UTF-8?q?ays=20of=20productivity=20in=202019:=20The=20fails=20sources/te?= =?UTF-8?q?ch/20190131=2019=20days=20of=20productivity=20in=202019-=20The?= =?UTF-8?q?=20fails.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...days of productivity in 2019- The fails.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20190131 19 days of productivity in 2019- The fails.md diff --git a/sources/tech/20190131 19 days of productivity in 2019- The fails.md b/sources/tech/20190131 19 days of productivity in 2019- The fails.md new file mode 100644 index 0000000000..e03a6f4ce0 --- /dev/null +++ b/sources/tech/20190131 19 days of productivity in 2019- The fails.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (19 days of productivity in 2019: The fails) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-wish-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +19 days of productivity in 2019: The fails +====== +Here are some tools the open source world doesn't do as well as it could. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Part of being productive is accepting that failure happens. I am a big proponent of [Howard Tayler's][1] Maxim 70: "Failure is not an option—it is mandatory. The option is whether or not to let failure be the last thing you do." And there were many things I wanted to talk about in this series that I failed to find good answers for. + +So, for the final edition of my 19 new (or new-to-you) open source tools to help you be more productive in 2019, I present the tools I wanted but didn't find. I am hopeful that you, the reader, will be able to help me find some good solutions to the items below. If you do, please share them in the comments. + +### Calendaring + +![](https://opensource.com/sites/default/files/uploads/thunderbird-1.png) + +If there is one thing the open source world is weak on, it is calendaring. I've tried about as many calendar programs as I've tried email programs. There are basically three good options for shared calendaring: [Evolution][2], the [Lightning add-on to Thunderbird][3], or [KOrganizer][4]. All the other applications I've tried (including [Orage][5], [Osmo][6], and almost all of the [Org mode][7] add-ons) seem to reliably support only read-only access to remote calendars. If the shared calendar uses either [Google Calendar][8] or [Microsoft Exchange][9] as the server, the first three are the only easily configured options (and even then, additional add-ons are often required). + +### Linux on the inside + +![](https://opensource.com/sites/default/files/uploads/android-x86-2.png) + +I love [Chrome OS][10], with its simplicity and lightweight requirements. I have owned several Chromebooks, including the latest models from Google. I find it to be reasonably distraction-free, lightweight, and easy to use. With the addition of Android apps and a Linux container, it's easy to be productive almost anywhere. + +I'd like to carry that over to some of the older laptops I have hanging around, but unless I do a full compile of Chromium OS, it is hard to find that same experience. The desktop [Android][11] projects like [Bliss OS][12], [Phoenix OS][13], and [Android-x86][14] are getting close, and I'm keeping an eye on them for the future. + +### Help desks + +![](https://opensource.com/sites/default/files/uploads/opennms_jira_dashboard-3.png) + +Customer service is a big deal for companies big and small. And with the added focus on DevOps these days, it is important to have tools to help bridge the gap. Almost every company I've worked with uses either [Jira][15], [GitHub][16], or [GitLab][17] for code issues, but none of these tools are very good at customer support tickets (without a lot of work). While there are many applications designed around customer support tickets and issues, most (if not all) of them are silos that don't play nice with other systems, again without a lot of work. + +On my wishlist is an open source solution that allows customers, support, and developers to work together without an unwieldy pile of code to glue multiple systems together. + +### Your turn + +![](https://opensource.com/sites/default/files/uploads/asciiquarium-4.png) + +I'm sure there are a lot of options I missed during this series. I try new applications regularly, in the hopes that they will help me be more productive. I encourage everyone to do the same, because when it comes to being productive with open source tools, there is always something new to try. And, if you have favorite open source productivity apps that didn't make it into this series, please make sure to share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-wish-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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://www.schlockmercenary.com/ +[2]: https://wiki.gnome.org/Apps/Evolution +[3]: https://www.thunderbird.net/en-US/calendar/ +[4]: https://userbase.kde.org/KOrganizer +[5]: https://github.com/xfce-mirror/orage +[6]: http://clayo.org/osmo/ +[7]: https://orgmode.org/ +[8]: https://calendar.google.com +[9]: https://products.office.com/ +[10]: https://en.wikipedia.org/wiki/Chrome_OS +[11]: https://www.android.com/ +[12]: https://blissroms.com/ +[13]: http://www.phoenixos.com/ +[14]: http://www.android-x86.org/ +[15]: https://www.atlassian.com/software/jira +[16]: https://github.com +[17]: https://about.gitlab.com/ From a2d953beb206d0444ed61c6ebe1e864abb973366 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 22:08:20 +0800 Subject: [PATCH 247/813] PRF:20190122 Get started with Go For It, a flexible to-do list application.md @geekpi --- ...r It, a flexible to-do list application.md | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md b/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md index e11d991541..c922661661 100644 --- a/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md +++ b/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md @@ -1,36 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Go For It, a flexible to-do list application) [#]: via: (https://opensource.com/article/19/1/productivity-tool-go-for-it) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 Go For It,一个灵活的待办事项列表程序 +开始使用 Go For It 吧,一个灵活的待办事项列表程序 ====== -Go For It,是我们开源工具系列中的第十个工具,它将使你在 2019 年更高效,它在 Todo.txt 系统的基础上构建,以帮助你完成更多工作。 + +> Go For It,是我们开源工具系列中的第十个工具,它将使你在 2019 年更高效,它在 Todo.txt 系统的基础上构建,以帮助你完成更多工作。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 10 个工具来帮助你在 2019 年更有效率。 ### Go For It -有时,人们要高效率需要的不是一个花哨的看板或一组笔记,而是一个简单,直接的待办事项清单。像“将项目添加到列表中,在完成后检查”一样基本的东西。为此,[纯文本 Todo.txt 系统][1]可能是最容易使用的系统之一,几乎所有系统都支持它。 +有时,人们要高效率需要的不是一个花哨的看板或一组笔记,而是一个简单、直接的待办事项清单。像“将项目添加到列表中,在完成后检查”一样基本的东西。为此,[纯文本 Todo.txt 系统][1]可能是最容易使用的系统之一,几乎所有系统都支持它。 ![](https://opensource.com/sites/default/files/uploads/go-for-it_1_1.png) -[Go For It][2] 是一个简单易用的 Todo.txt 图形界面。如果你已经在使用 Todo.txt,它可以与现有文件一起使用,如果还没有,那么可以同时创建待办事项和完成事项。它允许拖放任务排序,允许用户按照他们想要执行的顺序组织待办事项。它还支持 [Todo.txt 格式指南][3]中所述的优先级,项目和上下文。而且,只需单击任务列表中的项目或者上下文就可通过它们过滤任务。 +[Go For It][2] 是一个简单易用的 Todo.txt 图形界面。如果你已经在使用 Todo.txt,它可以与现有文件一起使用,如果还没有,那么可以同时创建待办事项和完成事项。它允许拖放任务排序,允许用户按照他们想要执行的顺序组织待办事项。它还支持 [Todo.txt 格式指南][3]中所述的优先级、项目和上下文。而且,只需单击任务列表中的项目或者上下文就可通过它们过滤任务。 ![](https://opensource.com/sites/default/files/uploads/go-for-it_2.png) -一开始,Go For It 可能看起来与任何其他 Todo.txt 程序相同,但外观可能是骗人的。将 Go For It 与其他真正区分开的功能是它包含一个内置的[番茄工作法][4]计时器。选择要完成的任务,切换到“计时器”选项卡,然后单击“启动”。任务完成后,只需单击“完成”,它将自动重置计时器并选择列表中的下一个任务。你可以暂停并重新启动计时器,也可以单击“跳过”跳转到下一个任务(或中断)。当当前任务剩余 60 秒时,它会发出警告。任务的默认时间设置为25分钟,中断的默认时间设置为五分钟。你可以在“设置”页面中调整,同时还能调整 Todo.txt 和 done.txt 文件的目录的位置。 +一开始,Go For It 可能看起来与任何其他 Todo.txt 程序相同,但外观可能是骗人的。将 Go For It 与其他程序真正区分开的功能是它包含一个内置的[番茄工作法][4]计时器。选择要完成的任务,切换到“计时器”选项卡,然后单击“启动”。任务完成后,只需单击“完成”,它将自动重置计时器并选择列表中的下一个任务。你可以暂停并重新启动计时器,也可以单击“跳过”跳转到下一个任务(或中断)。在当前任务剩余 60 秒时,它会发出警告。任务的默认时间设置为 25 分钟,中断的默认时间设置为 5 分钟。你可以在“设置”页面中调整,同时还能调整 Todo.txt 和 done.txt 文件的目录的位置。 ![](https://opensource.com/sites/default/files/uploads/go-for-it_3.png) -Go For It 的第三个选项卡“已完成”,允许你查看已完成的任务并在需要时将其清除。能够看到你已经完成的可能是非常激励的,也是一种了解你在更长的过程中进度的好方法。 +Go For It 的第三个选项卡是“已完成”,允许你查看已完成的任务并在需要时将其清除。能够看到你已经完成的可能是非常激励的,也是一种了解你在更长的过程中进度的好方法。 ![](https://opensource.com/sites/default/files/uploads/go-for-it_4.png) @@ -45,7 +47,7 @@ via: https://opensource.com/article/19/1/productivity-tool-go-for-it 作者:[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 9a6b388dfe12e2658c8a87fab1bf34eeb469c32c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Feb 2019 22:08:54 +0800 Subject: [PATCH 248/813] PUB:20190122 Get started with Go For It, a flexible to-do list application.md @geekpi https://linux.cn/article-10557-1.html --- ...arted with Go For It, a flexible to-do list application.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190122 Get started with Go For It, a flexible to-do list application.md (98%) diff --git a/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md b/published/20190122 Get started with Go For It, a flexible to-do list application.md similarity index 98% rename from translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md rename to published/20190122 Get started with Go For It, a flexible to-do list application.md index c922661661..e2602b216c 100644 --- a/translated/tech/20190122 Get started with Go For It, a flexible to-do list application.md +++ b/published/20190122 Get started with Go For It, a flexible to-do list application.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10557-1.html) [#]: subject: (Get started with Go For It, a flexible to-do list application) [#]: via: (https://opensource.com/article/19/1/productivity-tool-go-for-it) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From d007a342095ea1a195ed81b61b0a6bc035c34848 Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Thu, 21 Feb 2019 01:06:14 +0800 Subject: [PATCH 249/813] update --- sources/tech/20190219 Logical - in Bash.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md index adc8e4c465..a23ea21bd4 100644 --- a/sources/tech/20190219 Logical - in Bash.md +++ b/sources/tech/20190219 Logical - in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zero-MK) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -19,7 +19,7 @@ This means we haven't even touched on `&` as an AND operator, so let's do that n ### & is a Bitwise Operator If you are at all familiar with binary operations, you will have heard of AND and OR. These are bitwise operations that operate on individual bits of a binary number. In Bash, you use `&` as the AND operator and `|` as the OR operator: - +如果您完全熟悉二进制字符的各种操作,您肯定听说过AND和OR。这些是按位操作,对二进制数的各个位进行操作。在Bash中,使用`&`作为AND运算符,使用`|`作为OR运算符: **AND** ``` @@ -45,6 +45,7 @@ If you are at all familiar with binary operations, you will have heard of AND an ``` You can test this by ANDing any two numbers and outputting the result with `echo`: +您可以通过对任何两个数字进行AND运算并使用`echo`输出结果来测试: ``` $ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 @@ -57,6 +58,7 @@ $ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 ``` The same goes for OR (`|`): +OR(`|`)也是如此: ``` $ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 @@ -69,6 +71,7 @@ $ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 ``` Three things about this: +关于这个的三件事: 1. You use `(( ... ))` to tell Bash that what goes between the double brackets is some sort of arithmetic or logical operation. `(( 2 + 2 ))`, `(( 5 % 2 ))` (`%` being the [modulo][3] operator) and `((( 5 % 2 ) + 1))` (equals 3) will all work. 2. [Like with variables][4], `$` extracts the value so you can use it. @@ -213,7 +216,7 @@ via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash 作者:[Paul Brown][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zero-MK](https://github.com/zero-MK) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cf2c4809ec9eb6a378e074fb48b7ba69285830c0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 21 Feb 2019 08:53:10 +0800 Subject: [PATCH 250/813] translated --- ... gPodder, an open source podcast client.md | 64 ------------------- ... gPodder, an open source podcast client.md | 64 +++++++++++++++++++ 2 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 sources/tech/20190129 Get started with gPodder, an open source podcast client.md create mode 100644 translated/tech/20190129 Get started with gPodder, an open source podcast client.md diff --git a/sources/tech/20190129 Get started with gPodder, an open source podcast client.md b/sources/tech/20190129 Get started with gPodder, an open source podcast client.md deleted file mode 100644 index aaf72026b4..0000000000 --- a/sources/tech/20190129 Get started with gPodder, an open source podcast client.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with gPodder, an open source podcast client) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-gpodder) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with gPodder, an open source podcast client -====== -Keep your podcasts synced across your devices with gPodder, the 17th in our series on open source tools that will make you more productive in 2019. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/podcast-record-microphone.png?itok=8yUDOywf) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the 17th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### gPodder - -I like podcasts. Heck, I like them so much I record three of them (you can find links to them in [my profile][1]). I learn a lot from podcasts and play them in the background when I'm working. But keeping them in sync between multiple desktops and mobile devices can be a bit of a challenge. - -[gPodder][2] is a simple, cross-platform podcast downloader, player, and sync tool. It supports RSS feeds, [FeedBurner][3], [YouTube][4], and [SoundCloud][5], and it also has an open source sync service that you can run if you want. gPodder doesn't do podcast playback; instead, it uses your audio or video player of choice. - -![](https://opensource.com/sites/default/files/uploads/gpodder-1.png) - -Installing gPodder is very straightforward. Installers are available for Windows and MacOS, and packages are available for major Linux distributions. If it isn't available in your distribution, you can run it directly from a Git checkout. With the "Add Podcasts via URL" menu option, you can enter a podcast's RSS feed URL or one of the "special" URLs for the other services. gPodder will fetch a list of episodes and present a dialog where you can select which episodes to download or mark old episodes on the list. - -![](https://opensource.com/sites/default/files/uploads/gpodder-2.png) - -One of its nicer features is that if a URL is already in your clipboard, gPodder will automatically place it in its URL field, which makes it really easy to add a new podcast to your list. If you already have an OPML file of podcast feeds, you can upload and import it. There is also a discovery option that allows you to search for podcasts on [gPodder.net][6], the free and open source podcast listing site by the people who write and maintain gPodder. - -![](https://opensource.com/sites/default/files/uploads/gpodder-3.png) - -A [mygpo][7] server synchronizes podcasts between devices. By default, gPodder uses [gPodder.net][8]'s servers, but you can change this in the configuration files if want to run your own (be aware that you'll have to modify the configuration file directly). Syncing allows you to keep your lists consistent between desktops and mobile devices. This is very useful if you listen to podcasts on multiple devices (for example, I listen on my work computer, home computer, and mobile phone), as it means no matter where you are, you have the most recent lists of podcasts and episodes without having to set things up again and again. - -![](https://opensource.com/sites/default/files/uploads/gpodder-4.png) - -Clicking on a podcast episode will bring up the text post associated with it, and clicking "Play" will launch your device's default audio or video player. If you want to use something other than the default, you can change this in gPodder's configuration settings. - -gPodder makes it simple to find, download, and listen to podcasts, synchronize them across devices, and access a lot of other features in an easy-to-use interface. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-gpodder - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/users/ksonney -[2]: https://gpodder.github.io/ -[3]: https://feedburner.google.com/ -[4]: https://youtube.com -[5]: https://soundcloud.com/ -[6]: http://gpodder.net -[7]: https://github.com/gpodder/mygpo -[8]: http://gPodder.net diff --git a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md b/translated/tech/20190129 Get started with gPodder, an open source podcast client.md new file mode 100644 index 0000000000..429189b926 --- /dev/null +++ b/translated/tech/20190129 Get started with gPodder, an open source podcast client.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with gPodder, an open source podcast client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-gpodder) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 gPodder,一个开源播客客户端 +====== +使用 gPodder 将你的播客同步到你的设备上,gPodder 是我们开源工具系列中的第 17 个工具,它将在 2019 年提高你的工作效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/podcast-record-microphone.png?itok=8yUDOywf) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 17 个工具来帮助你在 2019 年更有效率。 + +### gPodder + +我喜欢播客。哎呀,我非常喜欢他们,因此我录制了其中的三个(你可以在[我的个人资料][1]中找到它们的链接)。我从播客那里学到了很多东西,并在我工作时在后台播放它们。但是,在多台桌面和移动设备之间保持同步可能会带来一些挑战。 + +[gPodder][2] 是一个简单的跨平台播客下载器、播放器和同步工具。它支持 RSS feed、[FeedBurner][3]、[YouTube][4] 和 [SoundCloud][5],它还有一个开源同步服务,你可以根据需要运行它。gPodder 不直接播放播客。相反, 它使用你选择的音频或视频播放器。 + +![](https://opensource.com/sites/default/files/uploads/gpodder-1.png) + +安装 gPodder 非常简单。安装程序适用于 Windows 和 MacOS,同时包可用于主要的 Linux 发行版。如果你的发行版中没有它,你可以直接从 Git 下载运行。通过 “Add Podcasts via URL” 菜单,你可以输入播客的 RSS 源 URL 或其他服务的“特殊” URL。gPodder 将获取节目列表并显示一个对话框,你可以在其中选择要下载的节目或在列表上标记旧节目。 + +![](https://opensource.com/sites/default/files/uploads/gpodder-2.png) + +它一个更好的功能是,如果 URL 已经在你的剪贴板中,gPodder 会自动将它放入播放 URL 中,这样你就可以很容易地将新的播客添加到列表中。如果你已有播客 feed 的 OPML 文件,那么可以上传并导入它。还有一个发现选项,让你可搜索 [gPodder.net][6] 上的播客,这是由编写和维护 gPodder 的人员提供的免费和开源播客列表网站。 + +![](https://opensource.com/sites/default/files/uploads/gpodder-3.png) + +[mygpo][7] 服务器在设备之间同步播客。gPodder 默认使用 [gPodder.net][8] 的服务器,但是如果你想要运行自己的服务器,那么可以在配置文件中更改它(请注意,你需要直接修改配置文件)。同步能让你在桌面和移动设备之间保持列表一致。如果你在多个设备上收听播客(例如,我在我的工作电脑、家用电脑和手机上收听),这会非常有用,因为这意味着无论你身在何处,你都拥有最近的播客和节目列表而无需一次又一次地设置。 + +![](https://opensource.com/sites/default/files/uploads/gpodder-4.png) + +单击播客节目将显示与其关联的文本,单击“播放”将启动设备的默认音频或视频播放器。如果要使用默认之外的其他播放器,可以在 gPodder 的配置设置中更改此设置。 + +通过 gPodder,你可以轻松查找、下载和收听播客,在设备之间同步这些播客,在易于使用的界面中访问许多其他功能。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-gpodder + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/users/ksonney +[2]: https://gpodder.github.io/ +[3]: https://feedburner.google.com/ +[4]: https://youtube.com +[5]: https://soundcloud.com/ +[6]: http://gpodder.net +[7]: https://github.com/gpodder/mygpo +[8]: http://gPodder.net From 2de0f1a94e4fbad267140506fb6f86d7f0dc5b8f Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 21 Feb 2019 09:03:14 +0800 Subject: [PATCH 251/813] translating --- .../20190123 Mind map yourself using FreeMind and Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md index 146f95752a..e52673707c 100644 --- a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md +++ b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 089451477500d76a4d4d61db9dfe9fcac16bbeb4 Mon Sep 17 00:00:00 2001 From: pityonline Date: Wed, 16 Jan 2019 00:23:40 +0800 Subject: [PATCH 252/813] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?5=20useful=20Vim=20plugins=20for=20developers.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...110 5 useful Vim plugins for developers.md | 369 ----------------- ...110 5 useful Vim plugins for developers.md | 371 ++++++++++++++++++ 2 files changed, 371 insertions(+), 369 deletions(-) delete mode 100644 sources/tech/20190110 5 useful Vim plugins for developers.md create mode 100644 translated/tech/20190110 5 useful Vim plugins for developers.md diff --git a/sources/tech/20190110 5 useful Vim plugins for developers.md b/sources/tech/20190110 5 useful Vim plugins for developers.md deleted file mode 100644 index 2b5b9421d4..0000000000 --- a/sources/tech/20190110 5 useful Vim plugins for developers.md +++ /dev/null @@ -1,369 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (pityonline) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 useful Vim plugins for developers) -[#]: via: (https://opensource.com/article/19/1/vim-plugins-developers) -[#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) - -5 useful Vim plugins for developers -====== -Expand Vim's capabilities and improve your workflow with these five plugins for writing code. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) - -I have used [Vim][1] as a text editor for over 20 years, but about two years ago I decided to make it my primary text editor. I use Vim to write code, configuration files, blog articles, and pretty much everything I can do in plaintext. Vim has many great features and, once you get used to it, you become very productive. - -I tend to use Vim's robust native capabilities for most of what I do, but there are a number of plugins developed by the open source community that extend Vim's capabilities, improve your workflow, and make you even more productive. - -Following are five plugins that are useful when using Vim to write code in any programming language. - -### 1. Auto Pairs - -The [Auto Pairs][2] plugin helps insert and delete pairs of characters, such as brackets, parentheses, or quotation marks. This is very useful for writing code, since most programming languages use pairs of characters in their syntax—such as parentheses for function calls or quotation marks for string definitions. - -In its most basic functionality, Auto Pairs inserts the corresponding closing character when you type an opening character. For example, if you enter a bracket **[** , Auto-Pairs automatically inserts the closing bracket **]**. Conversely, if you use the Backspace key to delete the opening bracket, Auto Pairs deletes the corresponding closing bracket. - -If you have automatic indentation on, Auto Pairs inserts the paired character in the proper indented position when you press Return/Enter, saving you from finding the correct position and typing the required spaces or tabs. - -Consider this Go code block for instance: - -``` -package main - -import "fmt" - -func main() { -    x := true -    items := []string{"tv", "pc", "tablet"} - -    if x { -        for _, i := range items -    } -} -``` - -Inserting an opening curly brace **{** after **items** and pressing Return/Enter produces this result: - -``` -package main - -import "fmt" - -func main() { -    x := true -    items := []string{"tv", "pc", "tablet"} - -    if x { -        for _, i := range items  { -            | (cursor here) -        } -    } -} -``` - -Auto Pairs offers many other options (which you can read about on [GitHub][3]), but even these basic features will save time. - -### 2. NERD Commenter - -The [NERD Commenter][4] plugin adds code-commenting functions to Vim, similar to the ones found in an integrated development environment (IDE). With this plugin installed, you can select one or several lines of code and change them to comments with the press of a button. - -NERD Commenter integrates with the standard Vim [filetype][5] plugin, so it understands several programming languages and uses the appropriate commenting characters for single or multi-line comments. - -The easiest way to get started is by pressing **Leader+Space** to toggle the current line between commented and uncommented. The standard Vim Leader key is the **\** character. - -In Visual mode, you can select multiple lines and toggle their status at the same time. NERD Commenter also understands counts, so you can provide a count n followed by the command to change n lines together. - -Other useful features are the "Sexy Comment," triggered by **Leader+cs** , which creates a fancy comment block using the multi-line comment character. For example, consider this block of code: - -``` -package main - -import "fmt" - -func main() { -    x := true -    items := []string{"tv", "pc", "tablet"} - -    if x { -        for _, i := range items { -            fmt.Println(i) -        } -    } -} -``` - -Selecting all the lines in **function main** and pressing **Leader+cs** results in the following comment block: - -``` -package main - -import "fmt" - -func main() { -/* - *    x := true - *    items := []string{"tv", "pc", "tablet"} - * - *    if x { - *        for _, i := range items { - *            fmt.Println(i) - *        } - *    } - */ -} -``` - -Since all the lines are commented in one block, you can uncomment the entire block by toggling any of the lines of the block with **Leader+Space**. - -NERD Commenter is a must-have for any developer using Vim to write code. - -### 3. VIM Surround - -The [Vim Surround][6] plugin helps you "surround" existing text with pairs of characters (such as parentheses or quotation marks) or tags (such as HTML or XML tags). It's similar to Auto Pairs but, instead of working while you're inserting text, it's more useful when you're editing text. - -For example, if you have the following sentence: - -``` -"Vim plugins are awesome !" -``` - -You can remove the quotation marks around the sentence by pressing the combination **ds"** while your cursor is anywhere between the quotation marks: - -``` -Vim plugins are awesome ! -``` - -You can also change the double quotation marks to single quotation marks with the command **cs"'** : - -``` -'Vim plugins are awesome !' -``` - -Or replace them with brackets by pressing **cs'[** - -``` -[ Vim plugins are awesome ! ] -``` - -While it's a great help for text objects, this plugin really shines when working with HTML or XML tags. Consider the following HTML line: - -``` -

Vim plugins are awesome !

-``` - -You can emphasize the word "awesome" by pressing the combination **ysiw ** while the cursor is anywhere on that word: - -``` -

Vim plugins are awesome !

-``` - -Notice that the plugin is smart enough to use the proper closing tag **< /em>**. - -Vim Surround can also indent text and add tags in their own lines using **ySS**. For example, if you have: - -``` -

Vim plugins are awesome !

-``` - -Add a **div** tag with this combination: **ySS
**, and notice that the paragraph line is indented automatically. - -``` -
-       

Vim plugins are awesome !

-
-``` - -Vim Surround has many other options. Give it a try—and consult [GitHub][7] for additional information. - -### 4\. Vim Gitgutter - -The [Vim Gitgutter][8] plugin is useful for anyone using Git for version control. It shows the output of **Git diff** as symbols in the "gutter"—the sign column where Vim presents additional information, such as line numbers. For example, consider the following as the committed version in Git: - -``` -  1 package main -  2 -  3 import "fmt" -  4 -  5 func main() { -  6     x := true -  7     items := []string{"tv", "pc", "tablet"} -  8 -  9     if x { - 10         for _, i := range items { - 11             fmt.Println(i) - 12         } - 13     } - 14 } -``` - -After making some changes, Vim Gitgutter displays the following symbols in the gutter: - -``` -    1 package main -    2 -    3 import "fmt" -    4 -_   5 func main() { -    6     items := []string{"tv", "pc", "tablet"} -    7 -~   8     if len(items) > 0 { -    9         for _, i := range items { -   10             fmt.Println(i) -+  11             fmt.Println("------") -   12         } -   13     } -   14 } -``` - -The **-** symbol shows that a line was deleted between lines 5 and 6. The **~** symbol shows that line 8 was modified, and the symbol **+** shows that line 11 was added. - -In addition, Vim Gitgutter allows you to navigate between "hunks"—individual changes made in the file—with **[c** and **]c** , or even stage individual hunks for commit by pressing **Leader+hs**. - -This plugin gives you immediate visual feedback of changes, and it's a great addition to your toolbox if you use Git. - -### 5\. VIM Fugitive - -[Vim Fugitive][9] is another great plugin for anyone incorporating Git into the Vim workflow. It's a Git wrapper that allows you to execute Git commands directly from Vim and integrates with Vim's interface. This plugin has many features—check its [GitHub][10] page for more information. - -Here's a basic Git workflow example using Vim Fugitive. Considering the changes we've made to the Go code block on section 4, you can use **git blame** by typing the command **:Gblame** : - -``` -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    1 package main -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    2 -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    3 import "fmt" -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    4 -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│_   5 func main() { -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    6     items := []string{"tv", "pc", "tablet"} -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    7 -00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│~   8     if len(items) > 0 { -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    9         for _, i := range items { -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   10             fmt.Println(i) -00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│+  11             fmt.Println("------") -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   12         } -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   13     } -e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   14 } -``` - -You can see that lines 8 and 11 have not been committed. Check the repository status by typing **:Gstatus** : - -``` - 1 # On branch master -  2 # Your branch is up to date with 'origin/master'. -  3 # -  4 # Changes not staged for commit: -  5 #   (use "git add ..." to update what will be committed) -  6 #   (use "git checkout -- ..." to discard changes in working directory) -  7 # -  8 #       modified:   vim-5plugins/examples/test1.go -  9 # - 10 no changes added to commit (use "git add" and/or "git commit -a") --------------------------------------------------------------------------------------------------------- -    1 package main -    2 -    3 import "fmt" -    4 -_   5 func main() { -    6     items := []string{"tv", "pc", "tablet"} -    7 -~   8     if len(items) > 0 { -    9         for _, i := range items { -   10             fmt.Println(i) -+  11             fmt.Println("------") -   12         } -   13     } -   14 } -``` - -Vim Fugitive opens a split window with the result of **git status**. You can stage a file for commit by pressing the **-** key on the line with the name of the file. You can reset the status by pressing **-** again. The message updates to reflect the new status: - -``` -  1 # On branch master -  2 # Your branch is up to date with 'origin/master'. -  3 # -  4 # Changes to be committed: -  5 #   (use "git reset HEAD ..." to unstage) -  6 # -  7 #       modified:   vim-5plugins/examples/test1.go -  8 # --------------------------------------------------------------------------------------------------------- -    1 package main -    2 -    3 import "fmt" -    4 -_   5 func main() { -    6     items := []string{"tv", "pc", "tablet"} -    7 -~   8     if len(items) > 0 { -    9         for _, i := range items { -   10             fmt.Println(i) -+  11             fmt.Println("------") -   12         } -   13     } -   14 } -``` - -Now you can use the command **:Gcommit** to commit the changes. Vim Fugitive opens another split that allows you to enter a commit message: - -``` -  1 vim-5plugins: Updated test1.go example file -  2 # Please enter the commit message for your changes. Lines starting -  3 # with '#' will be ignored, and an empty message aborts the commit. -  4 # -  5 # On branch master -  6 # Your branch is up to date with 'origin/master'. -  7 # -  8 # Changes to be committed: -  9 #       modified:   vim-5plugins/examples/test1.go - 10 # -``` - -Save the file with **:wq** to complete the commit: - -``` -[master c3bf80f] vim-5plugins: Updated test1.go example file - 1 file changed, 2 insertions(+), 2 deletions(-) -Press ENTER or type command to continue -``` - -You can use **:Gstatus** again to see the result and **:Gpush** to update the remote repository with the new commit. - -``` -  1 # On branch master -  2 # Your branch is ahead of 'origin/master' by 1 commit. -  3 #   (use "git push" to publish your local commits) -  4 # -  5 nothing to commit, working tree clean -``` - -If you like Vim Fugitive and want to learn more, the GitHub repository has links to screencasts showing additional functionality and workflows. Check it out! - -### What's next? - -These Vim plugins help developers write code in any programming language. There are two other categories of plugins to help developers: code-completion plugins and syntax-checker plugins. They are usually related to specific programming languages, so I will cover them in a follow-up article. - -Do you have another Vim plugin you use when writing code? Please share it in the comments below. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/vim-plugins-developers - -作者:[Ricardo Gerardi][a] -选题:[lujun9972][b] -译者:[pityonline](https://github.com/pityonline) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/rgerardi -[b]: https://github.com/lujun9972 -[1]: https://www.vim.org/ -[2]: https://www.vim.org/scripts/script.php?script_id=3599 -[3]: https://github.com/jiangmiao/auto-pairs -[4]: https://github.com/scrooloose/nerdcommenter -[5]: http://vim.wikia.com/wiki/Filetype.vim -[6]: https://www.vim.org/scripts/script.php?script_id=1697 -[7]: https://github.com/tpope/vim-surround -[8]: https://github.com/airblade/vim-gitgutter -[9]: https://www.vim.org/scripts/script.php?script_id=2975 -[10]: https://github.com/tpope/vim-fugitive diff --git a/translated/tech/20190110 5 useful Vim plugins for developers.md b/translated/tech/20190110 5 useful Vim plugins for developers.md new file mode 100644 index 0000000000..95d73b5ec2 --- /dev/null +++ b/translated/tech/20190110 5 useful Vim plugins for developers.md @@ -0,0 +1,371 @@ +[#]: collector: (lujun9972) +[#]: translator: (pityonline) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 useful Vim plugins for developers) +[#]: via: (https://opensource.com/article/19/1/vim-plugins-developers) +[#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) + +5 个好用的 Vim 插件 +====== + +通过这 5 个插件扩展 Vim 功能来提升你的编码效率。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +我用 Vim 已经超过 20 年了,两年前我决定把它作为我的首要文本编辑器。我用 Vim 来编写代码,配置文件,博客文章及其它任意可以用纯文本表达的东西。Vim 有很多超级棒的功能,一旦你适合了它,你的工作会变得非常高效。 + +在日常编辑工作中,我更倾向于使用 Vim 稳定的原生扩展,但开源社区对 Vim 开发了大量可以提升工作效率的插件。 + +以下列举 5 个非常好用的可以用于编写任意编程语言的插件。 + +### 1. Auto Pairs + +[Auto Pairs][2] 插件可以帮助你插入和删除成对的文字,如花括号,圆括号或引用标记。这在编写代码时非常有用,因为很多编程语言都有成对标记的语法,就像圆括号用于函数调用,或引号用于字符串定义。 + +Auto Pairs 最基本的功能是在你输入一个左括号时会自动补全对应的另一半括号。比如,你输入了一个 `[`,它会自动帮你补充另一半 `]`。相反,如果你用退格键删除开头的一半括号,Auto Pairs 会删除另一半。 + +如果你设置了自动缩进,当你按下回车键时 Auto Pairs 会在恰当的缩进位置补全另一半括号,这比你找到放置另一半的位置并选择一个正确的括号要省劲多了。 + +例如下面这段代码: + +``` +package main + +import "fmt" + +func main() { + x := true + items := []string{"tv", "pc", "tablet"} + + if x { + for _, i := range items + } +} +``` + +在 `items` 后面输入一个左花括号按下回车会产生下面的结果: + +``` +package main + +import "fmt" + +func main() { + x := true + items := []string{"tv", "pc", "tablet"} + + if x { + for _, i := range items { + | (cursor here) + } + } +} +``` + +Auto Pairs 提供了大量其它选项(你可以在 [GitHub][3] 上找到),但最基本的功能已经很让人省时间了。 + +### 2. NERD Commenter + +[NERD Commenter][4] 插件增加了方便注释的功能,类似在 IDEintegrated development environment 中注释功能。有了这个插件,你可以一键注释单行或多行代码。 + +NERD Commenter 使用了标准的 Vim [filetype][5],所以它能理解一些编程语言并使用合适的方式来注释代码。 + +最易上手的方法是按 `Leader+Space` 组合键来开关当前行的注释。Vim 默认的 Leader 键是 `\`。 + +在可视化模式Visual mode中,你可以选择多行一并注释。NERD Commenter 也可以按计数注释,所以你可以加个数量 n 来注释 n 行。 + +还有个有用的特性 Sexy Comment 可以用 `Leader+cs` 来触发,它的块注释风格更漂亮一些。例如下面这段代码: + +``` +package main + +import "fmt" + +func main() { + x := true +    items := []string{"tv", "pc", "tablet"} + +    if x { +        for _, i := range items { +            fmt.Println(i) +        } +    } +} +``` + +选择 `main` 函数中的所有行然后按下 `Leader+cs` 会出来以下注释效果: + +``` +package main + +import "fmt" + +func main() { +/* + *    x := true + *    items := []string{"tv", "pc", "tablet"} + * + *    if x { + *        for _, i := range items { + *            fmt.Println(i) + *        } + *    } + */ +} +``` + +因为这些行都是在一个块中注释的,你可以用 `Leader+Space` 组合键一次去掉这里所有的注释。 + +NERD Commenter 是任何使用 Vim 写代码的开发者都必装的插件。 + +### 3. VIM Surround + +[Vim Surround][6] 插件可以帮你在现有文本中实现环绕插入成对的符号(如括号或双引号)或标签(如 HTML 或 XML 标签)。它和 Auto Pairs 有点儿类似,但在编辑文本时更有用。 + +比如你有以下一个句子: + +``` +"Vim plugins are awesome !" +``` + +当你的光标处理句中任何位置时,你可以用 `ds"` 组合键删除句子两端的双引号。 + +``` +Vim plugins are awesome ! +``` + +你也可以用 `cs"'` 把双端的双引号换成单引号: + +``` +'Vim plugins are awesome !' +``` + +或者用 `cs'[` 替换成中括号: + +``` +[ Vim plugins are awesome ! ] +``` + +它对编辑 HTML 或 XML 文本中的标签tag尤其在行。假如你有以下一行 HTML 代码: + +``` +

Vim plugins are awesome !

+``` + +当光标在 awesome 这个单词的任何位置时,你可以按 `ysiw ` 直接给它加上着重标签: + +``` +

Vim plugins are awesome !

+``` + +注意它聪明地加上了 `
` 闭合标签。 + +Vim Surround 也可以用 `ySS` 缩进文本。比如你有以下文本: + +``` +

Vim plugins are awesome !

+``` + +你可以用 `ySS
` 加上 `div` 标签,注意生成的段落是自动缩进的。 + +``` +
+       

Vim plugins are awesome !

+
+``` + +Vim Surround 有很多其它选项,你可以参照 [GitHub][7] 上的说明尝试它们。 + +### 4. Vim Gitgutter + +[Vim Gitgutter][8] 插件对使用 Git 作为版本控制工具的人来说非常有用。它会在 Vim 显示行号的列旁 `git diff` 的差异标记。假设你有如下已提交过的代码: + +``` +  1 package main +  2 +  3 import "fmt" +  4 +  5 func main() { +  6     x := true +  7     items := []string{"tv", "pc", "tablet"} +  8 +  9     if x { + 10         for _, i := range items { + 11             fmt.Println(i) + 12         } + 13     } + 14 } +``` + +当你做出一些修改后,Vim Gitgutter 会显示如下标记: + +``` +    1 package main +    2 +    3 import "fmt" +    4 +_   5 func main() { +    6     items := []string{"tv", "pc", "tablet"} +    7 +~   8     if len(items) > 0 { +    9         for _, i := range items { +   10             fmt.Println(i) ++  11             fmt.Println("------") +   12         } +   13     } +   14 } +``` + +`-` 标记表示在第 5 行和第 6 行之间删除了一行。`~` 表示第 8 行有修改,`+` 表示新增了第 11 行。 + +另外,Vim Gitgutter 允许你用 `[c` 和 `]c` 在多个有修改的块之间跳转,甚至可以用 `Leader+hs` 来暂存某个变更集。 + +这个插件提供了对变更的即时视觉反馈,如果你用 Git 的话,有了它简直是如虎添翼。 + +### 5. VIM Fugitive + +[Vim Fugitive][9] 是另一个超棒的将 Git 工作流集成到 Vim 中的插件。它对 Git 做了一些封装,可以让你在 Vim 里直接执行 Git 命令并将结果集成在 Vim 界面里。这个插件有超多的特性,更多信息请访问它的 [GitHub][10] 项目页面。 + +这里有一个使用 Vim Fugitive 的基础 Git 工作流示例。设想我们已经对下面的 Go 代码做出修改,你可以用 `:Gblame` 调用 `git blame` 来查看每行最后的提交信息: + +``` +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    1 package main +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    2 +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    3 import "fmt" +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    4 +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│_   5 func main() { +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    6     items := []string{"tv", "pc", "tablet"} +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    7 +00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│~   8     if len(items) > 0 { +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    9         for _, i := range items { +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   10             fmt.Println(i) +00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│+  11             fmt.Println("------") +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   12         } +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   13     } +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   14 } +``` + +可以看到第 8 行和第 11 行显示还未提交。用 `:Gstatus` 命令检查仓库当前的状态: + +``` +  1 # On branch master +  2 # Your branch is up to date with 'origin/master'. +  3 # +  4 # Changes not staged for commit: +  5 #   (use "git add ..." to update what will be committed) +  6 #   (use "git checkout -- ..." to discard changes in working directory) +  7 # +  8 #       modified:   vim-5plugins/examples/test1.go +  9 # + 10 no changes added to commit (use "git add" and/or "git commit -a") +-------------------------------------------------------------------------------------------------------- +    1 package main +    2 +    3 import "fmt" +    4 +_   5 func main() { +    6     items := []string{"tv", "pc", "tablet"} +    7 +~   8     if len(items) > 0 { +    9         for _, i := range items { +   10             fmt.Println(i) ++  11             fmt.Println("------") +   12         } +   13     } +   14 } +``` + +Vim Fugitive 在分割的窗口里显示 `git status` 的输出结果。你可以在某文件名所在的行用 `-` 键暂存这个文件,再按一次 `-` 可以取消暂存。这个信息会随着你的操作自动更新: + +``` +  1 # On branch master +  2 # Your branch is up to date with 'origin/master'. +  3 # +  4 # Changes to be committed: +  5 #   (use "git reset HEAD ..." to unstage) +  6 # +  7 #       modified:   vim-5plugins/examples/test1.go +  8 # +-------------------------------------------------------------------------------------------------------- +    1 package main +    2 +    3 import "fmt" +    4 +_   5 func main() { +    6     items := []string{"tv", "pc", "tablet"} +    7 +~   8     if len(items) > 0 { +    9         for _, i := range items { +   10             fmt.Println(i) ++  11             fmt.Println("------") +   12         } +   13     } +   14 } +``` + +现在你可以用 `:Gcommit` 来提交修改了。Vim Fugitive 会打开另一个分割窗口让你输入提交信息: + +``` +  1 vim-5plugins: Updated test1.go example file +  2 # Please enter the commit message for your changes. Lines starting +  3 # with '#' will be ignored, and an empty message aborts the commit. +  4 # +  5 # On branch master +  6 # Your branch is up to date with 'origin/master'. +  7 # +  8 # Changes to be committed: +  9 #       modified:   vim-5plugins/examples/test1.go + 10 # +``` + +按 `:wq` 保存文件完成提交: + +``` +[master c3bf80f] vim-5plugins: Updated test1.go example file + 1 file changed, 2 insertions(+), 2 deletions(-) +Press ENTER or type command to continue +``` + +然后你可以再用 `:Gstatus` 检查结果并用 `:Gpush` 把新的提交推送到远程。 + +``` +  1 # On branch master +  2 # Your branch is ahead of 'origin/master' by 1 commit. +  3 #   (use "git push" to publish your local commits) +  4 # +  5 nothing to commit, working tree clean +``` + +Vim Fugitive 的 GitHub 项目主页有很多屏幕录像展示了它的更多功能和工作流,如果你喜欢它并想多学一些,快去看看吧。 + +### 接下来? + +这些 Vim 插件都是程序开发者的神器!还有其它几类开发者常用的插件:自动完成插件和语法检查插件。它些大都是和具体的编程语言相关的,以后我会在一些文章中介绍它们。 + +你在写代码时是否用到一些其它 Vim 插件?请在评论区留言分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/vim-plugins-developers + +作者:[Ricardo Gerardi][a] +选题:[lujun9972][b] +译者:[pityonline](https://github.com/pityonline) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rgerardi +[b]: https://github.com/lujun9972 +[1]: https://www.vim.org/ +[2]: https://www.vim.org/scripts/script.php?script_id=3599 +[3]: https://github.com/jiangmiao/auto-pairs +[4]: https://github.com/scrooloose/nerdcommenter +[5]: http://vim.wikia.com/wiki/Filetype.vim +[6]: https://www.vim.org/scripts/script.php?script_id=1697 +[7]: https://github.com/tpope/vim-surround +[8]: https://github.com/airblade/vim-gitgutter +[9]: https://www.vim.org/scripts/script.php?script_id=2975 +[10]: https://github.com/tpope/vim-fugitive From d42e65962f5ebe8e0d295e2ae36747f115e9e476 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 12:50:01 +0800 Subject: [PATCH 253/813] APL:20181123 Three SSH GUI Tools for Linux.md --- sources/tech/20181123 Three SSH GUI Tools for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181123 Three SSH GUI Tools for Linux.md b/sources/tech/20181123 Three SSH GUI Tools for Linux.md index 9691a737ca..0f29ac3a87 100644 --- a/sources/tech/20181123 Three SSH GUI Tools for Linux.md +++ b/sources/tech/20181123 Three SSH GUI Tools for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Three SSH GUI Tools for Linux) From 4ca61bf760d6b7fe3a89bdf4c0f2451fc1b5f5dd Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 21 Feb 2019 13:31:19 +0800 Subject: [PATCH 254/813] Translating 7 steps for hunting down Python code bugs. --- .../tech/20190208 7 steps for hunting down Python code bugs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 4781e06f9b..16620f78ad 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -22,7 +22,7 @@ ### 1. 不要碰你的代码 -Go ahead and look at it, maybe even come up with a hypothesis. But before you start mucking about in the code, take that call that creates the bug and turn it into a test. This will be an integration test because although you may have suspicions, you do not yet know exactly where the problem is. +阅读代码,你甚至可能会想出一个假设。但是在开始修改你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有疑问,目前你还没能准确地知道问题在哪儿。 Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. From 8313ec92aab9439b5ca7a15f898c1f911b485290 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 13:49:03 +0800 Subject: [PATCH 255/813] TSL:20181123 Three SSH GUI Tools for Linux.md --- .../20181123 Three SSH GUI Tools for Linux.md | 176 ------------------ .../20181123 Three SSH GUI Tools for Linux.md | 145 +++++++++++++++ 2 files changed, 145 insertions(+), 176 deletions(-) delete mode 100644 sources/tech/20181123 Three SSH GUI Tools for Linux.md create mode 100644 translated/tech/20181123 Three SSH GUI Tools for Linux.md diff --git a/sources/tech/20181123 Three SSH GUI Tools for Linux.md b/sources/tech/20181123 Three SSH GUI Tools for Linux.md deleted file mode 100644 index 0f29ac3a87..0000000000 --- a/sources/tech/20181123 Three SSH GUI Tools for Linux.md +++ /dev/null @@ -1,176 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Three SSH GUI Tools for Linux) -[#]: via: (https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - -Three SSH GUI Tools for Linux -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh.jpg?itok=3UcXhJt7) - -At some point in your career as a Linux administrator, you’re going to use Secure Shell (SSH) to remote into a Linux server or desktop. Chances are, you already have. In some instances, you’ll be SSH’ing into multiple Linux servers at once. In fact, Secure Shell might well be one of the most-used tools in your Linux toolbox. Because of this, you’ll want to make the experience as efficient as possible. For many admins, nothing is as efficient as the command line. However, there are users out there who do prefer a GUI tool, especially when working from a desktop machine to remote into and work on a server. - -If you happen to prefer a good GUI tool, you’ll be happy to know there are a couple of outstanding graphical tools for SSH on Linux. Couple that with a unique terminal window that allows you to remote into multiple machines from the same window, and you have everything you need to work efficiently. Let’s take a look at these three tools and find out if one (or more) of them is perfectly apt to meet your needs. - -I’ll be demonstrating these tools on [Elementary OS][1], but they are all available for most major distributions. - -### PuTTY - -Anyone that’s been around long enough knows about [PuTTY][2]. In fact, PuTTY is the de facto standard tool for connecting, via SSH, to Linux servers from the Windows environment. But PuTTY isn’t just for Windows. In fact, from withing the standard repositories, PuTTY can also be installed on Linux. PuTTY’s feature list includes: - - * Saved sessions. - - * Connect via IP address or hostname. - - * Define alternative SSH port. - - * Connection type definition. - - * Logging. - - * Options for keyboard, bell, appearance, connection, and more. - - * Local and remote tunnel configuration - - * Proxy support - - * X11 tunneling support - - - - -The PuTTY GUI is mostly a way to save SSH sessions, so it’s easier to manage all of those various Linux servers and desktops you need to constantly remote into and out of. Once you’ve connected, from PuTTY to the Linux server, you will have a terminal window in which to work. At this point, you may be asking yourself, why not just work from the terminal window? For some, the convenience of saving sessions does make PuTTY worth using. - -Installing PuTTY on Linux is simple. For example, you could issue the command on a Debian-based distribution: - -``` -sudo apt-get install -y putty -``` - -Once installed, you can either run the PuTTY GUI from your desktop menu or issue the command putty. In the PuTTY Configuration window (Figure 1), type the hostname or IP address in the HostName (or IP address) section, configure the port (if not the default 22), select SSH from the connection type, and click Open. - -![PuTTY Connection][4] - -Figure 1: The PuTTY Connection Configuration Window. - -[Used with permission][5] - -Once the connection is made, you’ll then be prompted for the user credentials on the remote server (Figure 2). - -![log in][7] - -Figure 2: Logging into a remote server with PuTTY. - -[Used with permission][5] - -To save a session (so you don’t have to always type the remote server information), fill out the IP address (or hostname), configure the port and connection type, and then (before you click Open), type a name for the connection in the top text area of the Saved Sessions section, and click Save. This will then save the configuration for the session. To then connect to a saved session, select it from the saved sessions window, click Load, and then click Open. You should then be prompted for the remote credentials on the remote server. - -### EasySSH - -Although [EasySSH][8] doesn’t offer the amount of configuration options found in PuTTY, it’s (as the name implies) incredibly easy to use. One of the best features of EasySSH is that it offers a tabbed interface, so you can have multiple SSH connections open and quickly switch between them. Other EasySSH features include: - - * Groups (so you can group tabs for an even more efficient experience). - - * Username/password save. - - * Appearance options. - - * Local and remote tunnel support. - - - - -Install EasySSH on a Linux desktop is simple, as the app can be installed via flatpak (which does mean you must have Flatpak installed on your system). Once flatpak is installed, add EasySSH with the commands: - -``` -sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - -sudo flatpak install flathub com.github.muriloventuroso.easyssh -``` - -Run EasySSH with the command: - -``` -flatpak run com.github.muriloventuroso.easyssh -``` - -The EasySSH app will open, where you can click the + button in the upper left corner. In the resulting window (Figure 3), configure your SSH connection as required. - -![Adding a connection][10] - -Figure 3: Adding a connection in EasySSH is simple. - -[Used with permission][5] - -Once you’ve added the connection, it will appear in the left navigation of the main window (Figure 4). - -![EasySSH][12] - -Figure 4: The EasySSH main window. - -[Used with permission][5] - -To connect to a remote server in EasySSH, select it from the left navigation and then click the Connect button (Figure 5). - -![Connecting][14] - -Figure 5: Connecting to a remote server with EasySSH. - -[Used with permission][5] - -The one caveat with EasySSH is that you must save the username and password in the connection configuration (otherwise the connection will fail). This means anyone with access to the desktop running EasySSH can remote into your servers without knowing the passwords. Because of this, you must always remember to lock your desktop screen any time you are away (and make sure to use a strong password). The last thing you want is to have a server vulnerable to unwanted logins. - -### Terminator - -Terminator is not actually an SSH GUI. Instead, Terminator functions as a single window that allows you to run multiple terminals (and even groups of terminals) at once. Effectively you can open Terminator, split the window vertical and horizontally (until you have all the terminals you want), and then connect to all of your remote Linux servers by way of the standard SSH command (Figure 6). - -![Terminator][16] - -Figure 6: Terminator split into three different windows, each connecting to a different Linux server. - -[Used with permission][5] - -To install Terminator, issue a command like: - -### sudo apt-get install -y terminator - -Once installed, open the tool either from your desktop menu or from the command terminator. With the window opened, you can right-click inside Terminator and select either Split Horizontally or Split Vertically. Continue splitting the terminal until you have exactly the number of terminals you need, and then start remoting into those servers. -The caveat to using Terminator is that it is not a standard SSH GUI tool, in that it won’t save your sessions or give you quick access to those servers. In other words, you will always have to manually log into your remote Linux servers. However, being able to see your remote Secure Shell sessions side by side does make administering multiple remote machines quite a bit easier. - -Few (But Worthwhile) Options - -There aren’t a lot of SSH GUI tools available for Linux. Why? Because most administrators prefer to simply open a terminal window and use the standard command-line tools to remotely access their servers. However, if you have a need for a GUI tool, you have two solid options and one terminal that makes logging into multiple machines slightly easier. Although there are only a few options for those looking for an SSH GUI tool, those that are available are certainly worth your time. Give one of these a try and see for yourself. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-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://elementary.io/ -[2]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html -[3]: https://www.linux.com/files/images/sshguis1jpg -[4]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_1.jpg?itok=DiNTz_wO (PuTTY Connection) -[5]: https://www.linux.com/licenses/category/used-permission -[6]: https://www.linux.com/files/images/sshguis2jpg -[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_2.jpg?itok=4ORsJlz3 (log in) -[8]: https://github.com/muriloventuroso/easyssh -[9]: https://www.linux.com/files/images/sshguis3jpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_3.jpg?itok=bHC2zlda (Adding a connection) -[11]: https://www.linux.com/files/images/sshguis4jpg -[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_4.jpg?itok=hhJzhRIg (EasySSH) -[13]: https://www.linux.com/files/images/sshguis5jpg -[14]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_5.jpg?itok=piFEFYTQ (Connecting) -[15]: https://www.linux.com/files/images/sshguis6jpg -[16]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_6.jpg?itok=-kYl6iSE (Terminator) diff --git a/translated/tech/20181123 Three SSH GUI Tools for Linux.md b/translated/tech/20181123 Three SSH GUI Tools for Linux.md new file mode 100644 index 0000000000..a09224e5a5 --- /dev/null +++ b/translated/tech/20181123 Three SSH GUI Tools for Linux.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Three SSH GUI Tools for Linux) +[#]: via: (https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) +[#]: url: ( ) + +3 个 Linux 上的 SSH 图形界面工具 +====== + +> 了解一下这三个用于 Linux 上的 SSH 图形界面工具。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh.jpg?itok=3UcXhJt7) + +在你担任 Linux 管理员的职业生涯中,你会使用 Secure Shell(SSH)远程连接到 Linux 服务器或桌面。可能曾经你在某些情况下,会同时 SSH 连接到多个 Linux 服务器。实际上,ssh 可能是 Linux 工具箱中最常用的工具之一。因此,你应该尽可能提高体验效率。对于许多管理员来说,没有什么比命令行更有效。但是,有些用户更喜欢使用 GUI 工具,尤其是在从台式机连接到远程工作并在服务器上工作时。 + +如果你碰巧喜欢好的图形界面工具,你肯定很乐于了解一些 Linux 上优秀的 SSH 图形界面工具。再加上一个可以让你从同一个窗口远程访问多台机器的独特的终端窗口,你就拥有高效工作所需的一切。让我们来看看这三个工具,看看它们中的一个(或多个)是否完全符合你的需求。 + +我将在 [Elementary OS][1] 上演示这些工具,但它们都可用于大多数主要发行版。 + +### PuTTY + +已经有一些经验的人都知道 [PuTTY][2]。实际上,从 Windows 环境通过 SSH 连接到 Linux 服务器时,PuTTY 是事实上的标准工具。但 PuTTY 不仅适用于 Windows。事实上,通过标准软件库,PuTTY 也可以安装在 Linux 上。 PuTTY 的功能列表包括: + + * 保存会话。 + * 通过 IP 或主机名连接。 + * 使用替代的 SSH 端口。 + * 定义连接类型。 + * 日志。 + * 设置键盘、响铃、外观、连接等等。 + * 配置本地和远程隧道。 + * 支持代理。 + * 支持 X11 隧道。 + +PuTTY 图形工具主要是一种保存 SSH 会话的方法,因此可以更轻松地管理所有需要不断远程进出的各种 Linux 服务器和桌面。一旦连接成功,PuTTY 就会建立一个到 Linux 服务器的连接窗口,你将可以在其中工作。 此时,你可能会有疑问,为什么不在终端窗口工作呢?对于一些人来说,保存会话的便利确实使 PuTTY 值得使用。 + +在 Linux 上安装 PuTTY 很简单。例如,你可以在基于 Debian 的发行版上运行命令: + +``` +sudo apt-get install -y putty +``` + +安装后,你可以从桌面菜单运行 PuTTY 图形工具或运行命令 `putty`。在 PuTTY “Configuration” 窗口(图 1)中,在 “HostName (or IP address) ” 部分键入主机名或 IP 地址,配置 “Port”(如果不是默认值 22),从 “Connection type”中选择 SSH,然后单击“Open”。 + +![PuTTY Connection][4] + +*图 1:PuTTY 连接配置窗口* + +建立连接后,系统将提示你输入远程服务器上的用户凭据(图2)。 + +![log in][7] + +*图 2:使用 PuTTY 登录到远程服务器* + +要保存会话(以便你不必始终键入远程服务器信息),请填写主机名(或 IP 地址)、配置端口和连接类型,然后(在单击 “Open” 之前),在 “Saved Sessions” 部分的顶部文本区域中键入名称,然后单击 “Save”。这将保存会话的配置。若要连接到已保存的会话,请从 “Saved Sessions” 窗口中选择它,单击 “Load”,然后单击 “Open”。系统会提示您输入远程服务器上的远程凭据。 + +### EasySSH + +虽然 [EasySSH][8] 没有提供 PuTTY 中的那么多的配置选项,但它(顾名思义)非常容易使用。 EasySSH 的最佳功能之一是它提供了一个标签式界面,因此您可以打开多个 SSH 连接并在它们之间快速切换。 其他 EasySSH 功能包括: + + * 分组(出于更好的效率体验,可以对标签进行分组)。 + * 保存用户名、密码。 + * 外观选项。 + * 支持本地和远程隧道。 + +在 Linux 桌面上安装 EasySSH 很简单,因为可以通过 Flatpak 安装应用程序(这意味着您必须在系统上安装 Flatpak)。安装 Flatpak 后,使用以下命令添加 EasySSH: + +``` +sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + +sudo flatpak install flathub com.github.muriloventuroso.easyssh +``` + +用如下命令运行 EasySSH: + +``` +flatpak run com.github.muriloventuroso.easyssh +``` + +将会打开 EasySSH 应用程序,你可以单击左上角的 “+” 按钮。 在结果窗口(图 3)中,根据需要配置 SSH 连接。 + +![Adding a connection][10] + +*图 3:在 EasySSH 中添加连接很简单* + +添加连接后,它将显示在主窗口的左侧导航中(图 4)。 + +![EasySSH][12] + +*图 4:EasySSH 主窗口* + +要在 EasySSH 连接到远程服务器,请从左侧导航栏中选择它,然后单击 “Connect” 按钮(图 5)。 + +![Connecting][14] + +*图 5:用 EasySSH 连接到远程服务器* + +对于 EasySSH 的一个警告是你必须在连接配置中保存用户名和密码(否则连接将失败)。这意味着任何有权访问运行 EasySSH 的桌面的人都可以在不知道密码的情况下远程访问您的服务器。因此,您必须始终记住在您离开时锁定桌面屏幕(并确保使用强密码)。否则服务器容易受到意外登录的影响。 + +### Terminator + +(LCTT 译注:这个选择不符合本文主题,本节删节) + + +### termius + +(LCTT 译注:本节是根据网友推荐补充的) + +termius 是一个商业版的 SSH、Telnet 和 Mosh 客户端,不开源。支持包括 [Linux](https://www.termius.com/linux)、Windows、Mac、iOS 和安卓在内的各种操作系统。对于单一设备是免费的,支持多设备的白金账号需要按月付费。 + +### 很少(但值得)的选择 + +Linux 上没有很多可用的 SSH 图形界面工具。为什么?因为大多数管理员更喜欢简单地打开终端窗口并使用标准命令行工具来远程访问其服务器。但是,如果你需要图形界面工具,则有两个可靠选项,可以更轻松地登录多台计算机。虽然对于那些寻找 SSH 图形界面工具的人来说只有不多的几个选择,但那些可用的工具当然值得您花时间。尝试其中一个,亲眼看看。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-linux + +作者:[Jack Wallen][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.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://elementary.io/ +[2]: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html +[3]: https://www.linux.com/files/images/sshguis1jpg +[4]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_1.jpg?itok=DiNTz_wO (PuTTY Connection) +[5]: https://www.linux.com/licenses/category/used-permission +[6]: https://www.linux.com/files/images/sshguis2jpg +[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_2.jpg?itok=4ORsJlz3 (log in) +[8]: https://github.com/muriloventuroso/easyssh +[9]: https://www.linux.com/files/images/sshguis3jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_3.jpg?itok=bHC2zlda (Adding a connection) +[11]: https://www.linux.com/files/images/sshguis4jpg +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_4.jpg?itok=hhJzhRIg (EasySSH) +[13]: https://www.linux.com/files/images/sshguis5jpg +[14]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_5.jpg?itok=piFEFYTQ (Connecting) +[15]: https://www.linux.com/files/images/sshguis6jpg +[16]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh_guis_6.jpg?itok=-kYl6iSE (Terminator) From 086e1102f053cfca97b38a9b267a3cf5cbd0daf2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 13:58:09 +0800 Subject: [PATCH 256/813] PRF:20181123 Three SSH GUI Tools for Linux.md @wxy --- .../20181123 Three SSH GUI Tools for Linux.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181123 Three SSH GUI Tools for Linux.md b/translated/tech/20181123 Three SSH GUI Tools for Linux.md index a09224e5a5..4566a203ef 100644 --- a/translated/tech/20181123 Three SSH GUI Tools for Linux.md +++ b/translated/tech/20181123 Three SSH GUI Tools for Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Three SSH GUI Tools for Linux) [#]: via: (https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-linux) @@ -14,9 +14,9 @@ ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ssh.jpg?itok=3UcXhJt7) -在你担任 Linux 管理员的职业生涯中,你会使用 Secure Shell(SSH)远程连接到 Linux 服务器或桌面。可能曾经你在某些情况下,会同时 SSH 连接到多个 Linux 服务器。实际上,ssh 可能是 Linux 工具箱中最常用的工具之一。因此,你应该尽可能提高体验效率。对于许多管理员来说,没有什么比命令行更有效。但是,有些用户更喜欢使用 GUI 工具,尤其是在从台式机连接到远程工作并在服务器上工作时。 +在你担任 Linux 管理员的职业生涯中,你会使用 Secure Shell(SSH)远程连接到 Linux 服务器或桌面。可能你曾经在某些情况下,会同时 SSH 连接到多个 Linux 服务器。实际上,SSH 可能是 Linux 工具箱中最常用的工具之一。因此,你应该尽可能提高体验效率。对于许多管理员来说,没有什么比命令行更有效了。但是,有些用户更喜欢使用 GUI 工具,尤其是在从台式机连接到远程并在服务器上工作时。 -如果你碰巧喜欢好的图形界面工具,你肯定很乐于了解一些 Linux 上优秀的 SSH 图形界面工具。再加上一个可以让你从同一个窗口远程访问多台机器的独特的终端窗口,你就拥有高效工作所需的一切。让我们来看看这三个工具,看看它们中的一个(或多个)是否完全符合你的需求。 +如果你碰巧喜欢好的图形界面工具,你肯定很乐于了解一些 Linux 上优秀的 SSH 图形界面工具。让我们来看看这三个工具,看看它们中的一个(或多个)是否完全符合你的需求。 我将在 [Elementary OS][1] 上演示这些工具,但它们都可用于大多数主要发行版。 @@ -34,7 +34,7 @@ * 支持代理。 * 支持 X11 隧道。 -PuTTY 图形工具主要是一种保存 SSH 会话的方法,因此可以更轻松地管理所有需要不断远程进出的各种 Linux 服务器和桌面。一旦连接成功,PuTTY 就会建立一个到 Linux 服务器的连接窗口,你将可以在其中工作。 此时,你可能会有疑问,为什么不在终端窗口工作呢?对于一些人来说,保存会话的便利确实使 PuTTY 值得使用。 +PuTTY 图形工具主要是一种保存 SSH 会话的方法,因此可以更轻松地管理所有需要不断远程进出的各种 Linux 服务器和桌面。一旦连接成功,PuTTY 就会建立一个到 Linux 服务器的连接窗口,你将可以在其中工作。此时,你可能会有疑问,为什么不在终端窗口工作呢?对于一些人来说,保存会话的便利确实使 PuTTY 值得使用。 在 Linux 上安装 PuTTY 很简单。例如,你可以在基于 Debian 的发行版上运行命令: @@ -54,18 +54,18 @@ sudo apt-get install -y putty *图 2:使用 PuTTY 登录到远程服务器* -要保存会话(以便你不必始终键入远程服务器信息),请填写主机名(或 IP 地址)、配置端口和连接类型,然后(在单击 “Open” 之前),在 “Saved Sessions” 部分的顶部文本区域中键入名称,然后单击 “Save”。这将保存会话的配置。若要连接到已保存的会话,请从 “Saved Sessions” 窗口中选择它,单击 “Load”,然后单击 “Open”。系统会提示您输入远程服务器上的远程凭据。 +要保存会话(以便你不必始终键入远程服务器信息),请填写主机名(或 IP 地址)、配置端口和连接类型,然后(在单击 “Open” 之前),在 “Saved Sessions” 部分的顶部文本区域中键入名称,然后单击 “Save”。这将保存会话的配置。若要连接到已保存的会话,请从 “Saved Sessions” 窗口中选择它,单击 “Load”,然后单击 “Open”。系统会提示你输入远程服务器上的远程凭据。 ### EasySSH -虽然 [EasySSH][8] 没有提供 PuTTY 中的那么多的配置选项,但它(顾名思义)非常容易使用。 EasySSH 的最佳功能之一是它提供了一个标签式界面,因此您可以打开多个 SSH 连接并在它们之间快速切换。 其他 EasySSH 功能包括: +虽然 [EasySSH][8] 没有提供 PuTTY 中的那么多的配置选项,但它(顾名思义)非常容易使用。 EasySSH 的最佳功能之一是它提供了一个标签式界面,因此你可以打开多个 SSH 连接并在它们之间快速切换。EasySSH 的其他功能包括: - * 分组(出于更好的效率体验,可以对标签进行分组)。 + * 分组(出于更好的体验效率,可以对标签进行分组)。 * 保存用户名、密码。 * 外观选项。 * 支持本地和远程隧道。 -在 Linux 桌面上安装 EasySSH 很简单,因为可以通过 Flatpak 安装应用程序(这意味着您必须在系统上安装 Flatpak)。安装 Flatpak 后,使用以下命令添加 EasySSH: +在 Linux 桌面上安装 EasySSH 很简单,因为可以通过 Flatpak 安装应用程序(这意味着你必须在系统上安装 Flatpak)。安装 Flatpak 后,使用以下命令添加 EasySSH: ``` sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo @@ -97,22 +97,21 @@ flatpak run com.github.muriloventuroso.easyssh *图 5:用 EasySSH 连接到远程服务器* -对于 EasySSH 的一个警告是你必须在连接配置中保存用户名和密码(否则连接将失败)。这意味着任何有权访问运行 EasySSH 的桌面的人都可以在不知道密码的情况下远程访问您的服务器。因此,您必须始终记住在您离开时锁定桌面屏幕(并确保使用强密码)。否则服务器容易受到意外登录的影响。 +对于 EasySSH 的一个警告是你必须将用户名和密码保存在连接配置中(否则连接将失败)。这意味着任何有权访问运行 EasySSH 的桌面的人都可以在不知道密码的情况下远程访问你的服务器。因此,你必须始终记住在你离开时锁定桌面屏幕(并确保使用强密码)。否则服务器容易受到意外登录的影响。 ### Terminator (LCTT 译注:这个选择不符合本文主题,本节删节) - ### termius (LCTT 译注:本节是根据网友推荐补充的) -termius 是一个商业版的 SSH、Telnet 和 Mosh 客户端,不开源。支持包括 [Linux](https://www.termius.com/linux)、Windows、Mac、iOS 和安卓在内的各种操作系统。对于单一设备是免费的,支持多设备的白金账号需要按月付费。 +termius 是一个商业版的 SSH、Telnet 和 Mosh 客户端,不是开源软件。支持包括 [Linux](https://www.termius.com/linux)、Windows、Mac、iOS 和安卓在内的各种操作系统。对于单一设备是免费的,支持多设备的白金账号需要按月付费。 ### 很少(但值得)的选择 -Linux 上没有很多可用的 SSH 图形界面工具。为什么?因为大多数管理员更喜欢简单地打开终端窗口并使用标准命令行工具来远程访问其服务器。但是,如果你需要图形界面工具,则有两个可靠选项,可以更轻松地登录多台计算机。虽然对于那些寻找 SSH 图形界面工具的人来说只有不多的几个选择,但那些可用的工具当然值得您花时间。尝试其中一个,亲眼看看。 +Linux 上没有很多可用的 SSH 图形界面工具。为什么?因为大多数管理员更喜欢简单地打开终端窗口并使用标准命令行工具来远程访问其服务器。但是,如果你需要图形界面工具,则有两个可靠选项,可以更轻松地登录多台计算机。虽然对于那些寻找 SSH 图形界面工具的人来说只有不多的几个选择,但那些可用的工具当然值得你花时间。尝试其中一个,亲眼看看。 -------------------------------------------------------------------------------- @@ -121,7 +120,7 @@ via: https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-linu 作者:[Jack Wallen][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 76fba143cb01ba0b9ecf00ffe14e0cc256f2b574 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 13:58:55 +0800 Subject: [PATCH 257/813] PUB:20181123 Three SSH GUI Tools for Linux.md @wxy https://linux.cn/article-10559-1.html --- .../20181123 Three SSH GUI Tools for Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181123 Three SSH GUI Tools for Linux.md (99%) diff --git a/translated/tech/20181123 Three SSH GUI Tools for Linux.md b/published/20181123 Three SSH GUI Tools for Linux.md similarity index 99% rename from translated/tech/20181123 Three SSH GUI Tools for Linux.md rename to published/20181123 Three SSH GUI Tools for Linux.md index 4566a203ef..d742be9ba8 100644 --- a/translated/tech/20181123 Three SSH GUI Tools for Linux.md +++ b/published/20181123 Three SSH GUI Tools for Linux.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Three SSH GUI Tools for Linux) [#]: via: (https://www.linux.com/blog/learn/intro-to-linux/2018/11/three-ssh-guis-linux) [#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10559-1.html) 3 个 Linux 上的 SSH 图形界面工具 ====== From 332673fe1376fa04390f9e3f8c3e1e1d3e137e30 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 21 Feb 2019 15:33:11 +0800 Subject: [PATCH 258/813] hankchow translated --- ...1 Will quantum computing break security.md | 106 ------------------ ...1 Will quantum computing break security.md | 93 +++++++++++++++ 2 files changed, 93 insertions(+), 106 deletions(-) delete mode 100644 sources/tech/20190131 Will quantum computing break security.md create mode 100644 translated/tech/20190131 Will quantum computing break security.md diff --git a/sources/tech/20190131 Will quantum computing break security.md b/sources/tech/20190131 Will quantum computing break security.md deleted file mode 100644 index af374408dc..0000000000 --- a/sources/tech/20190131 Will quantum computing break security.md +++ /dev/null @@ -1,106 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Will quantum computing break security?) -[#]: via: (https://opensource.com/article/19/1/will-quantum-computing-break-security) -[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) - -Will quantum computing break security? -====== - -Do you want J. Random Hacker to be able to pretend they're your bank? - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) - -Over the past few years, a new type of computer has arrived on the block: the quantum computer. It's arguably the sixth type of computer: - - 1. **Humans:** Before there were artificial computers, people used, well, people. And people with this job were called "computers." - - 2. **Mechanical analogue:** These are devices such as the [Antikythera mechanism][1], astrolabes, or slide rules. - - 3. **Mechanical digital:** In this category, I'd count anything that allowed discrete mathematics but didn't use electronics for the actual calculation: the abacus, Babbage's Difference Engine, etc. - - 4. **Electronic analogue:** Many of these were invented for military uses such as bomb sights, gun aiming, etc. - - 5. **Electronic digital:** I'm going to go out on a limb here and characterise Colossus as the first electronic digital computer1: these are basically what we use today for anything from mobile phones to supercomputers. - - 6. **Quantum computers:** These are coming and are fundamentally different from all of the previous generations. - - - - -### What is quantum computing? - -Quantum computing uses concepts from quantum mechanics to allow very different types of calculations from what we're used to in "classical computing." I'm not even going to try to explain, because I know I'd do a terrible job, so I suggest you try something like [Wikipedia's definition][2] as a starting point. What's important for our purposes is to understand that quantum computers use qubits to do calculations, and for quite a few types of mathematical algorithms—and therefore computing operations––they can solve problems much faster than classical computers. - -What's "much faster"? Much, much faster: orders of magnitude faster. A calculation that might take years or decades with a classical computer could, in certain circumstances, take seconds. Impressive, yes? And scary. Because one of the types of problems that quantum computers should be good at solving is decrypting encrypted messages, even without the keys. - -This means that someone with a sufficiently powerful quantum computer should be able to read all of your current and past messages, decrypt any stored data, and maybe fake digital signatures. Is this a big thing? Yes. Do you want J. Random Hacker to be able to pretend they're your bank?2 Do you want that transaction on the blockchain where you were sold a 10 bedroom mansion in Mayfair to be "corrected" to be a bedsit in Weston-super-Mare?3 - -### Some good news - -This is all scary stuff, but there's good news of various types. - -The first is that, in order to make any of this work at all, you need a quantum computer with a good number of qubits operating, and this is turning out to be hard.4 The general consensus is that we've got a few years before anybody has a "big" enough quantum computer to do serious damage to classical encryption algorithms. - -The second is that, even with a sufficient number of qubits to attacks our existing algorithms, you still need even more to allow for error correction. - -The third is that, although there are theoretical models to show how to attack some of our existing algorithms, actually making them work is significantly harder than you or I5 might expect. In fact, some of the attacks may turn out to be infeasible or just take more years to perfect than we worry about. - -The fourth is that there are clever people out there who are designing quantum-computation-resistant algorithms (sometimes referred to as "post-quantum algorithms") that we can use, at least for new encryption, once they've been tested and become widely available. - -All in all, in fact, there's a strong body of expert opinion that says we shouldn't be overly worried about quantum computing breaking our encryption in the next five or even 10 years. - -### And some bad news - -It's not all rosy, however. Two issues stick out to me as areas of concern. - - 1. People are still designing and rolling out systems that don't consider the issue. If you're coming up with a system that is likely to be in use for 10 or more years or will be encrypting or signing data that must remain confidential or attributable over those sorts of periods, then you should be considering the possible impact of quantum computing on your system. - - 2. Some of the new, quantum-computing-resistant algorithms are proprietary. This means that when you and I want to start implementing systems that are designed to be quantum-computing resistant, we'll have to pay to do so. I'm a big proponent of open source, and particularly of [open source cryptography][3], and my big worry is that we just won't be able to open source these things, and worse, that when new protocol standards are created––either de-facto or through standards bodies––they will choose proprietary algorithms that exclude the use of open source, whether on purpose, through ignorance, or because few good alternatives are available. - - - - -### What to do? - -Luckily, there are things you can do to address both of the issues above. The first is to think and plan when designing a system about what the impact of quantum computing might be on it. Often—very often—you won't need to implement anything explicit now (and it could be hard to, given the current state of the art), but you should at least embrace [the concept of crypto-agility][4]: designing protocols and systems so you can swap out algorithms if required.7 - -The second is a call to arms: Get involved in the open source movement and encourage everybody you know who has anything to do with cryptography to rally for open standards and for research into non-proprietary, quantum-computing-resistant algorithms. This is something that's very much on my to-do list, and an area where pressure and lobbying is just as important as the research itself. - -1\. I think it's fair to call it the first electronic, programmable computer. I know there were earlier non-programmable ones, and that some claim ENIAC, but I don't have the space or the energy to argue the case here. - -2\. No. - -3\. See 2. Don't get me wrong, by the way—I grew up near Weston-super-Mare, and it's got things going for it, but it's not Mayfair. - -4\. And if a quantum physicist says something's hard, then to my mind, it's hard. - -5\. And I'm assuming that neither of us is a quantum physicist or mathematician.6 - -6\. I'm definitely not. - -7\. And not just for quantum-computing reasons: There's a good chance that some of our existing classical algorithms may just fall to other, non-quantum attacks such as new mathematical approaches. - -This article was originally published on [Alice, Eve, and Bob][5] and is reprinted with the author's permission. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/will-quantum-computing-break-security - -作者:[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://en.wikipedia.org/wiki/Antikythera_mechanism -[2]: https://en.wikipedia.org/wiki/Quantum_computing -[3]: https://opensource.com/article/17/10/many-eyes -[4]: https://aliceevebob.com/2017/04/04/disbelieving-the-many-eyes-hypothesis/ -[5]: https://aliceevebob.com/2019/01/08/will-quantum-computing-break-security/ diff --git a/translated/tech/20190131 Will quantum computing break security.md b/translated/tech/20190131 Will quantum computing break security.md new file mode 100644 index 0000000000..a4b3792e6f --- /dev/null +++ b/translated/tech/20190131 Will quantum computing break security.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Will quantum computing break security?) +[#]: via: (https://opensource.com/article/19/1/will-quantum-computing-break-security) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +量子计算会打破现有的安全体系吗? +====== + +> 你会希望黑客冒充成你的银行吗? + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +近年来,量子计算机已经出现在大众的视野当中。量子计算机被认为是第六类计算机,这六类计算机包括: + +1. **人力:** 在人造的计算工具出现之前,人类只能使用人力去进行计算。而承担计算工作的人,只能被称为“计算者”。 + +2. **模拟计算工具:** 由人类制造的一些模拟计算过程的小工具,例如[安提凯希拉装置][1]Antikythera mechanism、星盘、计算尺等等。 + +3. **机械工具:** 在这一个类别中包括了运用到离散数学但未使用电子技术进行计算的工具,例如算盘、Charles Babbage 的差分机Difference Engine等等。 + +4. **电子模拟计算工具:** 这一个类别的计算机多数用于军事方面的用途,例如炸弹瞄准器、枪炮瞄准装置等等。 + +5. **电子计算机:** 这个类别包含的种类就太多了,几乎包含现代所有的电子设备,从移动电话到超级计算机,都在这个类别当中。 + +6. **量子计算机:** 即将进入我们的生活,而且与之前的几类完全不同。 + + +### 什么是量子计算? + +量子计算的概念来源于量子力学,因此使用的计算方式和我们平常使用的普通计算并不相同。如果想要深入理解,建议从参考[维基百科上的定义][2]开始。对我们来说,最重要的是理解这一点:量子计算机使用量子位qubit进行计算。在这样的前提下,对于很多数学算法和运算操作,量子计算机的计算速度会比普通计算机要快得多。 + +这里的“快得多”是按数量级来说的“快得多”。在某些情况下,一个计算任务如果由普通计算机来执行,可能要耗费几年或者几十年才能完成,但如果由量子计算机来执行,就只需要几秒钟。这样的速度甚至令人感到可怕。因为量子计算机会非常擅长信息的加密解密计算,即使在没有密钥的情况下,也能快速完成繁重的计算任务。 + +这意味着,如果拥有足够强大的量子计算机,那么你的所有信息都会被一览无遗,任何被加密的数据都可以被正确解密出来,甚至伪造数字签名也会成为可能。这确实是一个严重的问题。毕竟谁也不想被黑客冒充成自己在用的银行,更不希望自己在区块链上的交易被篡改得面目全非。 + +### 好消息 + +尽管上面的提到的问题非常可怕,但也不需要太担心。 + +首先,如果要实现上面提到的能力,一台可以操作大量量子位的量子计算机是必不可少的,而这个硬件上的要求就是一个很高的门槛。目前普遍认为,规模大得足以有效破解经典加密算法的量子计算机在最近几年还不可能出现。 + +其次,除了攻击现有的加密算法需要大量的量子位以外,还需要很多量子位来保证容错性。 + +还有,尽管确实有一些理论上的模型阐述了量子计算机如何对一些现有的算法作出攻击,但是要让这样的理论模型实际运作起来的难度会比我们想象中大得多。事实上,有一些攻击手段也是未被完全确认是可行的,又或者这些攻击手段还需要继续耗费很多年的改进才能到达如斯恐怖的程度。 + +最后,还有很多专业人士正在研究能够防御量子计算的算法(这样的算法也被称为“后量子算法post-quantum algorithms”)。如果这些防御算法经过测试以后投入使用,我们就可以使用这些算法进行加密,来对抗量子计算了。 + +总而言之,很多专家都认为,我们现有的加密方式在未来 5 年甚至未来 10 年内都是安全的,不需要过分担心。 + +### 也有坏消息 + +但我们也并不是高枕无忧了,以下两个问题就值得我们关注: + +1. 人们在设计应用系统的时候仍然没有对量子计算作出太多的考量。如果设计的系统可能会使用 10 年以上,又或者数据存储和加密的时间跨度在 10 年以上,那么就必须考虑量子计算在未来会不会对系统造成不利的影响。 + +2. 新出现的防御量子计算的算法可能会是专有的。也就是说,如果基于这些防御量子计算的算法来设计系统,那么在系统落地的时候,可能会需要为此付费。尽管我是支持开源的,尤其是[开源密码学][3],但我最担心的就是这方面的内容无法被开源。而且,在建立新的协议标准时,无论是故意的,无意的,还是别无选择,都很可能不会使用开源的专有算法。 + + + + +### 我们要怎样做? + +幸运的是,针对上述两个问题,我们还是有应对措施的。首先,在整个系统的设计阶段,就需要考虑到它是否会受到量子计算的影响,并作出相应的规划。当然了,不需要现在就立即采取行动,因为当前的技术水平也没法实现有效的方案,但至少也要[在加密方面保持敏捷性][4],以便在任何需要的时候为你的协议和系统更换更有效的加密算法。 + +其次是参与开源运动。尽可能鼓励密码学方面的有识之士团结起来,支持开放标准,并投入对非专有的防御量子计算的算法研究当中去。这一点也算是当务之急,因为号召更多的人重视起来并加入研究,比研究本身更为重要。 + + + +本文首发于《[Alice, Eve, and Bob][5]》,并在作者同意下重新发表。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/will-quantum-computing-break-security + +作者:[Mike Bursell][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/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Antikythera_mechanism +[2]: https://en.wikipedia.org/wiki/Quantum_computing +[3]: https://opensource.com/article/17/10/many-eyes +[4]: https://aliceevebob.com/2017/04/04/disbelieving-the-many-eyes-hypothesis/ +[5]: https://aliceevebob.com/2019/01/08/will-quantum-computing-break-security/ + From b94d7466f10b65051db40b4689da709c0391c1fd Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Thu, 21 Feb 2019 16:10:36 +0800 Subject: [PATCH 259/813] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20190219 Logical - in Bash.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md index a23ea21bd4..2c7e38dd32 100644 --- a/sources/tech/20190219 Logical - in Bash.md +++ b/sources/tech/20190219 Logical - in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (zero-MK) +[#]: translator: (zero-mk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -19,7 +19,7 @@ This means we haven't even touched on `&` as an AND operator, so let's do that n ### & is a Bitwise Operator If you are at all familiar with binary operations, you will have heard of AND and OR. These are bitwise operations that operate on individual bits of a binary number. In Bash, you use `&` as the AND operator and `|` as the OR operator: -如果您完全熟悉二进制字符的各种操作,您肯定听说过AND和OR。这些是按位操作,对二进制数的各个位进行操作。在Bash中,使用`&`作为AND运算符,使用`|`作为OR运算符: + **AND** ``` @@ -45,7 +45,6 @@ If you are at all familiar with binary operations, you will have heard of AND an ``` You can test this by ANDing any two numbers and outputting the result with `echo`: -您可以通过对任何两个数字进行AND运算并使用`echo`输出结果来测试: ``` $ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 @@ -58,7 +57,6 @@ $ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 ``` The same goes for OR (`|`): -OR(`|`)也是如此: ``` $ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 @@ -71,7 +69,6 @@ $ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 ``` Three things about this: -关于这个的三件事: 1. You use `(( ... ))` to tell Bash that what goes between the double brackets is some sort of arithmetic or logical operation. `(( 2 + 2 ))`, `(( 5 % 2 ))` (`%` being the [modulo][3] operator) and `((( 5 % 2 ) + 1))` (equals 3) will all work. 2. [Like with variables][4], `$` extracts the value so you can use it. @@ -216,7 +213,7 @@ via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash 作者:[Paul Brown][a] 选题:[lujun9972][b] -译者:[zero-MK](https://github.com/zero-MK) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b1a9e88a563292061481bbd74f5204540f1c3dc4 Mon Sep 17 00:00:00 2001 From: cycoe Date: Thu, 21 Feb 2019 16:42:09 +0800 Subject: [PATCH 260/813] translating by cycoe --- ...8 KDE Plasma Tips and Tricks to Improve Your Productivity.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md index 66e96549c7..3fc3de1d9f 100644 --- a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md +++ b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @@ -1,3 +1,5 @@ +translating by Cycoe +Cycoe 翻译中 8 KDE Plasma Tips and Tricks to Improve Your Productivity ====== From aa1e53c7f8c8545f844906525fc841dfafddb574 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Thu, 21 Feb 2019 17:30:34 +0800 Subject: [PATCH 261/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index 8c51dda1ce..3ab51bd697 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -36,7 +36,7 @@ Some of this might look a little complex, but most of it was taken from the tuto 这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也乐意跟你合作干这些事,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 Many of the tools listed below can offer this type of interaction, but some offer a slightly different model. The emerging model in this space is that of a declarative description of a pipeline in something like YAML with each stage being ephemeral and idempotent. Many of these systems also ensure correct sequencing by creating a [directed acyclic graph][13] (DAG) over the different stages of the pipeline. -下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明性的语言如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段能正确排序。 +下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明性的语言如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段排序的正确性。 These stages are often run in Linux containers and can do anything you can do in a container. Some tools, like [Spinnaker][14], focus only on the deployment component and offer some operational features that others don't normally include. [Jenkins][15] has generally kept pipelines in an XML format and most interactions occur within the GUI, but more recent implementations have used a [domain specific language][16] (DSL) using [Groovy][17]. Further, Jenkins jobs normally execute on nodes with a special Java agent installed and consist of a mix of plugins and pre-installed components. 这些阶段一般运行在 Linux 容器里,和普通的容器没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件而且提供一些其他工具没有的操作特性。[Jenkins][15] 通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用 [领域专用语言(DSL)][16] 如[Groovy][17]。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点会装一个专门的 Java 程序还有一堆混杂的插件和预装组件。 @@ -56,19 +56,23 @@ GitLab is a fairly new entrant to the CI/CD space, but it's already achieved the GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。这在一个高水平、竞争激烈的领域里是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。它还有一个功能叫做 Auto DevOps,可以为简单的工程自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 整合地很紧密,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 In addition to its CI functionality, GitLab offers many complementary features like operations and monitoring with Prometheus deployed automatically with your application; portfolio and project management using GitLab Issues, Epics, and Milestones; security checks built into the pipeline with the results provided as an aggregate across multiple projects; and the ability to edit code right in GitLab using the WebIDE, which can even provide a preview or execute part of a pipeline for faster feedback. -除了它的持续集成功能,GitLab 还提供了许多值得称赞的特性,比如: +除了它的持续集成功能,GitLab 还提供了许多补充特性,比如:将 Prometheus 和你的应用一同部署,以提供监控功能;通过 GitLab 提供的 Issues、Epics 和 Milestones 功能来实现项目评估和管理;管道中集成了安全检测功能,多个项目的检测结果会聚合显示;你可以通过 GitLab 提供的网页版 IDE 在线编辑代码,还可以快速查看管道的预览或执行状态。 ### GoCD GoCD comes from the great minds at Thoughtworks, which is testimony enough for its capabilities and efficiency. To me, GoCD's main differentiator from the rest of the pack is its [Value Stream Map][22] (VSM) feature. In fact, pipelines can be chained together with one pipeline providing the "material" for the next pipeline. This allows for increased independence for different teams with different responsibilities in the deployment process. This may be a useful feature when introducing this type of system in older organizations that intend to keep these teams separate—but having everyone using the same tool will make it easier later to find bottlenecks in the VSM and reorganize the teams or work to increase efficiencies. +GoCD 是由老牌软件公司 Thoughtworks 出品,这已经足够证明它的能力和效率。对我而言,GoCD 最有亮点的特性是它的[价值流视图(VSM)][22]。实际上,一个管道的输出可以变成下一个管道的输入,从而把管道串联起来。这样做有助于提高不同开发团队在整个开发流程中的独立性。比如在引入 CI/CD 系统时,有些成立较久的机构希望保持他们各个团队相互隔离,这时候 VSM 就很有用了:让每个人都使用相同的工具就很容易在 VSM 中发现工作流程上的瓶颈,然后可以按图索骥调整团队或者想办法提高工作效率。 It's incredibly valuable to have a VSM for each product in a company; that GoCD allows this to be [described in JSON or YAML][23] in version control and presented visually with all the data around wait times makes this tool even more valuable to an organization trying to understand itself better. Start by installing GoCD and mapping out your process with only manual approval gates. Then have each team use the manual approvals so you can start collecting data on where bottlenecks might exist. +为公司的每个产品配置 VSM 是非常有价值的;GoCD 可以使用 [JSON 或 YAML 格式存储配置][23],还能以可视化的方式展示等待时间,这让一个机构能有效减少学习它的成本。刚开始使用 GoCD 创建你自己的流程时,建议使用手动批复的方式。让每个团队也采用手动批复,这样你就可以开始收集数据并且找到可能的瓶颈点。 ### Travis CI Travis CI was my first experience with a Software as a Service (SaaS) CI system, and it's pretty awesome. The pipelines are stored as YAML with your source code, and it integrates seamlessly with tools like GitHub. I don't remember the last time a pipeline failed because of Travis CI or the integration—Travis CI has a very high uptime. Not only can it be used as SaaS, but it also has a version that can be hosted. I haven't run that version—there were a lot of components, and it looked a bit daunting to install all of it. I'm guessing it would be much easier to deploy it all to Kubernetes with [Helm charts provided by Travis CI][26]. Those charts don't deploy everything yet, but I'm sure it will grow even more in the future. There is also an enterprise version if you don't want to deal with the hassle. +我使用的第一个软件既服务(SaaS)类型的 CI 系统就是 Travis CI,体验很不错。管道配置以源码形式用 YAML 保存,它与 GitHub 等工具无缝整合。我印象中管道从来没有失效过,因为 Travis CI 的在线率很高。除了 SaaS 版之外,你也可以使用自行部署的版本。我还没有自行部署过,它的组件非常多,要全部安装的话,工作量就有点吓人了。我猜更简单的办法是把它部署到 Kubernetes 上,[Travis CI 提供了 Helm charts][26],这些 charts 目前不包含所有要部署的组件,但我相信以后会越来越多的。如果你不想处理这些细枝末节的问题,还有一个企业版可以试试。 However, if you're developing open source code, you can use the SaaS version of Travis CI for free. That is an awesome service provided by an awesome team! This alleviates a lot of overhead and allows you to use a fairly common platform for developing open source code without having to run anything. +如果你在开发一个开源项目,你就可以免费使用 SaaS 版的 Travis CI,享受顶尖团队提供的优质服务!这样能省去很多麻烦,你能在一个相对通用的平台上研发开源项目,而不用运行任何东西。 ### Jenkins From 93dfb6202fa58ce8d3a5fef68e6cc1acfb924cc8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 18:10:06 +0800 Subject: [PATCH 262/813] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 已经发过2019版了 --- ...est Linux Distributions for Development.md | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 sources/tech/20180129 The 5 Best Linux Distributions for Development.md diff --git a/sources/tech/20180129 The 5 Best Linux Distributions for Development.md b/sources/tech/20180129 The 5 Best Linux Distributions for Development.md deleted file mode 100644 index cc11407ff3..0000000000 --- a/sources/tech/20180129 The 5 Best Linux Distributions for Development.md +++ /dev/null @@ -1,158 +0,0 @@ -The 5 Best Linux Distributions for Development -============================================================ - -![Linux distros for devs](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/king-penguins_1920.jpg?itok=qmy8htw6 "Linux distros for devs") -Jack Wallen looks at some of the best LInux distributions for development efforts.[Creative Commons Zero][6] - -When considering Linux, there are so many variables to take into account. What package manager do you wish to use? Do you prefer a modern or old-standard desktop interface? Is ease of use your priority? How flexible do you want your distribution? What task will the distribution serve? - -It is that last question which should often be considered first. Is the distribution going to work as a desktop or a server? Will you be doing network or system audits? Or will you be developing? If you’ve spent much time considering Linux, you know that for every task there are several well-suited distributions. This certainly holds true for developers. Even though Linux, by design, is an ideal platform for developers, there are certain distributions that rise above the rest, to serve as great operating systems to serve developers. - -I want to share what I consider to be some of the best distributions for your development efforts. Although each of these five distributions can be used for general purpose development (with maybe one exception), they each serve a specific purpose. You may or may not be surprised by the selections. - -With that said, let’s get to the choices. - -### Debian - -The [Debian][14] distribution winds up on the top of many a Linux list. With good reason. Debian is that distribution from which so many are based. It is this reason why many developers choose Debian. When you develop a piece of software on Debian, chances are very good that package will also work on [Ubuntu][15], [Linux Mint][16], [Elementary OS][17], and a vast collection of other distributions. - -Beyond that obvious answer, Debian also has a very large amount of applications available, by way of the default repositories (Figure 1). - -![Debian apps](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/devel_1.jpg?itok=3mpkS3Kp "Debian apps") -Figure 1: Available applications from the standard Debian repositories.[Used with permission][1] - -To make matters even programmer-friendly, those applications (and their dependencies) are simple to install. Take, for instance, the build-essential package (which can be installed on any distribution derived from Debian). This package includes the likes of dkpg-dev, g++, gcc, hurd-dev, libc-dev, and make—all tools necessary for the development process. The build-essential package can be installed with the command sudo apt install build-essential. - -There are hundreds of other developer-specific applications available from the standard repositories, tools such as: - -* Autoconf—configure script builder - -* Autoproject—creates a source package for a new program - -* Bison—general purpose parser generator - -* Bluefish—powerful GUI editor, targeted towards programmers - -* Geany—lightweight IDE - -* Kate—powerful text editor - -* Eclipse—helps builders independently develop tools that integrate with other people’s tools - -The list goes on and on. - -Debian is also as rock-solid a distribution as you’ll find, so there’s very little concern you’ll lose precious work, by way of the desktop crashing. As a bonus, all programs included with Debian have met the [Debian Free Software Guidelines][18], which adheres to the following “social contract”: - -* Debian will remain 100% free. - -* We will give back to the free software community. - -* We will not hide problems. - -* Our priorities are our users and free software - -* Works that do not meet our free software standards are included in a non-free archive. - -Also, if you’re new to developing on Linux, Debian has a handy [Programming section in their user manual][19]. - -### openSUSE Tumbleweed - -If you’re looking to develop with a cutting-edge, rolling release distribution, [openSUSE][20] offers one of the best in [Tumbleweed][21]. Not only will you be developing with the most up to date software available, you’ll be doing so with the help of openSUSE’s amazing administrator tools … of which includes YaST. If you’re not familiar with YaST (Yet another Setup Tool), it’s an incredibly powerful piece of software that allows you to manage the whole of the platform, from one convenient location. From within YaST, you can also install using RPM Groups. Open YaST, click on RPM Groups (software grouped together by purpose), and scroll down to the Development section to see the large amount of groups available for installation (Figure 2). - - -![openSUSE](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/devel_2.jpg?itok=EeCjn1cx "openSUSE") -Figure 2: Installing package groups in openSUSE Tumbleweed.[Creative Commons Zero][2] - -openSUSE also allows you to quickly install all the necessary devtools with the simple click of a weblink. Head over to the [rpmdevtools install site][22] and click the link for Tumbleweed. This will automatically add the necessary repository and install rpmdevtools. - -By developing with a rolling release distribution, you know you’re working with the most recent releases of installed software. - -### CentOS - -Let’s face it, [Red Hat Enterprise Linux][23] (RHEL) is the de facto standard for enterprise businesses. If you’re looking to develop for that particular platform, and you can’t afford a RHEL license, you cannot go wrong with [CentOS][24]—which is, effectively, a community version of RHEL. You will find many of the packages found on CentOS to be the same as in RHEL—so once you’re familiar with developing on one, you’ll be fine on the other. - -If you’re serious about developing on an enterprise-grade platform, you cannot go wrong starting with CentOS. And because CentOS is a server-specific distribution, you can more easily develop for a web-centric platform. Instead of developing your work and then migrating it to a server (hosted on a different machine), you can easily have CentOS setup to serve as an ideal host for both developing and testing. - -Looking for software to meet your development needs? You only need open up the CentOS Application Installer, where you’ll find a Developer section that includes a dedicated sub-section for Integrated Development Environments (IDEs - Figure 3). - -![CentOS](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/devel_3.jpg?itok=0oe4zj9j "CentOS") -Figure 3: Installing a powerful IDE is simple in CentOS.[Used with permission][3] - -CentOS also includes Security Enhanced Linux (SELinux), which makes it easier for you to test your software’s ability to integrate with the same security platform found in RHEL. SELinux can often cause headaches for poorly designed software, so having it at the ready can be a real boon for ensuring your applications work on the likes of RHEL. If you’re not sure where to start with developing on CentOS 7, you can read through the [RHEL 7 Developer Guide][25]. - -### Raspbian - -Let’s face it, embedded systems are all the rage. One easy means of working with such systems is via the Raspberry Pi—a tiny footprint computer that has become incredibly powerful and flexible. In fact, the Raspberry Pi has become the hardware used by DIYers all over the planet. Powering those devices is the [Raspbian][26] operating system. Raspbian includes tools like [BlueJ][27], [Geany][28], [Greenfoot][29], [Sense HAT Emulator][30], [Sonic Pi][31], and [Thonny Python IDE][32], [Python][33], and [Scratch][34], so you won’t want for the necessary development software. Raspbian also includes a user-friendly desktop UI (Figure 4), to make things even easier. - -![Raspbian](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/devel_4.jpg?itok=VLoYak6L "Raspbian") -Figure 4: The Raspbian main menu, showing pre-installed developer software.[Used with permission][4] - -For anyone looking to develop for the Raspberry Pi platform, Raspbian is a must have. If you’d like to give Raspbian a go, without the Raspberry Pi hardware, you can always install it as a VirtualBox virtual machine, by way of the ISO image found [here][35]. - -### Pop!_OS - -Don’t let the name full you, [System76][36]’s [Pop!_OS][37] entry into the world of operating systems is serious. And although what System76 has done to this Ubuntu derivative may not be readily obvious, it is something special. - -The goal of System76 is to create an operating system specific to the developer, maker, and computer science professional. With a newly-designed GNOME theme, Pop!_OS is beautiful (Figure 5) and as highly functional as you would expect from both the hardware maker and desktop designers. - -### [devel_5.jpg][11] - -![Pop!_OS](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/devel_5.jpg?itok=n4K7k7Gd "Pop!_OS") -Figure 5: The Pop!_OS Desktop.[Used with permission][5] - -But what makes Pop!_OS special is the fact that it is being developed by a company dedicated to Linux hardware. This means, when you purchase a System76 laptop, desktop, or server, you know the operating system will work seamlessly with the hardware—on a level no other company can offer. I would predict that, with Pop!_OS, System76 will become the Apple of Linux. - -### Time for work - -In their own way, each of these distributions. You have a stable desktop (Debian), a cutting-edge desktop (openSUSE Tumbleweed), a server (CentOS), an embedded platform (Raspbian), and a distribution to seamless meld with hardware (Pop!_OS). With the exception of Raspbian, any one of these distributions would serve as an outstanding development platform. Get one installed and start working on your next project with confidence. - - _Learn more about Linux through the free ["Introduction to Linux" ][13]course from The Linux Foundation and edX._ - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/intro-to-linux/2018/1/5-best-linux-distributions-development - -作者:[JACK WALLEN ][a] -译者:[译者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 -[1]:https://www.linux.com/licenses/category/used-permission -[2]:https://www.linux.com/licenses/category/creative-commons-zero -[3]:https://www.linux.com/licenses/category/used-permission -[4]:https://www.linux.com/licenses/category/used-permission -[5]:https://www.linux.com/licenses/category/used-permission -[6]:https://www.linux.com/licenses/category/creative-commons-zero -[7]:https://www.linux.com/files/images/devel1jpg -[8]:https://www.linux.com/files/images/devel2jpg -[9]:https://www.linux.com/files/images/devel3jpg -[10]:https://www.linux.com/files/images/devel4jpg -[11]:https://www.linux.com/files/images/devel5jpg -[12]:https://www.linux.com/files/images/king-penguins1920jpg -[13]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux -[14]:https://www.debian.org/ -[15]:https://www.ubuntu.com/ -[16]:https://linuxmint.com/ -[17]:https://elementary.io/ -[18]:https://www.debian.org/social_contract -[19]:https://www.debian.org/doc/manuals/debian-reference/ch12.en.html -[20]:https://www.opensuse.org/ -[21]:https://en.opensuse.org/Portal:Tumbleweed -[22]:https://software.opensuse.org/download.html?project=devel%3Atools&package=rpmdevtools -[23]:https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[24]:https://www.centos.org/ -[25]:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/pdf/developer_guide/Red_Hat_Enterprise_Linux-7-Developer_Guide-en-US.pdf -[26]:https://www.raspberrypi.org/downloads/raspbian/ -[27]:https://www.bluej.org/ -[28]:https://www.geany.org/ -[29]:https://www.greenfoot.org/ -[30]:https://www.raspberrypi.org/blog/sense-hat-emulator/ -[31]:http://sonic-pi.net/ -[32]:http://thonny.org/ -[33]:https://www.python.org/ -[34]:https://scratch.mit.edu/ -[35]:http://rpf.io/x86iso -[36]:https://system76.com/ -[37]:https://system76.com/pop From d23b1c1b4ebba522aab934b398d1c9ba249990d3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 18:20:43 +0800 Subject: [PATCH 263/813] APL:20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md --- ...tors Power Usage and Improve Laptop Battery Life in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md b/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md index a615ffc73a..53b2054bd1 100644 --- a/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md +++ b/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From af6b622deb003420bb95ee0e9cb82441c484a5d3 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 21 Feb 2019 20:58:44 +0800 Subject: [PATCH 264/813] translate by MjSeven --- .../20190219 3 tools for viewing files at the command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190219 3 tools for viewing files at the command line.md b/sources/tech/20190219 3 tools for viewing files at the command line.md index 1443d3bfa9..bd666cc098 100644 --- a/sources/tech/20190219 3 tools for viewing files at the command line.md +++ b/sources/tech/20190219 3 tools for viewing files at the command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6a455bdcbee60e90b2ecc6ebca3dcbf49fa6e864 Mon Sep 17 00:00:00 2001 From: AnDJ <363787371@qq.com> Date: Thu, 21 Feb 2019 22:34:57 +0800 Subject: [PATCH 265/813] translate: 20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md --- ...Password in Ubuntu -Beginner-s Tutorial.md | 130 ------------------ ...Password in Ubuntu -Beginner-s Tutorial.md | 129 +++++++++++++++++ 2 files changed, 129 insertions(+), 130 deletions(-) delete mode 100644 sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md create mode 100644 translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md diff --git a/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md deleted file mode 100644 index 30691f7d5d..0000000000 --- a/sources/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (An-DJ ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Change User Password in Ubuntu [Beginner’s Tutorial]) -[#]: via: (https://itsfoss.com/change-password-ubuntu) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Change User Password in Ubuntu [Beginner’s Tutorial] -====== - -**Want to change root password in Ubuntu? Learn how to change the password for any user in Ubuntu Linux. Both terminal and GUI methods have been discussed.** - -When do you need to change the password in Ubuntu? Let me give you a couple of scenarios. - -When you install [Ubuntu][1], you create a user and set a password for it. It could be a weak password or perhaps a bit too complicated and you want to change it. - -If you are a sysadmin, you may need to change the password for other users on your system. - -You may have a few other reasons for doing this. Now the question comes, how to change the password for a user in Ubuntu or Linux? - -In this quick tutorial, I’ll show you the command line and the GUI ways of changing passwords in Ubuntu. - -### Change user password in Ubuntu [Command Line] - -![How to change user password in Ubuntu Linux][2] - -Changing user password in Ubuntu is dead simple. In fact, it’s the same with any Linu distribution because you use the generic Linux command called passwd for this purpose. - -If you want to change your current password, simply run this command in a terminal: - -``` -passwd -``` - -You’ll be asked to enter your current password and the new password twice. - -You won’t see anything on the screen while typing the password. This is perfectly normal behavior for UNIX and Linux. - -``` -passwd - -Changing password for abhishek. - -(current) UNIX password: - -Enter new UNIX password: - -Retype new UNIX password: - -passwd: password updated successfully -``` - -Since this is your admin account, you just changed the sudo password in Ubuntu without even realizing it. - -![Change user password in Linux command line][3] - -If you want to change password for some other user, you can do that as well with the passwd command. But in this case, you’ll have to use sudo. - -``` -sudo passwd -``` - -If you changed your password and forgot it later, don’t worry. You can [easily reset Ubuntu password][4]. - -### Change root password in Ubuntu - -By default, the root user in Ubuntu doesn’t have a password. Don’t be surprised. You don’t use the root user in Ubuntu all the time. Confused? Let me explain it to you quickly. - -While [installing Ubuntu][5], you are forced to create a user. This user has admin access. This admin user can gain root access using the sudo command. But it uses its own password, not the root account’s password (because there is none). - -You can set or change root password using the **passwd** command. However, in most cases, you don’t need it and you shouldn’t be doing it. - -You’ll have to use sudo (with an account with admin privileges). If the root password has no password set up previously, it will ask you to set it up. Else, you can change it using the existing root password. - -``` -sudo password root -``` - -### Change Ubuntu password using GUI - -I have used GNOME desktop with Ubuntu 18.04 here. The steps should be more or less the same for other desktop environments and Ubuntu versions. - -Go to Menu (press Windows/Super key) and search for Settings. - -In the Settings, scroll down a bit and go to Details. - -![Go to details in Ubuntu GNOME settings][6] - -In here, click on Users to access all the available users on your system. - -![Users settings in Ubuntu][7] - -You can select any user you want, including your main admin account. You need to unlock the users first and then click the password field. - -![Changing user password in Ubuntu][8] - -You’ll be asked to set the password. If you are changing your own password, you’ll have to enter your current password as well. - -![Changing user password in Ubuntu][9] - -Once done, click on the Change button on the top. That’s it. You have successfully changed user password in Ubuntu. - -I hope this quick little tip helped you to change user password in Ubuntu. If you have questions or suggestions, please leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/change-password-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://www.ubuntu.com/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-password-ubuntu-linux.png?resize=800%2C450&ssl=1 -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-linux-1.jpg?resize=800%2C253&ssl=1 -[4]: https://itsfoss.com/how-to-hack-ubuntu-password/ -[5]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-2.jpg?resize=800%2C484&ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-3.jpg?resize=800%2C488&ssl=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-4.jpg?resize=800%2C555&ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-1.jpg?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-password-ubuntu-linux.png?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md b/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..a2dfb77515 --- /dev/null +++ b/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (An-DJ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Change User Password in Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/change-password-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Ubuntu下如何修改用户密码 [新手教程] +====== +**想要在Ubuntu下修改root用户的密码?那我们来学习下如何在Ubuntu Linux下修改任意用户的密码。我们会讨论在终端下修改和在图形界面(GUI)修改两种做法** + +那么,在Ubuntu下什么时候会需要修改密码呢?这里我给出如下两种场景。 + +当你刚安装[Ubuntu][1]系统时,你会创建一个用户并且为之设置一个密码。这个初始密码可能安全性较弱或者太过于复杂,你会想要对它做出修改。 + +如果你是系统管理员,你可能需要去修改在你管理的系统内其他用户的密码。 + +当然,你可能会有其他的一些原因做这样的一件事。不过现在问题来了,我们到底如何在Ubuntu或Linux系统下修改单个用户的密码呢? + +在这个快速教程中,我将会展示给你在Ubuntu中如何使用命令行和图形界面(GUI)两种方式修改密码。 + +### 在Ubuntu中修改用户密码[通过命令行] + +![如何在Ubuntu Linux下修改用户密码][2] + +在Ubuntu下修改用户密码其实非常简单。事实上,在任何Linux发行版上修改的方式都是一样的,因为你要使用的是叫做 passwd 的普通Linux命令来达到此目的。 + +如果你想要修改你的当前密码,只需要简单地在终端执行此命令: + +``` +passwd +``` + +系统会要求你输入当前密码和两次新的密码。 + +在键入密码时,你不会从屏幕上看到任何东西。这在UNIX和Linux系统中是非常正常的表现。 + +``` +passwd + +Changing password for abhishek. + +(current) UNIX password: + +Enter new UNIX password: + +Retype new UNIX password: + +passwd: password updated successfully +``` + +由于这是你的管理员账户,你刚刚修改了Ubuntu下sudo的密码,但你甚至没有意识到这个操作。 + +![在Linux命令行中修改用户密码][3] + +如果你想要修改其他用户的密码,你也可以使用passwd命令来做。但是在这种情况下,你将不得不使用sudo。 + +``` +sudo passwd +``` + +如果你对密码已经做出了修改,不过之后忘记了,不要担心。你可以[很容易地在Ubuntu下重置密码][4]. + +### 修改Ubuntu下root用户密码 + +默认情况下,Ubuntu中root用户是没有密码的。不必惊讶,你并不是在Ubuntu下一直使用root用户。不太懂?让我快速地给你解释下。 + +当[安装Ubuntu][5]时,你会被强制创建一个用户。这个用户拥有管理员访问权限。这个管理员用户可以通过sudo命令获得root访问权限。但是,该用户使用的是自身的密码,而不是root账户的密码(因为就没有)。 + +你可以使用**passwd**命令来设置或修改root用户的密码。然而,在大多数情况下,你并不需要它,而且你不应该去做这样的事。 + +你将不得不使用sudo命令(对于拥有管理员权限的账户)。如果root用户的密码之前没有被设置,它会要求你设置。另外,你可以使用已有的root密码对它进行修改。 + +``` +sudo password root +``` + +### 在Ubuntu下使用图形界面(GUI)修改密码 + +我这里使用的是GNOME桌面环境,Ubuntu版本为18.04。这些步骤对于其他桌面环境和Ubuntu版本应该差别不大。 + +打开菜单(按下Windows/Super键)并搜索Settings。 + +在Settings中,向下滚动一段距离打开进入Details。 + +![在Ubuntu GNOME Settings中进入Details][6] + +在这里,点击Users获取系统下可见的所有用户。 + +![Ubuntu下用户设置][7] + +你可以选择任一你想要的用户,包括你的主要管理员账户。你需要先解锁用户并点击密码(password)区域。 + +![Ubuntu下修改用户密码][8] + +你会被要求设置密码。如果你正在修改的是你自己的密码,你将必须也输入当前使用的密码。 + +![Ubuntu下修改用户密码][9] + +做好这些后,点击上面的Change按钮,这样就完成了。你已经成功地在Ubuntu下修改了用户密码。 + +我希望这篇快速精简的小教程能够帮助你在Ubuntu下修改用户密码。如果你对此还有一些问题或建议,请在下方留下评论。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-password-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[An-DJ](https://github.com/An-DJ) +校对:[校对者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.ubuntu.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-password-ubuntu-linux.png?resize=800%2C450&ssl=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-linux-1.jpg?resize=800%2C253&ssl=1 +[4]: https://itsfoss.com/how-to-hack-ubuntu-password/ +[5]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-2.jpg?resize=800%2C484&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-3.jpg?resize=800%2C488&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-4.jpg?resize=800%2C555&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-user-password-ubuntu-gui-1.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/change-password-ubuntu-linux.png?fit=800%2C450&ssl=1 From 1fda93936be2bd441c23fc1b8ee3de0d340ca493 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 23:34:58 +0800 Subject: [PATCH 266/813] TSL:20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md --- ...nd Improve Laptop Battery Life in Linux.md | 77 +++++++++---------- 1 file changed, 35 insertions(+), 42 deletions(-) rename {sources => translated}/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md (87%) diff --git a/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md b/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md similarity index 87% rename from sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md rename to translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md index 53b2054bd1..d1703959f5 100644 --- a/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md +++ b/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @@ -7,70 +7,62 @@ [#]: via: (https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) -PowerTOP – Monitors Power Usage and Improve Laptop Battery Life in Linux +PowerTOP:在 Linux 上监视电量使用和改善笔记本电池寿命 ====== -We all know, we almost 80-90% migrated from PC (Desktop) to laptop. +我们都知道,现在几乎都从 PC 机换到了笔记本电脑了。但是使用笔记本有个问题,我们希望电池耐用,我们可以使用到每一点电量。所以,我们需要知道电量都去哪里了,是不是浪费了。 -But one thing we want from a laptop, it’s long battery life and we want to use every drop of power. +你可以使用 PowerTOP 工具来查看没有接入电源线时电量都用在了何处。你需要在终端中使用超级用户权限来运行 PowerTOP 工具。它可以访问该电池硬件并测量电量使用情况。 -So it’s good to know where our power is going and getting waste. +### 什么是 PowerTOP -You can use the powertop utility to see what’s drawing power when your system’s not plugged in. +PowerTOP 是一个 Linux 工具,用于诊断电量消耗和电源管理的问题。 -You need to run the powertop utility in terminal with super user privilege. +它是由 Intel 开发的,可以在内核、用户空间和硬件中启用各种节电模式。 -It will access the hardware and measure power usage. +除了作为一个一个诊断工具之外,PowweTop 还有一个交互模式,可以让你实验 Linux 发行版没有启用的各种电源管理设置。 -### What is PowerTOP +它也能监控进程,并展示其中哪个正在使用 CPU,以及从休眠状态页将其唤醒,也可以找出电量消耗特别高的应用程序。 -PowerTOP is a Linux tool to diagnose issues with power consumption and power management. +### 如何安装 PowerTOP -It was developed by Intel to enable various power-saving modes in kernel, userspace, and hardware. +PowerTOP 软件包在大多数发行版的软件库中可用,使用发行版的 [包管理器][1] 安装即可。 -In addition to being a diagnostic tool, PowerTOP also has an interactive mode where the user can experiment various power management settings for cases where the Linux distribution has not enabled these settings. - -It is possible to monitor processes and show which of them are utilizing the CPU and wake it from its Idle-States, allowing to identify applications with particular high power demands. - -### How to Install PowerTOP - -PowerTOP package is available in most of the distributions official repository so, use the distributions **[Package Manager][1]** to install it. - -For **`Fedora`** system, use **[DNF Command][2]** to install PowerTOP. +对于 Fedora 系统,使用 [DNF 命令][2] 来安装 PowerTOP。 ``` $ sudo dnf install powertop ``` -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install PowerTOP. +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][3] 或 [APT 命令][4] 来安装 PowerTOP。 ``` $ sudo apt install powertop ``` -For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install PowerTOP. +对于基于 Arch Linux 的系统,使用 [Pacman 命令][5] 来安装 PowerTOP。 ``` $ sudo pacman -S powertop ``` -For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install PowerTOP. +对于 RHEL/CentOS 系统,使用 [YUM 命令][6] 来安装 PowerTOP。 ``` $ sudo yum install powertop ``` -For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install PowerTOP. +对于 openSUSE Leap 系统,使用 [Zypper 命令][7] 来安装 PowerTOP。 ``` $ sudo zypper install powertop ``` -### How To Access PowerTOP +### 如何使用 PowerTOP -PowerTOP requires super user privilege so, run as root to use PowerTOP utility on your Linux system. +PowerTOP 需要超级用户权限,所以在 Linux 系统中以 root 身份运行 PowerTOP 工具。 -By default it shows `Overview` tab where we can see the power usage consumption for all the devices. Also shows your system wakeups seconds. +默认情况下其显示 “概览” 页,在这里我们可以看到所有设备的电量消耗情况,也可以看到系统的唤醒秒数。 ``` $ sudo powertop @@ -132,11 +124,11 @@ Summary: 1692.9 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and 54.9% Exit | / Navigate | ``` -The powertop output looks similar to the above screenshot, it will be slightly different based on your hardware. This have many screen you can switch between screen the using `Tab` and `Shift+Tab` button. +PowerTOP 的输出类似如上截屏,在你的机器上由于硬件不同会稍有不同。它的显示有很多页,你可以使用 `Tab` 和 `Shift+Tab` 在它们之间切换。 -### Idle Stats Tab +### 空闲状态页 -It displays various information about the processor. +它会显示处理器的各种信息。 ``` PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables @@ -194,9 +186,9 @@ C10 (pc10) 0.0% | | C10 39.5% 4.7 ms 41.4% Exit | / Navigate | ``` -### Frequency Stats Tab +### 频率状态页 -It displays the frequency of CPU. +它会显示 CPU 的主频。 ``` PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables @@ -220,9 +212,9 @@ Idle | Idle | Idle ``` -### Device Stats Tab +### 设备状态页 -It displays power usage information against only devices. +它仅针对设备显示其电量使用信息。 ``` PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables @@ -277,12 +269,12 @@ The power consumed was 280 J 0.0% runtime-coretemp.0 0.0% runtime-alarmtimer - Exit | / Navigate | + Exit | / Navigate | ``` -### Tunables Stats Tab +### 可调整状态页 -This tab is important area that provides suggestions to optimize your laptop battery. +这个页面是个重要区域,可以为你的笔记本电池优化提供建议。 ``` PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables @@ -340,9 +332,9 @@ PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunab Exit | Toggle tunable | Window refresh ``` -### How To Generate PowerTop HTML Report +### 如何生成 PowerTop 的 HTML 报告 -Run the following command to generate the PowerTop HTML report. +运行如下命令生成 PowerTop 的 HTML 报告。 ``` $ sudo powertop --html=powertop.html @@ -363,12 +355,13 @@ Taking 1 measurement(s) for a duration of 20 second(s) each. PowerTOP outputing using base filename powertop.html ``` -Navigate to `file:///home/daygeek/powertop.html` file to access the generated PowerTOP HTML report. +打开 `file:///home/daygeek/powertop.html` 文件以访问生成的 PowerTOP 的 HTML 报告。 + ![][9] -### Auto-Tune mode +### 自动调整模式 -This feature sets all tunable options from `BAD` to `GOOD` which increase the laptop battery life in Linux. +这个功能可以将所有可调整选项从 BAD 设置为 GOOD,这可以提升 Linux 中的笔记本电池寿命。 ``` $ sudo powertop --auto-tune @@ -393,7 +386,7 @@ via: https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/ 作者:[Vinoth Kumar][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 9e224c9c87bc3ff23345d6002daa10d36dca4f98 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 23:55:13 +0800 Subject: [PATCH 267/813] PRF:20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @wxy --- ...rs Power Usage and Improve Laptop Battery Life in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md b/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md index d1703959f5..4e8a0e80e1 100644 --- a/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md +++ b/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (PowerTOP – Monitors Power Usage and Improve Laptop Battery Life in Linux) @@ -387,7 +387,7 @@ via: https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/ 作者:[Vinoth 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 51f9c4dfe87c81b0f48658da9ed214720c6e653c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Feb 2019 23:56:03 +0800 Subject: [PATCH 268/813] PUB:20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @wxy https://linux.cn/article-10560-1.html --- ...rs Power Usage and Improve Laptop Battery Life in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md (99%) diff --git a/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md b/published/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md similarity index 99% rename from translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md rename to published/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md index 4e8a0e80e1..9a08e5216e 100644 --- a/translated/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md +++ b/published/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10560-1.html) [#]: subject: (PowerTOP – Monitors Power Usage and Improve Laptop Battery Life in Linux) [#]: via: (https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) From 7c5beaa84e0a4df0a43fd97f75dc9c483d1b7cac Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Thu, 21 Feb 2019 19:04:31 -0600 Subject: [PATCH 269/813] Submit Translated Passage for Review Submit Translated Passage for Review --- ...eriences Every Linux Gamer Never Wanted.md | 160 ------------------ ...eriences Every Linux Gamer Never Wanted.md | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 160 deletions(-) delete mode 100644 sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md create mode 100644 translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md diff --git a/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md deleted file mode 100644 index cbac45b76d..0000000000 --- a/sources/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md +++ /dev/null @@ -1,160 +0,0 @@ -tomjlw is translating -Annoying Experiences Every Linux Gamer Never Wanted! -============================================================ - - - [![Linux gamer's problem](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] - -[Gaming on Linux][12] has come a long way. There are dedicated [Linux gaming distributions][13] now. But this doesn’t mean that gaming experience on Linux is as smooth as on Windows. - -What are the obstacles that should be thought about to ensure that we enjoy games as much as Windows users do? - -[Wine][14], [PlayOnLinux][15] and other similar tools are not always able to play every popular Windows game. In this article, I would like to discuss various factors that must be dealt with in order to have the best possible Linux gaming experience. - -### #1 SteamOS is Open Source, Steam for Linux is NOT - -As stated on the [SteamOS page][16], even though SteamOS is open source, Steam for Linux continues to be proprietary. Had it also been open source, the amount of support from the open source community would have been tremendous! Since it is not, [the birth of Project Ascension was inevitable][17]: - -[video](https://youtu.be/07UiS5iAknA) - -Project Ascension is an open source game launcher designed to launch games that have been bought and downloaded from anywhere – they can be Steam games, [Origin games][18], Uplay games, games downloaded directly from game developer websites or from DVD/CD-ROMs. - -Here is how it all began: [Sharing The Idea][19] resulted in a very interesting discussion with readers all over from the gaming community pitching in their own opinions and suggestions. - -### #2 Performance compared to Windows - -Getting Windows games to run on Linux is not always an easy task. But thanks to a feature called [CSMT][20] (command stream multi-threading), PlayOnLinux is now better equipped to deal with these performance issues, though it’s still a long way to achieve Windows level outcomes. - -Native Linux support for games has not been so good for past releases. - -Last year, it was reported that SteamOS performed [significantly worse][21] than Windows. Tomb Raider was released on SteamOS/Steam for Linux last year. However, benchmark results were [not at par][22] with performance on Windows. - -[video](https://youtu.be/nkWUBRacBNE) - -This was much obviously due to the fact that the game had been developed with [DirectX][23] in mind and not [OpenGL][24]. - -Tomb Raider is the [first Linux game that uses TressFX][25]. This video includes TressFX comparisons: - -[video](https://youtu.be/-IeY5ZS-LlA) - -Here is another interesting comparison which shows Wine+CSMT performing much better than the native Linux version itself on Steam! This is the power of Open Source! - -[Suggested readA New Linux OS "OSu" Vying To Be Ubuntu Of Arch Linux World][26] - -[video](https://youtu.be/sCJkC6oJ08A) - -TressFX has been turned off in this case to avoid FPS loss. - -Here is another Linux vs Windows comparison for the recently released “[Life is Strange][27]” on Linux: - -[video](https://youtu.be/Vlflu-pIgIY) - -It’s good to know that  [_Steam for Linux_][28]  has begun to show better improvements in performance for this new Linux game. - -Before launching any game for Linux, developers should consider optimizing them especially if it’s a DirectX game and requires OpenGL translation. We really do hope that [Deus Ex: Mankind Divided on Linux][29] gets benchmarked well, upon release. As its a DirectX game, we hope it’s being ported well for Linux. Here’s [what the Executive Game Director had to say][30]. - -### #3 Proprietary NVIDIA Drivers - -[AMD’s support for Open Source][31] is definitely commendable when compared to [NVIDIA][32]. Though [AMD][33] driver support is [pretty good on Linux][34] now due to its better open source driver, NVIDIA graphic card owners will still have to use the proprietary NVIDIA drivers because of the limited capabilities of the open-source version of NVIDIA’s graphics driver called Nouveau. - -In the past, legendary Linus Torvalds has also shared his thoughts about Linux support from NVIDIA to be totally unacceptable: - -[video](https://youtu.be/O0r6Pr_mdio) - -You can watch the complete talk [here][35]. Although NVIDIA responded with [a commitment for better linux support][36], the open source graphics driver still continues to be weak as before. - -### #4 Need for Uplay and Origin DRM support on Linux - -[video](https://youtu.be/rc96NFwyxWU) - -The above video describes how to install the [Uplay][37] DRM on Linux. The uploader also suggests that the use of wine as the main tool of games and applications is not recommended on Linux. Rather, preference to native applications should be encouraged instead. - -The following video is a guide about installing the [Origin][38] DRM on Linux: - -[video](https://youtu.be/ga2lNM72-Kw) - -Digital Rights Management Software adds another layer for game execution and hence it adds up to the already challenging task to make a Windows game run well on Linux. So in addition to making the game execute, W.I.N.E has to take care of running the DRM software such as Uplay or Origin as well. It would have been great if, like Steam, Linux could have got its own native versions of Uplay and Origin. - -[Suggested readLinux Foundation Head Calls 2017 'Year of the Linux Desktop'... While Running Apple's macOS Himself][39] - -### #5 DirectX 11 support for Linux - -Even though we have tools on Linux to run Windows applications, every game comes with its own set of tweak requirements for it to be playable on Linux. Though there was an announcement about [DirectX 11 support for Linux][40] last year via Code Weavers, it’s still a long way to go to make playing newly launched titles on Linux a possibility. Currently, you can - -Currently, you can [buy Crossover from Codeweavers][41] to get the best DirectX 11 support available. This [thread][42] on the Arch Linux forums clearly shows how much more effort is required to make this dream a possibility. Here is an interesting [find][43] from a [Reddit thread][44], which mentions Wine getting [DirectX 11 patches from Codeweavers][45]. Now that’s definitely some good news. - -### #6 100% of Steam games are not available for Linux - -This is an important point to ponder as Linux gamers continue to miss out on every major game release since most of them land up on Windows. Here is a guide to [install Steam for Windows on Linux][46]. - -### #7 Better Support from video game publishers for OpenGL - -Currently, developers and publishers focus primarily on DirectX for video game development rather than OpenGL. Now as Steam is officially here for Linux, developers should start considering development in OpenGL as well. - -[Direct3D][47] is made solely for the Windows platform. The OpenGL API is an open standard, and implementations exist for not only Windows but a wide variety of other platforms. - -Though quite an old article, [this valuable resource][48] shares a lot of thoughtful information on the realities of OpenGL and DirectX. The points made are truly very sensible and enlightens the reader about the facts based on actual chronological events. - -Publishers who are launching their titles on Linux should definitely not leave out the fact that developing the game on OpenGL would be a much better deal than translating it from DirectX to OpenGL. If conversion has to be done, the translations must be well optimized and carefully looked into. There might be a delay in releasing the games but still it would definitely be worth the wait. - -Have more annoyances to share? Do let us know in the comments. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/linux-gaming-problems/ - -作者:[Avimanyu Bandyopadhyay ][a] -译者:[tomjlw](https://github.com/tomjlw -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://itsfoss.com/author/avimanyu/ -[1]:https://itsfoss.com/author/avimanyu/ -[2]:https://itsfoss.com/linux-gaming-problems/#comments -[3]:https://www.facebook.com/share.php?u=https%3A%2F%2Fitsfoss.com%2Flinux-gaming-problems%2F%3Futm_source%3Dfacebook%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare -[4]:https://twitter.com/share?original_referer=/&text=Annoying+Experiences+Every+Linux+Gamer+Never+Wanted%21&url=https://itsfoss.com/linux-gaming-problems/%3Futm_source%3Dtwitter%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare&via=itsfoss2 -[5]:https://plus.google.com/share?url=https%3A%2F%2Fitsfoss.com%2Flinux-gaming-problems%2F%3Futm_source%3DgooglePlus%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare -[6]:https://www.linkedin.com/cws/share?url=https%3A%2F%2Fitsfoss.com%2Flinux-gaming-problems%2F%3Futm_source%3DlinkedIn%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare -[7]:http://www.stumbleupon.com/submit?url=https://itsfoss.com/linux-gaming-problems/&title=Annoying+Experiences+Every+Linux+Gamer+Never+Wanted%21 -[8]:https://www.reddit.com/submit?url=https://itsfoss.com/linux-gaming-problems/&title=Annoying+Experiences+Every+Linux+Gamer+Never+Wanted%21 -[9]:https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg -[10]:https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg -[11]:http://pinterest.com/pin/create/bookmarklet/?media=https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg&url=https://itsfoss.com/linux-gaming-problems/&is_video=false&description=Linux%20gamer%27s%20problem -[12]:https://itsfoss.com/linux-gaming-guide/ -[13]:https://itsfoss.com/linux-gaming-distributions/ -[14]:https://itsfoss.com/use-windows-applications-linux/ -[15]:https://www.playonlinux.com/en/ -[16]:http://store.steampowered.com/steamos/ -[17]:http://www.ibtimes.co.uk/reddit-users-want-replace-steam-open-source-game-launcher-project-ascension-1498999 -[18]:https://www.origin.com/ -[19]:https://www.reddit.com/r/pcmasterrace/comments/33xcvm/we_hate_valves_monopoly_over_pc_gaming_why/ -[20]:https://github.com/wine-compholio/wine-staging/wiki/CSMT -[21]:http://arstechnica.com/gaming/2015/11/ars-benchmarks-show-significant-performance-hit-for-steamos-gaming/ -[22]:https://www.gamingonlinux.com/articles/tomb-raider-benchmark-video-comparison-linux-vs-windows-10.7138 -[23]:https://en.wikipedia.org/wiki/DirectX -[24]:https://en.wikipedia.org/wiki/OpenGL -[25]:https://www.gamingonlinux.com/articles/tomb-raider-released-for-linux-video-thoughts-port-report-included-the-first-linux-game-to-use-tresfx.7124 -[26]:https://itsfoss.com/osu-new-linux/ -[27]:http://lifeisstrange.com/ -[28]:https://itsfoss.com/install-steam-ubuntu-linux/ -[29]:https://itsfoss.com/deus-ex-mankind-divided-linux/ -[30]:http://wccftech.com/deus-ex-mankind-divided-director-console-ports-on-pc-is-disrespectful/ -[31]:http://developer.amd.com/tools-and-sdks/open-source/ -[32]:http://nvidia.com/ -[33]:http://amd.com/ -[34]:http://www.makeuseof.com/tag/open-source-amd-graphics-now-awesome-heres-get/ -[35]:https://youtu.be/MShbP3OpASA -[36]:https://itsfoss.com/nvidia-optimus-support-linux/ -[37]:http://uplay.com/ -[38]:http://origin.com/ -[39]:https://itsfoss.com/linux-foundation-head-uses-macos/ -[40]:http://www.pcworld.com/article/2940470/hey-gamers-directx-11-is-coming-to-linux-thanks-to-codeweavers-and-wine.html -[41]:https://itsfoss.com/deal-run-windows-software-and-games-on-linux-with-crossover-15-66-off/ -[42]:https://bbs.archlinux.org/viewtopic.php?id=214771 -[43]:https://ghostbin.com/paste/sy3e2 -[44]:https://www.reddit.com/r/linux_gaming/comments/3ap3uu/directx_11_support_coming_to_codeweavers/ -[45]:https://www.codeweavers.com/about/blogs/caron/2015/12/10/directx-11-really-james-didnt-lie -[46]:https://itsfoss.com/linux-gaming-guide/ -[47]:https://en.wikipedia.org/wiki/Direct3D -[48]:http://blog.wolfire.com/2010/01/Why-you-should-use-OpenGL-and-not-DirectX diff --git a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md new file mode 100644 index 0000000000..0b3dc1ba7e --- /dev/null +++ b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @@ -0,0 +1,155 @@ +每个 Linux 平台上的玩家都从不想要的恼人经历 +============================================================ + [![Linux 平台上玩家的问题](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] + +[在 Linux 平台上玩游戏][12] 已经走了很远,现在有专门的 [Linux 游戏型发行版]。但是这不意味着在 Linux 上打游戏的感觉和在 Windows 上一样顺畅。 + +为了确保我们和 Windows 用户同样地享受游戏,什么是我们应该考虑的困难呢? + +[Wine][14],[PlayOnLinux][15] 和其它类似软件不总是能够玩所有流行的 Windows 游戏。在这篇文章里,我想讨论一下为了拥有一个最好的 Linux 游戏体验所必须处理好的若干因素。 + +### #1 SteamOS 是一个开源平台,Steam for Linux 并不是 + +正如 [StemOS 主页][16]所说, 即便 SteamOS 是一个开源平台,Steam for Linux 仍然是专有的。如果 Steam for Linux 也开源,那么它从开源社区得到的支持将会是巨大的。既然它不是,那么 [Ascension 计划的诞生自然是不可避免的][17]: + +[video](https://youtu.be/07UiS5iAknA) + +Ascension 计划是一个开源的能够启动从任何平台购买、下载的游戏的游戏启动器。这些游戏可以是 Steam 平台的,[Origin 游戏]平台的,Uplay 平台的,以及直接从游戏开发者主页或者从 DVD、CD-ROM 拷下来的。 + +这是 Ascension 计划如何开始的:[头脑风暴][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表自己的观点并给出建议。 + +### #2 与 Windows 平台的性能比较 + +在 Linux 平台上运行 Windows 游戏并不总是一件轻松的任务。但是感谢一个叫做 [CSMT][20](多线程命令流)的特性,尽管离 Windows 级别的性能还有相当长的路要走,PlayOnLinux 现在依旧可以更好地解决这些性能方面的问题。 + +原生态 Linux 对游戏的支持在过去发行的游戏中从未如人意。 + +去年,有报道说 SteamOS 比 Windows 在游戏方面的表现要[差得多][21]。古墓丽影去年在 SteamOS 及 Steam for Linux 上发行,然而基准测试的结果与 Windows 上的性能无法抗衡。 + +[视频](https://youtu.be/nkWUBRacBNE) + +这明显是因为游戏是基于 [DirectX][23] 而不是 [OpenGL][24] 开发的缘故。 + +古墓丽影是[第一个使用 TressFX 的游戏][25]。这个视频包涵了 TressFX 的比较: + +[视频](https://youtu.be/-IeY5ZS-LlA) + +下面是另一个有趣的比较,它显示出使用 Wine+CSMT 带来的游戏性能比 Steam 上原生的 Linux 版游戏带来的游戏性能要好得多!这就是开源的力量! + +[推荐阅读:一个新 Linux 操作系统 "OSu",力争成为 Arch Linux 世界中的 Ubuntu][26] + +[视频](https://youtu.be/sCJkC6oJ08A) + +以防 FPS 损失,TressFX 已经被关闭。 + +以下是另一个有关在 Linux 上最新发布的 “[Life is Strange][27]”在 Linux 与 Windows上的比较: + +[视频](https://youtu.be/Vlflu-pIgIY) + +[_Steam for Linux_][28] 开始在这个游戏上展示出比 Windows 更好的游戏性能,这是一件好事。 + +在发布任何 Linux 版的游戏前,开发者应该考虑优化游戏,特别是基于 DirectX 并需要 OpenGL转换的游戏。我们十分希望[ Linux 上的杀出重围:人类分裂][29] 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX的游戏,我们希望它能良好地移植到 Linux 上。以下是[游戏执行总监不得不说的话][30]。 + +### #3 专有的 NVIDIA 驱动 + +相比于 [NVIDIA][32],[AMD 对于开源的支持][31]绝对是值得称赞的。尽管 [AMD][33] 因其更好的开源驱动在 Linux 上的驱动支持挺不错,NVIDIA 显卡用户由于开源版本的 NVIDIA 显卡驱动 “Nouveau” 有限的能力,仍不得不用专有的 NVIDIA 驱动。 + +在过去,传奇般的 Linus Torvalds 同样分享了他关于“来自 NIVIDIA 的 Linux 支持完全不可接受”的想法。 + +[视频](https://youtu.be/O0r6Pr_mdio) + +你可以在这里观看完整的[讲话][35],尽管 NVIDIA 用 [承诺更好的 Linux 平台支持][36]作为回复,开源显卡驱动仍如之前一样毫无起色。 + +### #4 需要 Uplay 和 Origin 在 Linux 平台上的 DRM 支持 + +[视频](https://youtu.be/rc96NFwyxWU) + +以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。上传者还建议使用 Wine 作为 Linux 上的主要的应用和游戏支持软件并不推荐。相反,使用原生的应用更值得鼓励。 + +以下视频是一个关于如何在 Linux 上安装 [Origin][38] DRM 的教程。 + +[视频](https://youtu.be/ga2lNM72-Kw) + +数字版权管理软件给游戏运行又加了一层阻碍,使得在 Linux 上良好运行 Windows 游戏这一本就充满挑战性的任务更有难度。因此除了使游戏能够运行之外,W.I.N.E 不得不同时负责运行像 Uplay 或 Origin 之类的 DRM 软件。如果能像 Steam 一样,Linux 也能够有自己原生版本的 Uplay 和 Origin 那就好了。 + +[推荐阅读:Linux 基金会会长称 2017 是 Linux 桌面之年......尽管他自己正使用苹果的 macOS][39] + +### #5 DirectX 11 对于 Linux 的支持 + +尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套插件需求。尽管去年通过 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣[发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 + +### #6 100%的 Steam 游戏在 Linux 上无法获得 + +随着 Linux 游戏玩家持续错过每一款主要游戏的发行,这是需要考虑的一个重点,因为大部分主要游戏都在 Windows 上发行。以下是[如何在 Linux 上安装 Windows 版的 Steam 的教程][46]。 + +### #7 游戏发行商对OpenGL更好的支持 + +目前开发者和发行商主要着眼于 DirectX 而不是 OpenGL 来开发游戏。现在随着 Steam 正式登录 Linux,开发者应该同样考虑在 OpenGL 下开发。 + +[Direct3D][47] 仅仅是为了 Windows 平台打造。而 OpenGL API 拥有开放性标准,并且它不仅能在 Windows 上同样也能在其它各种各样的平台上实现。 + +尽管是一篇很老的文章,[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。所提出的观点确实十分明智,基于按时间排序的事件给予读者启迪。 + +在 Linux 平台上发布大作的发行商绝不应该忽视一个事实:在 OpenGL 下直接开发游戏要比从 DirectX 移植到 OpenGL 合算得多。如果不得不转换平台,移植必须被仔细优化并谨慎研究。发布游戏可能会有延迟但这绝对值得。 + +有更多的烦恼要分享?务必在评论区让我们知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-gaming-problems/ + +作者:[Avimanyu Bandyopadhyay ][a] +译者:[tomjlw](https://github.com/tomjlw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/avimanyu/ +[1]:https://itsfoss.com/author/avimanyu/ +[2]:https://itsfoss.com/linux-gaming-problems/#comments +[3]:https://www.facebook.com/share.php?u=https%3A%2F%2Fitsfoss.com%2Flinux-gaming-problems%2F%3Futm_source%3Dfacebook%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare +[4]:https://twitter.com/share?original_referer=/&text=Annoying+Experiences+Every+Linux+Gamer+Never+Wanted%21&url=https://itsfoss.com/linux-gaming-problems/%3Futm_source%3Dtwitter%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare&via=itsfoss2 +[5]:https://plus.google.com/share?url=https%3A%2F%2Fitsfoss.com%2Flinux-gaming-problems%2F%3Futm_source%3DgooglePlus%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare +[6]:https://www.linkedin.com/cws/share?url=https%3A%2F%2Fitsfoss.com%2Flinux-gaming-problems%2F%3Futm_source%3DlinkedIn%26utm_medium%3Dsocial%26utm_campaign%3DSocialWarfare +[7]:http://www.stumbleupon.com/submit?url=https://itsfoss.com/linux-gaming-problems/&title=Annoying+Experiences+Every+Linux+Gamer+Never+Wanted%21 +[8]:https://www.reddit.com/submit?url=https://itsfoss.com/linux-gaming-problems/&title=Annoying+Experiences+Every+Linux+Gamer+Never+Wanted%21 +[9]:https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg +[10]:https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg +[11]:http://pinterest.com/pin/create/bookmarklet/?media=https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg&url=https://itsfoss.com/linux-gaming-problems/&is_video=false&description=Linux%20gamer%27s%20problem +[12]:https://itsfoss.com/linux-gaming-guide/ +[13]:https://itsfoss.com/linux-gaming-distributions/ +[14]:https://itsfoss.com/use-windows-applications-linux/ +[15]:https://www.playonlinux.com/en/ +[16]:http://store.steampowered.com/steamos/ +[17]:http://www.ibtimes.co.uk/reddit-users-want-replace-steam-open-source-game-launcher-project-ascension-1498999 +[18]:https://www.origin.com/ +[19]:https://www.reddit.com/r/pcmasterrace/comments/33xcvm/we_hate_valves_monopoly_over_pc_gaming_why/ +[20]:https://github.com/wine-compholio/wine-staging/wiki/CSMT +[21]:http://arstechnica.com/gaming/2015/11/ars-benchmarks-show-significant-performance-hit-for-steamos-gaming/ +[22]:https://www.gamingonlinux.com/articles/tomb-raider-benchmark-video-comparison-linux-vs-windows-10.7138 +[23]:https://en.wikipedia.org/wiki/DirectX +[24]:https://en.wikipedia.org/wiki/OpenGL +[25]:https://www.gamingonlinux.com/articles/tomb-raider-released-for-linux-video-thoughts-port-report-included-the-first-linux-game-to-use-tresfx.7124 +[26]:https://itsfoss.com/osu-new-linux/ +[27]:http://lifeisstrange.com/ +[28]:https://itsfoss.com/install-steam-ubuntu-linux/ +[29]:https://itsfoss.com/deus-ex-mankind-divided-linux/ +[30]:http://wccftech.com/deus-ex-mankind-divided-director-console-ports-on-pc-is-disrespectful/ +[31]:http://developer.amd.com/tools-and-sdks/open-source/ +[32]:http://nvidia.com/ +[33]:http://amd.com/ +[34]:http://www.makeuseof.com/tag/open-source-amd-graphics-now-awesome-heres-get/ +[35]:https://youtu.be/MShbP3OpASA +[36]:https://itsfoss.com/nvidia-optimus-support-linux/ +[37]:http://uplay.com/ +[38]:http://origin.com/ +[39]:https://itsfoss.com/linux-foundation-head-uses-macos/ +[40]:http://www.pcworld.com/article/2940470/hey-gamers-directx-11-is-coming-to-linux-thanks-to-codeweavers-and-wine.html +[41]:https://itsfoss.com/deal-run-windows-software-and-games-on-linux-with-crossover-15-66-off/ +[42]:https://bbs.archlinux.org/viewtopic.php?id=214771 +[43]:https://ghostbin.com/paste/sy3e2 +[44]:https://www.reddit.com/r/linux_gaming/comments/3ap3uu/directx_11_support_coming_to_codeweavers/ +[45]:https://www.codeweavers.com/about/blogs/caron/2015/12/10/directx-11-really-james-didnt-lie +[46]:https://itsfoss.com/linux-gaming-guide/ +[47]:https://en.wikipedia.org/wiki/Direct3D +[48]:http://blog.wolfire.com/2010/01/Why-you-should-use-OpenGL-and-not-DirectX From f936b0492311dadcaa84cc71614635eb507c4f24 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 22 Feb 2019 09:05:05 +0800 Subject: [PATCH 270/813] translated --- ...g to Take On Biggies Like Final Cut Pro.md | 102 ------------------ ...g to Take On Biggies Like Final Cut Pro.md | 101 +++++++++++++++++ 2 files changed, 101 insertions(+), 102 deletions(-) delete mode 100644 sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md create mode 100644 translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md diff --git a/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md deleted file mode 100644 index b77873dc58..0000000000 --- a/sources/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro) -[#]: via: (https://itsfoss.com/olive-video-editor) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro -====== - -[Olive][1] is a new open source video editor under development. This non-linear video editor aims to provide a free alternative to high-end professional video editing software. Too high an aim? I think so. - -If you have read our [list of best video editors for Linux][2], you might have noticed that most of the ‘professional-grade’ video editors such as [Lightworks][3] or DaVinciResolve are neither free nor open source. - -[Kdenlive][4] and Shotcut are there but they don’t often meet the standards of professional video editing (that’s what many Linux users have expressed). - -This gap between the hobbyist and professional video editors prompted the developer(s) of Olive to start this project. - -![Olive Video Editor][5]Olive Video Editor Interface - -There is a detailed [review of Olive on Libre Graphics World][6]. Actually, this is where I came to know about Olive first. You should read the article if you are interested in knowing more about it. - -### Installing Olive Video Editor in Linux - -Let me remind you. Olive is in the early stages of development. You’ll find plenty of bugs and missing/incomplete features. You should not treat it as your main video editor just yet. - -If you want to test Olive, there are several ways to install it on Linux. - -#### Install Olive in Ubuntu-based distributions via PPA - -You can install Olive via its official PPA in Ubuntu, Mint and other Ubuntu-based distributions. - -``` -sudo add-apt-repository ppa:olive-editor/olive-editor -sudo apt-get update -sudo apt-get install olive-editor -``` - -#### Install Olive via Snap - -If your Linux distribution supports Snap, you can use the command below to install it. - -``` -sudo snap install --edge olive-editor -``` - -#### Install Olive via Flatpak - -If your [Linux distribution supports Flatpak][7], you can install Olive video editor via Flatpak. - -#### Use Olive via AppImage - -Don’t want to install it? Download the [AppImage][8] file, set it as executable and run it. - -Both 32-bit and 64-bit AppImage files are available. You should download the appropriate file. - -Olive is also available for Windows and macOS. You can get it from their [download page][9]. - -### Want to support the development of Olive video editor? - -If you like what Olive is trying to achieve and want to support it, here are a few ways you can do that. - -If you are testing Olive and find some bugs, please report it on their GitHub repository. - -If you are a programmer, go and check out the source code of Olive and see if you could help the project with your coding skills. - -Contributing to projects financially is another way you can help the development of open source software. You can support Olive monetarily by becoming a patron. - -If you don’t have either the money or coding skills to support Olive, you could still help it. Share this article or Olive’s website on social media or in Linux/software related forums and groups you frequent. A little word of mouth should help it indirectly. - -### What do you think of Olive? - -It’s too early to judge Olive. I hope that the development continues rapidly and we have a stable release of Olive by the end of the year (if I am not being overly optimistic). - -What do you think of Olive? Do you agree with the developer’s aim of targeting the pro-users? What features would you like Olive to have? - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/olive-video-editor - -作者:[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.olivevideoeditor.org/ -[2]: https://itsfoss.com/best-video-editing-software-linux/ -[3]: https://www.lwks.com/ -[4]: https://kdenlive.org/en/ -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?resize=800%2C450&ssl=1 -[6]: http://libregraphicsworld.org/blog/entry/introducing-olive-new-non-linear-video-editor -[7]: https://itsfoss.com/flatpak-guide/ -[8]: https://itsfoss.com/use-appimage-linux/ -[9]: https://www.olivevideoeditor.org/download.php -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md new file mode 100644 index 0000000000..93f73664a6 --- /dev/null +++ b/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro) +[#]: via: (https://itsfoss.com/olive-video-editor) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Olive 是一个新的开源视频编辑器,一款类似 Final Cut Pro 的工具 +====== + +[Olive][1] 是一个正在开发的新开源视频编辑器。这个非线性视频编辑器旨在提供高端专业视频编辑软件的免费替代品。目标高么?我认为是的。 + +如果你读过我们的 [Linux 中的最佳视频编辑器][2]这篇文章,你可能已经注意到大多数“专业级”视频编辑器(如 [Lightworks][3] 或 DaVinciResolve)既不免费也不开源。 + +[Kdenlive][4] 和 Shotcut 也出现在了文章中,但它通常无法达到专业视频编辑的标准(这是许多 Linux 用户说的)。 + +爱好者和专业视频编辑之间的这种差距促使 Olive 的开发人员启动了这个项目。 + +![Olive Video Editor][5]Olive Video Editor Interface + +Libre Graphics World 中有一篇详细的[关于 Olive 的评论][6]。实际上,这是我第一次知道 Olive 的地方。如果你有兴趣了解更多信息,请阅读该文章。 + +### 在 Linux 中安装 Olive 视频编辑器 + +提醒你一下。Olive 正处于发展的早期阶段。你会发现很多 bug 和缺失/不完整的功能。你不应该把它当作你的主要视频编辑器。 + +如果你想测试 Olive,有几种方法可以在 Linux 上安装它。 + +#### 通过 PPA 在基于 Ubuntu 的发行版中安装 Olive + +你可以在 Ubuntu、Mint 和其他基于 Ubuntu 的发行版使用官方 PPA 安装 Olive。 + +``` +sudo add-apt-repository ppa:olive-editor/olive-editor +sudo apt-get update +sudo apt-get install olive-editor +``` + +#### 通过 Snap 安装 Olive + +如果你的 Linux 发行版支持 Snap,则可以使用以下命令进行安装。 + +``` +sudo snap install --edge olive-editor +``` + +#### 通过 Flatpak 安装 Olive + +如果你的 [Linux 发行版支持 Flatpak][7],你可以通过 Flatpak 安装 Olive 视频编辑器。 + +#### 通过 AppImage 使用 Olive + +不想安装吗?下载 [AppImage][8] 文件,将其设置为可执行文件并运行它。 + +32 位和 64 位 AppImage 文件都有。你应该下载相应的文件。 + +Olive 也可用于 Windows 和 macOS。你可以从它的[下载页面][9]获得它。 + +### 想要支持 Olive 视频编辑器的开发吗? + +如果你喜欢 Olive 尝试实现的功能,并且想要支持它,那么你可以通过以下几种方式。 + +如果你在测试 Olive 时发现一些 bug,请到它们的 GitHub 仓库中报告。 + +如果你是程序员,请浏览 Olive 的源代码,看看你是否可以通过编码技巧帮助项目。 + +在经济上为项目做贡献是另一种可以帮助开发开源软件的方法。你可以通过成为赞助人来支持 Olive。 + +如果你没有支持 Olive 的金钱或编码技能,你仍然可以帮助它。在社交媒体或你经常访问的 Linux/软件相关论坛和群组中分享这篇文章或 Olive 的网站。一点微小的口碑都能间接地帮助它。 + +### 你如何看待 Olive? + +评判 Olive 还为时过早。我希望能够持续快速开发,并且在年底之前发布 Olive 的稳定版(如果我没有过于乐观的话)。 + +你如何看待 Olive?你是否认同开发人员针对专业用户的目标?你希望 Olive 拥有哪些功能? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/olive-video-editor + +作者:[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.olivevideoeditor.org/ +[2]: https://itsfoss.com/best-video-editing-software-linux/ +[3]: https://www.lwks.com/ +[4]: https://kdenlive.org/en/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?resize=800%2C450&ssl=1 +[6]: http://libregraphicsworld.org/blog/entry/introducing-olive-new-non-linear-video-editor +[7]: https://itsfoss.com/flatpak-guide/ +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://www.olivevideoeditor.org/download.php +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/olive-video-editor-interface.jpg?fit=800%2C450&ssl=1 From adf0dd042b5151a19131deb5c43af7278d45501d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 22 Feb 2019 09:13:33 +0800 Subject: [PATCH 271/813] translating --- ...raphical tools for manipulating PDFs on the Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md b/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md index d1d640c30f..ac2167f093 100644 --- a/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md +++ b/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 15e6534e104edf6267eb72564d2265d97d312f8c Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Fri, 22 Feb 2019 10:08:06 +0800 Subject: [PATCH 272/813] hankchow translating --- sources/tech/20190206 And, Ampersand, and - in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190206 And, Ampersand, and - in Linux.md b/sources/tech/20190206 And, Ampersand, and - in Linux.md index 88a0458539..2febc0a2ef 100644 --- a/sources/tech/20190206 And, Ampersand, and - in Linux.md +++ b/sources/tech/20190206 And, Ampersand, and - in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 68a4c9d53f8396c76f94524cbe5b76a1112f2600 Mon Sep 17 00:00:00 2001 From: cycoe Date: Fri, 22 Feb 2019 10:58:59 +0800 Subject: [PATCH 273/813] translated by cycoe --- ...and Tricks to Improve Your Productivity.md | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md index 3fc3de1d9f..2bf9202b79 100644 --- a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md +++ b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @@ -1,86 +1,84 @@ -translating by Cycoe -Cycoe 翻译中 -8 KDE Plasma Tips and Tricks to Improve Your Productivity +8 个在 KDE Plasma 桌面环境下提高生产力的技巧和提示 ====== ![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg) -KDE's Plasma is easily one of the most powerful desktop environments available for Linux. It's highly configurable, and it looks pretty good, too. That doesn't amount to a whole lot unless you can actually get things done. +众所周知,KDE 的 Plasma 是 Linux 下最强大的桌面环境之一。它是高度可定制的,并且看起来也很棒。当你完成所有的配置工作后,你才能体会到它的所有特性。 -You can easily configure Plasma and make use of a lot of its convenient and time-saving features to boost your productivity and have a desktop that empowers you, rather than getting in your way. +你能够轻松地配置 Plasma 桌面并且使用它大量方便且节省时间的特性来加速你的工作,拥有一个能够帮助你而非阻碍你的桌面环境。 -These tips aren't in any particular order, so you don't need to prioritize. Pick the ones that best fit your workflow. +这些提示并没有特定顺序,因此你无需按次序阅读。你只需要挑出最适合你的工作流的那几个即可。 - **Related** : [10 of the Best KDE Plasma Applications You Should Try][1] + **相关阅读** : [10 个你应该尝试的最佳 KDE Plasma 应用][1] -### 1. Multimedia Controls +### 1. 多媒体控制 -This isn't so much of a tip as it is something that's good to keep in mind. Plasma keeps multimedia controls everywhere. You don't need to open your media player every time you need to pause, resume, or skip a song; you can mouse over the minimized window or even control it via the lock screen. There's no need to scramble to log in to change a song or because you forgot to pause one. +这点算不太上是一条提示,因为它是很容易被记在脑海里的。Plasma 可在各处进行多媒体控制。当你需要暂停、继续或跳过一首歌时,你不需要每次都打开你的媒体播放器。你能够通过将鼠标移至最小化窗口之上,甚至通过锁屏进行控制。当你需要切换歌曲或忘了暂停时,你也不必麻烦地登录再进行操作。 ### 2. KRunner ![KDE Plasma KRunner][2] -KRunner is an often under-appreciated feature of the Plasma desktop. Most people are used to digging through the application launcher menu to find the program that they're looking to launch. That's not necessary with KRunner. +KRunner 是 Plasma 桌面中一个经常受到赞誉的特性。大部分人习惯于深挖应用启动菜单来找到想要启动的程序。当你使用 KRunner 时就不需要这么做。 -To use KRunner, make sure that your focus is on the desktop itself. (Click on it instead of a window.) Then, start typing the name of the program that you want. KRunner will automatically drop down from the top of your screen with suggestions. Click or press Enter on the one you're looking for. It's much faster than remembering which category your program is under. +为了使用 KRunner,确保你当前的焦点在桌面本身(点击桌面而不是窗口)。然后开始输入你想要启动的应用名称,KRunner 将会带着建议项从你的屏幕顶部自动下拉。在你寻找的匹配项上点击或敲击 Enter 键。这比记住你每个应用所属的类别要更快。 -### 3. Jump Lists +### 3. 跳转列表 -![KDE Plasma Jump Lists][3] +![KDE Plasma 的跳转列表][3] -Jump lists are a fairly recent addition to the Plasma desktop. They allow you to launch an application directly to a specific section or feature. +跳转列表功能是最近才被添加进 Plasma 桌面的。它允许你在启动应用时直接跳转至特定的区域或特性部分。 -So if you have a launcher on a menu bar, you can right-click and get a list of places to jump to. Select where you want to go, and you're off. +因此如果你在菜单栏上有一个应用启动图标,你可以通过右键得到可跳转位置的列表。选择你想要跳转的位置,然后就可以“起飞”了。 ### 4. KDE Connect -![KDE Connect Menu Android][4] +![KDE Connect Android 客户端菜单][4] -[KDE Connect][5] is a massive help if you have an Android phone. It connects the phone to your desktop so you can share things seamlessly between the devices. +如果你有一个安卓手机,那么 [KDE Connect][5] 会为你提供大量帮助。它可以将你的手机连接至你的桌面,由此你可以在两台设备间无缝地共享。 -With KDE Connect, you can see your [Android device's notification][6] on your desktop in real time. It also enables you to send and receive text messages from Plasma without ever picking up your phone. +通过 KDE Connect,你能够在你的桌面上实时地查看 [Android 设备通知][6]。它同时也让你能够从 Plasma 中收发文字信息,甚至不需要拿起你的手机。 -KDE Connect also lets you send files and share web pages between your phone and your computer. You can easily move from one device to the other without a lot of hassle or losing your train of thought. +KDE Connect 也允许你在手机和电脑间发送文件或共享网页。你可以轻松地从一个设备转移至另一设备,而无需烦恼或打乱思绪。 ### 5. Plasma Vaults ![KDE Plasma Vault][7] -Plasma Vaults are another new addition to the Plasma desktop. They are KDE's simple solution to encrypted files and folders. If you don't work with encrypted files, this one won't really save you any time. If you do, though, vaults are a much simpler approach. +Plasma Vaults 是 Plasma 桌面的另一个新功能。它的 KDE 为加密文件和文件夹提供的简单解决方案。如果你不使用加密文件,此项功能不会为你节省时间。如果你使用,Vaults是一个更简单的途径。 -Plasma Vaults let you create encrypted directories as a regular user without root and manage them from your task bar. You can mount and unmount the directories on the fly without the need for external programs or additional privileges. +Plasma Vaults 允许你以无 root 权限的普通用户创建加密目录,并通过你的任务栏来管理它们。你能够快速地挂载或卸载目录,而无需外部程序或附加权限。 -### 6. Pager Widget +### 6. Pager 控件 ![KDE Plasma Pager][8] -Configure your desktop with the pager widget. It allows you to easily access three additional workspaces for even more screen room. +配置你的桌面的 pager 控件。它允许你轻松地切换至另三个附加工作区,带来更大的屏幕空间。 -Add the widget to your menu bar, and you can slide between multiple workspaces. These are all the size of your screen, so you gain multiple times the total screen space. That lets you lay out more windows without getting confused by a minimized mess or disorganization. +将控件添加到你的菜单栏上,然后你就可以在多个工作区间滑动切换。每个工作区都与你原桌面的尺寸相同,因此你能够得到数倍于完整屏幕的空间。这就使你能够排布更多的窗口,而不必受到一堆混乱的最小化窗口的困扰。 -### 7. Create a Dock +### 7. 创建一个 Dock ![KDE Plasma Dock][9] -Plasma is known for its flexibility and the room it allows for configuration. Use that to your advantage. If you have programs that you're always using, consider setting up an OS X style dock with your most used applications. You'll be able to get them with a single click rather than going through a menu or typing in their name. +Plasma 以其灵活性和可配置性出名,同时也是它的优势。如果你有常用的程序,你可以考虑将常用程序设置为 OS X 风格的 dock。你能够通过单击启动,而不必深入菜单或输入它们的名字。 -### 8. Add a File Tree to Dolphin +### 8. 为 Dolphin 添加文件树 -![Plasma Dolphin Directory][10] +![Plasma Dolphin 目录][10] -It's much easier to navigate folders in a directory tree. Dolphin, Plasma's default file manager, has built-in functionality to display a directory listing in the form of a tree on the side of the folder window. +通过目录树来浏览文件夹会更加简单。Dolphin 作为 Plasma 的默认文件管理器,具有在文件夹窗口一侧,以树的形式展示目录列表的内置功能。 -To enable the directory tree, click on the "Control" tab, then "Configure Dolphin," "View Modes," and "Details." Finally, select "Expandable Folders." +为了启用目录树,点击“控制”标签,然后“配置 Dolphin”,“显示模式”,“详细”,最后选择“可展开文件夹”。 -Remember that these tips are just tips. Don't try to force yourself to do something that's getting in your way. You may hate using file trees in Dolphin. You may never use Pager. That's alright. There may even be something that you personally like that's not listed here. Do what works for you. That said, at least a few of these should shave some serious time out of your work day. +记住这些仅仅是提示,不要强迫自己做阻碍自己的事情。你可能讨厌在 Dolphin 中使用文件树,你也可能从不使用 Pager,这都没关系。当然也可能会有你喜欢但是此处没列举出来的功能。选择对你有用处的,也就是说,这些技巧中总有一些能帮助你度过日常工作中的艰难时刻。 -------------------------------------------------------------------------------- via: https://www.maketecheasier.com/kde-plasma-tips-tricks-improve-productivity/ 作者:[Nick Congleton][a] -译者:[译者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 6cdcaf81154fcc9695c33bda0f21ef8f9a69211b Mon Sep 17 00:00:00 2001 From: cycoe Date: Fri, 22 Feb 2019 10:59:44 +0800 Subject: [PATCH 274/813] move article to translated --- ...2 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md (100%) diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md similarity index 100% rename from sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md rename to translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md From 0b38d50687d2599b58e3bfeca6e27ecfaf29d0ef Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 22 Feb 2019 11:49:17 +0800 Subject: [PATCH 275/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190115=20Linux?= =?UTF-8?q?=20Desktop=20Setup=20=C2=B7=20HookRace=20Blog=20sources/tech/20?= =?UTF-8?q?190115=20Linux=20Desktop=20Setup=20-=20HookRace=20Blog.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...115 Linux Desktop Setup - HookRace Blog.md | 515 ++++++++++++++++++ 1 file changed, 515 insertions(+) create mode 100644 sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md diff --git a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md new file mode 100644 index 0000000000..baaf4cf9c5 --- /dev/null +++ b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md @@ -0,0 +1,515 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Desktop Setup · HookRace Blog) +[#]: via: (https://hookrace.net/blog/linux-desktop-setup/) +[#]: author: (Dennis Felsing http://felsin9.de/nnis/) + +Linux Desktop Setup · HookRace Blog +====== + +### Linux Desktop Setup + +My software setup has been surprisingly constant over the last decade, after a few years of experimentation since I initially switched to Linux in 2006. It might be interesting to look back in another 10 years and see what changed. A quick overview of what’s running as I’m writing this post: + +[![htop overview][1]][2] + +#### Motivation + +My software priorities are, in no specific order: + + * Programs should run on my local system so that I’m in control of them, this excludes cloud solutions. + * Programs should run in the terminal, so that they can be used consistently from anywhere, including weak computers or a phone. + * Keyboard focused is nearly automatic by using terminal software. I prefer to use the mouse where it makes sense only, reaching for the mouse all the time during typing feels like a waste of time. Occasionally it took me an hour to notice that the mouse wasn’t even plugged in. + * Ideally use fast and efficient software, I don’t like hearing the fan and feeling the room heat up. I can also keep running older hardware for much longer, my 10 year old Thinkpad x200s is still fine for all the software I use. + * Be composable. I don’t want to do every step manually, instead automate more when it makes sense. This naturally favors the shell. + + + +#### Operating Systems + +I had a hard start with Linux 12 years ago by removing Windows, armed with just the [Gentoo Linux][3] installation CD and a printed manual to get a functioning Linux system. It took me a few days of compiling and tinkering, but in the end I felt like I had learnt a lot. + +I haven’t looked back to Windows since then, but I switched to [Arch Linux][4] on my laptop after having the fan fail from the constant compilation stress. Later I also switched all my other computers and private servers to Arch Linux. As a rolling release distribution you get package upgrades all the time, but the most important breakages are nicely reported in the [Arch Linux News][5]. + +One annoyance though is that Arch Linux removes the old kernel modules once you upgrade it. I usually notice that once I try plugging in a USB flash drive and the kernel fails to load the relevant module. Instead you’re supposed to reboot after each kernel upgrade. There are a few [hacks][6] around to get around the problem, but I haven’t been bothered enough to actually use them. + +Similar problems happen with other programs, commonly Firefox, cron or Samba requiring a restart after an upgrade, but annoyingly not warning you that that’s the case. [SUSE][7], which I use at work, nicely warns about such cases. + +For the [DDNet][8] production servers I prefer [Debian][9] over Arch Linux, so that I have a lower chance of breakage on each upgrade. For my firewall and router I used [OpenBSD][10] for its clean system, documentation and great [pf firewall][11], but right now I don’t have a need for a separate router anymore. + +#### Window Manager + +Since I started out with Gentoo I quickly noticed the huge compile time of KDE, which made it a no-go for me. I looked around for more minimal solutions, and used [Openbox][12] and [Fluxbox][13] initially. At some point I jumped on the tiling window manager train in order to be more keyboard-focused and picked up [dwm][14] and [awesome][15] close to their initial releases. + +In the end I settled on [xmonad][16] thanks to its flexibility, extendability and being written and configured in pure [Haskell][17], a great functional programming language. One example of this is that at home I run a single 40” 4K screen, but often split it up into four virtual screens, each displaying a workspace on which my windows are automatically arranged. Of course xmonad has a [module][18] for that. + +[dzen][19] and [conky][20] function as a simple enough status bar for me. My entire conky config looks like this: + +``` +out_to_console yes +update_interval 1 +total_run_times 0 + +TEXT +${downspeed eth0} ${upspeed eth0} | $cpu% ${loadavg 1} ${loadavg 2} ${loadavg 3} $mem/$memmax | ${time %F %T} +``` + +And gets piped straight into dzen2 with `conky | dzen2 -fn '-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#ffffff' -p -e '' -x 1000 -w 920 -xs 1 -ta r`. + +One important feature for me is to make the terminal emit a beep sound once a job is done. This is done simply by adding a `\a` character to the `PR_TITLEBAR` variable in zsh, which is shown whenever a job is done. Of course I disable the actual beep sound by blacklisting the `pcspkr` kernel module with `echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf`. Instead the sound gets turned into an urgency by urxvt’s `URxvt.urgentOnBell: true` setting. Then xmonad has an urgency hook to capture this and I can automatically focus the currently urgent window with a key combination. In dzen I get the urgent windowspaces displayed with a nice and bright `#ff0000`. + +The final result in all its glory on my Laptop: + +[![Laptop screenshot][21]][22] + +I hear that [i3][23] has become quite popular in the last years, but it requires more manual window alignment instead of specifying automated methods to do it. + +I realize that there are also terminal multiplexers like [tmux][24], but I still require a few graphical applications, so in the end I never used them productively. + +#### Terminal Persistency + +In order to keep terminals alive I use [dtach][25], which is just the detach feature of screen. In order to make every terminal on my computer detachable I wrote a [small wrapper script][26]. This means that even if I had to restart my X server I could keep all my terminals running just fine, both local and remote. + +#### Shell & Programming + +Instead of [bash][27] I use [zsh][28] as my shell for its huge number of features. + +As a terminal emulator I found [urxvt][29] to be simple enough, support Unicode and 256 colors and has great performance. Another great feature is being able to run the urxvt client and daemon separately, so that even a large number of terminals barely takes up any memory (except for the scrollback buffer). + +There is only one font that looks absolutely clean and perfect to me: [Terminus][30]. Since i’s a bitmap font everything is pixel perfect and renders extremely fast and at low CPU usage. In order to switch fonts on-demand in each terminal with `CTRL-WIN-[1-7]` my ~/.Xdefaults contains: + +``` +URxvt.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* +dzen2.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* + +URxvt.keysym.C-M-1: command:\033]50;-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-2: command:\033]50;-xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-3: command:\033]50;-xos4-terminus-medium-r-normal-*-18-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-4: command:\033]50;-xos4-terminus-medium-r-normal-*-22-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-5: command:\033]50;-xos4-terminus-medium-r-normal-*-24-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-6: command:\033]50;-xos4-terminus-medium-r-normal-*-28-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-7: command:\033]50;-xos4-terminus-medium-r-normal-*-32-*-*-*-*-*-*-*\007 + +URxvt.keysym.C-M-n: command:\033]10;#ffffff\007\033]11;#000000\007\033]12;#ffffff\007\033]706;#00ffff\007\033]707;#ffff00\007 +URxvt.keysym.C-M-b: command:\033]10;#000000\007\033]11;#ffffff\007\033]12;#000000\007\033]706;#0000ff\007\033]707;#ff0000\007 +``` + +For programming and writing I use [Vim][31] with syntax highlighting and [ctags][32] for indexing, as well as a few terminal windows with grep, sed and the other usual suspects for search and manipulation. This is probably not at the same level of comfort as an IDE, but allows me more automation. + +One problem with Vim is that you get so used to its key mappings that you’ll want to use them everywhere. + +[Python][33] and [Nim][34] do well as scripting languages where the shell is not powerful enough. + +#### System Monitoring + +[htop][35] (look at the background of that site, it’s a live view of the server that’s hosting it) works great for getting a quick overview of what the software is currently doing. [lm_sensors][36] allows monitoring the hardware temperatures, fans and voltages. [powertop][37] is a great little tool by Intel to find power savings. [ncdu][38] lets you analyze disk usage interactively. + +[nmap][39], iptraf-ng, [tcpdump][40] and [Wireshark][41] are essential tools for analyzing network problems. + +There are of course many more great tools. + +#### Mails & Synchronization + +On my home server I have a [fetchmail][42] daemon running for each email acccount that I have. Fetchmail just retrieves the incoming emails and invokes [procmail][43]: + +``` +#!/bin/sh +for i in /home/deen/.fetchmail/*; do + FETCHMAILHOME=$i /usr/bin/fetchmail -m 'procmail -d %T' -d 60 +done +``` + +The configuration is as simple as it could be and waits for the server to inform us of fresh emails: + +``` +poll imap.1und1.de protocol imap timeout 120 user "dennis@felsin9.de" password "XXX" folders INBOX keep ssl idle +``` + +My `.procmailrc` config contains a few rules to backup all mails and sort them into the correct directories, for example based on the mailing list id or from field in the mail header: + +``` +MAILDIR=/home/deen/shared/Maildir +LOGFILE=$HOME/.procmaillog +LOGABSTRACT=no +VERBOSE=off +FORMAIL=/usr/bin/formail +NL=" +" + +:0wc +* ! ? test -d /media/mailarchive/`date +%Y` +| mkdir -p /media/mailarchive/`date +%Y` + +# Make backups of all mail received in format YYYY/YYYY-MM +:0c +/media/mailarchive/`date +%Y`/`date +%Y-%m` + +:0 +* ^From: .*(.*@.*.kit.edu|.*@.*.uka.de|.*@.*.uni-karlsruhe.de) +$MAILDIR/.uni/ + +:0 +* ^list-Id:.*lists.kit.edu +$MAILDIR/.uni-ml/ + +[...] +``` + +To send emails I use [msmtp][44], which is also great to configure: + +``` +account default +host smtp.1und1.de +tls on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +auth on +from dennis@felsin9.de +user dennis@felsin9.de +password XXX + +[...] +``` + +But so far the emails are still on the server. My documents are all stored in a directory that I synchronize between all computers using [Unison][45]. Think of Unison as a bidirectional interactive [rsync][46]. My emails are part of this documents directory and thus they end up on my desktop computers. + +This also means that while the emails reach my server immediately, I only fetch them on deman instead of getting instant notifications when an email comes in. + +From there I read the mails with [mutt][47], using the sidebar plugin to display my mail directories. The `/etc/mailcap` file is essential to display non-plaintext mails containing HTML, Word or PDF: + +``` +text/html;w3m -I %{charset} -T text/html; copiousoutput +application/msword; antiword %s; copiousoutput +application/pdf; pdftotext -layout /dev/stdin -; copiousoutput +``` + +#### News & Communication + +[Newsboat][48] is a nice little RSS/Atom feed reader in the terminal. I have it running on the server in a `tach` session with about 150 feeds. Filtering feeds locally is also possible, for example: + +``` +ignore-article "https://forum.ddnet.tw/feed.php" "title =~ \"Map Testing •\" or title =~ \"Old maps •\" or title =~ \"Map Bugs •\" or title =~ \"Archive •\" or title =~ \"Waiting for mapper •\" or title =~ \"Other mods •\" or title =~ \"Fixes •\"" +``` + +I use [Irssi][49] the same way for communication via IRC. + +#### Calendar + +[remind][50] is a calendar that can be used from the command line. Setting new reminders is done by editing the `rem` files: + +``` +# One time events +REM 2019-01-20 +90 Flight to China %b + +# Recurring Holidays +REM 1 May +90 Holiday "Tag der Arbeit" %b +REM [trigger(easterdate(year(today()))-2)] +90 Holiday "Karfreitag" %b + +# Time Change +REM Nov Sunday 1 --7 +90 Time Change (03:00 -> 02:00) %b +REM Apr Sunday 1 --7 +90 Time Change (02:00 -> 03:00) %b + +# Birthdays +FSET birthday(x) "'s " + ord(year(trigdate())-x) + " birthday is %b" +REM 16 Apr +90 MSG Andreas[birthday(1994)] + +# Sun +SET $LatDeg 49 +SET $LatMin 19 +SET $LatSec 49 +SET $LongDeg -8 +SET $LongMin -40 +SET $LongSec -24 + +MSG Sun from [sunrise(trigdate())] to [sunset(trigdate())] +[...] +``` + +Unfortunately there is no Chinese Lunar calendar function in remind yet, so Chinese holidays can’t be calculated easily. + +I use two aliases for remind: + +``` +rem -m -b1 -q -g +``` + +to see a list of the next events in chronological order and + +``` +rem -m -b1 -q -cuc12 -w$(($(tput cols)+1)) | sed -e "s/\f//g" | less +``` + +to show a calendar fitting just the width of my terminal: + +![remcal][51] + +#### Dictionary + +[rdictcc][52] is a little known dictionary tool that uses the excellent dictionary files from [dict.cc][53] and turns them into a local database: + +``` +$ rdictcc rasch +====================[ A => B ]==================== +rasch: + - apace + - brisk [speedy] + - cursory + - in a timely manner + - quick + - quickly + - rapid + - rapidly + - sharpish [Br.] [coll.] + - speedily + - speedy + - swift + - swiftly +rasch [gehen]: + - smartly [quickly] +Rasch {n} [Zittergras-Segge]: + - Alpine grass [Carex brizoides] + - quaking grass sedge [Carex brizoides] +Rasch {m} [regional] [Putzrasch]: + - scouring pad +====================[ B => A ]==================== +Rasch model: + - Rasch-Modell {n} +``` + +#### Writing and Reading + +I have a simple todo file containing my tasks, that is basically always sitting open in a Vim session. For work I also use the todo file as a “done” file so that I can later check what tasks I finished on each day. + +For writing documents, letters and presentations I use [LaTeX][54] for its superior typesetting. A simple letter in German format can be set like this for example: + +``` +\documentclass[paper = a4, fromalign = right]{scrlttr2} +\usepackage{german} +\usepackage{eurosym} +\usepackage[utf8]{inputenc} +\setlength{\parskip}{6pt} +\setlength{\parindent}{0pt} + +\setkomavar{fromname}{Dennis Felsing} +\setkomavar{fromaddress}{Meine Str. 1\\69181 Leimen} +\setkomavar{subject}{Titel} + +\setkomavar*{enclseparator}{Anlagen} + +\makeatletter +\@setplength{refvpos}{89mm} +\makeatother + +\begin{document} +\begin{letter} {Herr Soundso\\Deine Str. 2\\69121 Heidelberg} +\opening{Sehr geehrter Herr Soundso,} + +Sie haben bei mir seit dem Bla Bla Bla. + +Ich fordere Sie hiermit zu Bla Bla Bla auf. + +\closing{Mit freundlichen Grüßen} + +\end{letter} +\end{document} +``` + +Further example documents and presentations can be found over at [my private site][55]. + +To read PDFs [Zathura][56] is fast, has Vim-like controls and even supports two different PDF backends: Poppler and MuPDF. [Evince][57] on the other hand is more full-featured for the cases where I encounter documents that Zathura doesn’t like. + +#### Graphical Editing + +[GIMP][58] and [Inkscape][59] are easy choices for photo editing and interactive vector graphics respectively. + +In some cases [Imagemagick][60] is good enough though and can be used straight from the command line and thus automated to edit images. Similarly [Graphviz][61] and [TikZ][62] can be used to draw graphs and other diagrams. + +#### Web Browsing + +As a web browser I’ve always used [Firefox][63] for its extensibility and low resource usage compared to Chrome. + +Unfortunately the [Pentadactyl][64] extension development stopped after Firefox switched to Chrome-style extensions entirely, so I don’t have satisfying Vim-like controls in my browser anymore. + +#### Media Players + +[mpv][65] with hardware decoding allows watching videos at 5% CPU load using the `vo=gpu` and `hwdec=vaapi` config settings. `audio-channels=2` in mpv seems to give me clearer downmixing to my stereo speakers / headphones than what PulseAudio does by default. A great little feature is exiting with `Shift-Q` instead of just `Q` to save the playback location. When watching with someone with another native tongue you can use `--secondary-sid=` to show two subtitles at once, the primary at the bottom, the secondary at the top of the screen + +My wirelss mouse can easily be made into a remote control with mpv with a small `~/.config/mpv/input.conf`: + +``` +MOUSE_BTN5 run "mixer" "pcm" "-2" +MOUSE_BTN6 run "mixer" "pcm" "+2" +MOUSE_BTN1 cycle sub-visibility +MOUSE_BTN7 add chapter -1 +MOUSE_BTN8 add chapter 1 +``` + +[youtube-dl][66] works great for watching videos hosted online, best quality can be achieved with `-f bestvideo+bestaudio/best --all-subs --embed-subs`. + +As a music player [MOC][67] hasn’t been actively developed for a while, but it’s still a simple player that plays every format conceivable, including the strangest Chiptune formats. In the AUR there is a [patch][68] adding PulseAudio support as well. Even with the CPU clocked down to 800 MHz MOC barely uses 1-2% of a single CPU core. + +![moc][69] + +My music collection sits on my home server so that I can access it from anywhere. It is mounted using [SSHFS][70] and automount in the `/etc/fstab/`: + +``` +root@server:/media/media /mnt/media fuse.sshfs noauto,x-systemd.automount,idmap=user,IdentityFile=/root/.ssh/id_rsa,allow_other,reconnect 0 0 +``` + +#### Cross-Platform Building + +Linux is great to build packages for any major operating system except Linux itself! In the beginning I used [QEMU][71] to with an old Debian, Windows and Mac OS X VM to build for these platforms. + +Nowadays I switched to using chroot for the old Debian distribution (for maximum Linux compatibility), [MinGW][72] to cross-compile for Windows and [OSXCross][73] to cross-compile for Mac OS X. + +The script used to [build DDNet][74] as well as the [instructions for updating library builds][75] are based on this. + +#### Backups + +As usual, we nearly forgot about backups. Even if this is the last chapter, it should not be an afterthought. + +I wrote [rrb][76] (reverse rsync backup) 10 years ago to wrap rsync so that I only need to give the backup server root SSH rights to the computers that it is backing up. Surprisingly rrb needed 0 changes in the last 10 years, even though I kept using it the entire time. + +The backups are stored straight on the filesystem. Incremental backups are implemented using hard links (`--link-dest`). A simple [config][77] defines how long backups are kept, which defaults to: + +``` +KEEP_RULES=( \ + 7 7 \ # One backup a day for the last 7 days + 31 8 \ # 8 more backups for the last month + 365 11 \ # 11 more backups for the last year +1825 4 \ # 4 more backups for the last 5 years +) +``` + +Since some of my computers don’t have a static IP / DNS entry and I still want to back them up using rrb I use a reverse SSH tunnel (as a systemd service) for them: + +``` +[Unit] +Description=Reverse SSH Tunnel +After=network.target + +[Service] +ExecStart=/usr/bin/ssh -N -R 27276:localhost:22 -o "ExitOnForwardFailure yes" server +KillMode=process +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +Now the server can reach the client through `ssh -p 27276 localhost` while the tunnel is running to perform the backup, or in `.ssh/config` format: + +``` +Host cr-remote + HostName localhost + Port 27276 +``` + +While talking about SSH hacks, sometimes a server is not easily reachable thanks to some bad routing. In that case you can route the SSH connection through another server to get better routing, in this case going through the USA to reach my Chinese server which had not been reliably reachable from Germany for a few weeks: + +``` +Host chn.ddnet.tw + ProxyCommand ssh -q usa.ddnet.tw nc -q0 chn.ddnet.tw 22 + Port 22 +``` + +#### Final Remarks + +Thanks for reading my random collection of tools. I probably forgot many programs that I use so naturally every day that I don’t even think about them anymore. Let’s see how stable my software setup stays in the next years. If you have any questions, feel free to get in touch with me at [dennis@felsin9.de][78]. + +Comments on [Hacker News][79]. + +-------------------------------------------------------------------------------- + +via: https://hookrace.net/blog/linux-desktop-setup/ + +作者:[Dennis Felsing][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://felsin9.de/nnis/ +[b]: https://github.com/lujun9972 +[1]: https://hookrace.net/public/linux-desktop/htop_small.png +[2]: https://hookrace.net/public/linux-desktop/htop.png +[3]: https://gentoo.org/ +[4]: https://www.archlinux.org/ +[5]: https://www.archlinux.org/news/ +[6]: https://www.reddit.com/r/archlinux/comments/4zrsc3/keep_your_system_fully_functional_after_a_kernel/ +[7]: https://www.suse.com/ +[8]: https://ddnet.tw/ +[9]: https://www.debian.org/ +[10]: https://www.openbsd.org/ +[11]: https://www.openbsd.org/faq/pf/ +[12]: http://openbox.org/wiki/Main_Page +[13]: http://fluxbox.org/ +[14]: https://dwm.suckless.org/ +[15]: https://awesomewm.org/ +[16]: https://xmonad.org/ +[17]: https://www.haskell.org/ +[18]: http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Layout-LayoutScreens.html +[19]: http://robm.github.io/dzen/ +[20]: https://github.com/brndnmtthws/conky +[21]: https://hookrace.net/public/linux-desktop/laptop_small.png +[22]: https://hookrace.net/public/linux-desktop/laptop.png +[23]: https://i3wm.org/ +[24]: https://github.com/tmux/tmux/wiki +[25]: http://dtach.sourceforge.net/ +[26]: https://github.com/def-/tach/blob/master/tach +[27]: https://www.gnu.org/software/bash/ +[28]: http://www.zsh.org/ +[29]: http://software.schmorp.de/pkg/rxvt-unicode.html +[30]: http://terminus-font.sourceforge.net/ +[31]: https://www.vim.org/ +[32]: http://ctags.sourceforge.net/ +[33]: https://www.python.org/ +[34]: https://nim-lang.org/ +[35]: https://hisham.hm/htop/ +[36]: http://lm-sensors.org/ +[37]: https://01.org/powertop/ +[38]: https://dev.yorhel.nl/ncdu +[39]: https://nmap.org/ +[40]: https://www.tcpdump.org/ +[41]: https://www.wireshark.org/ +[42]: http://www.fetchmail.info/ +[43]: http://www.procmail.org/ +[44]: https://marlam.de/msmtp/ +[45]: https://www.cis.upenn.edu/~bcpierce/unison/ +[46]: https://rsync.samba.org/ +[47]: http://www.mutt.org/ +[48]: https://newsboat.org/ +[49]: https://irssi.org/ +[50]: https://www.roaringpenguin.com/products/remind +[51]: https://hookrace.net/public/linux-desktop/remcal.png +[52]: https://github.com/tsdh/rdictcc +[53]: https://www.dict.cc/ +[54]: https://www.latex-project.org/ +[55]: http://felsin9.de/nnis/research/ +[56]: https://pwmt.org/projects/zathura/ +[57]: https://wiki.gnome.org/Apps/Evince +[58]: https://www.gimp.org/ +[59]: https://inkscape.org/ +[60]: https://imagemagick.org/Usage/ +[61]: https://www.graphviz.org/ +[62]: https://sourceforge.net/projects/pgf/ +[63]: https://www.mozilla.org/en-US/firefox/new/ +[64]: https://github.com/5digits/dactyl +[65]: https://mpv.io/ +[66]: https://rg3.github.io/youtube-dl/ +[67]: http://moc.daper.net/ +[68]: https://aur.archlinux.org/packages/moc-pulse/ +[69]: https://hookrace.net/public/linux-desktop/moc.png +[70]: https://github.com/libfuse/sshfs +[71]: https://www.qemu.org/ +[72]: http://www.mingw.org/ +[73]: https://github.com/tpoechtrager/osxcross +[74]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-release.sh +[75]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-lib-update.sh +[76]: https://github.com/def-/rrb/blob/master/rrb +[77]: https://github.com/def-/rrb/blob/master/config.example +[78]: mailto:dennis@felsin9.de +[79]: https://news.ycombinator.com/item?id=18979731 From 4878187b7098e758eb5ab9f0110457b7b8c99194 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 22 Feb 2019 11:50:26 +0800 Subject: [PATCH 276/813] add done: 20190115 Linux Desktop Setup - HookRace Blog.md --- ...115 Linux Desktop Setup - HookRace Blog.md | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md index baaf4cf9c5..29d5f63d2a 100644 --- a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md +++ b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md @@ -7,16 +7,15 @@ [#]: via: (https://hookrace.net/blog/linux-desktop-setup/) [#]: author: (Dennis Felsing http://felsin9.de/nnis/) -Linux Desktop Setup · HookRace Blog +Linux Desktop Setup ====== -### Linux Desktop Setup My software setup has been surprisingly constant over the last decade, after a few years of experimentation since I initially switched to Linux in 2006. It might be interesting to look back in another 10 years and see what changed. A quick overview of what’s running as I’m writing this post: [![htop overview][1]][2] -#### Motivation +### Motivation My software priorities are, in no specific order: @@ -28,7 +27,7 @@ My software priorities are, in no specific order: -#### Operating Systems +### Operating Systems I had a hard start with Linux 12 years ago by removing Windows, armed with just the [Gentoo Linux][3] installation CD and a printed manual to get a functioning Linux system. It took me a few days of compiling and tinkering, but in the end I felt like I had learnt a lot. @@ -40,7 +39,7 @@ Similar problems happen with other programs, commonly Firefox, cron or Samba req For the [DDNet][8] production servers I prefer [Debian][9] over Arch Linux, so that I have a lower chance of breakage on each upgrade. For my firewall and router I used [OpenBSD][10] for its clean system, documentation and great [pf firewall][11], but right now I don’t have a need for a separate router anymore. -#### Window Manager +### Window Manager Since I started out with Gentoo I quickly noticed the huge compile time of KDE, which made it a no-go for me. I looked around for more minimal solutions, and used [Openbox][12] and [Fluxbox][13] initially. At some point I jumped on the tiling window manager train in order to be more keyboard-focused and picked up [dwm][14] and [awesome][15] close to their initial releases. @@ -69,11 +68,11 @@ I hear that [i3][23] has become quite popular in the last years, but it requires I realize that there are also terminal multiplexers like [tmux][24], but I still require a few graphical applications, so in the end I never used them productively. -#### Terminal Persistency +### Terminal Persistency In order to keep terminals alive I use [dtach][25], which is just the detach feature of screen. In order to make every terminal on my computer detachable I wrote a [small wrapper script][26]. This means that even if I had to restart my X server I could keep all my terminals running just fine, both local and remote. -#### Shell & Programming +### Shell & Programming Instead of [bash][27] I use [zsh][28] as my shell for its huge number of features. @@ -103,7 +102,7 @@ One problem with Vim is that you get so used to its key mappings that you’ll w [Python][33] and [Nim][34] do well as scripting languages where the shell is not powerful enough. -#### System Monitoring +### System Monitoring [htop][35] (look at the background of that site, it’s a live view of the server that’s hosting it) works great for getting a quick overview of what the software is currently doing. [lm_sensors][36] allows monitoring the hardware temperatures, fans and voltages. [powertop][37] is a great little tool by Intel to find power savings. [ncdu][38] lets you analyze disk usage interactively. @@ -111,7 +110,7 @@ One problem with Vim is that you get so used to its key mappings that you’ll w There are of course many more great tools. -#### Mails & Synchronization +### Mails & Synchronization On my home server I have a [fetchmail][42] daemon running for each email acccount that I have. Fetchmail just retrieves the incoming emails and invokes [procmail][43]: @@ -185,7 +184,7 @@ application/msword; antiword %s; copiousoutput application/pdf; pdftotext -layout /dev/stdin -; copiousoutput ``` -#### News & Communication +### News & Communication [Newsboat][48] is a nice little RSS/Atom feed reader in the terminal. I have it running on the server in a `tach` session with about 150 feeds. Filtering feeds locally is also possible, for example: @@ -195,7 +194,7 @@ ignore-article "https://forum.ddnet.tw/feed.php" "title =~ \"Map Testing •\" o I use [Irssi][49] the same way for communication via IRC. -#### Calendar +### Calendar [remind][50] is a calendar that can be used from the command line. Setting new reminders is done by editing the `rem` files: @@ -245,7 +244,7 @@ to show a calendar fitting just the width of my terminal: ![remcal][51] -#### Dictionary +### Dictionary [rdictcc][52] is a little known dictionary tool that uses the excellent dictionary files from [dict.cc][53] and turns them into a local database: @@ -278,7 +277,7 @@ Rasch model: - Rasch-Modell {n} ``` -#### Writing and Reading +### Writing and Reading I have a simple todo file containing my tasks, that is basically always sitting open in a Vim session. For work I also use the todo file as a “done” file so that I can later check what tasks I finished on each day. @@ -320,19 +319,19 @@ Further example documents and presentations can be found over at [my private sit To read PDFs [Zathura][56] is fast, has Vim-like controls and even supports two different PDF backends: Poppler and MuPDF. [Evince][57] on the other hand is more full-featured for the cases where I encounter documents that Zathura doesn’t like. -#### Graphical Editing +### Graphical Editing [GIMP][58] and [Inkscape][59] are easy choices for photo editing and interactive vector graphics respectively. In some cases [Imagemagick][60] is good enough though and can be used straight from the command line and thus automated to edit images. Similarly [Graphviz][61] and [TikZ][62] can be used to draw graphs and other diagrams. -#### Web Browsing +### Web Browsing As a web browser I’ve always used [Firefox][63] for its extensibility and low resource usage compared to Chrome. Unfortunately the [Pentadactyl][64] extension development stopped after Firefox switched to Chrome-style extensions entirely, so I don’t have satisfying Vim-like controls in my browser anymore. -#### Media Players +### Media Players [mpv][65] with hardware decoding allows watching videos at 5% CPU load using the `vo=gpu` and `hwdec=vaapi` config settings. `audio-channels=2` in mpv seems to give me clearer downmixing to my stereo speakers / headphones than what PulseAudio does by default. A great little feature is exiting with `Shift-Q` instead of just `Q` to save the playback location. When watching with someone with another native tongue you can use `--secondary-sid=` to show two subtitles at once, the primary at the bottom, the secondary at the top of the screen @@ -358,7 +357,7 @@ My music collection sits on my home server so that I can access it from anywhere root@server:/media/media /mnt/media fuse.sshfs noauto,x-systemd.automount,idmap=user,IdentityFile=/root/.ssh/id_rsa,allow_other,reconnect 0 0 ``` -#### Cross-Platform Building +### Cross-Platform Building Linux is great to build packages for any major operating system except Linux itself! In the beginning I used [QEMU][71] to with an old Debian, Windows and Mac OS X VM to build for these platforms. @@ -366,7 +365,7 @@ Nowadays I switched to using chroot for the old Debian distribution (for maximum The script used to [build DDNet][74] as well as the [instructions for updating library builds][75] are based on this. -#### Backups +### Backups As usual, we nearly forgot about backups. Even if this is the last chapter, it should not be an afterthought. @@ -415,7 +414,7 @@ Host chn.ddnet.tw Port 22 ``` -#### Final Remarks +### Final Remarks Thanks for reading my random collection of tools. I probably forgot many programs that I use so naturally every day that I don’t even think about them anymore. Let’s see how stable my software setup stays in the next years. If you have any questions, feel free to get in touch with me at [dennis@felsin9.de][78]. From 0c5b88454df00ca55cb40f645c31fef8aa168744 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 22 Feb 2019 13:32:14 +0800 Subject: [PATCH 277/813] Translating 7 steps for hunting down Python code bugs. --- .../tech/20190208 7 steps for hunting down Python code bugs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 16620f78ad..45423c44da 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -24,7 +24,7 @@ 阅读代码,你甚至可能会想出一个假设。但是在开始修改你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有疑问,目前你还没能准确地知道问题在哪儿。 -Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. +确保这个测试是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. ### 2. 编写错误的测试 From 58bda830521781221ef11d2768518bbdf5aef2f4 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Fri, 22 Feb 2019 17:40:34 +0800 Subject: [PATCH 278/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index 3ab51bd697..55989a67a7 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -53,7 +53,7 @@ Let's dig into the tools a bit more. We'll briefly cover each one and share link ### GitLab CI GitLab is a fairly new entrant to the CI/CD space, but it's already achieved the top spot in the [Forrester Wave for Continuous Integration Tools][20]. That's a huge achievement in such a crowded and highly qualified field. What makes GitLab CI so great? It uses a YAML file to describe the entire pipeline. It also has a functionality called Auto DevOps that allows for simpler projects to have a pipeline built automatically with multiple tests built-in. This system uses [Herokuish buildpacks][21] to determine the language and how to build the application. Some languages can also manage databases, which is a real game-changer for building new applications and getting them deployed to production from the beginning of the development process. The system has native integrations into Kubernetes and will deploy your application automatically into a Kubernetes cluster using one of several different deployment methodologies, like percentage-based rollouts and blue-green deployments. -GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。这在一个高水平、竞争激烈的领域里是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。它还有一个功能叫做 Auto DevOps,可以为简单的工程自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 整合地很紧密,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 +GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。在一个高水平、竞争激烈的领域里,这是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。它还有一个功能叫做 Auto DevOps,可以为简单的工程自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 整合地很紧密,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 In addition to its CI functionality, GitLab offers many complementary features like operations and monitoring with Prometheus deployed automatically with your application; portfolio and project management using GitLab Issues, Epics, and Milestones; security checks built into the pipeline with the results provided as an aggregate across multiple projects; and the ability to edit code right in GitLab using the WebIDE, which can even provide a preview or execute part of a pipeline for faster feedback. 除了它的持续集成功能,GitLab 还提供了许多补充特性,比如:将 Prometheus 和你的应用一同部署,以提供监控功能;通过 GitLab 提供的 Issues、Epics 和 Milestones 功能来实现项目评估和管理;管道中集成了安全检测功能,多个项目的检测结果会聚合显示;你可以通过 GitLab 提供的网页版 IDE 在线编辑代码,还可以快速查看管道的预览或执行状态。 @@ -91,14 +91,18 @@ Jenkins 2 引入了两种原生的管道(pipeline)功能,我在 LISA(一 ### Concourse CI I was first introduced to Concourse through folks at Pivotal Labs when it was an early beta version—there weren't many tools like it at the time. The system is made of microservices, and each job runs within a container. One of its most useful features that other tools don't have is the ability to run a job from your local system with your local changes. This means you can develop locally (assuming you have a connection to the Concourse server) and run your builds just as they'll run in the real build pipeline. Also, you can rerun failed builds from your local system and inject specific changes to test your fixes. +我第一次知道 Concourse 是通过 Pivotal Labs 的伙计们介绍的,当时它处于早期 beta 版本,而且那时候也很少有类似的工具。这套系统是基于微服务构建的,每个任务运行在一个容器里。它独有的一个优良特性是能够在你本地系统上运行任务,体现你本地的改动。这意味着你完全可以在本地开发(假设你已经连接到了 Concourse 的服务器),像在真实的管道构建流程一样从你本地构建项目。而且,你可以在本地修改过代码后直接重新运行构建,来检验你的改动结果。 Concourse also has a simple extension system that relies on the fundamental concept of resources. Basically, each new feature you want to provide to your pipeline can be implemented in a Docker image and included as a new resource type in your configuration. This keeps all functionality encapsulated in a single, immutable artifact that can be upgraded and modified independently, and breaking changes don't necessarily have to break all your builds at the same time. +Concourse 还有一个简单的扩展系统,它依赖于资源这一基础概念。基本上,你想给管道添加的每个新功能都可以用一个 Docker 镜像实现,并作为一个新的资源类型包含在你的配置中。这样可以保证每个功能都被封装在一个不易改变的独立工件中,方便对其单独修改和升级,改变其中一个时不会影响其他构建。 ### Spinnaker Spinnaker comes from Netflix and is more focused on continuous deployment than continuous integration. It can integrate with other tools, including Travis and Jenkins, to kick off test and deployment pipelines. It also has integrations with monitoring tools like Prometheus and Datadog to make decisions about deployments based on metrics provided by these systems. For example, the canary deployment uses a judge concept and the metrics being collected to determine if the latest canary deployment has caused any degradation in pertinent metrics and should be rolled back or if deployment can continue. +Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在一次金丝雀发布(canary deployment)里,我们可以根据收集到的相关监控指标来做出判断:最近这次发布导致了服务降级应该立刻回滚;或者看起来一切OK,于是继续执行部署。 A couple of additional, unique features related to deployments cover an area that is often overlooked when discussing continuous deployment, and might even seem antithetical, but is critical to success: Spinnaker helps make continuous deployment a little less continuous. It will prevent a stage from running during certain times to prevent a deployment from occurring during a critical time in the application lifecycle. It can also enforce manual approvals to ensure the release occurs when the business will benefit the most from the change. In fact, the whole point of continuous integration and continuous deployment is to be ready to deploy changes as quickly as the business needs to change. +谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止继续执行,以阻止可能发生的部署错误。实际上,CI/CD 的主要目的 ### Screwdriver From 70f06fab64a65fae90678e15f3729cabe9ec8dcd Mon Sep 17 00:00:00 2001 From: Leopold Date: Fri, 22 Feb 2019 20:55:23 +0800 Subject: [PATCH 279/813] leommxj translating --- ...ine how much memory is installed, used on Linux systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md index c6098fa12d..78e2129807 100644 --- a/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md +++ b/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (leommxj) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -216,7 +216,7 @@ via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-insta 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[leommxj](https://github.com/leommxj) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f2e755bff25b599143122727c9bc720a7a8afc0e Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Fri, 22 Feb 2019 08:01:09 -0600 Subject: [PATCH 280/813] Apply for translating Apply for translating --- .../20180307 3 open source tools for scientific publishing.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20180307 3 open source tools for scientific publishing.md b/sources/tech/20180307 3 open source tools for scientific publishing.md index 0bbc3578e9..ffb844e5dc 100644 --- a/sources/tech/20180307 3 open source tools for scientific publishing.md +++ b/sources/tech/20180307 3 open source tools for scientific publishing.md @@ -1,3 +1,4 @@ +tomjlw is translating 3 open source tools for scientific publishing ====== @@ -51,7 +52,7 @@ We are always on the lookout for opportunities to engage with the best emerging via: https://opensource.com/article/18/3/scientific-publishing-software 作者:[Paul Shanno][a] -译者:[译者ID](https://github.com/译者ID) +译者:[tomjlw](https://github.com/tomjlw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4f1ebcd783b7ab79bc6d98fdade231e3ed3a061f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 22 Feb 2019 22:39:50 +0800 Subject: [PATCH 281/813] PRF:20190124 Get started with LogicalDOC, an open source document management system.md @geekpi --- ... open source document management system.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md index b49933414c..b94ec5e038 100644 --- a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md +++ b/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md @@ -1,47 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with LogicalDOC, an open source document management system) [#]: via: (https://opensource.com/article/19/1/productivity-tool-logicaldoc) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) -开始使用 LogicalDOC,一个开源文档管理系统 +开始使用 LogicalDOC 吧,一个开源文档管理系统 ====== -使用 LogicalDOC 更好地跟踪文档版本,这是我们开源工具系列中的第 12 个工具,它将使你在 2019 年更高效。 + +> 使用 LogicalDOC 更好地跟踪文档版本,这是我们开源工具系列中的第 12 个工具,它将使你在 2019 年更高效。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 12 个工具来帮助你在 2019 年更有效率。 ### LogicalDOC -高效的一部分是能够在你需要时找到你需要的东西。我们都看到过充满类似名称文件的目录, 这是每次更改文档时为跟踪所有版本而重命名这些文件的结果。例如,我的妻子是一名作家,她在将文档发送给审稿人之前,她经常使用新名称保存文档修订版。 +高效部分表现在能够在你需要时找到你所需的东西。我们都看到过塞满名称类似的文件的目录,这是每次更改文档时为了跟踪所有版本而重命名这些文件而导致的。例如,我的妻子是一名作家,她在将文档发送给审稿人之前,她经常使用新名称保存文档修订版。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-1.png) -程序员对此一个自然的解决方案是 Git 或者其他版本控制器,这个不适用于文档作者,因为用于代码的系统通常不能很好地兼容商业文本编辑器使用的格式。之前有人说,“只是更改格式”,[这不是每个人的选择][1]。同样,许多版本控制工具对于非技术人员来说并不是非常友好。在大型组织中,有一些工具可以解决此问题,但它们还需要大型组织的资源来运行、管理和支持它们。 +程序员对此一个自然的解决方案是 Git 或者其他版本控制器,但这个不适用于文档作者,因为用于代码的系统通常不能很好地兼容商业文本编辑器使用的格式。之前有人说,“改变格式就行”,[这不是适合每个人的选择][1]。同样,许多版本控制工具对于非技术人员来说并不是非常友好。在大型组织中,有一些工具可以解决此问题,但它们还需要大型组织的资源来运行、管理和支持它们。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-2.png) [LogicalDOC CE][2] 是为解决此问题而编写的开源文档管理系统。它允许用户签入、签出、查看版本、搜索和锁定文档,并保留版本历史记录,类似于程序员使用的版本控制工具。 -LogicalDOC 可在 Linux、MacOS 和 Windows 上[安装][3],使用基于 Java 的安装程序。在安装中,系统将提示你提供数据库存储文职,并提供仅限本地文件存储的选项。你将获得访问服务器的 URL 和默认用户名和密码,以及保存用于自动安装脚本选项。 +LogicalDOC 可在 Linux、MacOS 和 Windows 上[安装][3],使用基于 Java 的安装程序。在安装时,系统将提示你提供数据库存储位置,并提供只在本地文件存储的选项。你将获得访问服务器的 URL 和默认用户名和密码,以及保存用于自动安装脚本选项。 登录后,LogicalDOC 的默认页面会列出你已标记、签出的文档以及有关它们的最新说明。切换到“文档”选项卡将显示你有权访问的文件。你可以在界面中选择文件或使用拖放来上传文档。如果你上传 ZIP 文件,LogicalDOC 会解压它,并将其中的文件添加到仓库中。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-3.png) -右键单击文件将显示一个菜单选项,包括检出文件、锁定文件以防止更改,以及执行大量其他操作。签出文件会将其下载到用于编辑的本地计算机。在重新签入之前,其他任何人都无法修改签出文件。当重新签入文件时(使用相同的菜单),用户可以向版本添加标签,并且需要评论对其执行的操作。 +右键单击文件将显示一个菜单选项,包括检出文件、锁定文件以防止更改,以及执行大量其他操作。签出文件会将其下载到本地计算机以便编辑。在重新签入之前,其他任何人都无法修改签出的文件。当重新签入文件时(使用相同的菜单),用户可以向版本添加标签,并且需要备注对其执行的操作。 ![](https://opensource.com/sites/default/files/uploads/logicaldoc-4.png) 查看早期版本只需在“版本”页面下载就行。对于某些第三方服务,它还有导入和导出选项,内置 [Dropbox][4] 支持。 -文档管理不仅仅是对能够负担得起昂贵解决方案的大公司。LogicalDOC 可帮助你追踪文档的版本历史,并为难以管理的文档提供了安全的仓库。 +文档管理不仅仅是能够负担得起昂贵解决方案的大公司才能有的。LogicalDOC 可帮助你追踪文档的版本历史,并为难以管理的文档提供了安全的仓库。 -------------------------------------------------------------------------------- @@ -50,7 +51,7 @@ via: https://opensource.com/article/19/1/productivity-tool-logicaldoc 作者:[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 26f56242506232d386d8d9bfb4fe3c04cc8cdd9a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 22 Feb 2019 22:41:01 +0800 Subject: [PATCH 282/813] PUB:20190124 Get started with LogicalDOC, an open source document management system.md @geekpi https://linux.cn/article-10561-1.html --- ...h LogicalDOC, an open source document management system.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190124 Get started with LogicalDOC, an open source document management system.md (98%) diff --git a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md b/published/20190124 Get started with LogicalDOC, an open source document management system.md similarity index 98% rename from translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md rename to published/20190124 Get started with LogicalDOC, an open source document management system.md index b94ec5e038..35e90d4839 100644 --- a/translated/tech/20190124 Get started with LogicalDOC, an open source document management system.md +++ b/published/20190124 Get started with LogicalDOC, an open source document management system.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10561-1.html) [#]: subject: (Get started with LogicalDOC, an open source document management system) [#]: via: (https://opensource.com/article/19/1/productivity-tool-logicaldoc) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 0c2219d352fb7e30b213fb48515f3fb20e39896f Mon Sep 17 00:00:00 2001 From: pityonline Date: Fri, 22 Feb 2019 22:41:11 +0800 Subject: [PATCH 283/813] translating by pityonline --- ...How To Remove-Delete The Empty Lines In A File In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md index a7b2c06a16..b55cbcd811 100644 --- a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md +++ b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( pityonline ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -180,7 +180,7 @@ via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[pityonline](https://github.com/pityonline) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f9d7c4515d2ae902ed4b537cedf976b73611a462 Mon Sep 17 00:00:00 2001 From: leommxj Date: Fri, 22 Feb 2019 23:18:40 +0800 Subject: [PATCH 284/813] translated --- ...ory is installed, used on Linux systems.md | 227 ------------------ 1 file changed, 227 deletions(-) delete mode 100644 sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md diff --git a/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md deleted file mode 100644 index 78e2129807..0000000000 --- a/sources/tech/20190207 How to determine how much memory is installed, used on Linux systems.md +++ /dev/null @@ -1,227 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (leommxj) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to determine how much memory is installed, used on Linux systems) -[#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -How to determine how much memory is installed, used on Linux systems -====== -![](https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg) - -There are numerous ways to get information on the memory installed on Linux systems and view how much of that memory is being used. Some commands provide an overwhelming amount of detail, while others provide succinct, though not necessarily easy-to-digest, answers. In this post, we'll look at some of the more useful tools for checking on memory and its usage. - -Before we get into the details, however, let's review a few details. Physical memory and virtual memory are not the same. The latter includes disk space that configured to be used as swap. Swap may include partitions set aside for this usage or files that are created to add to the available swap space when creating a new partition may not be practical. Some Linux commands provide information on both. - -Swap expands memory by providing disk space that can be used to house inactive pages in memory that are moved to disk when physical memory fills up. - -One file that plays a role in memory management is **/proc/kcore**. This file looks like a normal (though extremely large) file, but it does not occupy disk space at all. Instead, it is a virtual file like all of the files in /proc. - -``` -$ ls -l /proc/kcore --r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore -``` - -Interestingly, the two systems queried below do _not_ have the same amount of memory installed, yet the size of /proc/kcore is the same on both. The first of these two systems has 4 GB of memory installed; the second has 6 GB. - -``` -system1$ ls -l /proc/kcore --r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore -system2$ ls -l /proc/kcore --r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore -``` - -Explanations that claim the size of this file represents the amount of available virtual memory (maybe plus 4K) don't hold much weight. This number would suggest that the virtual memory on these systems is 128 terrabytes! That number seems to represent instead how much memory a 64-bit systems might be capable of addressing — not how much is available on the system. Calculations of what 128 terrabytes and that number, plus 4K would look like are fairly easy to make on the command line: - -``` -$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 -140737488355328 -$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096 -140737488359424 -``` - -Another and more human-friendly command for examining memory is the **free** command. It gives you an easy-to-understand report on memory. - -``` -$ free - total used free shared buff/cache available -Mem: 6102476 812244 4090752 13112 1199480 4984140 -Swap: 2097148 0 2097148 -``` - -With the **-g** option, free reports the values in gigabytes. - -``` -$ free -g - total used free shared buff/cache available -Mem: 5 0 3 0 1 4 -Swap: 1 0 1 -``` - -With the **-t** option, free shows the same values as it does with no options (don't confuse -t with terrabytes!) but by adding a total line at the bottom of its output. - -``` -$ free -t - total used free shared buff/cache available -Mem: 6102476 812408 4090612 13112 1199456 4983984 -Swap: 2097148 0 2097148 -Total: 8199624 812408 6187760 -``` - -And, of course, you can choose to use both options. - -``` -$ free -tg - total used free shared buff/cache available -Mem: 5 0 3 0 1 4 -Swap: 1 0 1 -Total: 7 0 5 -``` - -You might be disappointed in this report if you're trying to answer the question "How much RAM is installed on this system?" This is the same system shown in the example above that was described as having 6GB of RAM. That doesn't mean this report is wrong, but that it's the system's view of the memory it has at its disposal. - -The free command also provides an option to update the display every X seconds (10 in the example below). - -``` -$ free -s 10 - total used free shared buff/cache available -Mem: 6102476 812280 4090704 13112 1199492 4984108 -Swap: 2097148 0 2097148 - - total used free shared buff/cache available -Mem: 6102476 812260 4090712 13112 1199504 4984120 -Swap: 2097148 0 2097148 -``` - -With **-l** , the free command provides high and low memory usage. - -``` -$ free -l - total used free shared buff/cache available -Mem: 6102476 812376 4090588 13112 1199512 4984000 -Low: 6102476 2011888 4090588 -High: 0 0 0 -Swap: 2097148 0 2097148 -``` - -Another option for looking at memory is the **/proc/meminfo** file. Like /proc/kcore, this is a virtual file and one that gives a useful report showing how much memory is installed, free and available. Clearly, free and available do not represent the same thing. MemFree seems to represent unused RAM. MemAvailable is an estimate of how much memory is available for starting new applications. - -``` -$ head -3 /proc/meminfo -MemTotal: 6102476 kB -MemFree: 4090596 kB -MemAvailable: 4984040 kB -``` - -If you only want to see total memory, you can use one of these commands: - -``` -$ awk '/MemTotal/ {print $2}' /proc/meminfo -6102476 -$ grep MemTotal /proc/meminfo -MemTotal: 6102476 kB -``` - -The **DirectMap** entries break information on memory into categories. - -``` -$ grep DirectMap /proc/meminfo -DirectMap4k: 213568 kB -DirectMap2M: 6076416 kB -``` - -DirectMap4k represents the amount of memory being mapped to standard 4k pages, while DirectMap2M shows the amount of memory being mapped to 2MB pages. - -The **getconf** command is one that will provide quite a bit more information than most of us want to contemplate. - -``` -$ getconf -a | more -LINK_MAX 65000 -_POSIX_LINK_MAX 65000 -MAX_CANON 255 -_POSIX_MAX_CANON 255 -MAX_INPUT 255 -_POSIX_MAX_INPUT 255 -NAME_MAX 255 -_POSIX_NAME_MAX 255 -PATH_MAX 4096 -_POSIX_PATH_MAX 4096 -PIPE_BUF 4096 -_POSIX_PIPE_BUF 4096 -SOCK_MAXBUF -_POSIX_ASYNC_IO -_POSIX_CHOWN_RESTRICTED 1 -_POSIX_NO_TRUNC 1 -_POSIX_PRIO_IO -_POSIX_SYNC_IO -_POSIX_VDISABLE 0 -ARG_MAX 2097152 -ATEXIT_MAX 2147483647 -CHAR_BIT 8 -CHAR_MAX 127 ---More-- -``` - -Pare that output down to something specific with a command like the one shown below, and you'll get the same kind of information provided by some of the commands above. - -``` -$ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) total *=$NF} END {print total / 1024" kB"}' -6102476 kB -``` - -That command calculates memory by multiplying the values in the first and last lines of output like this: - -``` -PAGESIZE 4096 <== -_AVPHYS_PAGES 1022511 -_PHYS_PAGES 1525619 <== -``` - -Calculating that independently, we can see how that value is derived. - -``` -$ expr 4096 \* 1525619 / 1024 -6102476 -``` - -Clearly that's one of those commands that deserves to be turned into an alias! - -Another command with very digestible output is **top**. In the first five lines of top's output, you'll see some numbers that show how memory is being used. - -``` -$ top -top - 15:36:38 up 8 days, 2:37, 2 users, load average: 0.00, 0.00, 0.00 -Tasks: 266 total, 1 running, 265 sleeping, 0 stopped, 0 zombie -%Cpu(s): 0.2 us, 0.4 sy, 0.0 ni, 99.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -MiB Mem : 3244.8 total, 377.9 free, 1826.2 used, 1040.7 buff/cache -MiB Swap: 3536.0 total, 3535.7 free, 0.3 used. 1126.1 avail Mem -``` - -And finally a command that will answer the question "So, how much RAM is installed on this system?" in a succinct fashion: - -``` -$ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB"}' -6GB -``` - -Depending on how much detail you want to see, Linux systems provide a lot of options for seeing how much memory is installed on your systems and how much is used and available. - -Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[leommxj](https://github.com/leommxj) -校对:[校对者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.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world From d1db1332f8a523c1bcc7d99f28f343822f5ee00d Mon Sep 17 00:00:00 2001 From: leommxj Date: Fri, 22 Feb 2019 23:19:08 +0800 Subject: [PATCH 285/813] translated --- ...ory is installed, used on Linux systems.md | 227 ++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md diff --git a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md new file mode 100644 index 0000000000..5732d2a1c5 --- /dev/null +++ b/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (leommxj) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to determine how much memory is installed, used on Linux systems) +[#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在Linux系统中判断安装、使用了多少内存 +====== +![](https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg) + +在Linux系统中有很多种方法获取有关安装了多少内存的信息及查看多少内存正在被使用。有些命令提供了大量的细节,而其他命令提供了简洁但不一定易于理解的答案。在这篇文章中,我们将介绍一些查看内存及其使用状态的有用的工具。 + +在我们开始之前,让我们先来回顾一些基础知识。物理内存和虚拟内存并不是一回事。后者包括配置为 swap 的磁盘空间。Swap 空间可能包括为此目的特意留出来的分区,以及在创建新的 swap 分区不可行时创建的用来增加可用 swap 空间的文件。有些Linux命令提供关于两者的信息。 + +Swap 通过提供当物理内存占满时可以用来存放内存中非活动页的磁盘空间来扩展内存。 + +**/proc/kcore** 是在内存管理中起作用的一个文件。这个文件看上去是个普通文件(虽然非常大),但它并不占用任何空间。它就像其他 /proc 下的文件一样是个虚拟文件。 + +``` +$ ls -l /proc/kcore +-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore +``` + +有趣的是,下面查询的两个系统并没有安装相同大小的内存,但 /proc/kcore 的大小却是相同的。第一个系统安装了 4 GB 的内存,而第二个系统安装了 6 GB。 + +``` +system1$ ls -l /proc/kcore +-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore +system2$ ls -l /proc/kcore +-r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore +``` + +一种不靠谱的解释说这个文件代表可用虚拟内存的大小(没准要加 4 KB),如果这样,这些系统的虚拟内存可就是 128TB 了!这个数字似乎代表了64位系统可以寻址多少内存,而不是当前系统有多少可用内存。在命令行中计算 128 TB 和这个文件大小加上 4 KB 很容易。 + +``` +$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 +140737488355328 +$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096 +140737488359424 +``` + +另一个用来检查内存的更人性化的命令是 **free**。它会给出一个易于理解的内存报告。 + +``` +$ free + total used free shared buff/cache available +Mem: 6102476 812244 4090752 13112 1199480 4984140 +Swap: 2097148 0 2097148 +``` + +使用 **-g** 选项,free会以 GB 为单位返回结果。 + +``` +$ free -g + total used free shared buff/cache available +Mem: 5 0 3 0 1 4 +Swap: 1 0 1 +``` + +使用 **-t** 选项,free 会显示与无附加选项时相同的值(不要把 -t 选项与 TB 搞混),并额外在输出的底部添加一行总计数据。 + +``` +$ free -t + total used free shared buff/cache available +Mem: 6102476 812408 4090612 13112 1199456 4983984 +Swap: 2097148 0 2097148 +Total: 8199624 812408 6187760 +``` + +当然,你也可以选择同时使用两个选项。 + +``` +$ free -tg + total used free shared buff/cache available +Mem: 5 0 3 0 1 4 +Swap: 1 0 1 +Total: 7 0 5 +``` + +如果你尝试用这个报告来解释“这个系统安装了多少内存?”,你可能会感到失望。上面的报告就是在前文说的装有 6 GB 内存的系统上运行的结果。这并不是说这个结果是错的,这就是系统对其可使用的内存的看法。 + +free 命令也提供了每隔 X 秒刷新显示的选项(下方示例中 X 为 10)。 + +``` +$ free -s 10 + total used free shared buff/cache available +Mem: 6102476 812280 4090704 13112 1199492 4984108 +Swap: 2097148 0 2097148 + + total used free shared buff/cache available +Mem: 6102476 812260 4090712 13112 1199504 4984120 +Swap: 2097148 0 2097148 +``` + +使用 **-l** 选项,free命令会提供高低内存使用信息。 + +``` +$ free -l + total used free shared buff/cache available +Mem: 6102476 812376 4090588 13112 1199512 4984000 +Low: 6102476 2011888 4090588 +High: 0 0 0 +Swap: 2097148 0 2097148 +``` + +查看内存的另一个选择是 **/proc/meminfo** 文件。像 /proc/kcore 一样,这也是一个虚拟文件,它可以提供关于安装/使用了多少内存以及可用内存的报告。显然,空闲内存和可用内存并不是同一回事。MemFree 看起来代表未使用的 RAM。MemAvailable则是对于启动新程序时可使用的内存的一个估计。 + +``` +$ head -3 /proc/meminfo +MemTotal: 6102476 kB +MemFree: 4090596 kB +MemAvailable: 4984040 kB +``` + +如果只想查看内存总计,可以使用下面的命令之一: + +``` +$ awk '/MemTotal/ {print $2}' /proc/meminfo +6102476 +$ grep MemTotal /proc/meminfo +MemTotal: 6102476 kB +``` + +**DirectMap** 将内存信息分为几类。 + +``` +$ grep DirectMap /proc/meminfo +DirectMap4k: 213568 kB +DirectMap2M: 6076416 kB +``` + +DirectMap4k 代表被映射成标准 4 k 页的内存大小,DirectMap2M 则显示了被映射为 2 MB 的页的内存大小。 + +**getconf** 命令将会提供比我们大多数人想要看到的更多的信息。 + +``` +$ getconf -a | more +LINK_MAX 65000 +_POSIX_LINK_MAX 65000 +MAX_CANON 255 +_POSIX_MAX_CANON 255 +MAX_INPUT 255 +_POSIX_MAX_INPUT 255 +NAME_MAX 255 +_POSIX_NAME_MAX 255 +PATH_MAX 4096 +_POSIX_PATH_MAX 4096 +PIPE_BUF 4096 +_POSIX_PIPE_BUF 4096 +SOCK_MAXBUF +_POSIX_ASYNC_IO +_POSIX_CHOWN_RESTRICTED 1 +_POSIX_NO_TRUNC 1 +_POSIX_PRIO_IO +_POSIX_SYNC_IO +_POSIX_VDISABLE 0 +ARG_MAX 2097152 +ATEXIT_MAX 2147483647 +CHAR_BIT 8 +CHAR_MAX 127 +--More-- +``` + +使用类似下面的命令来将其输出精简为指定的内容,你会得到跟前文提到的其他命令相同的结果。 + +``` +$ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) total *=$NF} END {print total / 1024" kB"}' +6102476 kB +``` + +上面的命令通过将下方输出的第一行和最后一行的值相乘来计算内存。 + +``` +PAGESIZE 4096 <== +_AVPHYS_PAGES 1022511 +_PHYS_PAGES 1525619 <== +``` + +自己动手计算一下,我们就知道这个值是怎么来的了。 + +``` +$ expr 4096 \* 1525619 / 1024 +6102476 +``` + +显然值得为以上的指令之一设置个 alias。 + +另一个具有非常易于理解的输出的命令是 **top** 。在 top 输出的前五行,你可以看到一些数字显示多少内存正被使用。 + +``` +$ top +top - 15:36:38 up 8 days, 2:37, 2 users, load average: 0.00, 0.00, 0.00 +Tasks: 266 total, 1 running, 265 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.2 us, 0.4 sy, 0.0 ni, 99.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 3244.8 total, 377.9 free, 1826.2 used, 1040.7 buff/cache +MiB Swap: 3536.0 total, 3535.7 free, 0.3 used. 1126.1 avail Mem +``` + +最后一个命令将会以一个非常简洁的方式回答“系统安装了多少内存?”: + +``` +$ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB"}' +6GB +``` + +取决于你想要获取多少细节,Linux系统提供了许多用来查看系统安装内存以及使用/空闲内存的选择。 + +在 [Facebook][1] 或 [LinkedIn][2] 上加入 Network World 社区,评论最重要的话题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[leommxj](https://github.com/leommxj) +校对:[校对者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.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world From cedddf9e19bd44aaf5f2f7d2f63c8bc6bf42ae57 Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Fri, 22 Feb 2019 23:19:13 +0800 Subject: [PATCH 286/813] Luuming translating --- ...File-Folder From A Local System To Remote System In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md index 6de6cd173f..9c6d5ffda8 100644 --- a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md +++ b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( luming) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ac906c73c4531e8fbd6c8e7afbe4d59ce81fb251 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 00:27:23 +0800 Subject: [PATCH 287/813] PRF:20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @guevaraya --- ...ackages on Ubuntu and Debian -Quick Tip.md | 102 +++++++++++------- 1 file changed, 61 insertions(+), 41 deletions(-) diff --git a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md index cba74fd894..7fe71e2cf2 100644 --- a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md +++ b/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @@ -1,60 +1,70 @@ [#]: collector: (lujun9972) [#]: translator: (guevaraya) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to List Installed Packages on Ubuntu and Debian [Quick Tip]) [#]: via: (https://itsfoss.com/list-installed-packages-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何索引 Ubuntu 和 Debian 上已安装的软件包 [快速提示] +如何列出 Ubuntu 和 Debian 上已安装的软件包 ====== 当你安装了 [Ubuntu 并想好好用一用][1]。但在将来某个时候,你肯定会遇到忘记曾经安装了那些软件包。 这个是完全正常。没有人要求你把系统里所有已安装的软件包都记住。但是问题是,如何才能知道已经安装了哪些软件包?如何查看安装过的软件包呢? -### 索引 Ubuntu 和 Debian 上已安装的软件包 +### 列出 Ubuntu 和 Debian 上已安装的软件包 -![索引已安装的软件包][2] +![列出已安装的软件包][2] -如果你经常用 [apt 命令][3],你可能会注意到 apt 可以索引已安装的软件包。这里说对了一点。 +如果你经常用 [apt 命令][3],你可能觉得会有个命令像 `apt` 一样可以列出已安装的软件包。不算全错。 +[apt-get 命令][4] 没有类似列出已安装软件包的简单的选项,但是 `apt` 有一个这样的命令: -[apt-get 命令] 没有类似索引已安装软件包的简单的选项,但是 apt 有一个这样的命令: ``` apt list --installed ``` -这个会显示 apt 命令安装的所有的软件包。同时也会包含由于依赖被安装的软件包。也就是说不仅会包含你曾经安装的程序,而且会包含大量库文件和间接安装的软件包。 -![用 atp 命令索引显示已安装的软件包][5] 用 atp 命令索引显示已安装的软件包 +这个会显示使用 `apt` 命令安装的所有的软件包。同时也会包含由于依赖而被安装的软件包。也就是说不仅会包含你曾经安装的程序,而且会包含大量库文件和间接安装的软件包。 + +![用 atp 命令列出显示已安装的软件包][5] + +*用 atp 命令列出显示已安装的软件包* + +由于列出出来的已安装的软件包太多,用 `grep` 过滤特定的软件包是一个比较好的办法。 -由于索引出来的已安装的软件包太多,用 grep 过滤特定的软件包是一个比较好的办法。 ``` apt list --installed | grep program_name ``` -如上命令也可以检索出 .deb 格式的软件包文件。是不是很酷?不是吗? +如上命令也可以检索出使用 .deb 软件包文件安装的软件。是不是很酷? -如果你阅读过 [apt 与 apt-get 对比][7]的文章,你可能已经知道 apt 和 apt-get 命令都是基于 [dpkg][8]。也就是说用 dpkg 命令可以索引 Debian 系统的所有已经安装的软件包。 +如果你阅读过 [apt 与 apt-get 对比][7]的文章,你可能已经知道 `apt` 和 `apt-get` 命令都是基于 [dpkg][8]。也就是说用 `dpkg` 命令可以列出 Debian 系统的所有已经安装的软件包。 ``` dpkg-query -l ``` -你可以用 grep 命令检索指定的软件包。 -![用 dpkg 命令索引显示已经安装的软件包][9]![用 dpkg 命令索引显示已经安装的软件包][9]用 dpkg 命令索引显示已经安装的软件包 +你可以用 `grep` 命令检索指定的软件包。 +![用 dpkg 命令列出显示已经安装的软件包][9]! -现在你可以搞定索引 Debian 的软件包管理器安装的应用了。那 Snap 和 Flatpak 这个两种应用呢?如何索引他们?因为他们不能被 apt 和 dpkg 访问。 +*用 dpkg 命令列出显示已经安装的软件包* + +现在你可以搞定列出 Debian 的软件包管理器安装的应用了。那 Snap 和 Flatpak 这个两种应用呢?如何列出它们?因为它们不能被 `apt` 和 `dpkg` 访问。 显示系统里所有已经安装的 [Snap 软件包][10],可以这个命令: ``` snap list ``` -Snap 可以用绿色勾号索引显示经过认证的发布者。 -![索引已经安装的 Snap 软件包][11]索引已经安装的 Snap 软件包 + +Snap 可以用绿色勾号标出哪个应用来自经过认证的发布者。 + +![列出已经安装的 Snap 软件包][11] + +*列出已经安装的 Snap 软件包* 显示系统里所有已安装的 [Flatpak 软件包][12],可以用这个命令: @@ -65,37 +75,45 @@ flatpak list 让我来个汇总: -用 apt 命令显示已安装软件包: +用 `apt` 命令显示已安装软件包: -**apt** **list –installed** +``` +apt list –installed +``` -用 dpkg 命令显示已安装软件包: +用 `dpkg` 命令显示已安装软件包: -**dpkg-query -l** +``` +dpkg-query -l +``` -索引系统里 Snap 已安装软件包: +列出系统里 Snap 已安装软件包: -**snap list** +``` +snap list +``` -索引系统里 Flatpak 已安装软件包: +列出系统里 Flatpak 已安装软件包: -**flatpak list** +``` +flatpak list +``` ### 显示最近安装的软件包 -现在你已经看过以字母顺序索引的已经安装软件包了。如何显示最近已经安装的软件包? +现在你已经看过以字母顺序列出的已经安装软件包了。如何显示最近已经安装的软件包? 幸运的是,Linux 系统保存了所有发生事件的日志。你可以参考最近安装软件包的日志。 -有两个方法可以来做。用 dpkg 命令的日志或者 apt 命令的日志。 +有两个方法可以来做。用 `dpkg` 命令的日志或者 `apt` 命令的日志。 -你仅仅需要用 grep 命令过滤已经安装的软件包日志。 +你仅仅需要用 `grep` 命令过滤已经安装的软件包日志。 ``` grep " install " /var/log/dpkg.log ``` -这会显示所有的软件安装包,其中包括最近安装的过程中被依赖的软件包。 +这会显示所有的软件安装包,其中包括最近安装的过程中所依赖的软件包。 ``` 2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1 @@ -108,13 +126,13 @@ grep " install " /var/log/dpkg.log 2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1 ``` -你也可以查看 apt历史命令日志。这个仅会显示用 apt 命令安装的的程序。但不会显示被依赖安装的软件包,详细的日志在日志里可以看到。有时你只是想看看对吧? +你也可以查看 `apt` 历史命令日志。这个仅会显示用 `apt` 命令安装的的程序。但不会显示被依赖安装的软件包,详细的日志在日志里可以看到。有时你只是想看看对吧? ``` grep " install " /var/log/apt/history.log ``` -具体的显示如下: +具体的显示如下: ``` Commandline: apt install pinta @@ -128,28 +146,30 @@ Commandline: apt install cool-retro-term Commandline: apt install ubuntu-software ``` -![显示最近已安装的软件包][13]显示最近已安装的软件包 +![显示最近已安装的软件包][13] -apt 的历史日志非常有用。因为他显示了什么时候执行了 apt 命令,哪个用户执行的命令以及安装的软件包名 +*显示最近已安装的软件包* -### 小贴士: 在软件中心显示已安装的程序包名 +`apt` 的历史日志非常有用。因为他显示了什么时候执行了 `apt` 命令,哪个用户执行的命令以及安装的软件包名。 -如果你觉得终端和命令行交互不友好,可以有一个方法查看系统的程序名。 +### 小技巧:在软件中心显示已安装的程序包名 + +如果你觉得终端和命令行交互不友好,还有一个方法可以查看系统的程序名。 可以打开软件中心,然后点击已安装标签。你可以看到系统上已经安装的程序包名 -![Ubuntu 软件中心显示已安装的软件包][14] 在软件中心显示已安装的软件包 +![Ubuntu 软件中心显示已安装的软件包][14] -这个不会显示库和其他命令行的东西,有可能你也不想看到他们,因为你是大量交互都是在 GUI,相反你可以一直用 Synaptic 软件包管理器。 +*在软件中心显示已安装的软件包* -**结束语** +这个不会显示库和其他命令行的东西,有可能你也不想看到它们,因为你的大量交互都是在 GUI。此外,你也可以用 Synaptic 软件包管理器。 -我希望这个简易的教程可以帮你查看 Ubuntu 和 基于 Debian 的发行版的已安装软件包。 +### 结束语 + +我希望这个简易的教程可以帮你查看 Ubuntu 和基于 Debian 的发行版的已安装软件包。 如果你对本文有什么问题或建议,请在下面留言。 - - -------------------------------------------------------------------------------- via: https://itsfoss.com/list-installed-packages-ubuntu @@ -157,7 +177,7 @@ via: https://itsfoss.com/list-installed-packages-ubuntu 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[guevaraya](https://github.com/guevaraya) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4264fb79ba000228c89fbd2f750e718568de9007 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 00:28:23 +0800 Subject: [PATCH 288/813] PUB:20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @guevaraya https://linux.cn/article-10562-1.html --- ...List Installed Packages on Ubuntu and Debian -Quick Tip.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md (99%) diff --git a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md similarity index 99% rename from translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md rename to published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md index 7fe71e2cf2..2eec9eb896 100644 --- a/translated/tech/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md +++ b/published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (guevaraya) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10562-1.html) [#]: subject: (How to List Installed Packages on Ubuntu and Debian [Quick Tip]) [#]: via: (https://itsfoss.com/list-installed-packages-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 01aa9f049263673f6800d52ee41e7080cb99a36e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 11:12:22 +0800 Subject: [PATCH 289/813] PRF:20190110 5 useful Vim plugins for developers.md @pityonline --- ...110 5 useful Vim plugins for developers.md | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/translated/tech/20190110 5 useful Vim plugins for developers.md b/translated/tech/20190110 5 useful Vim plugins for developers.md index 95d73b5ec2..bfeb83df48 100644 --- a/translated/tech/20190110 5 useful Vim plugins for developers.md +++ b/translated/tech/20190110 5 useful Vim plugins for developers.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (pityonline) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 useful Vim plugins for developers) [#]: via: (https://opensource.com/article/19/1/vim-plugins-developers) [#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) -5 个好用的 Vim 插件 +5 个好用的开发者 Vim 插件 ====== -通过这 5 个插件扩展 Vim 功能来提升你的编码效率。 +> 通过这 5 个插件扩展 Vim 功能来提升你的编码效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) -我用 Vim 已经超过 20 年了,两年前我决定把它作为我的首要文本编辑器。我用 Vim 来编写代码,配置文件,博客文章及其它任意可以用纯文本表达的东西。Vim 有很多超级棒的功能,一旦你适合了它,你的工作会变得非常高效。 +我用 Vim 已经超过 20 年了,两年前我决定把它作为我的首要文本编辑器。我用 Vim 来编写代码、配置文件、博客文章及其它任意可以用纯文本表达的东西。Vim 有很多超级棒的功能,一旦你适合了它,你的工作会变得非常高效。 -在日常编辑工作中,我更倾向于使用 Vim 稳定的原生扩展,但开源社区对 Vim 开发了大量可以提升工作效率的插件。 +在日常编辑工作中,我更倾向于使用 Vim 稳定的原生功能,但开源社区对 Vim 开发了大量的插件,可以扩展 Vim 的功能、改进你的工作流程和提升工作效率。 以下列举 5 个非常好用的可以用于编写任意编程语言的插件。 -### 1. Auto Pairs +### 1、Auto Pairs -[Auto Pairs][2] 插件可以帮助你插入和删除成对的文字,如花括号,圆括号或引用标记。这在编写代码时非常有用,因为很多编程语言都有成对标记的语法,就像圆括号用于函数调用,或引号用于字符串定义。 +[Auto Pairs][2] 插件可以帮助你插入和删除成对的文字,如花括号、圆括号或引号。这在编写代码时非常有用,因为很多编程语言都有成对标记的语法,就像圆括号用于函数调用,或引号用于字符串定义。 Auto Pairs 最基本的功能是在你输入一个左括号时会自动补全对应的另一半括号。比如,你输入了一个 `[`,它会自动帮你补充另一半 `]`。相反,如果你用退格键删除开头的一半括号,Auto Pairs 会删除另一半。 @@ -39,9 +39,9 @@ func main() { x := true items := []string{"tv", "pc", "tablet"} - if x { + if x { for _, i := range items - } + } } ``` @@ -57,7 +57,7 @@ func main() { items := []string{"tv", "pc", "tablet"} if x { - for _, i := range items { + for _, i := range items { | (cursor here) } } @@ -66,17 +66,17 @@ func main() { Auto Pairs 提供了大量其它选项(你可以在 [GitHub][3] 上找到),但最基本的功能已经很让人省时间了。 -### 2. NERD Commenter +### 2、NERD Commenter -[NERD Commenter][4] 插件增加了方便注释的功能,类似在 IDEintegrated development environment 中注释功能。有了这个插件,你可以一键注释单行或多行代码。 +[NERD Commenter][4] 插件给 Vim 增加了代码注释的功能,类似在 IDEintegrated development environment 中注释功能。有了这个插件,你可以一键注释单行或多行代码。 -NERD Commenter 使用了标准的 Vim [filetype][5],所以它能理解一些编程语言并使用合适的方式来注释代码。 +NERD Commenter 可以与标准的 Vim [filetype][5] 插件配合,所以它能理解一些编程语言并使用合适的方式来注释代码。 -最易上手的方法是按 `Leader+Space` 组合键来开关当前行的注释。Vim 默认的 Leader 键是 `\`。 +最易上手的方法是按 `Leader+Space` 组合键来切换注释当前行。Vim 默认的 Leader 键是 `\`。 在可视化模式Visual mode中,你可以选择多行一并注释。NERD Commenter 也可以按计数注释,所以你可以加个数量 n 来注释 n 行。 -还有个有用的特性 Sexy Comment 可以用 `Leader+cs` 来触发,它的块注释风格更漂亮一些。例如下面这段代码: +还有个有用的特性 “Sexy Comment” 可以用 `Leader+cs` 来触发,它的块注释风格更漂亮一些。例如下面这段代码: ``` package main @@ -85,13 +85,13 @@ import "fmt" func main() { x := true -    items := []string{"tv", "pc", "tablet"} + items := []string{"tv", "pc", "tablet"} -    if x { -        for _, i := range items { -            fmt.Println(i) -        } -    } + if x { + for _, i := range items { + fmt.Println(i) + } + } } ``` @@ -104,15 +104,15 @@ import "fmt" func main() { /* - *    x := true - *    items := []string{"tv", "pc", "tablet"} - * - *    if x { - *        for _, i := range items { - *            fmt.Println(i) - *        } - *    } - */ + * x := true + * items := []string{"tv", "pc", "tablet"} + * + * if x { + * for _, i := range items { + * fmt.Println(i) + * } + * } + */ } ``` @@ -120,9 +120,9 @@ func main() { NERD Commenter 是任何使用 Vim 写代码的开发者都必装的插件。 -### 3. VIM Surround +### 3、VIM Surround -[Vim Surround][6] 插件可以帮你在现有文本中实现环绕插入成对的符号(如括号或双引号)或标签(如 HTML 或 XML 标签)。它和 Auto Pairs 有点儿类似,但在编辑文本时更有用。 +[Vim Surround][6] 插件可以帮你“环绕”现有文本插入成对的符号(如括号或双引号)或标签(如 HTML 或 XML 标签)。它和 Auto Pairs 有点儿类似,但是用于处理已有文本,在编辑文本时更有用。 比如你有以下一个句子: @@ -130,7 +130,7 @@ NERD Commenter 是任何使用 Vim 写代码的开发者都必装的插件。 "Vim plugins are awesome !" ``` -当你的光标处理句中任何位置时,你可以用 `ds"` 组合键删除句子两端的双引号。 +当你的光标处于引起来的句中任何位置时,你可以用 `ds"` 组合键删除句子两端的双引号。 ``` Vim plugins are awesome ! @@ -142,7 +142,7 @@ Vim plugins are awesome ! 'Vim plugins are awesome !' ``` -或者用 `cs'[` 替换成中括号: +或者再用 `cs'[` 替换成中括号: ``` [ Vim plugins are awesome ! ] @@ -154,7 +154,7 @@ Vim plugins are awesome !

Vim plugins are awesome !

``` -当光标在 awesome 这个单词的任何位置时,你可以按 `ysiw ` 直接给它加上着重标签: +当光标在 “awesome” 这个单词的任何位置时,你可以按 `ysiw` 直接给它加上着重标签(``): ```

Vim plugins are awesome !

@@ -162,13 +162,13 @@ Vim plugins are awesome ! 注意它聪明地加上了 `
` 闭合标签。 -Vim Surround 也可以用 `ySS` 缩进文本。比如你有以下文本: +Vim Surround 也可以用 `ySS` 缩进文本并加上标签。比如你有以下文本: ```

Vim plugins are awesome !

``` -你可以用 `ySS
` 加上 `div` 标签,注意生成的段落是自动缩进的。 +你可以用 `ySS
` 加上 `div` 标签,注意生成的段落是自动缩进的。 ```
@@ -178,9 +178,9 @@ Vim Surround 也可以用 `ySS` 缩进文本。比如你有以下文本: Vim Surround 有很多其它选项,你可以参照 [GitHub][7] 上的说明尝试它们。 -### 4. Vim Gitgutter +### 4、Vim Gitgutter -[Vim Gitgutter][8] 插件对使用 Git 作为版本控制工具的人来说非常有用。它会在 Vim 显示行号的列旁 `git diff` 的差异标记。假设你有如下已提交过的代码: +[Vim Gitgutter][8] 插件对使用 Git 作为版本控制工具的人来说非常有用。它会在 Vim 的行号列旁显示 `git diff` 的差异标记。假设你有如下已提交过的代码: ```   1 package main @@ -218,15 +218,15 @@ _   5 func main() {    14 } ``` -`-` 标记表示在第 5 行和第 6 行之间删除了一行。`~` 表示第 8 行有修改,`+` 表示新增了第 11 行。 +`_` 标记表示在第 5 行和第 6 行之间删除了一行。`~` 表示第 8 行有修改,`+` 表示新增了第 11 行。 另外,Vim Gitgutter 允许你用 `[c` 和 `]c` 在多个有修改的块之间跳转,甚至可以用 `Leader+hs` 来暂存某个变更集。 这个插件提供了对变更的即时视觉反馈,如果你用 Git 的话,有了它简直是如虎添翼。 -### 5. VIM Fugitive +### 5、VIM Fugitive -[Vim Fugitive][9] 是另一个超棒的将 Git 工作流集成到 Vim 中的插件。它对 Git 做了一些封装,可以让你在 Vim 里直接执行 Git 命令并将结果集成在 Vim 界面里。这个插件有超多的特性,更多信息请访问它的 [GitHub][10] 项目页面。 +[Vim Fugitive][9] 是另一个将 Git 工作流集成到 Vim 中的超棒插件。它对 Git 做了一些封装,可以让你在 Vim 里直接执行 Git 命令并将结果集成在 Vim 界面里。这个插件有超多的特性,更多信息请访问它的 [GitHub][10] 项目页面。 这里有一个使用 Vim Fugitive 的基础 Git 工作流示例。设想我们已经对下面的 Go 代码做出修改,你可以用 `:Gblame` 调用 `git blame` 来查看每行最后的提交信息: @@ -277,7 +277,7 @@ _   5 func main() {    14 } ``` -Vim Fugitive 在分割的窗口里显示 `git status` 的输出结果。你可以在某文件名所在的行用 `-` 键暂存这个文件,再按一次 `-` 可以取消暂存。这个信息会随着你的操作自动更新: +Vim Fugitive 在分割的窗口里显示 `git status` 的输出结果。你可以在该行按下 `-` 键用该文件的名字暂存这个文件的提交,再按一次 `-` 可以取消暂存。这个信息会随着你的操作自动更新: ```   1 # On branch master @@ -342,7 +342,7 @@ Vim Fugitive 的 GitHub 项目主页有很多屏幕录像展示了它的更多 ### 接下来? -这些 Vim 插件都是程序开发者的神器!还有其它几类开发者常用的插件:自动完成插件和语法检查插件。它些大都是和具体的编程语言相关的,以后我会在一些文章中介绍它们。 +这些 Vim 插件都是程序开发者的神器!还有另外两类开发者常用的插件:自动完成插件和语法检查插件。它些大都是和具体的编程语言相关的,以后我会在一些文章中介绍它们。 你在写代码时是否用到一些其它 Vim 插件?请在评论区留言分享。 @@ -353,7 +353,7 @@ via: https://opensource.com/article/19/1/vim-plugins-developers 作者:[Ricardo Gerardi][a] 选题:[lujun9972][b] 译者:[pityonline](https://github.com/pityonline) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fdb465a151f6dbf94373674f47ccd95ded45bf21 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 11:12:57 +0800 Subject: [PATCH 290/813] PUB:20190110 5 useful Vim plugins for developers.md @pityonline https://linux.cn/article-10563-1.html --- .../20190110 5 useful Vim plugins for developers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190110 5 useful Vim plugins for developers.md (99%) diff --git a/translated/tech/20190110 5 useful Vim plugins for developers.md b/published/20190110 5 useful Vim plugins for developers.md similarity index 99% rename from translated/tech/20190110 5 useful Vim plugins for developers.md rename to published/20190110 5 useful Vim plugins for developers.md index bfeb83df48..f405baa6ab 100644 --- a/translated/tech/20190110 5 useful Vim plugins for developers.md +++ b/published/20190110 5 useful Vim plugins for developers.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (pityonline) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10563-1.html) [#]: subject: (5 useful Vim plugins for developers) [#]: via: (https://opensource.com/article/19/1/vim-plugins-developers) [#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) From 4e8b9cb25716c3421cd4d39977e609273b5f80a7 Mon Sep 17 00:00:00 2001 From: LuMing Date: Sat, 23 Feb 2019 15:50:00 +0800 Subject: [PATCH 291/813] Translated --- ... Local System To Remote System In Linux.md | 398 ------------------ ... Local System To Remote System In Linux.md | 385 +++++++++++++++++ 2 files changed, 385 insertions(+), 398 deletions(-) delete mode 100644 sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md create mode 100644 translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md diff --git a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md deleted file mode 100644 index 9c6d5ffda8..0000000000 --- a/sources/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md +++ /dev/null @@ -1,398 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( luming) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) -[#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) -[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) - -How To Copy A File/Folder From A Local System To Remote System In Linux? -====== - -Copying a file from one server to another server or local to remote is one of the routine task for Linux administrator. - -If anyone says no, i won’t accept because this is one of the regular activity wherever you go. - -It can be done in many ways and we are trying to cover all the possible options. - -You can choose the one which you would prefer. Also, check other commands as well that may help you for some other purpose. - -I have tested all these commands and script in my test environment so, you can use this for your routine work. - -By default every one go with SCP because it’s one of the native command that everyone use for file copy. But commands which is listed in this article are be smart so, give a try if you would like to try new things. - -This can be done in below four ways easily. - - * **`SCP:`** scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. - * **`RSYNC:`** rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. - * **`PSCP:`** pscp is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to scp, saving output to files, and timing out. - * **`PRSYNC:`** prsync is a program for copying files in parallel to a number of hosts. It provides features such as passing a password to ssh, saving output to files, and timing out. - - - -### Method-1: Copy Files/Folders From A Local System To Remote System In Linux Using SCP Command? - -scp command allow us to copy files/folders from a local system to remote system. - -We are going to copy the `output.txt` file from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. - -``` -# scp output.txt root@2g.CentOS.com:/opt/backup - -output.txt 100% 2468 2.4KB/s 00:00 -``` - -We are going to copy two files `output.txt` and `passwd-up.sh` files from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. - -``` -# scp output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup - -output.txt 100% 2468 2.4KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -``` - -We are going to copy the `shell-script` directory from my local system to `2g.CentOS.com` remote system under `/opt/backup` directory. - -This will copy the `shell-script` directory and associated files under `/opt/backup` directory. - -``` -# scp -r /home/daygeek/2g/shell-script/ [email protected]:/opt/backup/ - -output.txt 100% 2468 2.4KB/s 00:00 -ovh.sh 100% 76 0.1KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -passwd-up1.sh 100% 7 0.0KB/s 00:00 -server-list.txt 100% 23 0.0KB/s 00:00 -``` - -### Method-2: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with scp Command? - -If you would like to copy the same file into multiple remote servers then create the following small shell script to achieve this. - -To do so, get the servers list and add those into `server-list.txt` file. Make sure you have to update the servers list into `server-list.txt` file. Each server should be in separate line. - -Finally mention the file location which you want to copy like below. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - scp /home/daygeek/2g/shell-script/output.txt [email protected]$server:/opt/backup -done -``` - -Once you done, set an executable permission to password-update.sh file. - -``` -# chmod +x file-copy.sh -``` - -Finally run the script to achieve this. - -``` -# ./file-copy.sh - -output.txt 100% 2468 2.4KB/s 00:00 -output.txt 100% 2468 2.4KB/s 00:00 -``` - -Use the following script to copy the multiple files into multiple remote servers. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh [email protected]$server:/opt/backup -done -``` - -The below output shows all the files twice as this copied into two servers. - -``` -# ./file-cp.sh - -output.txt 100% 2468 2.4KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -output.txt 100% 2468 2.4KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -``` - -Use the following script to copy the directory recursively into multiple remote servers. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - scp -r /home/daygeek/2g/shell-script/ [email protected]$server:/opt/backup -done -``` - -Output for the above script. - -``` -# ./file-cp.sh - -output.txt 100% 2468 2.4KB/s 00:00 -ovh.sh 100% 76 0.1KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -passwd-up1.sh 100% 7 0.0KB/s 00:00 -server-list.txt 100% 23 0.0KB/s 00:00 - -output.txt 100% 2468 2.4KB/s 00:00 -ovh.sh 100% 76 0.1KB/s 00:00 -passwd-up.sh 100% 877 0.9KB/s 00:00 -passwd-up1.sh 100% 7 0.0KB/s 00:00 -server-list.txt 100% 23 0.0KB/s 00:00 -``` - -### Method-3: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using PSCP Command? - -pscp command directly allow us to perform the copy to multiple remote servers. - -Use the following pscp command to copy a single file to remote server. - -``` -# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt /opt/backup - -[1] 18:46:11 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a multiple files to remote server. - -``` -# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt ovh.sh /opt/backup - -[1] 18:47:48 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a directory recursively to remote server. - -``` -# pscp.pssh -H 2g.CentOS.com -r /home/daygeek/2g/shell-script/ /opt/backup - -[1] 18:48:46 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a single file to multiple remote servers. - -``` -# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt /opt/backup - -[1] 18:49:48 [SUCCESS] 2g.CentOS.com -[2] 18:49:48 [SUCCESS] 2g.Debian.com -``` - -Use the following pscp command to copy a multiple files to multiple remote servers. - -``` -# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt passwd-up.sh /opt/backup - -[1] 18:50:30 [SUCCESS] 2g.Debian.com -[2] 18:50:30 [SUCCESS] 2g.CentOS.com -``` - -Use the following pscp command to copy a directory recursively to multiple remote servers. - -``` -# pscp.pssh -h server-list.txt -r /home/daygeek/2g/shell-script/ /opt/backup - -[1] 18:51:31 [SUCCESS] 2g.Debian.com -[2] 18:51:31 [SUCCESS] 2g.CentOS.com -``` - -### Method-4: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using rsync Command? - -Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. - -Use the following rsync command to copy a single file to remote server. - -``` -# rsync -avz /home/daygeek/2g/shell-script/output.txt [email protected]:/opt/backup - -sending incremental file list -output.txt - -sent 598 bytes received 31 bytes 1258.00 bytes/sec -total size is 2468 speedup is 3.92 -``` - -Use the following pscp command to copy a multiple files to remote server. - -``` -# rsync -avz /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup - -sending incremental file list -output.txt -passwd-up.sh - -sent 737 bytes received 50 bytes 1574.00 bytes/sec -total size is 2537 speedup is 3.22 -``` - -Use the following rsync command to copy a single file to remote server overh ssh. - -``` -# rsync -avzhe ssh /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup - -sending incremental file list -output.txt - -sent 598 bytes received 31 bytes 419.33 bytes/sec -total size is 2.47K speedup is 3.92 -``` - -Use the following pscp command to copy a directory recursively to remote server over ssh. This will copy only files not the base directory. - -``` -# rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com:/opt/backup - -sending incremental file list -./ -output.txt -ovh.sh -passwd-up.sh -passwd-up1.sh -server-list.txt - -sent 3.85K bytes received 281 bytes 8.26K bytes/sec -total size is 9.12K speedup is 2.21 -``` - -### Method-5: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with rsync Command? - -If you would like to copy the same file into multiple remote servers then create the following small shell script to achieve this. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do - rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com$server:/opt/backup -done -``` - -Output for the above shell script. - -``` -# ./file-copy.sh - -sending incremental file list -./ -output.txt -ovh.sh -passwd-up.sh -passwd-up1.sh -server-list.txt - -sent 3.86K bytes received 281 bytes 8.28K bytes/sec -total size is 9.13K speedup is 2.21 - -sending incremental file list -./ -output.txt -ovh.sh -passwd-up.sh -passwd-up1.sh -server-list.txt - -sent 3.86K bytes received 281 bytes 2.76K bytes/sec -total size is 9.13K speedup is 2.21 -``` - -### Method-6: Copy Files/Folders From A Local System To Multiple Remote System In Linux Using Shell Script with scp Command? - -In the above two shell script, we need to mention the file and folder location as a prerequiesties but here i did a small modification that allow the script to get a file or folder as a input. It could be very useful when you want to perform the copy multiple times in a day. - -``` -# file-copy.sh - -#!/bin/sh -for server in `more server-list.txt` -do -scp -r $1 root@2g.CentOS.com$server:/opt/backup -done -``` - -Run the shell script and give the file name as a input. - -``` -# ./file-copy.sh output1.txt - -output1.txt 100% 3558 3.5KB/s 00:00 -output1.txt 100% 3558 3.5KB/s 00:00 -``` - -### Method-7: Copy Files/Folders From A Local System To Multiple Remote System In Linux With Non-Standard Port Number? - -Use the below shell script to copy a file or folder if you are using Non-Standard port. - -If you are using `Non-Standard` port, make sure you have to mention the port number as follow for SCP command. - -``` -# file-copy-scp.sh - -#!/bin/sh -for server in `more server-list.txt` -do -scp -P 2222 -r $1 root@2g.CentOS.com$server:/opt/backup -done -``` - -Run the shell script and give the file name as a input. - -``` -# ./file-copy.sh ovh.sh - -ovh.sh 100% 3558 3.5KB/s 00:00 -ovh.sh 100% 3558 3.5KB/s 00:00 -``` - -If you are using `Non-Standard` port, make sure you have to mention the port number as follow for rsync command. - -``` -# file-copy-rsync.sh - -#!/bin/sh -for server in `more server-list.txt` -do -rsync -avzhe 'ssh -p 2222' $1 root@2g.CentOS.com$server:/opt/backup -done -``` - -Run the shell script and give the file name as a input. - -``` -# ./file-copy-rsync.sh passwd-up.sh -sending incremental file list -passwd-up.sh - -sent 238 bytes received 35 bytes 26.00 bytes/sec -total size is 159 speedup is 0.58 - -sending incremental file list -passwd-up.sh - -sent 238 bytes received 35 bytes 26.00 bytes/sec -total size is 159 speedup is 0.58 -``` --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/ - -作者:[Prakash Subramanian][a] -选题:[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/prakash/ -[b]: https://github.com/lujun9972 diff --git a/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md new file mode 100644 index 0000000000..3191c8b4e9 --- /dev/null +++ b/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -0,0 +1,385 @@ +[#]: collector: (lujun9972) +[#]: translator: ( luming) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) +[#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) + +如何在 Linux 上拷贝文件/文件夹到远程系统? +====== + +从一个服务器拷贝文件到另一个服务器,或是从本地到远程是 Linux 管理员的日常任务之一。 + +如果有人说不,我不接受。因为无论去哪这都是你的日常操作之一。 +有很多办法都能解决,我们就试着加以概括。 +你可以挑一个喜欢的方法。当然,看看其他命令也能在别的地方帮到你。 +我已经在自己的环境下测试过所有的命令和脚本了,因此你可以直接用到日常工作当中。 +通常大家都倾向 `scp` ,因为它是文件拷贝的原生命令native command之一。但本文所列出的其它命令也很好用,建议你尝试一下。 +文件拷贝可以轻易地用以下四种方法。 + **`SCP`**:`scp` 在网络上的两个主机之间拷贝文件,与 `ssh` 使用相同的认证方式,具有相同的安全性。 + **`RSYNC`**:`rsync`是一个即快速又出众的多功能文件拷贝工具。它能本地拷贝,通过远程 shell 在其它主机之间拷贝,或者远程 `rsync` 守护进程daemon。 +**`PSCP`**:`pscp` 是一个并行拷贝文件到多个主机上的程序。它提供了诸多特性,例如为 scp 配置免密传输,保存输出到 文件,统计时长。 +**`PRSYNC`**:`prsync` 也是一个并行拷贝文件到多个主机上的程序。它也提供了诸多特性,例如为 ssh 配置免密传输,保存输出到 文件,统计时长。 + +### 方式1:如何在 Linux 上使用 scp 命令从本地系统向远程系统拷贝文件/文件夹? + +`scp` 命令可以让我们拷贝文件/文件夹到远程系统上。 + +我会把 `output.txt` 文件从本地系统拷贝到 `2g.CentOS.com` 远程系统的 `/opt/backup` 文件夹下。 + +``` +# scp output.txt root@2g.CentOS.com:/opt/backup + +output.txt 100% 2468 2.4KB/s 00:00 +``` + +拷贝两个文件 `output.txt` 和 `passwd-up.sh` 到远程系统 `2g.CentOs.com` 的 `/opt/backup` 文件夹下。 + +``` +# scp output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup + +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +``` + +拷贝 `shell-script` 文件夹到远程系统`2g.CentOs.com` 的 `/opt/back` 文件夹下。 +这会连同`/opt/backup`文件夹下所有的文件一同拷贝进去。 + +``` +# scp -r /home/daygeek/2g/shell-script/ root@:/opt/backup/ + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 +``` + +### 方式2:如何在 Linux 上使用 scp 命令和 Shell 脚本拷贝文件/文件夹到多个远程系统上? + +如果你想拷贝同一个文件到多个远程服务器上,那就需要创建一个如下面那样的小 shell 脚本。 + +并且,需要将服务器添加进 `server-list.txt` 文件。确保添加成功后,每个服务器之间应当空一行。 + +最终,你想要的脚本就像下面这样: +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp /home/daygeek/2g/shell-script/output.txt root@$server:/opt/backup +done +``` + +完成之后,给 `file-copy.sh` 文件设置可执行权限。 +``` +# chmod +x file-copy.sh +``` + +最后运行脚本完成拷贝。 + +``` +# ./file-copy.sh + +output.txt 100% 2468 2.4KB/s 00:00 +output.txt 100% 2468 2.4KB/s 00:00 +``` + +使用下面的脚本可以拷贝多个文件到多个远程服务器上。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@$server:/opt/backup +done +``` + +下面结果显示所有的两个文件都拷贝到两个服务器上。 +``` +# ./file-cp.sh + +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +output.txt 100% 2468 2.4KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +``` + +使用下面的脚本递归地拷贝文件夹到多个远程服务器上。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + scp -r /home/daygeek/2g/shell-script/ root@$server:/opt/backup +done +``` + +上面脚本的输出。 +``` +# ./file-cp.sh + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 + +output.txt 100% 2468 2.4KB/s 00:00 +ovh.sh 100% 76 0.1KB/s 00:00 +passwd-up.sh 100% 877 0.9KB/s 00:00 +passwd-up1.sh 100% 7 0.0KB/s 00:00 +server-list.txt 100% 23 0.0KB/s 00:00 +``` + +### 方式3:如何在 Linux 上使用 pscp 命令拷贝文件/文件夹到多个远程系统上? + +`pscp` 命令可以直接让我们拷贝文件到多个远程服务器上。 + +使用下面的 `pscp` 命令拷贝单个文件到远程服务器。 + +``` +# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt /opt/backup + +[1] 18:46:11 [SUCCESS] 2g.CentOS.com +``` + +使用下面的 `pscp` 命令拷贝多个文件到远程服务器。 + +``` +# pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt ovh.sh /opt/backup + +[1] 18:47:48 [SUCCESS] 2g.CentOS.com +``` + +递归地拷贝整个文件夹到远程服务器。 + +``` +# pscp.pssh -H 2g.CentOS.com -r /home/daygeek/2g/shell-script/ /opt/backup + +[1] 18:48:46 [SUCCESS] 2g.CentOS.com +``` + +使用下面的命令拷贝单个文件到多个远程服务器。 + +``` +# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt /opt/backup + +[1] 18:49:48 [SUCCESS] 2g.CentOS.com +[2] 18:49:48 [SUCCESS] 2g.Debian.com +``` + +使用下面的 `pscp` 命令拷贝多个文件到多个远程服务器。 + +``` +# pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt passwd-up.sh /opt/backup + +[1] 18:50:30 [SUCCESS] 2g.Debian.com +[2] 18:50:30 [SUCCESS] 2g.CentOS.com +``` + +使用下面的命令递归地拷贝文件夹到多个远程服务器。 + +``` +# pscp.pssh -h server-list.txt -r /home/daygeek/2g/shell-script/ /opt/backup + +[1] 18:51:31 [SUCCESS] 2g.Debian.com +[2] 18:51:31 [SUCCESS] 2g.CentOS.com +``` + +### 方式4:如何在 Linux 上使用 rsync 命令拷贝文件/文件夹到多个远程系统上? + +`rsync`是一个即快速又出众的多功能文件拷贝工具。它能本地拷贝,通过远程 shell 在其它主机之间拷贝,或者远程 `rsync` 守护进程daemon。 + +使用下面的 `rsync` 命令拷贝单个文件到远程服务器。 + +``` +# rsync -avz /home/daygeek/2g/shell-script/output.txt root@:/opt/backup + +sending incremental file list +output.txt + +sent 598 bytes received 31 bytes 1258.00 bytes/sec +total size is 2468 speedup is 3.92 +``` + +使用下面的 `rsync` 命令拷贝多个文件到远程服务器。 + +``` +# rsync -avz /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt +passwd-up.sh + +sent 737 bytes received 50 bytes 1574.00 bytes/sec +total size is 2537 speedup is 3.22 +``` + +使用下面的 `rsync` 命令通过 `ssh` 拷贝单个文件到远程服务器。 + +``` +# rsync -avzhe ssh /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup + +sending incremental file list +output.txt + +sent 598 bytes received 31 bytes 419.33 bytes/sec +total size is 2.47K speedup is 3.92 +``` + +使用下面的 `rsync` 命令通过 `ssh` 递归地拷贝文件夹到远程服务器。这种方式只拷贝文件不包括文件夹。 + +``` +# rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com:/opt/backup + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.85K bytes received 281 bytes 8.26K bytes/sec +total size is 9.12K speedup is 2.21 +``` + +### 如何在 Linux 上使用 rsync 命令和 Shell 脚本拷贝文件/文件夹到多个远程系统上? + +如果你想拷贝同一个文件到多个远程服务器上,那也需要创建一个如下面那样的小 shell 脚本。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do + rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com$server:/opt/backup +done +``` + +上面脚本的输出。 + +``` +# ./file-copy.sh + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.86K bytes received 281 bytes 8.28K bytes/sec +total size is 9.13K speedup is 2.21 + +sending incremental file list +./ +output.txt +ovh.sh +passwd-up.sh +passwd-up1.sh +server-list.txt + +sent 3.86K bytes received 281 bytes 2.76K bytes/sec +total size is 9.13K speedup is 2.21 +``` + +### 方式6:如何在 Linux 上使用 scp 命令和 Shell 脚本从本地系统向多个远程系统拷贝文件/文件夹? + +在上面两个 shell 脚本中,我们需要事先指定好文件和文件夹的路径,这儿我做了些小修改,让脚本可以接收文件或文件夹的输入。当你每天需要多次执行拷贝时,这将会非常有用。 + +``` +# file-copy.sh + +#!/bin/sh +for server in `more server-list.txt` +do +scp -r $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +输入文件名并运行脚本。 + +``` +# ./file-copy.sh output1.txt + +output1.txt 100% 3558 3.5KB/s 00:00 +output1.txt 100% 3558 3.5KB/s 00:00 +``` + +### 方式7:如何在Linux 系统上用非标准端口拷贝文件/文件夹到远程系统? + +如果你想使用非标准端口,使用下面的 shell 脚本拷贝文件或文件夹。 + +如果你使用了非标准Non-Standard端口,确保像下面 `SCP` 命令那样指定好了端口号。 + +``` +# file-copy-scp.sh + +#!/bin/sh +for server in `more server-list.txt` +do +scp -P 2222 -r $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +运行脚本,输入文件名。 + +``` +# ./file-copy.sh ovh.sh + +ovh.sh 100% 3558 3.5KB/s 00:00 +ovh.sh 100% 3558 3.5KB/s 00:00 +``` + +如果你使用了非标准Non-Standard端口,确保像下面 `rsync` 命令那样指定好了端口号。 + +``` +# file-copy-rsync.sh + +#!/bin/sh +for server in `more server-list.txt` +do +rsync -avzhe 'ssh -p 2222' $1 root@2g.CentOS.com$server:/opt/backup +done +``` + +运行脚本,输入文件名 + +``` +# ./file-copy-rsync.sh passwd-up.sh +sending incremental file list +passwd-up.sh + +sent 238 bytes received 35 bytes 26.00 bytes/sec +total size is 159 speedup is 0.58 + +sending incremental file list +passwd-up.sh + +sent 238 bytes received 35 bytes 26.00 bytes/sec +total size is 159 speedup is 0.58 +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/ + +作者:[Prakash Subramanian][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://www.2daygeek.com/author/prakash/ +[b]: https://github.com/lujun9972 From 36e26a3a7e7f5b3e2526a2d5325d5bb32aa15f59 Mon Sep 17 00:00:00 2001 From: AnDJ Date: Sat, 23 Feb 2019 17:48:01 +0800 Subject: [PATCH 292/813] Translate Translate: How To Check CPU, Memory And Swap Utilization Percentage In Linux? --- ...heck CPU, Memory And Swap Utilization Percentage In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index 24fc867ac0..0fadc0908d 100644 --- a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (An-DJ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 15665138f00f3c2bfa9a96f9b607baf4c1e4158f Mon Sep 17 00:00:00 2001 From: cycoe Date: Sat, 23 Feb 2019 18:48:12 +0800 Subject: [PATCH 293/813] remove article in source --- ...and Tricks to Improve Your Productivity.md | 99 ------------------- 1 file changed, 99 deletions(-) delete mode 100644 sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md deleted file mode 100644 index 884d89ca42..0000000000 --- a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md +++ /dev/null @@ -1,99 +0,0 @@ -translating by Cycoe -Cycoe 翻译中 -8 KDE Plasma Tips and Tricks to Improve Your Productivity -====== - -[#] leon-shi is translating -![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg) - -KDE's Plasma is easily one of the most powerful desktop environments available for Linux. It's highly configurable, and it looks pretty good, too. That doesn't amount to a whole lot unless you can actually get things done. - -You can easily configure Plasma and make use of a lot of its convenient and time-saving features to boost your productivity and have a desktop that empowers you, rather than getting in your way. - -These tips aren't in any particular order, so you don't need to prioritize. Pick the ones that best fit your workflow. - - **Related** : [10 of the Best KDE Plasma Applications You Should Try][1] - -### 1. Multimedia Controls - -This isn't so much of a tip as it is something that's good to keep in mind. Plasma keeps multimedia controls everywhere. You don't need to open your media player every time you need to pause, resume, or skip a song; you can mouse over the minimized window or even control it via the lock screen. There's no need to scramble to log in to change a song or because you forgot to pause one. - -### 2. KRunner - -![KDE Plasma KRunner][2] - -KRunner is an often under-appreciated feature of the Plasma desktop. Most people are used to digging through the application launcher menu to find the program that they're looking to launch. That's not necessary with KRunner. - -To use KRunner, make sure that your focus is on the desktop itself. (Click on it instead of a window.) Then, start typing the name of the program that you want. KRunner will automatically drop down from the top of your screen with suggestions. Click or press Enter on the one you're looking for. It's much faster than remembering which category your program is under. - -### 3. Jump Lists - -![KDE Plasma Jump Lists][3] - -Jump lists are a fairly recent addition to the Plasma desktop. They allow you to launch an application directly to a specific section or feature. - -So if you have a launcher on a menu bar, you can right-click and get a list of places to jump to. Select where you want to go, and you're off. - -### 4. KDE Connect - -![KDE Connect Menu Android][4] - -[KDE Connect][5] is a massive help if you have an Android phone. It connects the phone to your desktop so you can share things seamlessly between the devices. - -With KDE Connect, you can see your [Android device's notification][6] on your desktop in real time. It also enables you to send and receive text messages from Plasma without ever picking up your phone. - -KDE Connect also lets you send files and share web pages between your phone and your computer. You can easily move from one device to the other without a lot of hassle or losing your train of thought. - -### 5. Plasma Vaults - -![KDE Plasma Vault][7] - -Plasma Vaults are another new addition to the Plasma desktop. They are KDE's simple solution to encrypted files and folders. If you don't work with encrypted files, this one won't really save you any time. If you do, though, vaults are a much simpler approach. - -Plasma Vaults let you create encrypted directories as a regular user without root and manage them from your task bar. You can mount and unmount the directories on the fly without the need for external programs or additional privileges. - -### 6. Pager Widget - -![KDE Plasma Pager][8] - -Configure your desktop with the pager widget. It allows you to easily access three additional workspaces for even more screen room. - -Add the widget to your menu bar, and you can slide between multiple workspaces. These are all the size of your screen, so you gain multiple times the total screen space. That lets you lay out more windows without getting confused by a minimized mess or disorganization. - -### 7. Create a Dock - -![KDE Plasma Dock][9] - -Plasma is known for its flexibility and the room it allows for configuration. Use that to your advantage. If you have programs that you're always using, consider setting up an OS X style dock with your most used applications. You'll be able to get them with a single click rather than going through a menu or typing in their name. - -### 8. Add a File Tree to Dolphin - -![Plasma Dolphin Directory][10] - -It's much easier to navigate folders in a directory tree. Dolphin, Plasma's default file manager, has built-in functionality to display a directory listing in the form of a tree on the side of the folder window. - -To enable the directory tree, click on the "Control" tab, then "Configure Dolphin," "View Modes," and "Details." Finally, select "Expandable Folders." - -Remember that these tips are just tips. Don't try to force yourself to do something that's getting in your way. You may hate using file trees in Dolphin. You may never use Pager. That's alright. There may even be something that you personally like that's not listed here. Do what works for you. That said, at least a few of these should shave some serious time out of your work day. - --------------------------------------------------------------------------------- - -via: https://www.maketecheasier.com/kde-plasma-tips-tricks-improve-productivity/ - -作者:[Nick Congleton][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.maketecheasier.com/author/nickcongleton/ -[1]:https://www.maketecheasier.com/10-best-kde-plasma-applications/ (10 of the Best KDE Plasma Applications You Should Try) -[2]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-krunner.jpg (KDE Plasma KRunner) -[3]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-jumplist.jpg (KDE Plasma Jump Lists) -[4]:https://www.maketecheasier.com/assets/uploads/2017/05/kde-connect-menu-e1494899929112.jpg (KDE Connect Menu Android) -[5]:https://www.maketecheasier.com/send-receive-sms-linux-kde-connect/ -[6]:https://www.maketecheasier.com/android-notifications-ubuntu-kde-connect/ -[7]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-vault.jpg (KDE Plasma Vault) -[8]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-pager.jpg (KDE Plasma Pager) -[9]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dock.jpg (KDE Plasma Dock) -[10]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dolphin.jpg (Plasma Dolphin Directory) From 43fb8a3f80931768c853485a775905156867e33c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 22:59:06 +0800 Subject: [PATCH 294/813] PRF:20190103 How to use Magit to manage Git projects.md @lujun9972 --- ...How to use Magit to manage Git projects.md | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/translated/tech/20190103 How to use Magit to manage Git projects.md b/translated/tech/20190103 How to use Magit to manage Git projects.md index e2f43323e6..4885ed3c70 100644 --- a/translated/tech/20190103 How to use Magit to manage Git projects.md +++ b/translated/tech/20190103 How to use Magit to manage Git projects.md @@ -1,74 +1,76 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(How to use Magit to manage Git projects) -[#]:via:(https://opensource.com/article/19/1/how-use-magit) -[#]:author:(Sachin Patil https://opensource.com/users/psachin) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Magit to manage Git projects) +[#]: via: (https://opensource.com/article/19/1/how-use-magit) +[#]: author: (Sachin Patil https://opensource.com/users/psachin) -如何使用 Magit 管理 Git 项目 +如何在 Emacs 中使用 Magit 管理 Git 项目 ====== -Emacs 的 Magit 扩展插件使得使用 Git 进行版本控制变得简单起来。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e-) -[Git][1] 是一个很棒的用于项目管理的 [版本控制 ][2] 工具,就是新人学习起来太难。Git 的命令行工具很难用,你不仅需要熟悉它的标志和选项还需要知道什么环境下使用他们。这使人望而生畏,因此不少人只在有限的几个场景中才使用它。 +> Emacs 的 Magit 扩展插件使得使用 Git 进行版本控制变得简单起来。 -还在,现今大多数的集成开发环境 (IDE) 都包含了 Git 扩展,大大地简化了使用使用的难度。Emacs 中就有这么一款 Git 扩展名叫 [Magit][3]。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e-) -Magit 项目成立有差不多 10 年了,它将自己定义为 "一件 Emacs 内的 Git 瓷器。" 也就是说,它是一个操作界面,每个操作都能一键完成。本文会带你领略一下 Magit 的操作界面并告诉你如何使用它来管理 Git 项目。 +[Git][1] 是一个很棒的用于项目管理的 [版本控制][2] 工具,就是新人学习起来太难。Git 的命令行工具很难用,你不仅需要熟悉它的标志和选项,还需要知道什么环境下使用它们。这使人望而生畏,因此不少人只会非常有限的几个用法。 -若你还未 [安装 Emacs][4],则开始本教程之前请先 [安装 Magit][5]。 +好在,现今大多数的集成开发环境 (IDE) 都包含了 Git 扩展,大大地简化了使用使用的难度。Emacs 中就有这么一款 Git 扩展名叫 [Magit][3]。 + +Magit 项目成立有差不多 10 年了,它将自己定义为 “一件 Emacs 内的 Git 瓷器”。也就是说,它是一个操作界面,每个操作都能一键完成。本文会带你领略一下 Magit 的操作界面并告诉你如何使用它来管理 Git 项目。 + +若你还没有做,请在开始本教程之前先 [安装 Emacs][4],再 [安装 Magit][5]。 ### Magit 的界面 -首先用 Emacs 的 [Dired mode][6] 访问一个项目目录。比如我所有的 Emacs 配置存储在 **~/.emacs.d/** 目录中,就是用 Git 来进行管理的。 +首先用 Emacs 的 [Dired 模式][6] 访问一个项目的目录。比如我所有的 Emacs 配置存储在 `~/.emacs.d/` 目录中,就是用 Git 来进行管理的。 ![](https://opensource.com/sites/default/files/uploads/visiting_a_git_project.png) -若你在命令行下工作,则你需要输入 **git status** 来查看项目的当前状态。Magit 也有类似的函数:**magit-status**。你可以通过 **M-x magit-status** (快捷方式是 **Alt+x magit-status** )来调用该函数。结果看起来像下面这样: +若你在命令行下工作,则你需要输入 `git status` 来查看项目的当前状态。Magit 也有类似的功能:`magit-status`。你可以通过 `M-x magit-status` (快捷方式是 `Alt+x magit-status` )来调用该功能。结果看起来像下面这样: ![](https://opensource.com/sites/default/files/uploads/magit_status.png) -Magit 显示的信息比 **git status** 命令的要多得多。它分别列出了未追踪文件列表、未暂存文件列表以及已暂存文件列表。它还列出了储藏 (stash) 列表以及最近几次的提交—所有这些信息都在一个窗口中展示。 +Magit 显示的信息比 `git status` 命令的要多得多。它分别列出了未追踪文件列表、未暂存文件列表以及已暂存文件列表。它还列出了储藏stash列表以及最近几次的提交 —— 所有这些信息都在一个窗口中展示。 -如果你想查看修改了哪些内容,按下 Tab 键。比如,我移动光标到未暂存文件 **custom_functions.org** 上然后按下 Tab 键,Magit 会显示修改了哪些内容: +如果你想查看修改了哪些内容,按下 `Tab` 键。比如,我移动光标到未暂存的文件 `custom_functions.org` 上,然后按下 `Tab` 键,Magit 会显示修改了哪些内容: ![](https://opensource.com/sites/default/files/uploads/show_unstaged_content.png) -这跟运行命令 **git diff custom_functions.org** 类似。储藏文件更简单。只需要移动光标到文件上然后按下 **s** 键。该文件就会迅速移动到被储藏文件列表中: +这跟运行命令 `git diff custom_functions.org` 类似。储藏文件更简单。只需要移动光标到文件上然后按下 `s` 键。该文件就会迅速移动到已储藏文件列表中: ![](https://opensource.com/sites/default/files/uploads/staging_a_file.png) -要反储藏 (unstage) 某个文件,使用 **u** 键。按下 **s** 和 **u** 键要比在命令行输入 **git add -u ** 和 **git reset HEAD ** 快的多也更有趣的多。 +要反储藏unstage某个文件,使用 `u` 键。按下 `s` 和 `u` 键要比在命令行输入 `git add -u ` 和 `git reset HEAD ` 快的多也更有趣的多。 ### 提交更改 -在同一个 Magit 窗口中,按下 **c** 键会显示一个提交窗口,其中提供了许多标志,比如 **--all** 用来暂存所有文件或者 **--signoff** 来往提交信息中添加签名行。 +在同一个 Magit 窗口中,按下 `c` 键会显示一个提交窗口,其中提供了许多标志,比如 `--all` 用来暂存所有文件或者 `--signoff` 来往提交信息中添加签名行。 ![](https://opensource.com/sites/default/files/uploads/magit_commit_popup.png) -将光标移动到想要启动的行,比如 signoff 标签行,然后按下回车。**--signoff** 文本会变成高亮,这说明该标志已经被启用。 +将光标移动到想要启用签名标志的行,然后按下回车。`--signoff` 文本会变成高亮,这说明该标志已经被启用。 ![](https://opensource.com/sites/default/files/uploads/magit_signoff_commit.png) -再次按下 **c** 键会显示一个窗口供你输入提交信息。 +再次按下 `c` 键会显示一个窗口供你输入提交信息。 ![](https://opensource.com/sites/default/files/uploads/magit_commit_message.png) -最后,使用 **C-c C-c **(按键 Ctrl+cc 的缩写形式) 来提交更改。 +最后,使用 `C-c C-c `(按键 `Ctrl+cc` 的缩写形式) 来提交更改。 ![](https://opensource.com/sites/default/files/uploads/magit_commit_message_2.png) ### 推送更改 -更改提交后,提交行将会显示在 **Recent commits** 段中显示。 +更改提交后,提交行将会显示在 `Recent commits` 区域中显示。 ![](https://opensource.com/sites/default/files/uploads/magit_commit_log.png) -将光标放到该提交处然后按下 **p** 来推送该变更。 +将光标放到该提交处然后按下 `p` 来推送该变更。 -若你想感受一下使用 Magit 的感觉,我已经在 YouTube 上上传了一段 [演示 ][7]。本文只涉及到 Magit 的一点皮毛。它有许多超酷的功能可以帮你使用 Git 分支,变基等功能。你可以在 Magit 的主页上找到 [文档,支持,以及更多 ][8] 链接。 +若你想感受一下使用 Magit 的感觉,我已经在 YouTube 上传了一段 [演示][7]。本文只涉及到 Magit 的一点皮毛。它有许多超酷的功能可以帮你使用 Git 分支、变基等功能。你可以在 Magit 的主页上找到 [文档、支持,以及更多][8] 的链接。 -------------------------------------------------------------------------------- @@ -77,7 +79,7 @@ via: https://opensource.com/article/19/1/how-use-magit 作者:[Sachin Patil][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0b7c4e73f6e7e2f2230b2a79dd437a59426a6d29 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sat, 23 Feb 2019 23:02:20 +0800 Subject: [PATCH 295/813] translated over translated over --- ...ork- A tool for improving WiFi security.md | 236 ------------------ ...ork- A tool for improving WiFi security.md | 236 ++++++++++++++++++ 2 files changed, 236 insertions(+), 236 deletions(-) delete mode 100644 sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md create mode 100644 translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md diff --git a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md deleted file mode 100644 index 7ab67f5c22..0000000000 --- a/sources/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md +++ /dev/null @@ -1,236 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hopefully2333) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Evil-Twin Framework: A tool for improving WiFi security) -[#]: via: (https://opensource.com/article/19/1/evil-twin-framework) -[#]: author: (André Esser https://opensource.com/users/andreesser) - -The Evil-Twin Framework: A tool for improving WiFi security -====== -Learn about a pen-testing tool intended to test the security of WiFi access points for all types of threats. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-cloud-safe.png?itok=yj2TFPzq) - -The increasing number of devices that connect over-the-air to the internet over-the-air and the wide availability of WiFi access points provide many opportunities for attackers to exploit users. By tricking users to connect to [rogue access points][1], hackers gain full control over the users' network connection, which allows them to sniff and alter traffic, redirect users to malicious sites, and launch other attacks over the network.. - -To protect users and teach them to avoid risky online behaviors, security auditors and researchers must evaluate users' security practices and understand the reasons they connect to WiFi access points without being confident they are safe. There are a significant number of tools that can conduct WiFi audits, but no single tool can test the many different attack scenarios and none of the tools integrate well with one another. - -The **Evil-Twin Framework** (ETF) aims to fix these problems in the WiFi auditing process by enabling auditors to examine multiple scenarios and integrate multiple tools. This article describes the framework and its functionalities, then provides some examples to show how it can be used. - -### The ETF architecture - -The ETF framework was written in [Python][2] because the development language is very easy to read and make contributions to. In addition, many of the ETF's libraries, such as **[Scapy][3]** , were already developed for Python, making it easy to use them for ETF. - -The ETF architecture (Figure 1) is divided into different modules that interact with each other. The framework's settings are all written in a single configuration file. The user can verify and edit the settings through the user interface via the **ConfigurationManager** class. Other modules can only read these settings and run according to them. - -![Evil-Twin Framework Architecture][5] - -Figure 1: Evil-Twin framework architecture - -The ETF supports multiple user interfaces that interact with the framework. The current default interface is an interactive console, similar to the one on [Metasploit][6]. A graphical user interface (GUI) and a command line interface (CLI) are under development for desktop/browser use, and mobile interfaces may be an option in the future. The user can edit the settings in the configuration file using the interactive console (and eventually with the GUI). The user interface can interact with every other module that exists in the framework. - -The WiFi module ( **AirCommunicator** ) was built to support a wide range of WiFi capabilities and attacks. The framework identifies three basic pillars of Wi-Fi communication: **packet sniffing** , **custom packet injection** , and **access point creation**. The three main WiFi communication modules are **AirScanner** , **AirInjector** , and **AirHost** , which are responsible for packet sniffing, packet injection, and access point creation, respectively. The three classes are wrapped inside the main WiFi module, AirCommunicator, which reads the configuration file before starting the services. Any type of WiFi attack can be built using one or more of these core features. - -To enable man-in-the-middle (MITM) attacks, which are a common way to attack WiFi clients, the framework has an integrated module called ETFITM (Evil-Twin Framework-in-the-Middle). This module is responsible for the creation of a web proxy used to intercept and manipulate HTTP/HTTPS traffic. - -There are many other tools that can leverage the MITM position created by the ETF. Through its extensibility, ETF can support them—and, instead of having to call them separately, you can add the tools to the framework just by extending the Spawner class. This enables a developer or security auditor to call the program with a preconfigured argument string from within the framework. - -The other way to extend the framework is through plugins. There are two categories of plugins: **WiFi plugins** and **MITM plugins**. MITM plugins are scripts that can run while the MITM proxy is active. The proxy passes the HTTP(S) requests and responses through to the plugins where they can be logged or manipulated. WiFi plugins follow a more complex flow of execution but still expose a fairly simple API to contributors who wish to develop and use their own plugins. WiFi plugins can be further divided into three categories, one for each of the core WiFi communication modules. - -Each of the core modules has certain events that trigger the execution of a plugin. For instance, AirScanner has three defined events to which a response can be programmed. The events usually correspond to a setup phase before the service starts running, a mid-execution phase while the service is running, and a teardown or cleanup phase after a service finishes. Since Python allows multiple inheritance, one plugin can subclass more than one plugin class. - -Figure 1 above is a summary of the framework's architecture. Lines pointing away from the ConfigurationManager mean that the module reads information from it and lines pointing towards it mean that the module can write/edit configurations. - -### Examples of using the Evil-Twin Framework - -There are a variety of ways ETF can conduct penetration testing on WiFi network security or work on end users' awareness of WiFi security. The following examples describe some of the framework's pen-testing functionalities, such as access point and client detection, WPA and WEP access point attacks, and evil twin access point creation. - -These examples were devised using ETF with WiFi cards that allow WiFi traffic capture. They also utilize the following abbreviations for ETF setup commands: - - * **APS** access point SSID - * **APB** access point BSSID - * **APC** access point channel - * **CM** client MAC address - - - -In a real testing scenario, make sure to replace these abbreviations with the correct information. - -#### Capturing a WPA 4-way handshake after a de-authentication attack - -This scenario (Figure 2) takes two aspects into consideration: the de-authentication attack and the possibility of catching a 4-way WPA handshake. The scenario starts with a running WPA/WPA2-enabled access point with one connected client device (in this case, a smartphone). The goal is to de-authenticate the client with a general de-authentication attack then capture the WPA handshake once it tries to reconnect. The reconnection will be done manually immediately after being de-authenticated. - -![Scenario for capturing a WPA handshake after a de-authentication attack][8] - -Figure 2: Scenario for capturing a WPA handshake after a de-authentication attack - -The consideration in this example is the ETF's reliability. The goal is to find out if the tools can consistently capture the WPA handshake. The scenario will be performed multiple times with each tool to check its reliability when capturing the WPA handshake. - -There is more than one way to capture a WPA handshake using the ETF. One way is to use a combination of the AirScanner and AirInjector modules; another way is to just use the AirInjector. The following scenario uses a combination of both modules. - -The ETF launches the AirScanner module and analyzes the IEEE 802.11 frames to find a WPA handshake. Then the AirInjector can launch a de-authentication attack to force a reconnection. The following steps must be done to accomplish this on the ETF: - - 1. Enter the AirScanner configuration mode: **config airscanner** - 2. Configure the AirScanner to not hop channels: **config airscanner** - 3. Set the channel to sniff the traffic on the access point channel (APC): **set fixed_sniffing_channel = ** - 4. Start the AirScanner module with the CredentialSniffer plugin: **start airscanner with credentialsniffer** - 5. Add a target access point BSSID (APS) from the sniffed access points list: **add aps where ssid = ** - 6. Start the AirInjector, which by default lauches the de-authentication attack: **start airinjector** - - - -This simple set of commands enables the ETF to perform an efficient and successful de-authentication attack on every test run. The ETF can also capture the WPA handshake on every test run. The following code makes it possible to observe the ETF's successful execution. - -``` -███████╗████████╗███████╗ -██╔════╝╚══██╔══╝██╔════╝ -█████╗     ██║   █████╗   -██╔══╝     ██║   ██╔══╝   -███████╗   ██║   ██║     -╚══════╝   ╚═╝   ╚═╝     -                                        - -[+] Do you want to load an older session? [Y/n]: n -[+] Creating new temporary session on 02/08/2018 -[+] Enter the desired session name: -ETF[etf/aircommunicator/]::> config airscanner -ETF[etf/aircommunicator/airscanner]::> listargs -  sniffing_interface =               wlan1; (var) -              probes =                True; (var) -             beacons =                True; (var) -        hop_channels =               false; (var) -fixed_sniffing_channel =                  11; (var) -ETF[etf/aircommunicator/airscanner]::> start airscanner with -arpreplayer        caffelatte         credentialsniffer  packetlogger       selfishwifi         -ETF[etf/aircommunicator/airscanner]::> start airscanner with credentialsniffer -[+] Successfully added credentialsniffer plugin. -[+] Starting packet sniffer on interface 'wlan1' -[+] Set fixed channel to 11 -ETF[etf/aircommunicator/airscanner]::> add aps where ssid = CrackWPA -ETF[etf/aircommunicator/airscanner]::> start airinjector -ETF[etf/aircommunicator/airscanner]::> [+] Starting deauthentication attack -                    - 1000 bursts of 1 packets -                    - 1 different packets -[+] Injection attacks finished executing. -[+] Starting post injection methods -[+] Post injection methods finished -[+] WPA Handshake found for client '70:3e:ac:bb:78:64' and network 'CrackWPA' -``` - -#### Launching an ARP replay attack and cracking a WEP network - -The next scenario (Figure 3) will also focus on the [Address Resolution Protocol][9] (ARP) replay attack's efficiency and the speed of capturing the WEP data packets containing the initialization vectors (IVs). The same network may require a different number of caught IVs to be cracked, so the limit for this scenario is 50,000 IVs. If the network is cracked during the first test with less than 50,000 IVs, that number will be the new limit for the following tests on the network. The cracking tool to be used will be **aircrack-ng**. - -The test scenario starts with an access point using WEP encryption and an offline client that knows the key—the key for testing purposes is 12345, but it can be a larger and more complex key. Once the client connects to the WEP access point, it will send out a gratuitous ARP packet; this is the packet that's meant to be captured and replayed. The test ends once the limit of packets containing IVs is captured. - -![Scenario for capturing a WPA handshake after a de-authentication attack][11] - -Figure 3: Scenario for capturing a WPA handshake after a de-authentication attack - -ETF uses Python's Scapy library for packet sniffing and injection. To minimize known performance problems in Scapy, ETF tweaks some of its low-level libraries to significantly speed packet injection. For this specific scenario, the ETF uses **tcpdump** as a background process instead of Scapy for more efficient packet sniffing, while Scapy is used to identify the encrypted ARP packet. - -This scenario requires the following commands and operations to be performed on the ETF: - - 1. Enter the AirScanner configuration mode: **config airscanner** - 2. Configure the AirScanner to not hop channels: **set hop_channels = false** - 3. Set the channel to sniff the traffic on the access point channel (APC): **set fixed_sniffing_channel = ** - 4. Enter the ARPReplayer plugin configuration mode: **config arpreplayer** - 5. Set the target access point BSSID (APB) of the WEP network: **set target_ap_bssid ** - 6. Start the AirScanner module with the ARPReplayer plugin: **start airscanner with arpreplayer** - - - -After executing these commands, ETF correctly identifies the encrypted ARP packet, then successfully performs an ARP replay attack, which cracks the network. - -#### Launching a catch-all honeypot - -The scenario in Figure 4 creates multiple access points with the same SSID. This technique discovers the encryption type of a network that was probed for but out of reach. By launching multiple access points with all security settings, the client will automatically connect to the one that matches the security settings of the locally cached access point information. - -![Scenario for capturing a WPA handshake after a de-authentication attack][13] - -Figure 4: Scenario for capturing a WPA handshake after a de-authentication attack - -Using the ETF, it is possible to configure the **hostapd** configuration file then launch the program in the background. Hostapd supports launching multiple access points on the same wireless card by configuring virtual interfaces, and since it supports all types of security configurations, a complete catch-all honeypot can be set up. For the WEP and WPA(2)-PSK networks, a default password is used, and for the WPA(2)-EAP, an "accept all" policy is configured. - -For this scenario, the following commands and operations must be performed on the ETF: - - 1. Enter the APLauncher configuration mode: **config aplauncher** - 2. Set the desired access point SSID (APS): **set ssid = ** - 3. Configure the APLauncher as a catch-all honeypot: **set catch_all_honeypot = true** - 4. Start the AirHost module: **start airhost** - - - -With these commands, the ETF can launch a complete catch-all honeypot with all types of security configurations. ETF also automatically launches the DHCP and DNS servers that allow clients to stay connected to the internet. ETF offers a better, faster, and more complete solution to create catch-all honeypots. The following code enables the successful execution of the ETF to be observed. - -``` -███████╗████████╗███████╗ -██╔════╝╚══██╔══╝██╔════╝ -█████╗     ██║   █████╗   -██╔══╝     ██║   ██╔══╝   -███████╗   ██║   ██║     -╚══════╝   ╚═╝   ╚═╝     -                                        - -[+] Do you want to load an older session? [Y/n]: n -[+] Creating ne´,cxzw temporary session on 03/08/2018 -[+] Enter the desired session name: -ETF[etf/aircommunicator/]::> config aplauncher -ETF[etf/aircommunicator/airhost/aplauncher]::> setconf ssid CatchMe -ssid = CatchMe -ETF[etf/aircommunicator/airhost/aplauncher]::> setconf catch_all_honeypot true -catch_all_honeypot = true -ETF[etf/aircommunicator/airhost/aplauncher]::> start airhost -[+] Killing already started processes and restarting network services -[+] Stopping dnsmasq and hostapd services -[+] Access Point stopped... -[+] Running airhost plugins pre_start -[+] Starting hostapd background process -[+] Starting dnsmasq service -[+] Running airhost plugins post_start -[+] Access Point launched successfully -[+] Starting dnsmasq service -``` - -### Conclusions and future work - -These scenarios use common and well-known attacks to help validate the ETF's capabilities for testing WiFi networks and clients. The results also validate that the framework's architecture enables new attack vectors and features to be developed on top of it while taking advantage of the platform's existing capabilities. This should accelerate development of new WiFi penetration-testing tools, since a lot of the code is already written. Furthermore, the fact that complementary WiFi technologies are all integrated in a single tool will make WiFi pen-testing simpler and more efficient. - -The ETF's goal is not to replace existing tools but to complement them and offer a broader choice to security auditors when conducting WiFi pen-testing and improving user awareness. - -The ETF is an open source project [available on GitHub][14] and community contributions to its development are welcomed. Following are some of the ways you can help. - -One of the limitations of current WiFi pen-testing is the inability to log important events during tests. This makes reporting identified vulnerabilities both more difficult and less accurate. The framework could implement a logger that can be accessed by every class to create a pen-testing session report. - -The ETF tool's capabilities cover many aspects of WiFi pen-testing. On one hand, it facilitates the phases of WiFi reconnaissance, vulnerability discovery, and attack. On the other hand, it doesn't offer a feature that facilitates the reporting phase. Adding the concept of a session and a session reporting feature, such as the logging of important events during a session, would greatly increase the value of the tool for real pen-testing scenarios. - -Another valuable contribution would be extending the framework to facilitate WiFi fuzzing. The IEEE 802.11 protocol is very complex, and considering there are multiple implementations of it, both on the client and access point side, it's safe to assume these implementations contain bugs and even security flaws. These bugs could be discovered by fuzzing IEEE 802.11 protocol frames. Since Scapy allows custom packet creation and injection, a fuzzer can be implemented through it. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/evil-twin-framework - -作者:[André Esser][a] -选题:[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/andreesser -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Rogue_access_point -[2]: https://www.python.org/ -[3]: https://scapy.net -[4]: /file/417776 -[5]: https://opensource.com/sites/default/files/uploads/pic1.png (Evil-Twin Framework Architecture) -[6]: https://www.metasploit.com -[7]: /file/417781 -[8]: https://opensource.com/sites/default/files/uploads/pic2.png (Scenario for capturing a WPA handshake after a de-authentication attack) -[9]: https://en.wikipedia.org/wiki/Address_Resolution_Protocol -[10]: /file/417786 -[11]: https://opensource.com/sites/default/files/uploads/pic3.png (Scenario for capturing a WPA handshake after a de-authentication attack) -[12]: /file/417791 -[13]: https://opensource.com/sites/default/files/uploads/pic4.png (Scenario for capturing a WPA handshake after a de-authentication attack) -[14]: https://github.com/Esser420/EvilTwinFramework diff --git a/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md new file mode 100644 index 0000000000..da26f24c2d --- /dev/null +++ b/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Evil-Twin Framework: A tool for improving WiFi security) +[#]: via: (https://opensource.com/article/19/1/evil-twin-framework) +[#]: author: (André Esser https://opensource.com/users/andreesser) + +Evil-Twin 框架:一个用于提升 WiFi 安全性的工具 +====== +了解一款用于对 WiFi 安全性进行手动测试的工具,这款工具可以通过不同类型安全威胁的漏洞点进行测试。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-cloud-safe.png?itok=yj2TFPzq) + +越来越多的设备通过无线传输的方式连接到互联网,以及,WiFi 接入点大范围的可用,这两者为攻击者攻击用户提供了很多机会。通过欺骗用户连接到虚假的 WiFi 接入点,攻击者可以完全控制用户的网络连接,这将使得攻击者可以嗅探和篡改用户通过无线连接进行发送和接收的数据包,将用户的连接重定向到一个恶意的网站,并通过网络发起其他的攻击。 + +为了保护用户并告诉他们如何避免线上的危险操作,安全审计人员和安全研究员必须评估用户的安全实践能力,用户常常在没有确认该 WiFi 接入点为安全的情况下就连接上了该网络,安全审计人员和研究员需要去了解这背后的原因。有很多工具都可以对 WiFi 的安全性进行审计,但是没有一款工具可以测试大量不同的攻击场景,也没有能和其他工具集成得很好的工具。 + +Evil-Twin Framework(ETF)用于在 WiFi 审计过程中解决这些问题。审计者能够使用 ETF 来集成多种工具并测试该 WiFi 在不同场景下的安全性。本文会介绍 ETF 的框架和功能,然后会提供一些案例来说明该如何使用这款工具。 + +### ETF 的架构 + +ETF 的框架是用 python 写的,因为这门开发语言的代码读起来非常容易,也方便其他开发者向这个项目贡献代码。除此之外,很多 ETF 的库,比如 Scapy,都是为 python 开发的,很容易就能将它们用于 ETF。 + +ETF 的架构(图1)分为不同的模块,模块之间相互作用。框架的设置都写在一个单独的配置文件里。用户可以通过 ConfigurationManager 类里的用户界面验证并修改这些配置。其他模块只能读取这些设置并根据这些设置进行运行。 + +![Evil-Twin Framework Architecture][5] + +图 1:Evil-Twin 的框架架构 + +ETF 支持多种用户界面来与框架交互,当前的默认界面是一个交互式控制台界面,类似于 Metasploit 那种。正在开发用于桌面/浏览器使用的图形用户界面(GUI)和命令行界面(CLI),移动端界面也是未来的一个备选项。用户可以使用交互式控制台界面来修改配置文件里的设置(最终会使用 GUI)。用户界面可以与框架里存在的每个模块进行交互。 + +WiFi 模块(AirCommunicator)用于支持多种 WiFi 功能和攻击。该框架确定了 Wi-Fi 通信的三个基本支柱:数据包嗅探,自定义数据包注入和创建接入点。三个主要的 WiFi 通信模块是 AirScanner,AirInjector,和 AirHost,它们分别用于数据包嗅探,数据包注入,和接入点创建。这三个类包含在主 WiFi 模块 AirCommunicator 中,AirCommunicator 在启动这些服务之前会先读取这些服务的配置文件。使用这些核心功能的一个或多个就可以构造任意类型的 WiFi 攻击。 + +使用中间人(MITM)攻击,这是一种攻击 WiFi 客户端的常见手法。ETF 有一个叫做 ETFITM(Evil-Twin Framework-in-the-Middle)的集成模块,这个模块用于创建一个 web 代理,来拦截和修改经过的 HTTP/HTTPS 数据包。 + +许多其他的工具也可以使用 ETF 创建 MITM。通过它的可扩展性,ETF 能够支持它们,而不必单独地调用它们,你可以通过扩展 Spawner 类来将这些工具添加到框架里。这使得开发者和安全审计人员可以使用框架里预先配置好的参数字符来调用程序。 + +扩展 ETF 的另一种方法就是通过插件。有两类插件:WiFi 插件和 MITM 插件。MITM 插件是在 MITM 代理运行时可以执行的脚本。代理会将 HTTP(s)请求和响应传递给可以记录和处理它们的插件。WiFi 插件遵循一个更加复杂的执行流程,但仍然会给想参与开发并且使用自己插件的贡献者提供一个相对简单的 API。WiFi 插件还可以进一步地划分为三类,其中一类用于每个核心 WiFi 通信模块。 + +每个核心模块都有一些事件能触发响应的插件的执行。举个栗子,AirScanner 有三个已定义的事件,可以对其进行编程。事件通常对应于服务开始运行之前的设置阶段,服务正在运行时的中间执行阶段,服务完成后的卸载或清理阶段。因为 python 允许多重继承,所以一个插件可以继承多个插件类。 + +图 1 是框架架构的摘要。指向远离 ConfigurationManager 的行意味着模块会从中读取信息,指向它的行意味着模块会编写/修改配置。 + +### 使用 ETF 的实例 + +ETF 可以通过多种方式对 WiFi 的网络安全或者终端用户的 WiFi 安全意识进行渗透测试。下面的例子描述了这个框架的一些手动测试的功能,例如接入点和客户端检测,对使用 WPA 和 WEP 类型协议的接入点进行攻击,和创建恶意的双接入点。 + +这些例子是使用 ETF 设计的,WiFi 卡允许进行 WiFi 数据捕获。它们同样为 ETF 设置命令使用了下面这些缩写: + + * **APS** access point SSID + * **APB** access point BSSID + * **APC** access point channel + * **CM** client MAC address + + + +在实际的测试场景中,确保你使用了正确的信息来替换这些缩写。 + +#### 在解除认证攻击后捕获 WPA 四次握手的数据包。 + +这个场景(图 2)做了两个方面的考虑:解除认证攻击和捕获 WPA 四次握手数据包的可能性。这个场景从一个运行 WPA/WPA2 的接入点开始,这个接入点有一个已经连上的客户端设备(在本例中是一台智能手机)。目的是通过一般的解除认证攻击(译者注:类似于 DOS 攻击)来让客户端断开和 WiFi 的网络,然后在客户端尝试重连的时候捕获 WPA 的握手包。重连会在断开连接后马上手动完成。 + +![Scenario for capturing a WPA handshake after a de-authentication attack][8] + +图 2:在解除认证攻击后捕获 WPA 握手包的场景 + +在这个例子中需要考虑的是 ETF 的可靠性。目的是确认工具是否一直都能捕获 WPA 的握手数据包。每个工具都会用来多次复现这个场景,以此来检查它们在捕获 WPA 握手数据包时的可靠性。 + +使用 ETF 来捕获 WPA 握手数据包的方法不止一种。一种方法是使用 AirScanner 和 AirInjector 两个模块的组合;另一种方法是只使用 AirInjector。下面这个场景是使用了两个模块的组合。 + +ETF 启用了 AirScanner 模块并分析 IEEE 802.11 数据帧来发现 WPA 握手包。然后 AirInjecto 就可以使用解除认证攻击来强制客户端断开连接,以进行重连。必须在 ETF 上执行下面这些步骤才能完成上面的目标: + + 1. 进入 AirScanner 配置模式: **config airscanner** + 2. 设置 AirScanner 不跳信道: **config airscanner** + 3. 设置信道以嗅探经过 WiFi 接入点信道的数据(APC): **set fixed_sniffing_channel = ** + 4. 使用 CredentialSniffer 插件来启动 AirScanner 模块: **start airscanner with credentialsniffer** + 5. 从已嗅探的接入点列表中添加目标接入点的 BSSID(APS): **add aps where ssid = ** + 6. 启用 AirInjector 模块,在默认情况下,它会启用解除认证攻击: **start airinjector** + + + +这些简单的命令设置能让 ETF 在每次测试时执行成功且有效的解除认证攻击。ETF 也能在每次测试的时候捕获 WPA 的握手数据包。下面的代码能让我们看到 ETF 成功的执行情况。 + +``` +███████╗████████╗███████╗ +██╔════╝╚══██╔══╝██╔════╝ +█████╗     ██║   █████╗   +██╔══╝     ██║   ██╔══╝   +███████╗   ██║   ██║     +╚══════╝   ╚═╝   ╚═╝     +                                        + +[+] Do you want to load an older session? [Y/n]: n +[+] Creating new temporary session on 02/08/2018 +[+] Enter the desired session name: +ETF[etf/aircommunicator/]::> config airscanner +ETF[etf/aircommunicator/airscanner]::> listargs +  sniffing_interface =               wlan1; (var) +              probes =                True; (var) +             beacons =                True; (var) +        hop_channels =               false; (var) +fixed_sniffing_channel =                  11; (var) +ETF[etf/aircommunicator/airscanner]::> start airscanner with +arpreplayer        caffelatte         credentialsniffer  packetlogger       selfishwifi         +ETF[etf/aircommunicator/airscanner]::> start airscanner with credentialsniffer +[+] Successfully added credentialsniffer plugin. +[+] Starting packet sniffer on interface 'wlan1' +[+] Set fixed channel to 11 +ETF[etf/aircommunicator/airscanner]::> add aps where ssid = CrackWPA +ETF[etf/aircommunicator/airscanner]::> start airinjector +ETF[etf/aircommunicator/airscanner]::> [+] Starting deauthentication attack +                    - 1000 bursts of 1 packets +                    - 1 different packets +[+] Injection attacks finished executing. +[+] Starting post injection methods +[+] Post injection methods finished +[+] WPA Handshake found for client '70:3e:ac:bb:78:64' and network 'CrackWPA' +``` + +#### 使用 ARP 重放攻击并破解 WEP 无线网络 + +下面这个场景(图 3)将关注地址解析协议(ARP)重放攻击的效率和捕获包含初始化向量(IVs)的 WEP 数据包的速度。相同的网络可能需要破解不同数量的捕获的 IVs,所以这个场景的 IVs 上限是 50000。如果这个网络在首次测试期间,还未捕获到 50000IVs 就崩溃了,那么实际捕获到的 IVs 数量会成为这个网络在接下来的测试里的新的上限。我们使用 aircrack-ng 对数据包进行破解。 + +测试场景从一个使用 WEP 协议进行加密的 WiFi 接入点和一台知道其密钥的离线客户端设备开始-为了测试密钥使用了 12345,但它可以是更长且更复杂的密钥。一旦客户端连接到了 WEP 接入点,它会发送一个 ARP 数据包;这是要捕获和重放的数据包。一旦被捕获的包含 IVs 的数据包数量达到了设置的上限,测试就结束了。 + +![Scenario for capturing a WPA handshake after a de-authentication attack][11] + +图 3:在进行解除认证攻击后捕获 WPA 握手包的场景 + +ETF 使用 Python 的 Scapy 库来进行包嗅探和包注入。为了最大限度地解决 Scapy 里的已知性能问题,ETF 微调了一些低级库,来大大加快包注入的速度。对于这个特定的场景,ETF 为了更有效率地嗅探,使用了 tcpdump 作为后台进程而不是 Scapy,Scapy 用于识别加密的 ARP 数据包。 + +这个场景需要在 ETF 上执行下面这些命令和操作: + + 1. 进入 AirScanner 设置模式: **config airscanner** + 2. 设置 AirScanner 不跳信道: **set hop_channels = false** + 3. 设置信道以嗅探经过接入点信道的数据(APC): **set fixed_sniffing_channel = ** + 4. 进入 ARPReplayer 插件设置模式: **config arpreplayer** + 5. 设置 WEP 网络目标接入点的 BSSID(APB): **set target_ap_bssid ** + 6. 使用 ARPReplayer 插件启动 AirScanner 模块: **start airscanner with arpreplayer** + + + +在执行完这些命令后,ETF 会正确地识别加密的 ARP 数据包,然后成功执行 ARP 重放攻击,以此破坏这个网络。 + +#### 使用一款全能型蜜罐 + +图 4 中的场景使用相同的 SSID 创建了多个接入点,对于那些可以探测到但是无法接入的 WiFi 网络,这个技术可以发现网络的加密类型。通过启动具有所有安全设置的多个接入点,客户端会自动连接和本地缓存的接入点信息相匹配的接入点。 + +![Scenario for capturing a WPA handshake after a de-authentication attack][13] + +图 4:在解除认证攻击后捕获 WPA 握手包数据。 + +使用 ETF,可以去设置 hostapd 配置文件,然后在后台启动该程序。Hostpad 支持在一张无线网卡上通过设置虚拟接口开启多个接入点,并且因为它支持所有类型的安全设置,因此可以设置完整的全能蜜罐。对于使用 WEP 和 WPA(2)-PSK 的网络,使用默认密码,和对于使用 WPA(2)-EAP 的网络,配置“全部接受”策略。 + +对于这个场景,必须在 ETF 上执行下面的命令和操作: + + 1. 进入 APLauncher 设置模式: **config aplauncher** + 2. 设置目标接入点的 SSID(APS): **set ssid = ** + 3. 设置 APLauncher 为全部接收的蜜罐: **set catch_all_honeypot = true** + 4. 启动 AirHost 模块: **start airhost** + + + +使用这些命令,ETF 可以启动一个包含所有类型安全配置的完整全能蜜罐。ETF 同样能自动启动 DHCP 和 DNS 服务器,从而让客户端能与互联网保持连接。ETF 提供了一个更好、更快、更完整的解决方案来创建全能蜜罐。下面的代码能够看到 ETF 的成功执行。 + +``` +███████╗████████╗███████╗ +██╔════╝╚══██╔══╝██╔════╝ +█████╗     ██║   █████╗   +██╔══╝     ██║   ██╔══╝   +███████╗   ██║   ██║     +╚══════╝   ╚═╝   ╚═╝     +                                        + +[+] Do you want to load an older session? [Y/n]: n +[+] Creating ne´,cxzw temporary session on 03/08/2018 +[+] Enter the desired session name: +ETF[etf/aircommunicator/]::> config aplauncher +ETF[etf/aircommunicator/airhost/aplauncher]::> setconf ssid CatchMe +ssid = CatchMe +ETF[etf/aircommunicator/airhost/aplauncher]::> setconf catch_all_honeypot true +catch_all_honeypot = true +ETF[etf/aircommunicator/airhost/aplauncher]::> start airhost +[+] Killing already started processes and restarting network services +[+] Stopping dnsmasq and hostapd services +[+] Access Point stopped... +[+] Running airhost plugins pre_start +[+] Starting hostapd background process +[+] Starting dnsmasq service +[+] Running airhost plugins post_start +[+] Access Point launched successfully +[+] Starting dnsmasq service +``` + +### 结论和以后的工作 + +这些场景使用常见和总所周知的攻击方式来帮助验证 ETF 测试 WIFI 网络和客户端的能力。这个结果同样证明了框架的架构能在平台现有功能的优势上开发新的攻击向量和功能。这会加快新的 WiFi 渗透测试工具的开发,因为很多的代码已经写好了。除此之外,将 WiFi 技术相关的东西都集成到一个单独的工具里,会使 WiFi 渗透测试更加简单高效。 + +ETF 的目标不是取代现有的工具,而是为它们提供补充,并为安全审计人员在进行 WiFi 测试和提升用户安全意识时,提供一个更好的选择。 + +ETF 是 GitHub 上的一个开源项目,欢迎社区为它的开发做出贡献。下面是一些您可以提供帮助的方法。 + +当前 WiFi 手动测试的一个限制是无法在测试期间记录重要的事件。这使得报告已经识别到的漏洞更加困难且准确性更低。这个框架可以实现一个登陆器,每个类都可以来访问它并创建一个手动测试会话报告。 + +ETF 工具的功能涵盖了 WiFi 手动测试的方方面面。一方面,它让 WiFi 目标侦察,漏洞挖掘和攻击这些阶段变得更加容易。另一方面,它没有提供一个便于提交报告的功能。增加会话的概念和会话报告的功能,比如在一个会话期间记录重要的事件,会极大地增加这个工具对于真实手动测试场景的价值。 + +另一个有价值的贡献是扩展框架来促进 WiFi 模糊测试。IEEE 802.11 协议非常的复杂,考虑到它在客户端和接入点两方面都会有多种实现方式。可以假设这些实现都包含 bug 甚至是安全漏洞。这些 bug 可以通过对 IEEE 802.11 协议的数据帧进行模糊测试来进行发现。因为 Scapy 允许自定义的数据包创建和数据包注入,可以通过它实现一个模糊测试器。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/evil-twin-framework + +作者:[André Esser][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/andreesser +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Rogue_access_point +[2]: https://www.python.org/ +[3]: https://scapy.net +[4]: /file/417776 +[5]: https://opensource.com/sites/default/files/uploads/pic1.png (Evil-Twin Framework Architecture) +[6]: https://www.metasploit.com +[7]: /file/417781 +[8]: https://opensource.com/sites/default/files/uploads/pic2.png (Scenario for capturing a WPA handshake after a de-authentication attack) +[9]: https://en.wikipedia.org/wiki/Address_Resolution_Protocol +[10]: /file/417786 +[11]: https://opensource.com/sites/default/files/uploads/pic3.png (Scenario for capturing a WPA handshake after a de-authentication attack) +[12]: /file/417791 +[13]: https://opensource.com/sites/default/files/uploads/pic4.png (Scenario for capturing a WPA handshake after a de-authentication attack) +[14]: https://github.com/Esser420/EvilTwinFramework From 3047faa00b6fe70de79867f834b26eff12113cc9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 23:04:00 +0800 Subject: [PATCH 296/813] PUB:20190103 How to use Magit to manage Git projects.md @lujun9972 https://linux.cn/article-10564-1.html --- .../20190103 How to use Magit to manage Git projects.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190103 How to use Magit to manage Git projects.md (98%) diff --git a/translated/tech/20190103 How to use Magit to manage Git projects.md b/published/20190103 How to use Magit to manage Git projects.md similarity index 98% rename from translated/tech/20190103 How to use Magit to manage Git projects.md rename to published/20190103 How to use Magit to manage Git projects.md index 4885ed3c70..f9370ca14e 100644 --- a/translated/tech/20190103 How to use Magit to manage Git projects.md +++ b/published/20190103 How to use Magit to manage Git projects.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10564-1.html) [#]: subject: (How to use Magit to manage Git projects) [#]: via: (https://opensource.com/article/19/1/how-use-magit) [#]: author: (Sachin Patil https://opensource.com/users/psachin) From c632ebe43a2917ff9d7580e19b34f73eda8a3a9b Mon Sep 17 00:00:00 2001 From: Name1e5s <836401406@qq.com> Date: Sat, 23 Feb 2019 23:25:15 +0800 Subject: [PATCH 297/813] [translating] Qalculate- - The Best Calculator Application in The Entire Universe.md --- ...- - The Best Calculator Application in The Entire Universe.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md index 6cbea61308..03e87367b5 100644 --- a/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md +++ b/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md @@ -1,3 +1,4 @@ +name1e5s translating Qalculate! – The Best Calculator Application in The Entire Universe ====== I have been a GNU-Linux user and a [Debian][1] user for more than a decade. As I started using the desktop more and more, it seemed to me that apart from few web-based services most of my needs were being met with [desktop applications][2] within Debian itself. From 9b54c88741486859d28ec4f7a8f114f83b969455 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 23:55:59 +0800 Subject: [PATCH 298/813] PRF:20190123 Book Review- Fundamentals of Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @mySoul8012 恭喜你完成了第一篇翻译。 --- ...0123 Book Review- Fundamentals of Linux.md | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/translated/talk/20190123 Book Review- Fundamentals of Linux.md b/translated/talk/20190123 Book Review- Fundamentals of Linux.md index fc05d96fec..3b342fcb5f 100644 --- a/translated/talk/20190123 Book Review- Fundamentals of Linux.md +++ b/translated/talk/20190123 Book Review- Fundamentals of Linux.md @@ -1,54 +1,56 @@ [#]: collector: (lujun9972) [#]: translator: (mySoul8012) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Book Review: Fundamentals of Linux) [#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review) [#]: author: (John Paul https://itsfoss.com/author/john/) -书评:linux的基础知识 +书评:《Linux 基础》 ====== -有很多很棒的书籍涵盖了Linux的基础知识以及它的工作原理,今天,我们将会书评这样一本书,讨论的主题为Oliver Pelz所写的[linux的基础知识][1],由[PacktPub][2]发布。 -[Oliver Pelz][3] 是一位超过十年软件开发人员和系统管理员经验人员,同时拥有生物信息学学位证书。 +介绍 Linux 的基础知识以及它的工作原理的书很多,今天,我们将会点评这样一本书。这次讨论的主题为 Oliver Pelz 所写的 《[Linux 基础][1]Fundamentals of Linux》,由 [PacktPub][2] 出版。 -### 什么是linux基础知识一书 +[Oliver Pelz][3] 是一位拥有超过十年软件开发经验的开发者和系统管理员,拥有生物信息学学位证书。 + +### 《Linux 基础》 ![Fundamental of Linux books][4] -正如可以从标题中猜到那样,该书(Linux基础知识)的目标是为读者打下一个了解Linux命令行的坚实基础。这本书一共有两百多页。因此它专注于教授用户日常遇到的问题,以及任务。本书为想要成为Linux管理员的读者而书写。 -第一章首先概述了虚拟化。本书作者指导了读者如何在[VirtualBox][6]中创建[CentOS][5]实例。如何克隆实例,如何使用快照。并且同时你也会学习到如何通过SSH命令连接到虚拟机。 +正如可以从书名中猜到那样,《Linux 基础》的目标是为读者打下一个从了解 Linux 到学习 Linux 命令行的坚实基础。这本书一共有两百多页,因此它专注于教给用户日常任务和解决经常遇到的问题。本书是为想要成为 Linux 管理员的读者而写的。 -第二章介绍了Linux的命令行的基础知识,包括shell GLOB模式,shell扩展,如何使用包含空格和特殊字符的文件名称。如何来获取命令手册的帮助页面。如何使用`sed`, `awk`这两个命令。如何浏览Linux的文件系统。 +第一章首先概述了虚拟化。本书作者指导了读者如何在 [VirtualBox][6] 中创建 [CentOS][5] 实例。如何克隆实例,如何使用快照。并且同时你也会学习到如何通过 SSH 命令连接到虚拟机。 -第三章更深入的介绍了Linux文件系统。您将了解如何在Linux中链接文件,以及如何搜索它们。您还将获得用户,组,以及文件权限的概述。由于本章的重点介绍了如何与文件进行交互。因此还将会介绍如何从命令行中读取文本文件,以及如何使用vim编辑器。 +第二章介绍了 Linux 命令行的基础知识,包括 shell 通配符,shell 展开,如何使用包含空格和特殊字符的文件名称。如何来获取命令手册的帮助页面。如何使用 `sed`、`awk` 这两个命令。如何浏览 Linux 的文件系统。 -第四章重点介绍了如何使用命令行。以及涵盖的重要命令。如`cat`, `sort`, `awk`. `tee`, `tar`,`rsync`, `nmap`, `htop`等。您还将会了解这些命令的流程,以及如何相互使用,还将介绍Bash shell脚本。 +第三章更深入的介绍了 Linux 文件系统。你将了解如何在 Linux 中文件是如何链接的,以及如何搜索它们。你还将获得用户、组,以及文件权限的大概了解。由于本章的重点介绍了如何与文件进行交互。因此还将会介绍如何从命令行中读取文本文件,以及初步了解如何使用 vim 编辑器。 -第五章同时也是本书的最后一章,将会介绍Linux和其他高级命令,以及网络的概念。本书的作者讨论了Linux如何处理网络并提供使用多个虚拟机的示例。同时还将会介绍如何安装新的程序,如何设置防火墙。 +第四章重点介绍了如何使用命令行。以及涵盖的重要命令。如 `cat`、`sort`、`awk`、`tee`、`tar`、`rsync`、`nmap`、`htop` 等。你还将会了解到进程,以及它们如何彼此通讯。这一章还介绍了 Bash shell 脚本编程。 -### 关于这本书的想法 +第五章同时也是本书的最后一章,将会介绍 Linux 和其他高级命令,以及网络的概念。本书的作者讨论了 Linux 是如何处理网络,并提供使用多个虚拟机的示例。同时还将会介绍如何安装新的程序,如何设置防火墙。 -Linux的基础知识可能看起来很见到,但是涵盖了相当多的信息。同时也将会获得如何使用命令行所需要的知识的一切。 +### 关于这本书的思考 -使用本书的时候,需要注意一件事情,即,本书专注于对命令行的关注,没有任何关于如何使用图形化的用户界面的任何教程。这是因为在Linux中有太多不同的桌面环境,以及很多的类似的操作系统。因此很难编写一本可以涵盖所有变量的书。部分原因还因为本书的面向的用户群体为Linux管理员。 +Linux 的基础知识只有五章和少少的 200 来页可能看起来有些短,但是也涵盖了相当多的信息。同时也将会获得如何使用命令行所需要的知识的一切。 -当我看到作者使用Centos教授Linux的时候有点惊讶。我原本以为他会使用更为常见的Linux的发行版本,例如Ubuntu,Debian或者Fedora。原因在于Centos是为服务器设计的发行版本。随着时间的推移变化很小。能够为Linux的基础知识打下一个非常坚实的基础。 +使用本书的时候,需要注意一件事情,即,本书专注于对命令行的关注,没有任何关于如何使用图形化的用户界面的任何教程。这是因为在 Linux 中有太多不同的桌面环境,以及很多的类似的系统应用,因此很难编写一本可以涵盖所有变种的书。此外,还有部分原因还因为本书的面向的用户群体为潜在的 Linux 管理员。 -自己使用Linux已经操作五年了。我大部分时间都在使用桌面版本的Linux。我有些时候会使用命令行操作。但我并没有花太多的时间在哪里。我使用鼠标执行了本书中很多的操作。现在呢。我同时也知道了如何通过终端做出同样的事情。这种方式不会改变我完成任务的路径。但是会更加帮助自己理解幕后发生的事情。 +当我看到作者使用 Centos 教授 Linux 的时候有点惊讶。我原本以为他会使用更为常见的 Linux 的发行版本,例如 Ubuntu、Debian 或者 Fedora。原因在于 Centos 是为服务器设计的发行版本。随着时间的推移变化很小,能够为 Linux 的基础知识打下一个非常坚实的基础。 -如果您刚刚使用Linux,或者计划使用。我不会推荐您阅读这本书。这可能有点绝对化。但是如何您已经花了一些时间在Linux上。或者可以快速掌握某种技术语言。那么这本书很适合你。 +我自己使用 Linux 已经操作五年了。我大部分时间都在使用桌面版本的 Linux。我有些时候会使用命令行操作。但我并没有花太多的时间在那里。我使用鼠标完成了本书中涉及到的很多操作。现在呢。我同时也知道了如何通过终端做到同样的事情。这种方式不会改变我完成任务的方式,但是会有助于自己理解幕后发生的事情。 -如果您认为本书适合您的学习需求。您可以从以下链接获取到该书。 +如果你刚刚使用 Linux,或者计划使用。我不会推荐你阅读这本书。这可能有点绝对化。但是如何你已经花了一些时间在 Linux 上。或者可以快速掌握某种技术语言。那么这本书很适合你。 -我们将在未来几个月内尝试查看更多Linux书籍,敬请关注我们。 +如果你认为本书适合你的学习需求。你可以从以下链接获取到该书: -你最喜欢的关于Linux的入门书籍是什么?请在下面的评论中告诉我们。 - -如果您发现这篇文章很有趣,请花一点时间在社交媒体,黑客新闻或[Reddit][8]上分享 +- [下载《Linux 基础》](https://www.packtpub.com/networking-and-servers/fundamentals-linux) +我们将在未来几个月内尝试点评更多 Linux 书籍,敬请关注我们。 +你最喜欢的关于 Linux 的入门书籍是什么?请在下面的评论中告诉我们。 + +如果你发现这篇文章很有趣,请花一点时间在社交媒体、Hacker News或 [Reddit][8] 上分享。 -------------------------------------------------------------------------------- @@ -56,8 +58,8 @@ via: https://itsfoss.com/fundamentals-of-linux-book-review 作者:[John Paul][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[mySoul8012](https://github.com/mySoul8012) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0f1983af5503bf2ee1a869c4720867b0d027f9b2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 23 Feb 2019 23:57:58 +0800 Subject: [PATCH 299/813] PUB:20190123 Book Review- Fundamentals of Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @mySoul8012 本文首发地址: https://linux.cn/article-10565-1.html 您的 LCTT 专页地址:https://linux.cn/lctt/mySoul8012 请注册领取 LCCN:https://lctt.linux.cn/ --- .../20190123 Book Review- Fundamentals of Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190123 Book Review- Fundamentals of Linux.md (98%) diff --git a/translated/talk/20190123 Book Review- Fundamentals of Linux.md b/published/20190123 Book Review- Fundamentals of Linux.md similarity index 98% rename from translated/talk/20190123 Book Review- Fundamentals of Linux.md rename to published/20190123 Book Review- Fundamentals of Linux.md index 3b342fcb5f..bdde86d16e 100644 --- a/translated/talk/20190123 Book Review- Fundamentals of Linux.md +++ b/published/20190123 Book Review- Fundamentals of Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (mySoul8012) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10565-1.html) [#]: subject: (Book Review: Fundamentals of Linux) [#]: via: (https://itsfoss.com/fundamentals-of-linux-book-review) [#]: author: (John Paul https://itsfoss.com/author/john/) From 172f84040decb5fffbb58e567f78c627d111dabf Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Sun, 24 Feb 2019 11:13:46 +0800 Subject: [PATCH 300/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index 55989a67a7..a3b3c89687 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -102,17 +102,18 @@ Spinnaker comes from Netflix and is more focused on continuous deployment than c Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在一次金丝雀发布(canary deployment)里,我们可以根据收集到的相关监控指标来做出判断:最近这次发布导致了服务降级应该立刻回滚;或者看起来一切OK,于是继续执行部署。 A couple of additional, unique features related to deployments cover an area that is often overlooked when discussing continuous deployment, and might even seem antithetical, but is critical to success: Spinnaker helps make continuous deployment a little less continuous. It will prevent a stage from running during certain times to prevent a deployment from occurring during a critical time in the application lifecycle. It can also enforce manual approvals to ensure the release occurs when the business will benefit the most from the change. In fact, the whole point of continuous integration and continuous deployment is to be ready to deploy changes as quickly as the business needs to change. -谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止继续执行,以阻止可能发生的部署错误。实际上,CI/CD 的主要目的 +谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止执行,以阻止可能发生的部署错误。但它也可以在最关键的时刻让手动审核强制通过,发布新版本上线,使整体收益最大化。实际上,CI/CD 的主要目的就是在商业模式需要调整时,能够让待更新的代码立即得到部署。 ### Screwdriver Screwdriver is an impressively simple piece of engineering. It uses a microservices approach and relies on tools like Nomad, Kubernetes, and Docker to act as its execution engine. There is a pretty good [deployment tutorial][34] for deploying to AWS and Kubernetes, but it could be improved once the in-progress [Helm chart][35] is completed. +Screwdriver 是个简单而又强大的软件。它采用微服务架构,依赖像 Nomad、Kubernetes 和 Docker 这样的工具作为执行引擎。官方有一篇很不错的[部署教学文档][34],介绍了如何将它部署到 AWS 和 Kubernetes 上,但如果相应的 [Helm chart][35] 也完成的话,就更完美了。 Screwdriver also uses YAML for its pipeline descriptions and includes a lot of sensible defaults, so there's less boilerplate configuration for each pipeline. The configuration describes an advanced workflow that can have complex dependencies among jobs. For example, a job can be guaranteed to run after or before another job. Jobs can run in parallel and be joined afterward. You can also use logical operators to run a job, for example, if any of its dependencies are successful or only if all are successful. Even better is that you can specify certain jobs to be triggered from a pull request. Also, dependent jobs won't run when this occurs, which allows easy segregation of your pipeline for when an artifact should go to production and when it still needs to be reviewed. +Screwdriver 也使用 YAML 来描述它的管道,并且有很多合理的默认值,这样可以有效减少各个管道重复的配置项。用配置文件可以组织起高级的工作流,来描述各个 job 间复杂的依赖关系。例如,一项工作可以确保在另一个工作开始前或结束后运行;各个工作可以并行也可以串行执行;更赞的是你可以预先定义一项工作,只在特定的 pull request 请求时被触发,而且与之有依赖关系的工作并不会被执行,这能让你的管道具有一定的隔离性:什么时候被构造的工件应该被部署到生产环境,什么时候应该被审核。 This is only a brief description of these CI/CD tools—each has even more cool features and differentiators you can investigate. They are all open source and free to use, so go deploy them and see which one fits your needs best. - -### What to read next +以上只是我对这些 CI/CD 工具的简单介绍,它们还有许多很酷的特性和差异值得你深入探索。它们都是开源软件,可以自由使用,去部署一下看看,究竟哪个才是最适合你的那个。 -------------------------------------------------------------------------------- From a631b7e292c508e0bf93ccab0533d3257c65f830 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 24 Feb 2019 11:21:26 +0800 Subject: [PATCH 301/813] PRF:20190131 Will quantum computing break security.md @HankChow --- ...1 Will quantum computing break security.md | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/translated/tech/20190131 Will quantum computing break security.md b/translated/tech/20190131 Will quantum computing break security.md index a4b3792e6f..2e55f5fe49 100644 --- a/translated/tech/20190131 Will quantum computing break security.md +++ b/translated/tech/20190131 Will quantum computing break security.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Will quantum computing break security?) @@ -10,42 +10,36 @@ 量子计算会打破现有的安全体系吗? ====== -> 你会希望黑客冒充成你的银行吗? +> 你会希望[某黑客][6]J. Random Hacker假冒你的银行吗? ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) -近年来,量子计算机已经出现在大众的视野当中。量子计算机被认为是第六类计算机,这六类计算机包括: - -1. **人力:** 在人造的计算工具出现之前,人类只能使用人力去进行计算。而承担计算工作的人,只能被称为“计算者”。 - -2. **模拟计算工具:** 由人类制造的一些模拟计算过程的小工具,例如[安提凯希拉装置][1]Antikythera mechanism、星盘、计算尺等等。 - -3. **机械工具:** 在这一个类别中包括了运用到离散数学但未使用电子技术进行计算的工具,例如算盘、Charles Babbage 的差分机Difference Engine等等。 - -4. **电子模拟计算工具:** 这一个类别的计算机多数用于军事方面的用途,例如炸弹瞄准器、枪炮瞄准装置等等。 - -5. **电子计算机:** 这个类别包含的种类就太多了,几乎包含现代所有的电子设备,从移动电话到超级计算机,都在这个类别当中。 - -6. **量子计算机:** 即将进入我们的生活,而且与之前的几类完全不同。 +近年来,量子计算机quantum computer已经出现在大众的视野当中。量子计算机被认为是第六类计算机,这六类计算机包括: +1. 人力Humans:在人造的计算工具出现之前,人类只能使用人力去进行计算。而承担计算工作的人,只能被称为“计算者”。 +2. 模拟计算工具Mechanical analogue:由人类制造的一些模拟计算过程的小工具,例如[安提凯希拉装置][1]Antikythera mechanism星盘astrolabe计算尺slide rule等等。 +3. 机械工具Mechanical digital:在这一个类别中包括了运用到离散数学但未使用电子技术进行计算的工具,例如算盘abacus、Charles Babbage 的差分机Difference Engine等等。 +4. 电子模拟计算工具Electronic analogue:这一个类别的计算机多数用于军事方面的用途,例如炸弹瞄准器、枪炮瞄准装置等等。 +5. 电子计算机Electronic digital:我在这里会稍微冒险一点,我觉得 Colossus 是第一台电子计算机,[^1] :这一类几乎包含现代所有的电子设备,从移动电话到超级计算机,都在这个类别当中。 +6. 量子计算机Quantum computer:即将进入我们的生活,而且与之前的几类完全不同。 ### 什么是量子计算? -量子计算的概念来源于量子力学,因此使用的计算方式和我们平常使用的普通计算并不相同。如果想要深入理解,建议从参考[维基百科上的定义][2]开始。对我们来说,最重要的是理解这一点:量子计算机使用量子位qubit进行计算。在这样的前提下,对于很多数学算法和运算操作,量子计算机的计算速度会比普通计算机要快得多。 +量子计算Quantum computing的概念来源于量子力学quantum mechanics,使用的计算方式和我们平常使用的普通计算非常不同。如果想要深入理解,建议从参考[维基百科上的定义][2]开始。对我们来说,最重要的是理解这一点:量子计算机使用量子位qubit进行计算。在这样的前提下,对于很多数学算法和运算操作,量子计算机的计算速度会比普通计算机要快得多。 这里的“快得多”是按数量级来说的“快得多”。在某些情况下,一个计算任务如果由普通计算机来执行,可能要耗费几年或者几十年才能完成,但如果由量子计算机来执行,就只需要几秒钟。这样的速度甚至令人感到可怕。因为量子计算机会非常擅长信息的加密解密计算,即使在没有密钥的情况下,也能快速完成繁重的计算任务。 -这意味着,如果拥有足够强大的量子计算机,那么你的所有信息都会被一览无遗,任何被加密的数据都可以被正确解密出来,甚至伪造数字签名也会成为可能。这确实是一个严重的问题。毕竟谁也不想被黑客冒充成自己在用的银行,更不希望自己在区块链上的交易被篡改得面目全非。 +这意味着,如果拥有足够强大的量子计算机,那么你的所有信息都会被一览无遗,任何被加密的数据都可以被正确解密出来,甚至伪造数字签名也会成为可能。这确实是一个严重的问题。谁也不想被某个黑客冒充成自己在用的银行,更不希望自己在区块链上的交易被篡改得面目全非。 ### 好消息 尽管上面的提到的问题非常可怕,但也不需要太担心。 -首先,如果要实现上面提到的能力,一台可以操作大量量子位的量子计算机是必不可少的,而这个硬件上的要求就是一个很高的门槛。目前普遍认为,规模大得足以有效破解经典加密算法的量子计算机在最近几年还不可能出现。 +首先,如果要实现上面提到的能力,一台可以操作大量量子位的量子计算机是必不可少的,而这个硬件上的要求就是一个很高的门槛。[^4] 目前普遍认为,规模大得足以有效破解经典加密算法的量子计算机在最近几年还不可能出现。 其次,除了攻击现有的加密算法需要大量的量子位以外,还需要很多量子位来保证容错性。 -还有,尽管确实有一些理论上的模型阐述了量子计算机如何对一些现有的算法作出攻击,但是要让这样的理论模型实际运作起来的难度会比我们想象中大得多。事实上,有一些攻击手段也是未被完全确认是可行的,又或者这些攻击手段还需要继续耗费很多年的改进才能到达如斯恐怖的程度。 +还有,尽管确实有一些理论上的模型阐述了量子计算机如何对一些现有的算法作出攻击,但是要让这样的理论模型实际运作起来的难度会比我们[^5] 想象中大得多。事实上,有一些攻击手段也是未被完全确认是可行的,又或者这些攻击手段还需要继续耗费很多年的改进才能到达如斯恐怖的程度。 最后,还有很多专业人士正在研究能够防御量子计算的算法(这样的算法也被称为“后量子算法post-quantum algorithms”)。如果这些防御算法经过测试以后投入使用,我们就可以使用这些算法进行加密,来对抗量子计算了。 @@ -55,23 +49,25 @@ 但我们也并不是高枕无忧了,以下两个问题就值得我们关注: -1. 人们在设计应用系统的时候仍然没有对量子计算作出太多的考量。如果设计的系统可能会使用 10 年以上,又或者数据存储和加密的时间跨度在 10 年以上,那么就必须考虑量子计算在未来会不会对系统造成不利的影响。 - -2. 新出现的防御量子计算的算法可能会是专有的。也就是说,如果基于这些防御量子计算的算法来设计系统,那么在系统落地的时候,可能会需要为此付费。尽管我是支持开源的,尤其是[开源密码学][3],但我最担心的就是这方面的内容无法被开源。而且,在建立新的协议标准时,无论是故意的,无意的,还是别无选择,都很可能不会使用开源的专有算法。 - - - +1. 人们在设计应用系统的时候仍然没有对量子计算作出太多的考量。如果设计的系统可能会使用 10 年以上,又或者数据加密和签名的时间跨度在 10 年以上,那么就必须考虑量子计算在未来会不会对系统造成不利的影响。 +2. 新出现的防御量子计算的算法可能会是专有的。也就是说,如果基于这些防御量子计算的算法来设计系统,那么在系统落地的时候,可能会需要为此付费。尽管我是支持开源的,尤其是[开源密码学][3],但我最担心的就是无法开源这方面的内容。而且最糟糕的是,在建立新的协议标准时(不管是事实标准还是通过标准组织建立的标准),无论是故意的,还是无意忽略,或者是没有好的开源替代品,他们都很可能使用专有算法而排除使用开源算法。 ### 我们要怎样做? -幸运的是,针对上述两个问题,我们还是有应对措施的。首先,在整个系统的设计阶段,就需要考虑到它是否会受到量子计算的影响,并作出相应的规划。当然了,不需要现在就立即采取行动,因为当前的技术水平也没法实现有效的方案,但至少也要[在加密方面保持敏捷性][4],以便在任何需要的时候为你的协议和系统更换更有效的加密算法。 +幸运的是,针对上述两个问题,我们还是有应对措施的。首先,在整个系统的设计阶段,就需要考虑到它是否会受到量子计算的影响,并作出相应的规划。当然了,不需要现在就立即采取行动,因为当前的技术水平也没法实现有效的方案,但至少也要[在加密方面保持敏捷性][4],以便在任何需要的时候为你的协议和系统更换更有效的加密算法。[^7] 其次是参与开源运动。尽可能鼓励密码学方面的有识之士团结起来,支持开放标准,并投入对非专有的防御量子计算的算法研究当中去。这一点也算是当务之急,因为号召更多的人重视起来并加入研究,比研究本身更为重要。 - - 本文首发于《[Alice, Eve, and Bob][5]》,并在作者同意下重新发表。 +[^1]: 我认为把它称为第一台电子可编程计算机是公平的。我知道有早期的非可编程的,也有些人声称是 ENIAC,但我没有足够的空间或精力在这里争论这件事。 +[^2]: No。 +[^3]: See 2. Don't get me wrong, by the way—I grew up near Weston-super-Mare, and it's got things going for it, but it's not Mayfair. +[^4]: 如果量子物理学家说很难,那么在我看来,就很难。 +[^5]: 而且我假设我们都不是量子物理学家或数学家。 +[^6]: I'm definitely not. +[^7]: 而且不仅仅是出于量子计算的原因:我们现有的一些经典算法很可能会陷入其他非量子攻击,例如新的数学方法。 + -------------------------------------------------------------------------------- via: https://opensource.com/article/19/1/will-quantum-computing-break-security @@ -79,7 +75,7 @@ via: https://opensource.com/article/19/1/will-quantum-computing-break-security 作者:[Mike Bursell][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/) 荣誉推出 @@ -90,4 +86,4 @@ via: https://opensource.com/article/19/1/will-quantum-computing-break-security [3]: https://opensource.com/article/17/10/many-eyes [4]: https://aliceevebob.com/2017/04/04/disbelieving-the-many-eyes-hypothesis/ [5]: https://aliceevebob.com/2019/01/08/will-quantum-computing-break-security/ - +[6]: https://www.techopedia.com/definition/20225/j-random-hacker From ce8bbca6927d915dade91ed9ddd13c7e6db9220b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 24 Feb 2019 11:22:05 +0800 Subject: [PATCH 302/813] PUB:20190131 Will quantum computing break security.md @HankChow https://linux.cn/article-10566-1.html --- .../20190131 Will quantum computing break security.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190131 Will quantum computing break security.md (99%) diff --git a/translated/tech/20190131 Will quantum computing break security.md b/published/20190131 Will quantum computing break security.md similarity index 99% rename from translated/tech/20190131 Will quantum computing break security.md rename to published/20190131 Will quantum computing break security.md index 2e55f5fe49..33323796ce 100644 --- a/translated/tech/20190131 Will quantum computing break security.md +++ b/published/20190131 Will quantum computing break security.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10566-1.html) [#]: subject: (Will quantum computing break security?) [#]: via: (https://opensource.com/article/19/1/will-quantum-computing-break-security) [#]: author: (Mike Bursell https://opensource.com/users/mikecamel) From d898eadcff49e308d29ef440ce1b66482a7bc335 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Sun, 24 Feb 2019 14:02:00 +0800 Subject: [PATCH 303/813] Translating 7 steps for hunting down Python code bugs. --- ...8 7 steps for hunting down Python code bugs.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 45423c44da..276a32c3c0 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -24,19 +24,16 @@ 阅读代码,你甚至可能会想出一个假设。但是在开始修改你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有疑问,目前你还没能准确地知道问题在哪儿。 -确保这个测试是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. +确保这个测试是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。当我尝试着重现这个失败的调用时,我不准备说我创建了一个测试,但是,对的,我已经创建了,但我不认为这是特别不寻常的。从自己的错误中吸取教训。 ### 2. 编写错误的测试 -Now that you have a failing test or maybe a test with an error, it is time to troubleshoot. But before you do that, let's do a review of the stack, as this makes troubleshooting easier. - -The stack consists of all of the tasks you have started but not finished. So, if you are baking a cake and adding the flour to the batter, then your stack would be: - - * Make cake - * Make batter - * Add flour - +现在,你有了一个失败的测试或者可能是一个带有错误的测试,那么是时候解决问题了。但是在你开干之前,让我们先检查下调用栈,因为这样可以更轻松地解决问题。 +调用栈包括你已经启动但尚未完成地所有任务。所以,比如你正在烤蛋糕并准备往面糊里加面粉,那你的调用栈将是: +* 做蛋糕 +* 打面糊 +* 加面粉 You have started making your cake, you have started making the batter, and you are adding the flour. Greasing the pan is not on the list since you already finished that, and making the frosting is not on the list because you have not started that. From 820e01515a407ed583583dade74e9ccd2aa0f3e1 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 24 Feb 2019 17:38:59 +0800 Subject: [PATCH 304/813] =?UTF-8?q?20190219=203=20Tools=20for=20viewing...?= =?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 --- ...s for viewing files at the command line.md | 97 ------------------- ...s for viewing files at the command line.md | 97 +++++++++++++++++++ 2 files changed, 97 insertions(+), 97 deletions(-) delete mode 100644 sources/tech/20190219 3 tools for viewing files at the command line.md create mode 100644 translated/tech/20190219 3 tools for viewing files at the command line.md diff --git a/sources/tech/20190219 3 tools for viewing files at the command line.md b/sources/tech/20190219 3 tools for viewing files at the command line.md deleted file mode 100644 index bd666cc098..0000000000 --- a/sources/tech/20190219 3 tools for viewing files at the command line.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (3 tools for viewing files at the command line) -[#]: via: (https://opensource.com/article/19/2/view-files-command-line) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -3 tools for viewing files at the command line -====== -Take a look at less, Antiword, and odt2txt, three utilities for viewing files in the terminal. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) - -I always say you don't need to use the command line to use Linux effectively—I know many Linux users who never crack open a terminal window and are quite happy. However, even though I don't consider myself a techie, I spend about 20% of my computing time at the command line, manipulating files, processing text, and using utilities. - -One thing I often do in a terminal window is viewing files, whether text or word processor files. Sometimes it's just easier to use a command line utility than to fire up a text editor or a word processor. - -Here are three of the utilities I use to view files at the command line. - -### less - -The beauty of [less][1] is that it's easy to use and it breaks the files you're viewing down into discrete chunks (or pages), which makes them easier to read. You use it to view text files at the command line, such as a README, an HTML file, a LaTeX file, or anything else in plaintext. I took a look at less in a [previous article][2]. - -To use less, just type: - -``` -less file_name -``` - -![](https://opensource.com/sites/default/files/uploads/less.png) - -Scroll down through the file by pressing the spacebar or PgDn key on your keyboard. You can move up through a file by pressing the PgUp key. To stop viewing the file, press the Q key on your keyboard. - -### Antiword - -[Antiword][3] is great little utility that you can use to that can convert Word documents to plaintext. If you want, you can also convert them to [PostScript][4] or [PDF][5]. For this article, let's just stick with the conversion to text. - -Antiword can read and convert files created with versions of Word from 2.0 to 2003. It doesn't read DOCX files—if you try, Antiword displays an error message that what you're trying to read is a ZIP file. That's technically correct, but it's still frustrating. - -To view a Word document using Antiword, type the following command: - -``` -antiword file_name.doc -``` - -Antiword converts the document to text and displays it in the terminal window. Unfortunately, it doesn't break the document into pages in the terminal. You can, though, redirect Antiword's output to a utility like less or [more][6] to paginate it. Do that by typing the following command: - -``` -antiword file_name.doc | less -``` - -If you're new to the command line, the | is called a pipe. That's what does the redirection. - -![](https://opensource.com/sites/default/files/uploads/antiword.png) - -### odt2txt - -Being a good open source citizen, you'll want to use as many open formats as possible. For your word processing needs, you might deal with [ODT][7] files (used by such word processors as LibreOffice Writer and AbiWord) instead of Word files. Even if you don't, you might run into ODT files. And they're easy to view at the command line, even if you don't have Writer or AbiWord installed on your computer. - -How? With a little utility called [odt2txt][8]. As you've probably guessed, odt2txt converts an ODT file to plaintext. To use it, run the command: - -``` -odt2txt file_name.odt -``` - -Like Antiword, odt2txt converts the document to text and displays it in the terminal window. And, like Antiword, it doesn't page the document. Once again, though, you can pipe the output from odt2txt to a utility like less or more using the following command: - -``` -odt2txt file_name.odt | more -``` - -![](https://opensource.com/sites/default/files/uploads/odt2txt.png) - -Do you have a favorite utility for viewing files at the command line? Feel free to share it with the community by leaving a comment. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/view-files-command-line - -作者:[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://www.gnu.org/software/less/ -[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line -[3]: http://www.winfield.demon.nl/ -[4]: http://en.wikipedia.org/wiki/PostScript -[5]: http://en.wikipedia.org/wiki/Portable_Document_Format -[6]: https://opensource.com/article/19/1/more-text-files-linux -[7]: http://en.wikipedia.org/wiki/OpenDocument -[8]: https://github.com/dstosberg/odt2txt diff --git a/translated/tech/20190219 3 tools for viewing files at the command line.md b/translated/tech/20190219 3 tools for viewing files at the command line.md new file mode 100644 index 0000000000..f0c90c22df --- /dev/null +++ b/translated/tech/20190219 3 tools for viewing files at the command line.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 tools for viewing files at the command line) +[#]: via: (https://opensource.com/article/19/2/view-files-command-line) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +在命令行查看文件的 3 个工具 +====== +看一下 less, Antiword 和 odt2xt 这三个实用程序,它们都可以在终端中查看文件。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) + +我常说,你不需要使用命令行也可以高效使用 Linux - 我知道许多 Linux 用户从不打开终端窗口,并且他们也很高兴。然而,即使我不认为自己是一名技术人员,我也会在命令行上花费大约 20% 的计算时间,包括操作文件,处理文本和使用实用程序。 + +我经常在终端窗口中做的一件事是查看文件,无论是文本还是需要用到文字处理器的文件。有时使用命令行实用程序比启动文本编辑器或文字处理器更容易。 + +下面是我在命令行中用来查看文件的三个实用程序。 + +### less + +[less][1] 的美妙之处在于它易于使用,它将你正在查看的文件分解为离散的块(或页面),这使得它们更易于阅读。你可以使用它在命令行查看文本文件,例如 README,HTML 文件,LaTeX 文件或其他任何纯文本文件。我在[上一篇文章][2]中介绍了 less。 + +要使用 less,只需输入: + +``` +less file_name +``` + +![](https://opensource.com/sites/default/files/uploads/less.png) + +通过按键盘上的空格键或 PgDn 键向下滚动文件,按 PgUp 键向上移动文件。要停止查看文件,按键盘上的 Q 键。 + +### Antiword + +[Antiword][3] 是一个很好地实用小程序,你可以使用它将 Word 文档转换为纯文本。只要你想,还可以将它们转换为 [PostScript][4] 或 [PDF][5]。在本文中,让我们继续使用文本转换。 + +Antiword 可以读取和转换 Word 2.0 到 2003 版本创建的文件(to 校正:这里 Word 2.0 应该是 2000 吧)。它不能读取 DOCX 文件 - 如果你尝试这样做,Antiword 会显示一条错误消息,表明你尝试读取的是一个 ZIP 文件。这在技术上是正确的,但仍然令人沮丧。 + +要使用 Antiword 查看 Word 文档,输入以下命令: + +``` +antiword file_name.doc +``` + +Antiword 将文档转换为文本并显示在终端窗口中。不幸的是,它不能在终端中将文档分解成页面。不过,你可以将 Antiword 的输出重定向到 less 或 [more][6] 之类的实用程序,一遍对其进行分页。通过输入以下命令来执行此操作: + +``` +antiword file_name.doc | less +``` + +如果你是命令行的新手,那么我告诉你 | 称为管道。这就是重定向。 + +![](https://opensource.com/sites/default/files/uploads/antiword.png) + +### odt2txt + +作为一个优秀的开源公民,你会希望尽可能多地使用开放格式。对于你的文字处理需求,你可能需要处理 [ODT][7] 文件(由诸如 LibreOffice Writer 和 AbiWord 等文字处理器使用)而不是 Word 文件。即使没有,也可能会遇到 ODT 文件。而且,即使你的计算机上没有安装 Writer 或 AbiWord,也很容易在命令行中查看它们。 + +怎样做呢?用一个名叫 [odt2txt][8] 的实用小程序。正如你猜到的那样,odt2txt 将 ODT 文件转换为纯文本。要使用它,运行以下命令: + +``` +odt2txt file_name.odt +``` + +与 Antiword 一样,odt2txt 将文档转换为文本并在终端窗口中显示。和 Antiword 一样,它不会对文档进行分页。但是,你也可以使用以下命令将 odt2txt 的输出管道传输到 less 或 more 这样的实用程序中: + +``` +odt2txt file_name.odt | more +``` + +![](https://opensource.com/sites/default/files/uploads/odt2txt.png) + +你有一个最喜欢的在命令行中查看文件的实用程序吗?欢迎留下评论与社区分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/view-files-command-line + +作者:[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://www.gnu.org/software/less/ +[2]: https://opensource.com/article/18/4/using-less-view-text-files-command-line +[3]: http://www.winfield.demon.nl/ +[4]: http://en.wikipedia.org/wiki/PostScript +[5]: http://en.wikipedia.org/wiki/Portable_Document_Format +[6]: https://opensource.com/article/19/1/more-text-files-linux +[7]: http://en.wikipedia.org/wiki/OpenDocument +[8]: https://github.com/dstosberg/odt2txt From 8b6c09b4d2f794474dcdc30bfa5cef68b01b476d Mon Sep 17 00:00:00 2001 From: sugarfillet <18705174754@163.com> Date: Sun, 24 Feb 2019 19:24:16 +0800 Subject: [PATCH 305/813] translating by sugarfillet --- .../tech/20190204 Top 5 open source network monitoring tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190204 Top 5 open source network monitoring tools.md b/sources/tech/20190204 Top 5 open source network monitoring tools.md index 5b6e7f1bfa..afbcae9833 100644 --- a/sources/tech/20190204 Top 5 open source network monitoring tools.md +++ b/sources/tech/20190204 Top 5 open source network monitoring tools.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (sugarfillet) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5a97c521691d3de0ae00a7260c2d77bce0007039 Mon Sep 17 00:00:00 2001 From: oska874 Date: Sun, 24 Feb 2019 21:32:45 +0800 Subject: [PATCH 306/813] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=80=E9=83=A8?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atory - Raspberry Pi- Lesson 10 Input01.md | 78 ++++++++++--------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md index eb0f8091d4..e81d460001 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md +++ b/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md @@ -9,53 +9,55 @@ ezio is translating -Computer Laboratory – Raspberry Pi: Lesson 10 Input01 +计算机实验课 – 树莓派: 课程 10 输入01 ====== -Welcome to the Input lesson series. In this series, you will learn how to receive inputs to the Raspberry Pi using the keyboard. We will start with just revealing the input, and then move to a more traditional text prompt. +欢迎进入输入课程系列。在本系列,你将会学会如何使用键盘接收输入给树莓派。我们将会从揭示输入开始本课,然后开始传统的文本命令。 -This first input lesson teaches some theory about drivers and linking, as well as about keyboards and ends up displaying text on the screen. +这是第一堂输入课,会教授一些关于驱动和链接的理论,同样也包含键盘的知识,最后以在屏幕上显示文本结束。 -### 1 Getting Started +### 1 开始 -It is expected that you have completed the OK series, and it would be helpful to have completed the Screen series. Many of the files from that series will be called, without comment. If you do not have these files, or prefer to use a correct implementation, download the template for this lesson from the [Downloads][1] page. If you're using your own implementation, please remove everything after your call to SetGraphicsAddress. +希望你已经完成了 OK 系列课程, 这会对你完成屏幕系列课程很有帮助。很多 OK 课程上的文件会被使用而不会做解释。如果你没有这些文件,或者希望使用一个正确的实现, 可以从该堂课的[下载页][1]下载模板。如果你使用你自己的实现,请删除调用了 `SetGraphicsAddress` 之后全部的代码。 ### 2 USB ``` -The USB standard was designed to make simple hardware in exchange for complex software. +USB 标准的设计目的是通过复杂的硬件来简化硬件。 ``` -As you are no doubt aware, the Raspberry Pi model B has two USB ports, commonly used for connecting a mouse and keyboard. This was a very good design decision, USB is a very generic connector, and many different kinds of device use it. It's simple to build new devices for, simple to write device drivers for, and is highly extensible thanks to USB hubs. Could it get any better? Well, no, in fact for an Operating Systems developer this is our worst nightmare. The USB standard is huge. I really mean it this time, it is over 700 pages, before you've even thought about connecting a device. +如你所知,树莓派 B 型有两个 USB 接口,通常用来连接一个鼠标和一个键盘。这是一个非常好的设计决策,USB 是一个非常通用的接口, 很多种设备都可以使用它。这就很容易为它设计新外设,很容易为它编写设备驱动, 而且通过 USB 集线器可以非常容易扩展。还能更好吗?当然是不能,实际上对一个操作系统开发者来说,这就是我们的噩梦。USB 标准太大了。 我是真的,在你思考如何连接设备之前,它的文档将近 700 页。 -I spoke to a number of other hobbyist Operating Systems developers about this and they all say one thing: don't bother. "It will take too long to implement", "You won't be able to write a tutorial on it" and "It will be of little benefit". In many ways they are right, I'm not able to write a tutorial on the USB standard, as it would take weeks. I also can't teach how to write device drivers for all the different devices, so it is useless on its own. However, I can do the next best thing: Get a working USB driver, get a keyboard driver, and then teach how to use these in an Operating System. I set out searching for a free driver that would run in an operating system that doesn't even know what a file is yet, but I couldn't find one. They were all too high level. So, I attempted to write one. Everybody was right, this took weeks to do. However, I'm pleased to say I did get one that works with no external help from the Operating System, and can talk to a mouse and keyboard. It is by no means complete, efficient, or correct, but it does work. It has been written in C and the full source code can be found on the downloads page for those interested. +我和很多爱好操作系统的开发者谈过这些,而他们全部都说几句话:不要抱怨。“实现这个需要花费很久时间”,“你不可能写出关于 USB 的教程”,“收益太小了”。在很多方面,他们是对的,我不可能写出一个关于 USB 标准的教程, 那得花费几周时间。我同样不能教授如何为全部所有的设备编写外设驱动,所以使用自己写的驱动是没什么用的。然而,我可以做仅次于最好的事情是获取一个正常工作的 USB 驱动,拿一个键盘驱动,然后教授如何在操作系统中使用它们。我开始寻找可以运行在一个甚至不知道文件是什么的操作系统的自由驱动,但是我一个都找不到。他们都太高层了。所以我尝试写一个。每个人都是对的,这耗费了我几周时间。然而我高兴的说我我做这些工作没有获取操作系统以外的帮助,并且可以和鼠标和键盘通信。这句不是完整的,高效的,或者正确的,但是它能工作。驱动是以 C 编写的,而且有兴趣的可以在下载页找到全部源代码。 -So, this tutorial won't be a lesson on the USB standard (at all). Instead we'll look at how to work with other people's code. +所以,这一个教程不会是 USB 标准的课程(一点也没有)。实际上我们将会看到如何使用其他人的代码。 -### 3 Linking +### 3 链接 ``` -Linking allows us to make reusable code 'libraries' that anyone can use in their program. +链接允许我们制作可重用的代码库,所有人都可以在他们的程序中使用。 ``` -Since we're about to incorporate external code into the Operating System, we need to talk about linking. Linking is a process which is applied to programs or Operating System to link in functions. What this means is that when a program is made, we don't necessarily code every function (almost certainly not in fact). Linking is what we do to make our program link to functions in other people's code. This has actually been going on all along in our Operating Systems, as the linker links together all of the different files, each of which is compiled separately. +既然我们要引进外部代码到操作系统,我们就需要谈一谈链接。链接是一种过程,可以在程序或者操作系统中链接函数。这意味着当一个程序生成之后,我们不必要编写每一个函数(几乎可以肯定,实际上并非如此)。链接就是我们做的用来把我们程序和别人代码中的函数连结在一起。这个实际上已经在我们的操作系统进行了,因为链接器吧所有不同的文件链接在一起,每个都是分开编译的。 + ``` -Programs often just call libraries, which call other libraries and so on until eventually they call an Operating System library which we would write. +程序经常知识调用库,这些库会调用其它的库,知道最终调用了我们写的操作系统。 ``` -There are two types of linking: static and dynamic. Static linking is like what goes on when we make our Operating Systems. The linker finds all the addresses of the functions, and writes them into the code, before the program is finished. Dynamic linking is linking that occurs after the program is 'complete'. When it is loaded, the dynamic linker goes through the program and links any functions which are not in the program to libraries in the Operating System. This is one of the jobs our Operating System should eventually be capable of, but for now everything will be statically linked. +有两种链接:静态和动态。静态链接就像我们在制作自己的操作系统时进行的。链接器找到全部函数的地址,然后在链接结束前,将这些地址都写入代码中。动态链接是在程序“完成”之后。当程序加载后,动态链接器检查程序,然后在操作系统的库找到所有不在程序里的函数。这就是我们的操作系统最终应该能够完成的一项工作,但是现在所有东西都将是静态链接的。 -The USB driver I have written is suitable for static linking. This means I give you the compiled code for each of my files, and then the linker finds functions in your code which are not defined in your code, and links them to functions in my code. On the [Downloads][1] page for this lesson is a makefile and my USB driver, which you will need to continue. Download them and replace the makefile in your code with this one, and also put the driver in the same folder as that makefile. +我编写的 USB 驱动程序适合静态编译。这意味着我给你我的每个文件的编译后的代码,然后链接器找到你的代码中的那些没有实现的函数,就将这些函数链接到我的代码。在本课的 [下载页][1] 是一个 makefile 和我的 USB 驱动,这是接下来需要的。下载并使用这 makefile 替换你的代码中的 makefile, 同事将驱动放在和这个 makefile 相同的文件夹。 -### 4 Keyboards +### 4 键盘 -In order to get input into our Operating System, we need to understand at some level how keyboards actually work. Keyboards have two types of keys: Normal and Modifier keys. The normal keys are the letters, numbers, function keys, etc. They constitute almost every key on the keyboard. The modifiers are up to 8 special keys. These are left shift, right shift, left control, right control, left alt, right alt, left GUI and right GUI. The keyboard can detect any combination of the modifier keys being held, as well as up to 6 normal keys. Every time a key changes (i.e. is pushed or released), it reports this to the computer. Typically, keyboards also have three LEDs for Caps Lock, Num Lock and Scroll Lock, which are controlled by the computer, not the keyboard itself. Keyboards may have many more lights such as power, mute, etc. +为了将输入传给我们的操作系统,我们需要在某种程度上理解键盘是如何实际工作的。键盘有两种按键:普通键和修饰键。普通按键是字母、数字、功能键,等等。他们构成了键盘上几乎每一个按键。修饰键是最多 8 个特殊键。他们是左 shift , 右 shift, 左 ctrl,右 ctrl,左 alt, 右 alt,左 GUI 和右 GUI。键盘可以检测出所有的组合中那个修饰键被按下了,以及最多 6 个普通键。每次一个按钮变化了(i.e. 是按下了还是释放了),键盘就会报告给电脑。通常,键盘也会有 3 个 LED 灯,分别指示 Caps 锁定,Num 锁定,和 Scroll 锁定,这些都是由电脑控制的,而不是键盘自己。键盘也可能由更多的灯,比如电源、静音,等等。 -In order to help standardise USB keyboards, a table of values was produced, such that every keyboard key ever is given a unique number, as well as every conceivable LED. The table below lists the first 126 of values. +为了帮助标准 USB 键盘,产生了一个按键值的表,每个键盘按键都一个唯一的数字,每个可能的 LED 也类似。下面的表格列出了前 126 个值。 -Table 4.1 USB Keyboard Keys -| Number | Description | Number | Description | Number | Description | Number | Description | | +Table 4.1 USB 键盘值 + +| 序号 | 描述 | 序号 | 描述 | 序号 | 描述 | 序号 | 描述 | | | ------ | ---------------- | ------- | ---------------------- | -------- | -------------- | --------------- | -------------------- | | | 4 | a and A | 5 | b and B | 6 | c and C | 7 | d and D | | | 8 | e and E | 9 | f and F | 10 | g and G | 11 | h and H | | @@ -91,29 +93,31 @@ Table 4.1 USB Keyboard Keys | 128 | Volume Up | 129 | Volume Down | | | | | | The full list can be found in section 10, page 53 of [HID Usage Tables 1.12][2]. +完全列表可以在[HID 页表 1.12][2]的 53 页,第 10 节找到 -### 5 The Nut Behind the Wheel +### 5 车轮后的螺母 ``` -These summaries and the code they describe form an API - Application Product Interface. +这些总结和代码的描述组成了一个 API - 应用程序产品接口。 + ``` -Normally, when you work with someone else's code, they provide a summary of their methods, what they do and roughly how they work, as well as how they can go wrong. Here is a table of the relevant instructions required to use my USB driver. +通常,当你使用其他人的代码,他们会提供一份自己代码的总结,描述代码都做了什么,粗略介绍了是如何工作的,以及什么情况下会出错。下面是一个使用我的 USB 驱动的相关步骤要求。 Table 5.1 Keyboard related functions in CSUD -| Function | Arguments | Returns | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| UsbInitialise | None | r0 is result code | This method is the all-in-one method that loads the USB driver, enumerates all devices and attempts to communicate with them. This method generally takes about a second to execute, though with a few USB hubs plugged in this can be significantly longer. After this method is completed methods in the keyboard driver become available, regardless of whether or not a keyboard is indeed inserted. Result code explained below. | -| UsbCheckForChange | None | None | Essentially provides the same effect as UsbInitialise, but does not provide the same one time initialisation. This method checks every port on every connected hub recursively, and adds new devices if they have been added. This should be very quick if there are no changes, but can take up to a few seconds if a hub with many devices is attached. | -| KeyboardCount | None | r0 is count | Returns the number of keyboards currently connected and detected. UsbCheckForChange may update this. Up to 4 keyboards are supported by default. Up to this many keyboards may be accessed through this driver. | -| KeyboardGetAddress | r0 is index | r0 is address | Retrieves the address of a given keyboard. All other functions take a keyboard address in order to know which keyboard to access. Thus, to communicate with a keyboard, first check the count, then retrieve the address, then use other methods. Note, the order of keyboards that this method returns may change after calls to UsbCheckForChange. | -| KeyboardPoll | r0 is address | r0 is result code | Reads in the current key state from the keyboard. This operates via polling the device directly, contrary to the best practice. This means that if this method is not called frequently enough, a key press could be missed. All reading methods simply return the value as of the last poll. | -| KeyboardGetModifiers | r0 is address | r0 is modifier state | Retrieves the status of the modifier keys as of the last poll. These are the shift, alt control and GUI keys on both sides. This is returned as a bit field, such that a 1 in the bit 0 means left control is held, bit 1 means left shift, bit 2 means left alt, bit 3 means left GUI and bits 4 to 7 mean the right versions of those previous. If there is a problem r0 contains 0. | -| KeyboardGetKeyDownCount | r0 is address | r0 is count | Retrieves the number of keys currently held down on the keyboard. This excludes modifier keys. Normally, this cannot go above 6. If there is an error this method returns 0. | +| Function | Arguments | Returns | Description | +| ----------------------- | ----------------------- | ----------------------- | -----------------------| +| UsbInitialise | None | r0 is result code | This method is the all-in-one method that loads the USB driver, enumerates all devices and attempts to communicate with them. This method generally takes about a second to execute, though with a few USB hubs plugged in this can be significantly longer. After this method is completed methods in the keyboard driver become available, regardless of whether or not a keyboard is indeed inserted. Result code explained below. | +| UsbCheckForChange | None | None | Essentially provides the same effect as UsbInitialise, but does not provide the same one time initialisation. This method checks every port on every connected hub recursively, and adds new devices if they have been added. This should be very quick if there are no changes, but can take up to a few seconds if a hub with many devices is attached.| +| KeyboardCount | None | r0 is count | Returns the number of keyboards currently connected and detected. UsbCheckForChange may update this. Up to 4 keyboards are supported by default. Up to this many keyboards may be accessed through this driver.| +| KeyboardGetAddress | r0 is index | r0 is address | Retrieves the address of a given keyboard. All other functions take a keyboard address in order to know which keyboard to access. Thus, to communicate with a keyboard, first check the count, then retrieve the address, then use other methods. Note, the order of keyboards that this method returns may change after calls to UsbCheckForChange.| +| KeyboardPoll | r0 is address | r0 is result code | Reads in the current key state from the keyboard. This operates via polling the device directly, contrary to the best practice. This means that if this method is not called frequently enough, a key press could be missed. All reading methods simply return the value as of the last poll.| +| KeyboardGetModifiers | r0 is address | r0 is modifier state | Retrieves the status of the modifier keys as of the last poll. These are the shift, alt control and GUI keys on both sides. This is returned as a bit field, such that a 1 in the bit 0 means left control is held, bit 1 means left shift, bit 2 means left alt, bit 3 means left GUI and bits 4 to 7 mean the right versions of those previous. If there is a problem r0 contains 0.| +| KeyboardGetKeyDownCount | r0 is address | r0 is count | Retrieves the number of keys currently held down on the keyboard. This excludes modifier keys. Normally, this cannot go above 6. If there is an error this method returns 0.| | KeyboardGetKeyDown | r0 is address, r1 is key number | r0 is scan code | Retrieves the scan code (see Table 4.1) of a particular held down key. Normally, to work out which keys are down, call KeyboardGetKeyDownCount and then call KeyboardGetKeyDown up to that many times with increasing values of r1 to determine which keys are down. Returns 0 if there is a problem. It is safe (but not recommended) to call this method without calling KeyboardGetKeyDownCount and interpret 0s as keys not held. Note, the order or scan codes can change randomly (some keyboards sort numerically, some sort temporally, no guarantees are made). | -| KeyboardGetKeyIsDown | r0 is address, r1 is scan code | r0 is status | Alternative to KeyboardGetKeyDown, checks if a particular scan code is among the held down keys. Returns 0 if not, or a non-zero value if so. Faster when detecting particular scan codes (e.g. looking for ctrl+c). On error, returns 0. | -| KeyboardGetLedSupport | r0 is address | r0 is LEDs | Checks which LEDs a particular keyboard supports. Bit 0 being 1 represents Number Lock, bit 1 represents Caps Lock, bit 2 represents Scroll Lock, bit 3 represents Compose, bit 4 represents Kana, bit 5 represents Power, bit 6 represents Mute and bit 7 represents Compose. As per the USB standard, none of these LEDs update automatically (e.g. Caps Lock must be set manually when the Caps Lock scan code is detected). | -| KeyboardSetLeds | r0 is address, r1 is LEDs | r0 is result code | Attempts to turn on/off the specified LEDs on the keyboard. See below for result code values. See KeyboardGetLedSupport for LEDs' values. | +| KeyboardGetKeyIsDown | r0 is address, r1 is scan code | r0 is status | Alternative to KeyboardGetKeyDown, checks if a particular scan code is among the held down keys. Returns 0 if not, or a non-zero value if so. Faster when detecting particular scan codes (e.g. looking for ctrl+c). On error, returns 0.| +| KeyboardGetLedSupport | r0 is address | r0 is LEDs | Checks which LEDs a particular keyboard supports. Bit 0 being 1 represents Number Lock, bit 1 represents Caps Lock, bit 2 represents Scroll Lock, bit 3 represents Compose, bit 4 represents Kana, bit 5 represents Power, bit 6 represents Mute and bit 7 represents Compose. As per the USB standard, none of these LEDs update automatically (e.g. Caps Lock must be set manually when the Caps Lock scan code is detected).| +| KeyboardSetLeds | r0 is address, r1 is LEDs | r0 is result code | Attempts to turn on/off the specified LEDs on the keyboard. See below for result code values. See KeyboardGetLedSupport for LEDs' values.| ``` Result codes are an easy way to handle errors, but often more elegant solutions exist in higher level code. @@ -146,8 +150,8 @@ The general usage of the driver is as follows: 1. Check whether or not it has just been pushed 2. Store that the key is down 4. For each key stored: - 1. Check whether or not key is released - 2. Remove key if released + 3. Check whether or not key is released + 4. Remove key if released 6. Perform actions based on keys pushed/released 7. Go to 2. From 0f04cff71058345e312238518b3740ef87d3aad4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 24 Feb 2019 22:42:31 +0800 Subject: [PATCH 307/813] PRF:20190129 Get started with gPodder, an open source podcast client.md @geekpi --- ... gPodder, an open source podcast client.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md b/translated/tech/20190129 Get started with gPodder, an open source podcast client.md index 429189b926..dddefec674 100644 --- a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md +++ b/translated/tech/20190129 Get started with gPodder, an open source podcast client.md @@ -1,35 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with gPodder, an open source podcast client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-gpodder) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 gPodder,一个开源播客客户端 +开始使用 gPodder 吧,一个开源播客客户端 ====== -使用 gPodder 将你的播客同步到你的设备上,gPodder 是我们开源工具系列中的第 17 个工具,它将在 2019 年提高你的工作效率。 + +> 使用 gPodder 将你的播客同步到你的设备上,gPodder 是我们开源工具系列中的第 17 个工具,它将在 2019 年提高你的工作效率。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/podcast-record-microphone.png?itok=8yUDOywf) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 17 个工具来帮助你在 2019 年更有效率。 ### gPodder -我喜欢播客。哎呀,我非常喜欢他们,因此我录制了其中的三个(你可以在[我的个人资料][1]中找到它们的链接)。我从播客那里学到了很多东西,并在我工作时在后台播放它们。但是,在多台桌面和移动设备之间保持同步可能会带来一些挑战。 +我喜欢播客。哎呀,我非常喜欢它们,因此我录制了其中的三个(你可以在[我的个人资料][1]中找到它们的链接)。我从播客那里学到了很多东西,并在我工作时在后台播放它们。但是,如何在多台桌面和移动设备之间保持同步可能会有一些挑战。 -[gPodder][2] 是一个简单的跨平台播客下载器、播放器和同步工具。它支持 RSS feed、[FeedBurner][3]、[YouTube][4] 和 [SoundCloud][5],它还有一个开源同步服务,你可以根据需要运行它。gPodder 不直接播放播客。相反, 它使用你选择的音频或视频播放器。 +[gPodder][2] 是一个简单的跨平台播客下载器、播放器和同步工具。它支持 RSS feed、[FeedBurner][3]、[YouTube][4] 和 [SoundCloud][5],它还有一个开源的同步服务,你可以根据需要运行它。gPodder 不直接播放播客。相反,它会使用你选择的音频或视频播放器。 ![](https://opensource.com/sites/default/files/uploads/gpodder-1.png) -安装 gPodder 非常简单。安装程序适用于 Windows 和 MacOS,同时包可用于主要的 Linux 发行版。如果你的发行版中没有它,你可以直接从 Git 下载运行。通过 “Add Podcasts via URL” 菜单,你可以输入播客的 RSS 源 URL 或其他服务的“特殊” URL。gPodder 将获取节目列表并显示一个对话框,你可以在其中选择要下载的节目或在列表上标记旧节目。 +安装 gPodder 非常简单。安装程序适用于 Windows 和 MacOS,同时也有用于主要的 Linux 发行版的软件包。如果你的发行版中没有它,你可以直接从 Git 下载运行。通过 “Add Podcasts via URL” 菜单,你可以输入播客的 RSS 源 URL 或其他服务的 “特殊” URL。gPodder 将获取节目列表并显示一个对话框,你可以在其中选择要下载的节目或在列表上标记旧节目。 ![](https://opensource.com/sites/default/files/uploads/gpodder-2.png) -它一个更好的功能是,如果 URL 已经在你的剪贴板中,gPodder 会自动将它放入播放 URL 中,这样你就可以很容易地将新的播客添加到列表中。如果你已有播客 feed 的 OPML 文件,那么可以上传并导入它。还有一个发现选项,让你可搜索 [gPodder.net][6] 上的播客,这是由编写和维护 gPodder 的人员提供的免费和开源播客列表网站。 +它一个更好的功能是,如果 URL 已经在你的剪贴板中,gPodder 会自动将它放入播放 URL 中,这样你就可以很容易地将新的播客添加到列表中。如果你已有播客 feed 的 OPML 文件,那么可以上传并导入它。还有一个发现选项,让你可搜索 [gPodder.net][6] 上的播客,这是由编写和维护 gPodder 的人员提供的自由及开源的播客的列表网站。 ![](https://opensource.com/sites/default/files/uploads/gpodder-3.png) @@ -48,7 +49,7 @@ via: https://opensource.com/article/19/1/productivity-tool-gpodder 作者:[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 f636656ca8ceae1b66a71b6aef04f9f3b82233e0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 24 Feb 2019 22:44:07 +0800 Subject: [PATCH 308/813] PUB:20190129 Get started with gPodder, an open source podcast client.md @geekpi https://linux.cn/article-10567-1.html --- ...Get started with gPodder, an open source podcast client.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190129 Get started with gPodder, an open source podcast client.md (98%) diff --git a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md b/published/20190129 Get started with gPodder, an open source podcast client.md similarity index 98% rename from translated/tech/20190129 Get started with gPodder, an open source podcast client.md rename to published/20190129 Get started with gPodder, an open source podcast client.md index dddefec674..f5449a95de 100644 --- a/translated/tech/20190129 Get started with gPodder, an open source podcast client.md +++ b/published/20190129 Get started with gPodder, an open source podcast client.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10567-1.html) [#]: subject: (Get started with gPodder, an open source podcast client) [#]: via: (https://opensource.com/article/19/1/productivity-tool-gpodder) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 4a42bb3b8138b786cae1301f95100321d24d1abb Mon Sep 17 00:00:00 2001 From: name1e5s <836401406@qq.com> Date: Sun, 24 Feb 2019 22:46:13 +0800 Subject: [PATCH 309/813] [Translated]20180531 Qalculate- - The Best Calculator Application in The Entire Universe --- ...ator Application in The Entire Universe.md | 126 ------------------ ...ator Application in The Entire Universe.md | 125 +++++++++++++++++ 2 files changed, 125 insertions(+), 126 deletions(-) delete mode 100644 sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md create mode 100644 translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md diff --git a/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md deleted file mode 100644 index 03e87367b5..0000000000 --- a/sources/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md +++ /dev/null @@ -1,126 +0,0 @@ -name1e5s translating -Qalculate! – The Best Calculator Application in The Entire Universe -====== -I have been a GNU-Linux user and a [Debian][1] user for more than a decade. As I started using the desktop more and more, it seemed to me that apart from few web-based services most of my needs were being met with [desktop applications][2] within Debian itself. - -One of such applications was the need for me to calculate between different measurements of units. While there are and were many web-services which can do the same, I wanted something which could do all this and more on my desktop for both privacy reasons as well as not having to hunt for a web service for doing one thing or the other. My search ended when I found Qalculate!. - -### Qalculate! The most versatile calculator application - -![Qalculator is the best calculator app][3] - -This is what aptitude says about [Qalculate!][4] and I cannot put it in better terms: - -> Powerful and easy to use desktop calculator – GTK+ version -> -> Qalculate! is small and simple to use but with much power and versatility underneath. Features include customizable functions, units, arbitrary precision, plotting, and a graphical interface that uses a one-line fault-tolerant expression entry (although it supports optional traditional buttons). - -It also did have a KDE interface as well as in its previous avatar, but at least in Debian testing, it just shows only the GTK+ version which can be seen from the github [repo][5] as well. - -Needless to say that Qalculate! is available in Debian repository and hence can easily be installed [using apt command][6] or through software center in Debian based distributions like Ubuntu. It is also availale for Windows and macOS. - -#### Features of Qalculate! - -Now while it would be particularly long to go through the whole list of functionality it allows – allow me to list some of the functionality to be followed by a few screenshots of just a couple of functionalities that Qalculate! provides. The idea is basically to familiarize you with a couple of basic methods and then leave it up to you to enjoy exploring what all Qalculate! can do. - - * Algebra - * Calculus - * Combinatorics - * Complex_Numbers - * Data_Sets - * Date_&_Time - * Economics - * Exponents_&_Logarithms - * Geometry - * Logical - * Matrices_&_Vectors - * Miscellaneous - * Number_Theory - * Statistics - * Trigonometry - - - -#### Using Qalculate! - -Using Qalculate! is not complicated. You can even write in the simple natural language. However, I recommend [reading the manual][7] to utilize the full potential of Qalculate! - -![qalculate byte to gibibyte conversion ][8] - -![conversion from celcius degrees to fahreneit][9] - -#### qalc is the command line version of Qalculate! - -You can achieve the same results as Qalculate! with its command-line brethren qalc -``` -$ qalc 62499836 byte to gibibyte -62499836 * byte = approx. 0.058207508 gibibyte - -$ qalc 40 degree celsius to fahrenheit -(40 * degree) * celsius = 104 deg*oF - -``` - -I shared the command-line interface so that people who don’t like GUI interfaces and prefer command-line (CLI) or have headless nodes (no GUI) could also use qalculate, pretty common in server environments. - -If you want to use it in scripts, I guess libqalculate would be the way to go and seeing how qalculate-gtk, qalc depend on it seems it should be good enough. - -Just to share, you could also explore how to use plotting of series data but that and other uses will leave to you. Don’t forget to check the /usr/share/doc/qalculate/index.html to see all the different functionalities that Qalculate! has. - -Note:- Do note that though Debian prefers [gnuplot][10] to showcase the pretty graphs that can come out of it. - -#### Bonus Tip: You can thank the developer via command line in Debian - -If you use Debian and like any package, you can quickly thank the Debian Developer or maintainer maintaining the said package using: -``` -reportbug --kudos $PACKAGENAME - -``` - -Since I liked QaIculate!, I would like to give a big shout-out to the Debian developer and maintainer Vincent Legout for the fantastic work he has done. -``` -reportbug --kudos qalculate - -``` - -I would also suggest reading my detailed article on using reportbug tool for [bug reporting in Debian][11]. - -#### The opinion of a Polymer Chemist on Qalculate! - -Through my fellow author [Philip Prado][12], we contacted a Mr. Timothy Meyers, currently a student working in a polymer lab as a Polymer Chemist. - -His professional opinion on Qaclulate! is – - -> This looks like almost any scientist to use as any type of data calculations statistics could use this program issue would be do you know the commands and such to make it function -> -> I feel like there’s some Physics constants that are missing but off the top of my head I can’t think of what they are but I feel like there’s not very many [fluid dynamics][13] stuff in there and also some different like [light absorption][14] coefficients for different compounds but that’s just a chemist in me I don’t know if those are super necessary. [Free energy][15] might be one - -In the end, I just want to share this is a mere introduction to what Qalculate! can do and is limited by what you want to get done and your imagination. I hope you like Qalculate! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/qalculate/ - -作者:[Shirish][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/shirish/ -[1]:https://www.debian.org/ -[2]:https://itsfoss.com/essential-linux-applications/ -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/qalculate-app-featured-1-800x450.jpeg -[4]:https://qalculate.github.io/ -[5]:https://github.com/Qalculate -[6]:https://itsfoss.com/apt-command-guide/ -[7]:https://qalculate.github.io/manual/index.html -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-byte-conversion.png -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-gtk-weather-conversion.png -[10]:http://www.gnuplot.info/ -[11]:https://itsfoss.com/bug-report-debian/ -[12]:https://itsfoss.com/author/phillip/ -[13]:https://en.wikipedia.org/wiki/Fluid_dynamics -[14]:https://en.wikipedia.org/wiki/Absorption_(electromagnetic_radiation) -[15]:https://en.wikipedia.org/wiki/Gibbs_free_energy diff --git a/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md new file mode 100644 index 0000000000..a9f7b3e590 --- /dev/null +++ b/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md @@ -0,0 +1,125 @@ +Qalculate! – 全宇宙最好的计算器软件 +====== +十多年来,我一直都是 GNU-Linux 以及 [Debian][1] 的用户。随着我越来越频繁的使用桌面环境,我发现对我来说除了少数基于 web 的服务以外我的大多数需求都可以通过 Debian 软件库里自带的[桌面应用][2]解决。 + +我的需求之一就是进行单位换算。尽管有很多很多在线服务可以做这件事,但是我还是需要一个可以在桌面环境使用的应用。这主要是因为隐私问题以及我不想一而再再而三的寻找在线服务做事。为此我搜寻良久,直到找到 Qalculate!。 + +### Qalculate! 最强多功能计算器应用 + +![最佳计算器应用 Qalculator][3] + +这是 aptitude 上关于 [Qalculate!][4] 的介绍,我没法总结的比他们更好了: + +> 强大易用的桌面计算器 - GTK+ 版 +> +> Qalculate! 是一款外表简单易用,内核强大且功能丰富的应用。其功能包含自定广义函数,单位,计算精度,作图以及可以输入一行表达式(有容错措施)的图形界面(也可以选择使用传统按钮)。 + +这款应用也发行过 KDE 的界面,但是至少在 Debian Testing 软件库里,只出现了 GTK+ 版的界面,你也可以在 GitHub 上的这个[仓库][5]里面看到。 + +不必多说, Qalculate! 在 Debian 的软件源内处于可用状态,因此可以使用 [apt][6] 命令或者是基于 Debian 的发行版比如 Ubuntu 提供的软件中心轻松安装。在 Windows 或者 macOS 上也可以使用这款软件。 + +### Qalculate! 特性一览 + +列出全部的功能清单会有点长,请允许我只列出一部分功能并使用截图来展示极少数 Qalculate! 提供的功能。这么做是为了让你熟悉 Qalculate! 的基本功能并在之后可以自由探索 Qalculate! 到底还能干什么。 + +* 代数 +* 微积分 +* 组合数学 +* 复数 +* 数据集 +* 日期与时间 +* 经济学 +* 对数和指数 +* 集合 +* 逻辑学 +* 向量和矩阵 +* 杂项 +* 数论 +* 统计学 +* 三角学 + + + +#### 使用 Qalculate! + +Qalculate! 的使用不是很难。你甚至可以在里面写简单的英文。但是我还是推荐先[阅读手册][7]以便充分发挥 Qalculate! 的潜能。 + +![使用 Qalculate 进行字节到 GB 的换算][8] + +![摄氏度到华氏度的换算][9] + +#### qalc 是 Qalculate! 的命令行版 + +你也可以使用 Qalculate! 的命令行版 `qalc`: +``` +$ qalc 62499836 byte to gibibyte +62499836 * byte = approx. 0.058207508 gibibyte + +$ qalc 40 degree celsius to fahrenheit +(40 * degree) * celsius = 104 deg*oF + +``` + +Qalculate! 的命令行界面可以让不喜欢 GUI 而是喜欢命令行界面(CLI)或者是使用无头结点(没有 GUI)的人可以使用 Qalculate!。这些人大多是在服务器环境下工作。 + +如果你想要在脚本里使用这一软件的话,我想 libqalculate 是最好的解决方案。看一看 qalc 以及 qalculate-gtk 是如何依赖于它工作的就足以知晓如何使用了。 + +再提一嘴,你还可以了解下如何根据一系列数据绘图,其他应用方式就留给你自己发掘了。不要忘记查看 /usr/share/doc/qalculate/index.html 以获取 Qalculate! 的全部功能。 + +注释:- 注意 Debian 更喜欢 [gnuplot][10],因为其输出的图片很精美。 + +#### 额外贴士: 你可以通过在 Debian 下通过命令行感谢开发者 + +如果你使用 Debian 而且喜欢哪个包的话,你可以使用如下命令感谢 Debian 下这个软件包的开发者或者是维护者: +``` +reportbug --kudos $PACKAGENAME + +``` + +因为我喜欢 Qalculate!,我想要对 Debian 的开发者以及维护者 Vincent Legout 的卓越工作表示感谢: +``` +reportbug --kudos qalculate + +``` + +建议各位阅读我写的关于如何使用报错工具的详细指南 [在 Debian 中上报 BUG][11]. + +#### 一位高分子化学家对 Qalculate! 的评价 + +经由作者 [Philip Prado][12],我们联系上了 Timothy Meyers 先生,他目前是在高分子实验室工作的高分子化学家。 + +他对 Qaclulate! 的专业评价是 - + +> 看起来这个软件几乎任何科学家都可以使用,因为如果你直到指令以及如何使其生效的话,几乎任何数据计算都可以使用这个软件计算。 + +> 我觉得这个软件少了些物理常数,但我想不起来缺了哪些。我觉得那里没有很多有关[流体动力学][13]的东西,再就是少了点部分化合物的[光吸收][14]系数,但这些东西只对我这个化学家来说比较重要,我不知道这些是不是对别人来说也是特别必要的。 自由能也许会这样。 + +最后,我分享的关于 Qalculate! 的介绍十分简陋,其实际功能与你的需要以及你的想象力有关系。希望你能喜欢 Qalculate! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/qalculate/ + +作者:[Shirish][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[name1e5s](https://github.com/name1e5s) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/shirish/ +[1]:https://www.debian.org/ +[2]:https://itsfoss.com/essential-linux-applications/ +[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/qalculate-app-featured-1-800x450.jpeg +[4]:https://qalculate.github.io/ +[5]:https://github.com/Qalculate +[6]:https://itsfoss.com/apt-command-guide/ +[7]:https://qalculate.github.io/manual/index.html +[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-byte-conversion.png +[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-gtk-weather-conversion.png +[10]:http://www.gnuplot.info/ +[11]:https://itsfoss.com/bug-report-debian/ +[12]:https://itsfoss.com/author/phillip/ +[13]:https://en.wikipedia.org/wiki/Fluid_dynamics +[14]:https://en.wikipedia.org/wiki/Absorption_(electromagnetic_radiation) +[15]:https://en.wikipedia.org/wiki/Gibbs_free_energy From da9004c69eb78b88d4da0b453b9c9663b450efef Mon Sep 17 00:00:00 2001 From: Name1e5s <836401406@qq.com> Date: Sun, 24 Feb 2019 22:52:22 +0800 Subject: [PATCH 310/813] [translating] The Rise and Demise of RSS --- sources/talk/20180916 The Rise and Demise of RSS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20180916 The Rise and Demise of RSS.md b/sources/talk/20180916 The Rise and Demise of RSS.md index 8511d220d9..d7f5c610b6 100644 --- a/sources/talk/20180916 The Rise and Demise of RSS.md +++ b/sources/talk/20180916 The Rise and Demise of RSS.md @@ -1,3 +1,4 @@ +name1e5s translating The Rise and Demise of RSS ====== There are two stories here. The first is a story about a vision of the web’s future that never quite came to fruition. The second is a story about how a collaborative effort to improve a popular standard devolved into one of the most contentious forks in the history of open-source software development. From efe747eaad809541e47321055645239b2032702c Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Sun, 24 Feb 2019 22:59:09 +0800 Subject: [PATCH 311/813] =?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 --- sources/tech/20190219 Logical - in Bash.md | 113 +++++++++++---------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md index 2c7e38dd32..9e2641f1c9 100644 --- a/sources/tech/20190219 Logical - in Bash.md +++ b/sources/tech/20190219 Logical - in Bash.md @@ -1,24 +1,25 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-mk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Logical & in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) +[#]: collector: "lujun9972" +[#]: translator: "zero-mk" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Logical & in Bash" +[#]: via: "https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash" +[#]: author: "Paul Brown https://www.linux.com/users/bro66" Logical & in Bash +Bash中的逻辑和(`&`) ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) -One would think you could dispatch `&` in two articles. Turns out you can't. While [the first article dealt with using `&` at the end of commands to push them into the background][1] and then diverged into explaining process management, the second article saw [`&` being used as a way to refer to file descriptors][2], which led us to seeing how, combined with `<` and `>`, you can route inputs and outputs from and to different places. +有人可能会认为两篇文章中的`&`意思差不多,但实际上并不是。虽然 [第一篇文章讨论了如何在命令末尾使用`&`来将命令转到后台运行][1] 之后分解为解释流程管理, 第二篇文章将 [`&` 看作引用文件描述符的方法][2], 这些文章让我们知道了,与 `<` 和 `>` 结合使用后,你可以将输入或输出引导到别的地方。 -This means we haven't even touched on `&` as an AND operator, so let's do that now. +但我们还没接触过作为 AND 操作符使用的`&`。所以,让我们来看看。 -### & is a Bitwise Operator +### & 是一个按位运算符 -If you are at all familiar with binary operations, you will have heard of AND and OR. These are bitwise operations that operate on individual bits of a binary number. In Bash, you use `&` as the AND operator and `|` as the OR operator: +如果您完全熟悉二进制数操作,您肯定听说过 AND 和 OR 。这些是按位操作,对二进制数的各个位进行操作。在 Bash 中,使用`&`作为AND运算符,使用`|`作为 OR 运算符: **AND** @@ -42,9 +43,11 @@ If you are at all familiar with binary operations, you will have heard of AND an 1 | 0 = 1 1 | 1 = 1 + ``` -You can test this by ANDing any two numbers and outputting the result with `echo`: + +您可以通过对任何两个数字进行 AND 运算并使用`echo`输出结果: ``` $ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 @@ -56,7 +59,7 @@ $ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 96 ``` -The same goes for OR (`|`): +OR(`|`)也是如此: ``` $ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 @@ -68,62 +71,62 @@ $ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 121 ``` -Three things about this: - 1. You use `(( ... ))` to tell Bash that what goes between the double brackets is some sort of arithmetic or logical operation. `(( 2 + 2 ))`, `(( 5 % 2 ))` (`%` being the [modulo][3] operator) and `((( 5 % 2 ) + 1))` (equals 3) will all work. - 2. [Like with variables][4], `$` extracts the value so you can use it. - 3. For once spaces don't matter: `((2+3))` will work the same as `(( 2+3 ))` and `(( 2 + 3 ))`. - 4. Bash only operates with integers. Trying to do something like this `(( 5 / 2 ))` will give you "2", and trying to do something like this `(( 2.5 & 7 ))` will result in an error. Then again, using anything but integers in a bitwise operation (which is what we are talking about now) is generally something you wouldn't do anyway. +关于这个不得不说的三件事: + +1. 使用`(( ... ))`告诉 Bash 双括号之间的内容是某种算术或逻辑运算。`(( 2 + 2 ))`, `(( 5 % 2 ))` (`%`是[求模][3]运算符)和`((( 5 % 2 ) + 1))`(等于3)一切都会奏效。 + + 2. [像变量一样][4], 使用`$`提取值,以便你可以使用它。 + 3. 空格并没有影响: `((2+3))` 将等价于 `(( 2+3 ))` 和 `(( 2 + 3 ))`。 + 4. Bash只能对整数进行操作. 试试这样做: `(( 5 / 2 ))` ,你会得到"2";或者这样 `(( 2.5 & 7 ))` ,但会得到一个错误。然后,在按位操作中使用除整数之外的任何东西(这就是我们现在所讨论的)通常是你不应该做的事情。 -**TIP:** If you want to check what your decimal number would look like in binary, you can use _bc_ , the command-line calculator that comes preinstalled with most Linux distros. For example, using: +**提示:** 如果您想看看十进制数字在二进制下会是什么样子,你可以使用 _bc_ ,这是一个大多数 Linux 发行版都预装了的命令行计算器。比如: ``` bc <<< "obase=2; 97" ``` -will convert `97` to binary (the _o_ in `obase` stands for _output_ ), and ... +这个操作将会把 `97`转换成十二进制(`obase` 中的 _o_ 代表 _output_ ,也即,_输出_)。 ``` bc <<< "ibase=2; 11001011" ``` +这个操作将会把 `11001011`转换成十进制(`ibase` 中的 _i_ 代表 _input_ ,也即,_输入_)。 -will convert `11001011` to decimal (the _i_ in `ibase` stands for _input_ ). +### &&是一个逻辑运算符 -### && is a Logical Operator - -Although it uses the same logic principles as its bitwise cousin, Bash's `&&` operator can only render two results: 1 ("true") and 0 ("false"). For Bash, any number not 0 is “true” and anything that equals 0 is “false.” What is also false is anything that is not a number: +虽然它使用与其按位表达相同的逻辑原理,但Bash的`&&`运算符只能呈现两个结果:1(“true”)和0(“false”)。对于Bash来说,任何不是0的数字都是“true”,任何等于0的数字都是“false”。什么也是false也不是数字: ``` -$ echo $(( 4 && 5 )) # Both non-zero numbers, both true = true +$ echo $(( 4 && 5 )) # 两个非零数字, 两个为true = true 1 -$ echo $(( 0 && 5 )) # One zero number, one is false = false +$ echo $(( 0 && 5 )) # 有一个为零, 一个为false = false 0 -$ echo $(( b && 5 )) # One of them is not number, one is false = false +$ echo $(( b && 5 )) # 其中一个不是数字, 一个为false = false 0 ``` -The OR counterpart for `&&` is `||` and works exactly as you would expect. +与 `&&` 类似, OR 对应着 `||` ,用法正如你想的那样。 -All of this is simple enough... until it comes to a command's exit status. +以上这些都很简单... 直到进入命令的退出状态。 -### && is a Logical Operator for Command Exit Status +### &&是命令退出状态的逻辑运算符 -[As we have seen in previous articles][2], as a command runs, it outputs error messages. But, more importantly for today's discussion, it also outputs a number when it ends. This number is called an _exit code_ , and if it is 0, it means the command did not encounter any problem during its execution. If it is any other number, it means something, somewhere, went wrong, even if the command completed. +[正如我们在之前的文章中看到的][2],当命令运行时,它会输出错误消息。更重要的是,对于今天的讨论,它在结束时也会输出一个数字。此数字称为_exit code_(即_返回码_),如果为0,则表示该命令在执行期间未遇到任何问题。如果是任何其他数字,即使命令完成,也意味着某些地方出错了。 +所以 0 意味着非常棒,任何其他数字都说明有问题发生,并且,在返回码的上下文中,0 意味着“真”,其他任何数字都意味着“假”。对!这 **与您所熟知的逻辑操作完全相反** ,但是你能用这个做什么? 不同的背景,不同的规则。这种用处很快就会显现出来。 -So 0 is good, any other number is bad, and, in the context of exit codes, 0/good means "true" and everything else means “false.” Yes, this is **the exact contrary of what you saw in the logical operations above** , but what are you gonna do? Different contexts, different rules. The usefulness of this will become apparent soon enough. +让我们继续! -Moving on. +返回码 _临时_ 储存在 [特殊变量][5] `?` 中— 是的,我知道:这又是一个令人迷惑的选择。但不管怎样, [别忘了我们在讨论变量的文章中说过][4], 那时我们说你要用 `$` 符号来读取变量中的值,在这里也一样。所以,如果你想知道一个命令是否顺利运行,你需要在命令结束后,在运行别的命令之前马上用 `$?` 来读取 `?` 的值。 -Exit codes are stored _temporarily_ in the [special variable][5] `?` \-- yes, I know: another confusing choice. Be that as it may, [remember that in our article about variables][4], and we said that you read the value in a variable using a the `$` symbol. So, if you want to know if a command has run without a hitch, you have to read `?` as soon as the command finishes and before running anything else. - -Try it with: +试试下面的命令: ``` $ find /etc -iname "*.service" @@ -134,22 +137,22 @@ find: '/etc/audisp/plugins.d': Permission denied /etc/systemd/system/dbus-org.freedesktop.ModemManager1.service -[etcetera] +[等等内容] ``` -[As you saw in the previous article][2], running `find` over _/etc_ as a regular user will normally throw some errors when it tries to read subdirectories for which you do not have access rights. +[正如你在上一篇文章中看到的一样][2],普通用户权限在 _/etc_ 下运行 `find` 通常将抛出错误,因为它试图读取你没有权限访问的子目录。 -So, if you execute... +所以,如果你在执行 `find` 后立马执行... ``` echo $? ``` -... right after `find`, it will print a `1`, indicating that there were some errors. +...,,它将打印 `1`,表明存在错误。 -(Notice that if you were to run `echo $?` a second time in a row, you'd get a `0`. This is because `$?` would contain the exit code of `echo $?`, which, supposedly, will have executed correctly. So the first lesson when using `$?` is: **use`$?` straight away** or store it somewhere safe -- like in another variable, or you will lose it). +注意:当你在一行中运行两遍 `echo $?` ,你将得到一个 `0` 。这是因为 `$?` 将包含 `echo $?` 的返回码,而这条命令按理说一定会执行成功。所以学习如何使用 `$?` 的第一课就是: **单独执行 `$?`** 或者将它保存在别的安全的地方 —— 比如保存在一个变量里,不然你会很快丢失它。) -One immediate use of `?` is to fold it into a list of chained commands and bork the whole thing if anything fails as Bash runs through it. For example, you may be familiar with the process of building and compiling the source code of an application. You can run them on after another by hand like this: +一个直接使用 `?` 的用法是将它并入一串链式命令列表,这样 Bash 运行这串命令时若有任何操作失败,后面命令将终止。例如,您可能熟悉构建和编译应用程序源代码的过程。你可以像这样手动一个接一个地运行它们: ``` $ configure @@ -177,35 +180,35 @@ $ make install . ``` -You can also put all three on one line... +你也可以把这三行合并成一行... ``` $ configure; make; make install ``` -... and hope for the best. +... 但你要希望上天保佑。 -The disadvantage of this is that if, say, `configure` fails, Bash will still try and run `make` and `sudo make install`, even if there is nothing to make or, indeed, install. +为什么这样说呢?因为你这样做是有缺点的,比方说 `configure` 执行失败了, Bash 将仍会尝试执行 `make` 和 `sudo make install`——就算没东西可 make ,实际上,是没东西会安装。 -The smarter way of doing it is like this: +聪明一点的做法是: ``` $ configure && make && make install ``` -This takes the exit code from each command and uses it as an operand in a chained `&&` operation. +这将从每个命令中获取退出代码,并将其用作链式 `&&` 操作的操作数。 +但是,没什么好抱怨的,Bash 知道如果 `configure` 返回非零结果,整个过程都会失败。如果发生这种情况,不必运行 `make` 来检查它的退出代码,因为无论如何都会失败的。因此,它放弃运行 `make` ,只是将非零结果传递给下一步操作。并且,由于 `configure && make` 传递了错误,Bash 也不必运行`make install`。这意味着,在一长串命令中,您可以使用 `&&` 连接它们,并且一旦失败,您可以节省时间,因为其他命令会立即被取消运行。 -But, and here's the kicker, Bash knows the whole thing is going to fail if `configure` returns a non-zero result. If that happens, it doesn't have to run `make` to check its exit code, since the result is going to be false no matter what. So, it forgoes `make` and just passes a non-zero result onto the next step of the operation. And, as `configure && make` delivers false, Bash doesn't have to run `make install` either. This means that, in a long chain of commands, you can join them with `&&`, and, as soon as one fails, you can save time as the rest of the commands get canceled immediately. - -You can do something similar with `||`, the OR logical operator, and make Bash continue processing chained commands if only one of a pair completes. - -In view of all this (along with the stuff we covered earlier), you should now have a clearer idea of what the command line we set at the beginning of [this article does][1]: +你可以类似地使用 `||`,OR 逻辑操作符,这样就算只有一部分命令成功执行,Bash 也能运行接下来链接在一起的命令。 +鉴于所有这些(以及我们之前介绍过的内容),您现在应该更清楚地了解我们在 [本文开头][1] 开头设置的命令行: ``` mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & ``` -So, assuming you are running the above from a directory for which you have read and write privileges, what it does it do and how does it do it? How does it avoid unseemly and potentially execution-breaking errors? Next week, apart from giving you the solution, we'll be dealing with brackets: curly, curvy and straight. Don't miss it! +因此,假设您从具有读写权限的目录运行上述内容,它做了什么以及如何做到这一点?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你这些答案的结果,我们将讨论 brackets: curly, curvy and straight. 不要错过了哟! + +因此,假设您在具有读写权限的目录运行上述内容,它会执行的操作以及如何执行此操作?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你解决方案,我们将处理包括:卷曲,曲线和直线。不要错过! -------------------------------------------------------------------------------- @@ -213,7 +216,7 @@ via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash 作者:[Paul Brown][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zero-MK](https://github.com/zero-mk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 38ff6a6e06a26e29c93fb961b5ecc54f756896f0 Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Sun, 24 Feb 2019 22:59:35 +0800 Subject: [PATCH 312/813] =?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 --- sources/tech/20190219 Logical - in Bash.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md index 9e2641f1c9..1b69e80e00 100644 --- a/sources/tech/20190219 Logical - in Bash.md +++ b/sources/tech/20190219 Logical - in Bash.md @@ -7,7 +7,6 @@ [#]: via: "https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash" [#]: author: "Paul Brown https://www.linux.com/users/bro66" -Logical & in Bash Bash中的逻辑和(`&`) ====== From 6d4d9177ad1cc595b47e7d4949f9fcd4c4b55bc1 Mon Sep 17 00:00:00 2001 From: AnDJ <363787371@qq.com> Date: Sun, 24 Feb 2019 23:04:54 +0800 Subject: [PATCH 313/813] translate the method1 of checking memory utilization percentage. --- ...nd Swap Utilization Percentage In Linux.md | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) rename {sources => translated}/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md (74%) diff --git a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md similarity index 74% rename from sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md rename to translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index 0fadc0908d..d5a6579e8c 100644 --- a/sources/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -7,72 +7,72 @@ [#]: via: (https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) -How To Check CPU, Memory And Swap Utilization Percentage In Linux? +如何查看Linux下CPU,内存和Swap(交换分区)的利用率? ====== -There is a lot of commands and options are available in Linux to check memory utilization but i don’t see much information to check about memory utilization percentage. +在Linux下有很多可用的命令和选项来查看内存利用情况,但是我并没有看见关于内存利用率的更多的信息。 -Most of the times we are checking memory utilization alone and we won’t think about how much percentage is used. +在大多数情况下我们只单独查看内存使用情况,没有考虑究竟占用了多少百分比。 -If you want to know those information then you are in the right page. +如果你想要了解这些信息,那你看这篇文章就对了。 -We are here to help you out on this in details. +我们将详细地在这里帮助你摆脱困境。 -This tutorial will help you to identify the memory utilization when you are facing high memory utilization frequently in Linux server. +这篇教程将会帮助你在面对Linux服务器下频繁内存高占用情况时,确定内存使用情况。 -But the same time, you won’t be getting the clear utilization if you are using `free -m` or `free -g`. +但是在同时,如果你使用的是`free -m`或者`free -g`,你将不会得到描述清楚的占用情况。 -These format commands fall under Linux advanced commands. It will be very useful for Linux Experts and Middle Level Linux Users. +这些格式命令属于Linux高级命令。它将会对于Linux专家和中等水平Linux使用者非常有用。 -### Method-1: How To Check Memory Utilization Percentage In Linux? +### 方法-1:如何查看Linux下内存占用率? -We can use the following combination of commands to get this done. In this method, we are using combination of free and awk command to get the memory utilization percentage. +我们可以使用下面命令的组合来达到此目的。在该方法中,我们使用的是free和awk命令的组合来获取内存占用率。 -If you are looking for other articles which is related to memory then navigate to the following link. Those are **[free Command][1]** , **[smem Command][2]** , **[ps_mem Command][3]** , **[vmstat Command][4]** and **[Multiple ways to check size of physical memory][5]**. +如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 **[free命令][1]** , **[smem 命令][2]** , **[ps_mem 命令][3]** , **[vmstat 命令][4]** and **[多种方式来查看物理内存大小][5]**. -For `Memory` Utilization Percentage without Percent Symbol: +对于获取不包含百分比符号的`内存`占用率: ``` $ free -t | awk 'NR == 2 {print "Current Memory Utilization is : " $3/$2*100}' -or +或 $ free -t | awk 'FNR == 2 {print "Current Memory Utilization is : " $3/$2*100}' Current Memory Utilization is : 20.4194 ``` -For `Swap` Utilization Percentage without Percent Symbol: +对于获取不包含百分比符号的`Swap(交换空间)`占用率: ``` $ free -t | awk 'NR == 3 {print "Current Swap Utilization is : " $3/$2*100}' -or +或 $ free -t | awk 'FNR == 3 {print "Current Swap Utilization is : " $3/$2*100}' Current Swap Utilization is : 0 ``` -For `Memory` Utilization Percentage with Percent Symbol and two decimal places: +对于获取包含百分比符号及保留两位小数的`内存`占用率: ``` $ free -t | awk 'NR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' -or +或 $ free -t | awk 'FNR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' Current Memory Utilization is : 20.42% ``` -For `Swap` Utilization Percentage with Percent Symbol and two decimal places: +对于获取包含百分比符号及保留两位小数的`Swap(交换空间)`占用率: ``` $ free -t | awk 'NR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' -or +或 $ free -t | awk 'FNR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' Current Swap Utilization is : 0.00% ``` -If you are looking for other articles which is related to memory then navigate to the following link. Those are **[Create/Extend Swap Partition using LVM][6]** , **[Multiple Ways To Create Or Extend Swap Space][7]** and **[Shell Script to automatically Create/Remove and Mount Swap File][8]**. +如果你正在寻找有关于内存的其他文章,你可以导航至如下链接。这些链接有 **[使用LVM(逻辑盘卷管理,Logical Volume Manager)创建和扩展Swap交换分区][6]** , **[多种方式创建或扩展Swap交换分区][7]** 和 **[多种方式创建/删除和挂载交换分区文件][8]**。 -free command output for better clarification: +键入free命令输出更好的相关说明: ``` $ free @@ -82,15 +82,22 @@ Swap: 17454 0 17454 Total: 33322 3730 27322 ``` -Details are follow: +下面是一些细节: * **`free:`** free is a standard command to check memory utilization in Linux. + * **`free:`** free是一个标准命令,用于在Linux下查看内存使用情况。 * **`awk:`** awk is a powerful command which is specialized for textual data manipulation. + * **`awk:`** awk是一个强大的专门用来做文本数据处理的强大命令。 * **`FNR == 2:`** It gives the total number of records for each input file. Basically it’s used to select the given line (Here, it chooses the line number 2). + * **`FNR == 2:`** 该命令给出了对于每一个输入文件的记录总数。基本上它用于选择给出的行(针对于这里,它选择了行数字为2的行) * **`NR == 2:`** It gives the total number of records processed. Basically it’s used to filter the given line (Here, it chooses the line number 2).. + * **`NR == 2:`** 该命令给出了处理的记录总数。基本上它用于过滤给出的行(针对于这里,它选择的是行数字为2的行) * **`$3/$2*100:`** It divides column 2 with column 3 and it’s multiply the results with 100. + * **`$3/$2*100:`** 该命令将列3除以列2并将结果乘以100。 * **`printf:`** It used to format and print data. + * **`printf:`** 该命令用已格式化和打印数据。 * **`%.2f%:`** By default it prints floating point numbers with 6 decimal places. Use the following format to limit a decimal places. + * **`%.2f%:`** 默认情况下,该命令打印保留6位的浮点数。使用后跟的格式来约束小数位。 @@ -205,7 +212,7 @@ via: https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage 作者:[Vinoth Kumar][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[An-DJ](https://github.com/An-DJ) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 615cfae8e3db01cbf49f12f412c5ae993b872f4a Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Sun, 24 Feb 2019 23:10:47 +0800 Subject: [PATCH 314/813] =?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 --- sources/tech/20190219 Logical - in Bash.md | 230 ------------------ .../tech/T20190219 Logical - in Bash.md | 229 +++++++++++++++++ 2 files changed, 229 insertions(+), 230 deletions(-) delete mode 100644 sources/tech/20190219 Logical - in Bash.md create mode 100644 translated/tech/T20190219 Logical - in Bash.md diff --git a/sources/tech/20190219 Logical - in Bash.md b/sources/tech/20190219 Logical - in Bash.md deleted file mode 100644 index a23ea21bd4..0000000000 --- a/sources/tech/20190219 Logical - in Bash.md +++ /dev/null @@ -1,230 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-MK) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Logical & in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -Logical & in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) - -One would think you could dispatch `&` in two articles. Turns out you can't. While [the first article dealt with using `&` at the end of commands to push them into the background][1] and then diverged into explaining process management, the second article saw [`&` being used as a way to refer to file descriptors][2], which led us to seeing how, combined with `<` and `>`, you can route inputs and outputs from and to different places. - -This means we haven't even touched on `&` as an AND operator, so let's do that now. - -### & is a Bitwise Operator - -If you are at all familiar with binary operations, you will have heard of AND and OR. These are bitwise operations that operate on individual bits of a binary number. In Bash, you use `&` as the AND operator and `|` as the OR operator: -如果您完全熟悉二进制字符的各种操作,您肯定听说过AND和OR。这些是按位操作,对二进制数的各个位进行操作。在Bash中,使用`&`作为AND运算符,使用`|`作为OR运算符: -**AND** - -``` -0 & 0 = 0 - -0 & 1 = 0 - -1 & 0 = 0 - -1 & 1 = 1 -``` - -**OR** - -``` -0 | 0 = 0 - -0 | 1 = 1 - -1 | 0 = 1 - -1 | 1 = 1 -``` - -You can test this by ANDing any two numbers and outputting the result with `echo`: -您可以通过对任何两个数字进行AND运算并使用`echo`输出结果来测试: - -``` -$ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 - -2 - -$ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 - -96 -``` - -The same goes for OR (`|`): -OR(`|`)也是如此: - -``` -$ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 - -3 - -$ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 - -121 -``` - -Three things about this: -关于这个的三件事: - - 1. You use `(( ... ))` to tell Bash that what goes between the double brackets is some sort of arithmetic or logical operation. `(( 2 + 2 ))`, `(( 5 % 2 ))` (`%` being the [modulo][3] operator) and `((( 5 % 2 ) + 1))` (equals 3) will all work. - 2. [Like with variables][4], `$` extracts the value so you can use it. - 3. For once spaces don't matter: `((2+3))` will work the same as `(( 2+3 ))` and `(( 2 + 3 ))`. - 4. Bash only operates with integers. Trying to do something like this `(( 5 / 2 ))` will give you "2", and trying to do something like this `(( 2.5 & 7 ))` will result in an error. Then again, using anything but integers in a bitwise operation (which is what we are talking about now) is generally something you wouldn't do anyway. - - - -**TIP:** If you want to check what your decimal number would look like in binary, you can use _bc_ , the command-line calculator that comes preinstalled with most Linux distros. For example, using: - -``` -bc <<< "obase=2; 97" -``` - -will convert `97` to binary (the _o_ in `obase` stands for _output_ ), and ... - -``` -bc <<< "ibase=2; 11001011" -``` - -will convert `11001011` to decimal (the _i_ in `ibase` stands for _input_ ). - -### && is a Logical Operator - -Although it uses the same logic principles as its bitwise cousin, Bash's `&&` operator can only render two results: 1 ("true") and 0 ("false"). For Bash, any number not 0 is “true” and anything that equals 0 is “false.” What is also false is anything that is not a number: - -``` -$ echo $(( 4 && 5 )) # Both non-zero numbers, both true = true - -1 - -$ echo $(( 0 && 5 )) # One zero number, one is false = false - -0 - -$ echo $(( b && 5 )) # One of them is not number, one is false = false - -0 -``` - -The OR counterpart for `&&` is `||` and works exactly as you would expect. - -All of this is simple enough... until it comes to a command's exit status. - -### && is a Logical Operator for Command Exit Status - -[As we have seen in previous articles][2], as a command runs, it outputs error messages. But, more importantly for today's discussion, it also outputs a number when it ends. This number is called an _exit code_ , and if it is 0, it means the command did not encounter any problem during its execution. If it is any other number, it means something, somewhere, went wrong, even if the command completed. - -So 0 is good, any other number is bad, and, in the context of exit codes, 0/good means "true" and everything else means “false.” Yes, this is **the exact contrary of what you saw in the logical operations above** , but what are you gonna do? Different contexts, different rules. The usefulness of this will become apparent soon enough. - -Moving on. - -Exit codes are stored _temporarily_ in the [special variable][5] `?` \-- yes, I know: another confusing choice. Be that as it may, [remember that in our article about variables][4], and we said that you read the value in a variable using a the `$` symbol. So, if you want to know if a command has run without a hitch, you have to read `?` as soon as the command finishes and before running anything else. - -Try it with: - -``` -$ find /etc -iname "*.service" - -find: '/etc/audisp/plugins.d': Permission denied - -/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service - -/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service - -[etcetera] -``` - -[As you saw in the previous article][2], running `find` over _/etc_ as a regular user will normally throw some errors when it tries to read subdirectories for which you do not have access rights. - -So, if you execute... - -``` -echo $? -``` - -... right after `find`, it will print a `1`, indicating that there were some errors. - -(Notice that if you were to run `echo $?` a second time in a row, you'd get a `0`. This is because `$?` would contain the exit code of `echo $?`, which, supposedly, will have executed correctly. So the first lesson when using `$?` is: **use`$?` straight away** or store it somewhere safe -- like in another variable, or you will lose it). - -One immediate use of `?` is to fold it into a list of chained commands and bork the whole thing if anything fails as Bash runs through it. For example, you may be familiar with the process of building and compiling the source code of an application. You can run them on after another by hand like this: - -``` -$ configure - -. - -. - -. - -$ make - -. - -. - -. - -$ make install - -. - -. - -. -``` - -You can also put all three on one line... - -``` -$ configure; make; make install -``` - -... and hope for the best. - -The disadvantage of this is that if, say, `configure` fails, Bash will still try and run `make` and `sudo make install`, even if there is nothing to make or, indeed, install. - -The smarter way of doing it is like this: - -``` -$ configure && make && make install -``` - -This takes the exit code from each command and uses it as an operand in a chained `&&` operation. - -But, and here's the kicker, Bash knows the whole thing is going to fail if `configure` returns a non-zero result. If that happens, it doesn't have to run `make` to check its exit code, since the result is going to be false no matter what. So, it forgoes `make` and just passes a non-zero result onto the next step of the operation. And, as `configure && make` delivers false, Bash doesn't have to run `make install` either. This means that, in a long chain of commands, you can join them with `&&`, and, as soon as one fails, you can save time as the rest of the commands get canceled immediately. - -You can do something similar with `||`, the OR logical operator, and make Bash continue processing chained commands if only one of a pair completes. - -In view of all this (along with the stuff we covered earlier), you should now have a clearer idea of what the command line we set at the beginning of [this article does][1]: - -``` -mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & -``` - -So, assuming you are running the above from a directory for which you have read and write privileges, what it does it do and how does it do it? How does it avoid unseemly and potentially execution-breaking errors? Next week, apart from giving you the solution, we'll be dealing with brackets: curly, curvy and straight. Don't miss it! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash - -作者:[Paul Brown][a] -选题:[lujun9972][b] -译者:[zero-MK](https://github.com/zero-MK) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[2]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash -[3]: https://en.wikipedia.org/wiki/Modulo_operation -[4]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise -[5]: https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html diff --git a/translated/tech/T20190219 Logical - in Bash.md b/translated/tech/T20190219 Logical - in Bash.md new file mode 100644 index 0000000000..1b69e80e00 --- /dev/null +++ b/translated/tech/T20190219 Logical - in Bash.md @@ -0,0 +1,229 @@ +[#]: collector: "lujun9972" +[#]: translator: "zero-mk" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Logical & in Bash" +[#]: via: "https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash" +[#]: author: "Paul Brown https://www.linux.com/users/bro66" + +Bash中的逻辑和(`&`) +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) + +有人可能会认为两篇文章中的`&`意思差不多,但实际上并不是。虽然 [第一篇文章讨论了如何在命令末尾使用`&`来将命令转到后台运行][1] 之后分解为解释流程管理, 第二篇文章将 [`&` 看作引用文件描述符的方法][2], 这些文章让我们知道了,与 `<` 和 `>` 结合使用后,你可以将输入或输出引导到别的地方。 + +但我们还没接触过作为 AND 操作符使用的`&`。所以,让我们来看看。 + +### & 是一个按位运算符 + +如果您完全熟悉二进制数操作,您肯定听说过 AND 和 OR 。这些是按位操作,对二进制数的各个位进行操作。在 Bash 中,使用`&`作为AND运算符,使用`|`作为 OR 运算符: + +**AND** + +``` +0 & 0 = 0 + +0 & 1 = 0 + +1 & 0 = 0 + +1 & 1 = 1 +``` + +**OR** + +``` +0 | 0 = 0 + +0 | 1 = 1 + +1 | 0 = 1 + +1 | 1 = 1 + +``` + + +您可以通过对任何两个数字进行 AND 运算并使用`echo`输出结果: + +``` +$ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 + +2 + +$ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 + +96 +``` + +OR(`|`)也是如此: + +``` +$ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 + +3 + +$ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 + +121 +``` + + +关于这个不得不说的三件事: + +1. 使用`(( ... ))`告诉 Bash 双括号之间的内容是某种算术或逻辑运算。`(( 2 + 2 ))`, `(( 5 % 2 ))` (`%`是[求模][3]运算符)和`((( 5 % 2 ) + 1))`(等于3)一切都会奏效。 + + 2. [像变量一样][4], 使用`$`提取值,以便你可以使用它。 + 3. 空格并没有影响: `((2+3))` 将等价于 `(( 2+3 ))` 和 `(( 2 + 3 ))`。 + 4. Bash只能对整数进行操作. 试试这样做: `(( 5 / 2 ))` ,你会得到"2";或者这样 `(( 2.5 & 7 ))` ,但会得到一个错误。然后,在按位操作中使用除整数之外的任何东西(这就是我们现在所讨论的)通常是你不应该做的事情。 + + + +**提示:** 如果您想看看十进制数字在二进制下会是什么样子,你可以使用 _bc_ ,这是一个大多数 Linux 发行版都预装了的命令行计算器。比如: + +``` +bc <<< "obase=2; 97" +``` + +这个操作将会把 `97`转换成十二进制(`obase` 中的 _o_ 代表 _output_ ,也即,_输出_)。 + +``` +bc <<< "ibase=2; 11001011" +``` +这个操作将会把 `11001011`转换成十进制(`ibase` 中的 _i_ 代表 _input_ ,也即,_输入_)。 + +### &&是一个逻辑运算符 + +虽然它使用与其按位表达相同的逻辑原理,但Bash的`&&`运算符只能呈现两个结果:1(“true”)和0(“false”)。对于Bash来说,任何不是0的数字都是“true”,任何等于0的数字都是“false”。什么也是false也不是数字: + +``` +$ echo $(( 4 && 5 )) # 两个非零数字, 两个为true = true + +1 + +$ echo $(( 0 && 5 )) # 有一个为零, 一个为false = false + +0 + +$ echo $(( b && 5 )) # 其中一个不是数字, 一个为false = false + +0 +``` + +与 `&&` 类似, OR 对应着 `||` ,用法正如你想的那样。 + +以上这些都很简单... 直到进入命令的退出状态。 + +### &&是命令退出状态的逻辑运算符 + +[正如我们在之前的文章中看到的][2],当命令运行时,它会输出错误消息。更重要的是,对于今天的讨论,它在结束时也会输出一个数字。此数字称为_exit code_(即_返回码_),如果为0,则表示该命令在执行期间未遇到任何问题。如果是任何其他数字,即使命令完成,也意味着某些地方出错了。 +所以 0 意味着非常棒,任何其他数字都说明有问题发生,并且,在返回码的上下文中,0 意味着“真”,其他任何数字都意味着“假”。对!这 **与您所熟知的逻辑操作完全相反** ,但是你能用这个做什么? 不同的背景,不同的规则。这种用处很快就会显现出来。 + +让我们继续! + +返回码 _临时_ 储存在 [特殊变量][5] `?` 中— 是的,我知道:这又是一个令人迷惑的选择。但不管怎样, [别忘了我们在讨论变量的文章中说过][4], 那时我们说你要用 `$` 符号来读取变量中的值,在这里也一样。所以,如果你想知道一个命令是否顺利运行,你需要在命令结束后,在运行别的命令之前马上用 `$?` 来读取 `?` 的值。 + +试试下面的命令: + +``` +$ find /etc -iname "*.service" + +find: '/etc/audisp/plugins.d': Permission denied + +/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service + +/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service + +[等等内容] +``` + +[正如你在上一篇文章中看到的一样][2],普通用户权限在 _/etc_ 下运行 `find` 通常将抛出错误,因为它试图读取你没有权限访问的子目录。 + +所以,如果你在执行 `find` 后立马执行... + +``` +echo $? +``` + +...,,它将打印 `1`,表明存在错误。 + +注意:当你在一行中运行两遍 `echo $?` ,你将得到一个 `0` 。这是因为 `$?` 将包含 `echo $?` 的返回码,而这条命令按理说一定会执行成功。所以学习如何使用 `$?` 的第一课就是: **单独执行 `$?`** 或者将它保存在别的安全的地方 —— 比如保存在一个变量里,不然你会很快丢失它。) + +一个直接使用 `?` 的用法是将它并入一串链式命令列表,这样 Bash 运行这串命令时若有任何操作失败,后面命令将终止。例如,您可能熟悉构建和编译应用程序源代码的过程。你可以像这样手动一个接一个地运行它们: + +``` +$ configure + +. + +. + +. + +$ make + +. + +. + +. + +$ make install + +. + +. + +. +``` + +你也可以把这三行合并成一行... + +``` +$ configure; make; make install +``` + +... 但你要希望上天保佑。 + +为什么这样说呢?因为你这样做是有缺点的,比方说 `configure` 执行失败了, Bash 将仍会尝试执行 `make` 和 `sudo make install`——就算没东西可 make ,实际上,是没东西会安装。 + +聪明一点的做法是: + +``` +$ configure && make && make install +``` + +这将从每个命令中获取退出代码,并将其用作链式 `&&` 操作的操作数。 +但是,没什么好抱怨的,Bash 知道如果 `configure` 返回非零结果,整个过程都会失败。如果发生这种情况,不必运行 `make` 来检查它的退出代码,因为无论如何都会失败的。因此,它放弃运行 `make` ,只是将非零结果传递给下一步操作。并且,由于 `configure && make` 传递了错误,Bash 也不必运行`make install`。这意味着,在一长串命令中,您可以使用 `&&` 连接它们,并且一旦失败,您可以节省时间,因为其他命令会立即被取消运行。 + +你可以类似地使用 `||`,OR 逻辑操作符,这样就算只有一部分命令成功执行,Bash 也能运行接下来链接在一起的命令。 +鉴于所有这些(以及我们之前介绍过的内容),您现在应该更清楚地了解我们在 [本文开头][1] 开头设置的命令行: + +``` +mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & +``` + +因此,假设您从具有读写权限的目录运行上述内容,它做了什么以及如何做到这一点?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你这些答案的结果,我们将讨论 brackets: curly, curvy and straight. 不要错过了哟! + +因此,假设您在具有读写权限的目录运行上述内容,它会执行的操作以及如何执行此操作?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你解决方案,我们将处理包括:卷曲,曲线和直线。不要错过! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[zero-MK](https://github.com/zero-mk) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[2]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash +[3]: https://en.wikipedia.org/wiki/Modulo_operation +[4]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise +[5]: https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html From 19041561bf4ccf5e07573097a5d60eda87bceeef Mon Sep 17 00:00:00 2001 From: alim0x Date: Sun, 24 Feb 2019 23:16:10 +0800 Subject: [PATCH 315/813] [translating]Booting Linux faster --- sources/talk/20190121 Booting Linux faster.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190121 Booting Linux faster.md b/sources/talk/20190121 Booting Linux faster.md index ef79351e0e..871efc1957 100644 --- a/sources/talk/20190121 Booting Linux faster.md +++ b/sources/talk/20190121 Booting Linux faster.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (alim0x) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8429c4e9f76bb0b268441dfe7de100b826561c68 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 00:08:54 +0800 Subject: [PATCH 316/813] PRF:20190116 The Evil-Twin Framework- A tool for improving WiFi security.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @hopefully2333 翻译的不错 --- ...ork- A tool for improving WiFi security.md | 114 +++++++++--------- 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md index da26f24c2d..b65d059f2f 100644 --- a/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md +++ b/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The Evil-Twin Framework: A tool for improving WiFi security) @@ -9,61 +9,61 @@ Evil-Twin 框架:一个用于提升 WiFi 安全性的工具 ====== -了解一款用于对 WiFi 安全性进行手动测试的工具,这款工具可以通过不同类型安全威胁的漏洞点进行测试。 + +> 了解一款用于对 WiFi 接入点安全进行渗透测试的工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-cloud-safe.png?itok=yj2TFPzq) -越来越多的设备通过无线传输的方式连接到互联网,以及,WiFi 接入点大范围的可用,这两者为攻击者攻击用户提供了很多机会。通过欺骗用户连接到虚假的 WiFi 接入点,攻击者可以完全控制用户的网络连接,这将使得攻击者可以嗅探和篡改用户通过无线连接进行发送和接收的数据包,将用户的连接重定向到一个恶意的网站,并通过网络发起其他的攻击。 +越来越多的设备通过无线传输的方式连接到互联网,以及,大范围可用的 WiFi 接入点为攻击者攻击用户提供了很多机会。通过欺骗用户连接到[虚假的 WiFi 接入点][1],攻击者可以完全控制用户的网络连接,这将使得攻击者可以嗅探和篡改用户的数据包,将用户的连接重定向到一个恶意的网站,并通过网络发起其他的攻击。 为了保护用户并告诉他们如何避免线上的危险操作,安全审计人员和安全研究员必须评估用户的安全实践能力,用户常常在没有确认该 WiFi 接入点为安全的情况下就连接上了该网络,安全审计人员和研究员需要去了解这背后的原因。有很多工具都可以对 WiFi 的安全性进行审计,但是没有一款工具可以测试大量不同的攻击场景,也没有能和其他工具集成得很好的工具。 -Evil-Twin Framework(ETF)用于在 WiFi 审计过程中解决这些问题。审计者能够使用 ETF 来集成多种工具并测试该 WiFi 在不同场景下的安全性。本文会介绍 ETF 的框架和功能,然后会提供一些案例来说明该如何使用这款工具。 +Evil-Twin Framework(ETF)用于解决 WiFi 审计过程中的这些问题。审计者能够使用 ETF 来集成多种工具并测试该 WiFi 在不同场景下的安全性。本文会介绍 ETF 的框架和功能,然后会提供一些案例来说明该如何使用这款工具。 ### ETF 的架构 -ETF 的框架是用 python 写的,因为这门开发语言的代码读起来非常容易,也方便其他开发者向这个项目贡献代码。除此之外,很多 ETF 的库,比如 Scapy,都是为 python 开发的,很容易就能将它们用于 ETF。 +ETF 的框架是用 [Python][2] 写的,因为这门开发语言的代码非常易读,也方便其他开发者向这个项目贡献代码。除此之外,很多 ETF 的库,比如 [Scapy][3],都是为 Python 开发的,很容易就能将它们用于 ETF。 -ETF 的架构(图1)分为不同的模块,模块之间相互作用。框架的设置都写在一个单独的配置文件里。用户可以通过 ConfigurationManager 类里的用户界面验证并修改这些配置。其他模块只能读取这些设置并根据这些设置进行运行。 +ETF 的架构(图 1)分为不同的彼此交互的模块。该框架的设置都写在一个单独的配置文件里。用户可以通过 `ConfigurationManager` 类里的用户界面来验证并修改这些配置。其他模块只能读取这些设置并根据这些设置进行运行。 ![Evil-Twin Framework Architecture][5] -图 1:Evil-Twin 的框架架构 +*图 1:Evil-Twin 的框架架构* -ETF 支持多种用户界面来与框架交互,当前的默认界面是一个交互式控制台界面,类似于 Metasploit 那种。正在开发用于桌面/浏览器使用的图形用户界面(GUI)和命令行界面(CLI),移动端界面也是未来的一个备选项。用户可以使用交互式控制台界面来修改配置文件里的设置(最终会使用 GUI)。用户界面可以与框架里存在的每个模块进行交互。 +ETF 支持多种与框架交互的用户界面,当前的默认界面是一个交互式控制台界面,类似于 [Metasploit][6] 那种。正在开发用于桌面/浏览器使用的图形用户界面(GUI)和命令行界面(CLI),移动端界面也是未来的一个备选项。用户可以使用交互式控制台界面来修改配置文件里的设置(最终会使用 GUI)。用户界面可以与存在于这个框架里的每个模块进行交互。 -WiFi 模块(AirCommunicator)用于支持多种 WiFi 功能和攻击。该框架确定了 Wi-Fi 通信的三个基本支柱:数据包嗅探,自定义数据包注入和创建接入点。三个主要的 WiFi 通信模块是 AirScanner,AirInjector,和 AirHost,它们分别用于数据包嗅探,数据包注入,和接入点创建。这三个类包含在主 WiFi 模块 AirCommunicator 中,AirCommunicator 在启动这些服务之前会先读取这些服务的配置文件。使用这些核心功能的一个或多个就可以构造任意类型的 WiFi 攻击。 +WiFi 模块(AirCommunicator)用于支持多种 WiFi 功能和攻击类型。该框架确定了 Wi-Fi 通信的三个基本支柱:数据包嗅探、自定义数据包注入和创建接入点。三个主要的 WiFi 通信模块 AirScanner、AirInjector,和 AirHost,分别用于数据包嗅探、数据包注入,和接入点创建。这三个类被封装在主 WiFi 模块 AirCommunicator 中,AirCommunicator 在启动这些服务之前会先读取这些服务的配置文件。使用这些核心功能的一个或多个就可以构造任意类型的 WiFi 攻击。 -使用中间人(MITM)攻击,这是一种攻击 WiFi 客户端的常见手法。ETF 有一个叫做 ETFITM(Evil-Twin Framework-in-the-Middle)的集成模块,这个模块用于创建一个 web 代理,来拦截和修改经过的 HTTP/HTTPS 数据包。 +要使用中间人(MITM)攻击(这是一种攻击 WiFi 客户端的常见手法),ETF 有一个叫做 ETFITM(Evil-Twin Framework-in-the-Middle)的集成模块,这个模块用于创建一个 web 代理,来拦截和修改经过的 HTTP/HTTPS 数据包。 -许多其他的工具也可以使用 ETF 创建 MITM。通过它的可扩展性,ETF 能够支持它们,而不必单独地调用它们,你可以通过扩展 Spawner 类来将这些工具添加到框架里。这使得开发者和安全审计人员可以使用框架里预先配置好的参数字符来调用程序。 +许多其他的工具也可以利用 ETF 创建的 MITM。通过它的可扩展性,ETF 能够支持它们,而不必单独地调用它们,你可以通过扩展 Spawner 类来将这些工具添加到框架里。这使得开发者和安全审计人员可以使用框架里预先配置好的参数字符来调用程序。 -扩展 ETF 的另一种方法就是通过插件。有两类插件:WiFi 插件和 MITM 插件。MITM 插件是在 MITM 代理运行时可以执行的脚本。代理会将 HTTP(s)请求和响应传递给可以记录和处理它们的插件。WiFi 插件遵循一个更加复杂的执行流程,但仍然会给想参与开发并且使用自己插件的贡献者提供一个相对简单的 API。WiFi 插件还可以进一步地划分为三类,其中一类用于每个核心 WiFi 通信模块。 +扩展 ETF 的另一种方法就是通过插件。有两类插件:WiFi 插件和 MITM 插件。MITM 插件是在 MITM 代理运行时可以执行的脚本。代理会将 HTTP(s) 请求和响应传递给可以记录和处理它们的插件。WiFi 插件遵循一个更加复杂的执行流程,但仍然会给想参与开发并且使用自己插件的贡献者提供一个相对简单的 API。WiFi 插件还可以进一步地划分为三类,其中每个对应一个核心 WiFi 通信模块。 -每个核心模块都有一些事件能触发响应的插件的执行。举个栗子,AirScanner 有三个已定义的事件,可以对其进行编程。事件通常对应于服务开始运行之前的设置阶段,服务正在运行时的中间执行阶段,服务完成后的卸载或清理阶段。因为 python 允许多重继承,所以一个插件可以继承多个插件类。 +每个核心模块都有一些特定事件能触发响应的插件的执行。举个例子,AirScanner 有三个已定义的事件,可以对其响应进行编程处理。事件通常对应于服务开始运行之前的设置阶段、服务正在运行时的中间执行阶段、服务完成后的卸载或清理阶段。因为 Python 允许多重继承,所以一个插件可以继承多个插件类。 -图 1 是框架架构的摘要。指向远离 ConfigurationManager 的行意味着模块会从中读取信息,指向它的行意味着模块会编写/修改配置。 +上面的图 1 是框架架构的摘要。从 ConfigurationManager 指出的箭头意味着模块会从中读取信息,指向它的箭头意味着模块会写入/修改配置。 -### 使用 ETF 的实例 +### 使用 ETF 的例子 -ETF 可以通过多种方式对 WiFi 的网络安全或者终端用户的 WiFi 安全意识进行渗透测试。下面的例子描述了这个框架的一些手动测试的功能,例如接入点和客户端检测,对使用 WPA 和 WEP 类型协议的接入点进行攻击,和创建恶意的双接入点。 - -这些例子是使用 ETF 设计的,WiFi 卡允许进行 WiFi 数据捕获。它们同样为 ETF 设置命令使用了下面这些缩写: - - * **APS** access point SSID - * **APB** access point BSSID - * **APC** access point channel - * **CM** client MAC address +ETF 可以通过多种方式对 WiFi 的网络安全或者终端用户的 WiFi 安全意识进行渗透测试。下面的例子描述了这个框架的一些渗透测试功能,例如接入点和客户端检测、对使用 WPA 和 WEP 类型协议的接入点进行攻击,和创建 evil twin 接入点。 +这些例子是使用 ETF 和允许进行 WiFi 数据捕获的 WiFi 卡设计的。它们也在 ETF 设置命令中使用了下面这些缩写: + * **APS** Access Point SSID + * **APB** Access Point BSSID + * **APC** Access Point Channel + * **CM** Client MAC address 在实际的测试场景中,确保你使用了正确的信息来替换这些缩写。 #### 在解除认证攻击后捕获 WPA 四次握手的数据包。 -这个场景(图 2)做了两个方面的考虑:解除认证攻击和捕获 WPA 四次握手数据包的可能性。这个场景从一个运行 WPA/WPA2 的接入点开始,这个接入点有一个已经连上的客户端设备(在本例中是一台智能手机)。目的是通过一般的解除认证攻击(译者注:类似于 DOS 攻击)来让客户端断开和 WiFi 的网络,然后在客户端尝试重连的时候捕获 WPA 的握手包。重连会在断开连接后马上手动完成。 +这个场景(图 2)做了两个方面的考虑:解除认证攻击de-authentication attack和捕获 WPA 四次握手数据包的可能性。这个场景从一个启用了 WPA/WPA2 的接入点开始,这个接入点有一个已经连上的客户端设备(在本例中是一台智能手机)。目的是通过常规的解除认证攻击(LCTT 译注:类似于 DoS 攻击)来让客户端断开和 WiFi 的网络,然后在客户端尝试重连的时候捕获 WPA 的握手包。重连会在断开连接后马上手动完成。 ![Scenario for capturing a WPA handshake after a de-authentication attack][8] -图 2:在解除认证攻击后捕获 WPA 握手包的场景 +*图 2:在解除认证攻击后捕获 WPA 握手包的场景* 在这个例子中需要考虑的是 ETF 的可靠性。目的是确认工具是否一直都能捕获 WPA 的握手数据包。每个工具都会用来多次复现这个场景,以此来检查它们在捕获 WPA 握手数据包时的可靠性。 @@ -71,14 +71,12 @@ ETF 可以通过多种方式对 WiFi 的网络安全或者终端用户的 WiFi ETF 启用了 AirScanner 模块并分析 IEEE 802.11 数据帧来发现 WPA 握手包。然后 AirInjecto 就可以使用解除认证攻击来强制客户端断开连接,以进行重连。必须在 ETF 上执行下面这些步骤才能完成上面的目标: - 1. 进入 AirScanner 配置模式: **config airscanner** - 2. 设置 AirScanner 不跳信道: **config airscanner** - 3. 设置信道以嗅探经过 WiFi 接入点信道的数据(APC): **set fixed_sniffing_channel = ** - 4. 使用 CredentialSniffer 插件来启动 AirScanner 模块: **start airscanner with credentialsniffer** - 5. 从已嗅探的接入点列表中添加目标接入点的 BSSID(APS): **add aps where ssid = ** - 6. 启用 AirInjector 模块,在默认情况下,它会启用解除认证攻击: **start airinjector** - - + 1. 进入 AirScanner 配置模式:`config airscanner` + 2. 设置 AirScanner 不跳信道:`config airscanner` + 3. 设置信道以嗅探经过 WiFi 接入点信道的数据(APC):`set fixed_sniffing_channel = ` + 4. 使用 CredentialSniffer 插件来启动 AirScanner 模块:`start airscanner with credentialsniffer` + 5. 从已嗅探的接入点列表中添加目标接入点的 BSSID(APS):`add aps where ssid = ` + 6. 启用 AirInjector 模块,在默认情况下,它会启用解除认证攻击:`start airinjector` 这些简单的命令设置能让 ETF 在每次测试时执行成功且有效的解除认证攻击。ETF 也能在每次测试的时候捕获 WPA 的握手数据包。下面的代码能让我们看到 ETF 成功的执行情况。 @@ -120,26 +118,24 @@ ETF[etf/aircommunicator/airscanner]::> [+] Starting deauthentication attack #### 使用 ARP 重放攻击并破解 WEP 无线网络 -下面这个场景(图 3)将关注地址解析协议(ARP)重放攻击的效率和捕获包含初始化向量(IVs)的 WEP 数据包的速度。相同的网络可能需要破解不同数量的捕获的 IVs,所以这个场景的 IVs 上限是 50000。如果这个网络在首次测试期间,还未捕获到 50000IVs 就崩溃了,那么实际捕获到的 IVs 数量会成为这个网络在接下来的测试里的新的上限。我们使用 aircrack-ng 对数据包进行破解。 +下面这个场景(图 3)将关注[地址解析协议][9](ARP)重放攻击的效率和捕获包含初始化向量(IVs)的 WEP 数据包的速度。相同的网络可能需要破解不同数量的捕获的 IVs,所以这个场景的 IVs 上限是 50000。如果这个网络在首次测试期间,还未捕获到 50000 IVs 就崩溃了,那么实际捕获到的 IVs 数量会成为这个网络在接下来的测试里的新的上限。我们使用 `aircrack-ng` 对数据包进行破解。 -测试场景从一个使用 WEP 协议进行加密的 WiFi 接入点和一台知道其密钥的离线客户端设备开始-为了测试密钥使用了 12345,但它可以是更长且更复杂的密钥。一旦客户端连接到了 WEP 接入点,它会发送一个 ARP 数据包;这是要捕获和重放的数据包。一旦被捕获的包含 IVs 的数据包数量达到了设置的上限,测试就结束了。 +测试场景从一个使用 WEP 协议进行加密的 WiFi 接入点和一台知道其密钥的离线客户端设备开始 —— 为了测试方便,密钥使用了 12345,但它可以是更长且更复杂的密钥。一旦客户端连接到了 WEP 接入点,它会发送一个不必要的 ARP 数据包;这是要捕获和重放的数据包。一旦被捕获的包含 IVs 的数据包数量达到了设置的上限,测试就结束了。 ![Scenario for capturing a WPA handshake after a de-authentication attack][11] -图 3:在进行解除认证攻击后捕获 WPA 握手包的场景 +*图 3:在进行解除认证攻击后捕获 WPA 握手包的场景* -ETF 使用 Python 的 Scapy 库来进行包嗅探和包注入。为了最大限度地解决 Scapy 里的已知性能问题,ETF 微调了一些低级库,来大大加快包注入的速度。对于这个特定的场景,ETF 为了更有效率地嗅探,使用了 tcpdump 作为后台进程而不是 Scapy,Scapy 用于识别加密的 ARP 数据包。 +ETF 使用 Python 的 Scapy 库来进行包嗅探和包注入。为了最大限度地解决 Scapy 里的已知的性能问题,ETF 微调了一些低级库,来大大加快包注入的速度。对于这个特定的场景,ETF 为了更有效率地嗅探,使用了 `tcpdump` 作为后台进程而不是 Scapy,Scapy 用于识别加密的 ARP 数据包。 这个场景需要在 ETF 上执行下面这些命令和操作: - 1. 进入 AirScanner 设置模式: **config airscanner** - 2. 设置 AirScanner 不跳信道: **set hop_channels = false** - 3. 设置信道以嗅探经过接入点信道的数据(APC): **set fixed_sniffing_channel = ** - 4. 进入 ARPReplayer 插件设置模式: **config arpreplayer** - 5. 设置 WEP 网络目标接入点的 BSSID(APB): **set target_ap_bssid ** - 6. 使用 ARPReplayer 插件启动 AirScanner 模块: **start airscanner with arpreplayer** - - + 1. 进入 AirScanner 设置模式:`config airscanner` + 2. 设置 AirScanner 不跳信道:`set hop_channels = false` + 3. 设置信道以嗅探经过接入点信道的数据(APC):`set fixed_sniffing_channel = ` + 4. 进入 ARPReplayer 插件设置模式:`config arpreplayer` + 5. 设置 WEP 网络目标接入点的 BSSID(APB):`set target_ap_bssid ` + 6. 使用 ARPReplayer 插件启动 AirScanner 模块:`start airscanner with arpreplayer` 在执行完这些命令后,ETF 会正确地识别加密的 ARP 数据包,然后成功执行 ARP 重放攻击,以此破坏这个网络。 @@ -149,18 +145,16 @@ ETF 使用 Python 的 Scapy 库来进行包嗅探和包注入。为了最大限 ![Scenario for capturing a WPA handshake after a de-authentication attack][13] -图 4:在解除认证攻击后捕获 WPA 握手包数据。 +*图 4:在解除认证攻击后捕获 WPA 握手包数据。* -使用 ETF,可以去设置 hostapd 配置文件,然后在后台启动该程序。Hostpad 支持在一张无线网卡上通过设置虚拟接口开启多个接入点,并且因为它支持所有类型的安全设置,因此可以设置完整的全能蜜罐。对于使用 WEP 和 WPA(2)-PSK 的网络,使用默认密码,和对于使用 WPA(2)-EAP 的网络,配置“全部接受”策略。 +使用 ETF,可以去设置 `hostapd` 配置文件,然后在后台启动该程序。`hostapd` 支持在一张无线网卡上通过设置虚拟接口开启多个接入点,并且因为它支持所有类型的安全设置,因此可以设置完整的全能蜜罐。对于使用 WEP 和 WPA(2)-PSK 的网络,使用默认密码,和对于使用 WPA(2)-EAP 的网络,配置“全部接受”策略。 对于这个场景,必须在 ETF 上执行下面的命令和操作: - 1. 进入 APLauncher 设置模式: **config aplauncher** - 2. 设置目标接入点的 SSID(APS): **set ssid = ** - 3. 设置 APLauncher 为全部接收的蜜罐: **set catch_all_honeypot = true** - 4. 启动 AirHost 模块: **start airhost** - - + 1. 进入 APLauncher 设置模式:`config aplauncher` + 2. 设置目标接入点的 SSID(APS):`set ssid = ` + 3. 设置 APLauncher 为全部接收的蜜罐:`set catch_all_honeypot = true` + 4. 启动 AirHost 模块:`start airhost` 使用这些命令,ETF 可以启动一个包含所有类型安全配置的完整全能蜜罐。ETF 同样能自动启动 DHCP 和 DNS 服务器,从而让客户端能与互联网保持连接。ETF 提供了一个更好、更快、更完整的解决方案来创建全能蜜罐。下面的代码能够看到 ETF 的成功执行。 @@ -195,17 +189,17 @@ ETF[etf/aircommunicator/airhost/aplauncher]::> start airhost ### 结论和以后的工作 -这些场景使用常见和总所周知的攻击方式来帮助验证 ETF 测试 WIFI 网络和客户端的能力。这个结果同样证明了框架的架构能在平台现有功能的优势上开发新的攻击向量和功能。这会加快新的 WiFi 渗透测试工具的开发,因为很多的代码已经写好了。除此之外,将 WiFi 技术相关的东西都集成到一个单独的工具里,会使 WiFi 渗透测试更加简单高效。 +这些场景使用常见和众所周知的攻击方式来帮助验证 ETF 测试 WIFI 网络和客户端的能力。这个结果同样证明了该框架的架构能在平台现有功能的优势上开发新的攻击向量和功能。这会加快新的 WiFi 渗透测试工具的开发,因为很多的代码已经写好了。除此之外,将 WiFi 技术相关的东西都集成到一个单独的工具里,会使 WiFi 渗透测试更加简单高效。 -ETF 的目标不是取代现有的工具,而是为它们提供补充,并为安全审计人员在进行 WiFi 测试和提升用户安全意识时,提供一个更好的选择。 +ETF 的目标不是取代现有的工具,而是为它们提供补充,并为安全审计人员在进行 WiFi 渗透测试和提升用户安全意识时,提供一个更好的选择。 -ETF 是 GitHub 上的一个开源项目,欢迎社区为它的开发做出贡献。下面是一些您可以提供帮助的方法。 +ETF 是 [GitHub][14] 上的一个开源项目,欢迎社区为它的开发做出贡献。下面是一些您可以提供帮助的方法。 -当前 WiFi 手动测试的一个限制是无法在测试期间记录重要的事件。这使得报告已经识别到的漏洞更加困难且准确性更低。这个框架可以实现一个登陆器,每个类都可以来访问它并创建一个手动测试会话报告。 +当前 WiFi 渗透测试的一个限制是无法在测试期间记录重要的事件。这使得报告已经识别到的漏洞更加困难且准确性更低。这个框架可以实现一个记录器,每个类都可以来访问它并创建一个渗透测试会话报告。 -ETF 工具的功能涵盖了 WiFi 手动测试的方方面面。一方面,它让 WiFi 目标侦察,漏洞挖掘和攻击这些阶段变得更加容易。另一方面,它没有提供一个便于提交报告的功能。增加会话的概念和会话报告的功能,比如在一个会话期间记录重要的事件,会极大地增加这个工具对于真实手动测试场景的价值。 +ETF 工具的功能涵盖了 WiFi 渗透测试的方方面面。一方面,它让 WiFi 目标侦察、漏洞挖掘和攻击这些阶段变得更加容易。另一方面,它没有提供一个便于提交报告的功能。增加了会话的概念和会话报告的功能,比如在一个会话期间记录重要的事件,会极大地增加这个工具对于真实渗透测试场景的价值。 -另一个有价值的贡献是扩展框架来促进 WiFi 模糊测试。IEEE 802.11 协议非常的复杂,考虑到它在客户端和接入点两方面都会有多种实现方式。可以假设这些实现都包含 bug 甚至是安全漏洞。这些 bug 可以通过对 IEEE 802.11 协议的数据帧进行模糊测试来进行发现。因为 Scapy 允许自定义的数据包创建和数据包注入,可以通过它实现一个模糊测试器。 +另一个有价值的贡献是扩展该框架来促进 WiFi 模糊测试。IEEE 802.11 协议非常的复杂,考虑到它在客户端和接入点两方面都会有多种实现方式。可以假设这些实现都包含 bug 甚至是安全漏洞。这些 bug 可以通过对 IEEE 802.11 协议的数据帧进行模糊测试来进行发现。因为 Scapy 允许自定义的数据包创建和数据包注入,可以通过它实现一个模糊测试器。 -------------------------------------------------------------------------------- @@ -214,7 +208,7 @@ via: https://opensource.com/article/19/1/evil-twin-framework 作者:[André Esser][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/) 荣誉推出 From e3097d1d988114c302c62348f91ba70ddda37f60 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 00:10:19 +0800 Subject: [PATCH 317/813] PUB:20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @hopefully2333 https://linux.cn/article-10568-1.html --- ...Evil-Twin Framework- A tool for improving WiFi security.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md (99%) diff --git a/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md similarity index 99% rename from translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md rename to published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md index b65d059f2f..760c2ed1cf 100644 --- a/translated/tech/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md +++ b/published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10568-1.html) [#]: subject: (The Evil-Twin Framework: A tool for improving WiFi security) [#]: via: (https://opensource.com/article/19/1/evil-twin-framework) [#]: author: (André Esser https://opensource.com/users/andreesser) From b5e693c72f039659a494f718edfd45e401fec1f9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 25 Feb 2019 08:52:26 +0800 Subject: [PATCH 318/813] translated --- ...move Sudo Privileges To Users On Ubuntu.md | 103 ------------------ ...move Sudo Privileges To Users On Ubuntu.md | 103 ++++++++++++++++++ 2 files changed, 103 insertions(+), 103 deletions(-) delete mode 100644 sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md create mode 100644 translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md diff --git a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md deleted file mode 100644 index 56e8bd0abc..0000000000 --- a/sources/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) -[#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Grant And Remove Sudo Privileges To Users On Ubuntu -====== -![](https://www.ostechnix.com/wp-content/uploads/2019/02/sudo-privileges-720x340.png) - -As you know already, the user can perform any administrative tasks with sudo privileges on Ubuntu systems. When creating a new users on your Linux box, they can’t do any administrative tasks until you make them to be a member of **‘sudo’ group**. In this brief tutorial, we explain how to add a regular user to sudo group and remove the given privileges to make it as just a normal user. - -**Grant Sudo Privileges To A regular User On Linux** - -Usually, we use **‘adduser’** command to create new user like below. - -``` -$ sudo adduser ostechnix -``` - -If you want the newly created user to perform any administrative tasks with sudo, just add him to the sudo group using command: - -``` -$ sudo usermod -a -G sudo hduser -``` - -The above command will make the user called **‘ostechnix’** to be the member of sudo group. - -You can also use this command too to add the users to sudo group. - -``` -$ sudo adduser ostechnix sudo -``` - -Now, log out and log in back as the new user for this change to take effect. The user has now become an administrative user. - -To verify it, just use ‘sudo’ as prefix in a any command. - -``` -$ sudo mkdir /test -[sudo] password for ostechnix: -``` - -### Remove sudo privileges of an User - -Sometimes, you might want to remove sudo privileges to a particular user without deleting it from your Linux box. To make any user as a normal user, just remove them from the sudo group. - -Say for example If you want to remove a user called **ostechnix** , from the sudo group, just run: - -``` -$ sudo deluser ostechnix sudo -``` - -**Sample output:** - -``` -Removing user `ostechnix' from group `sudo' ... -Done. -``` - -This command will only remove user ‘ostechnix’ from the sudo group, but it will not delete the user permanently from the system. Now, He becomes a regular user and can’t do any administrative tasks as sudo user. - -Also, you can use the following command to revoke the sudo access from an user: - -``` -$ sudo gpasswd -d ostechnix sudo -``` - -Please be careful while removing users from the sudo group. Do not remove the real administrator from the “sudo” group. - -Verify the user “ostechnix” has been really removed from sudo group using command: - -``` -$ sudo -l -U ostechnix -User ostechnix is not allowed to run sudo on ubuntuserver. -``` - -Yes, the user “ostechnix” has been removed from sudo group, and he can’t execute any administrative tasks. - -Please be careful while removing a user from a sudo group. If you have only one sudo user on your system and you remove him from the sudo group, you can’t perform any administrative stuffs such as installing, removing and updating programs on your system. So, please be careful. In our next, tutorial, we will explain how to restore sudo privileges to a user - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ - -作者:[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 diff --git a/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md new file mode 100644 index 0000000000..139301bcf9 --- /dev/null +++ b/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) +[#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 上为用户授予和删除 sudo 权限 +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/02/sudo-privileges-720x340.png) + +如你所知,用户可以在 Ubuntu 系统上使用 sudo 权限执行任何管理任务。在 Linux 机器上创建新用户时,他们无法执行任何管理任务,直到你将其加入 **“sudo” 组的成员**。在这个简短的教程中,我们将介绍如何将普通用户添加到 sudo 组以及删除给定的权限,使其成为普通用户。 + +**在 Linux 上向普通用户授予 sudo 权限** + +通常,我们使用 **“adduser”** 命令创建新用户,如下所示。 + +``` +$ sudo adduser ostechnix +``` + +如果你希望新创建的用户使用 sudo 执行管理任务,只需使用以下命令将它添加到 sudo 组: + +``` +$ sudo usermod -a -G sudo hduser +``` + +上面的命令将使名为 **“ostechnix”** 的用户成为 sudo 组的成员。 + +你也可以使用此命令将用户添加到 sudo 组。 + +``` +$ sudo adduser ostechnix sudo +``` + +现在,注销并以新用户身份登录,以使此更改生效。此时用户已成为管理用户。 + +要验证它,只需在任何命令中使用 “sudo” 作为前缀。 + +``` +$ sudo mkdir /test +[sudo] password for ostechnix: +``` + +### 删除用户的 sudo 权限 + +有时,你可能希望删除特定用户的 sudo 权限,而不用在 Linux 中删除它。要将任何用户设为普通用户,只需将其从 sudo 组中删除即可。 + +比如说如果要从 sudo 组中删除名为 **ostechnix** 的用户,只需运行: + +``` +$ sudo deluser ostechnix sudo +``` + +**示例输出:** + +``` +Removing user `ostechnix' from group `sudo' ... +Done. +``` + +此命令仅从 sudo 组中删除用户 “ostechnix”,但不会永久地从系统中删除用户。现在,它成为了普通用户,无法像 sudo 用户那样执行任何管理任务。 + +此外,你可以使用以下命令撤消用户的 sudo 访问权限: + +``` +$ sudo gpasswd -d ostechnix sudo +``` + +从 sudo 组中删除用户时请小心。不要从 “sudo” 组中删除真正的管理员。 + +使用命令验证用户 “ostechnix” 是否已从 sudo 组中删除: + +``` +$ sudo -l -U ostechnix +User ostechnix is not allowed to run sudo on ubuntuserver. +``` + +是的,用户 “ostechnix” 已从 sudo 组中删除,他无法执行任何管理任务。 + +从 sudo 组中删除用户时请小心。如果你的系统上只有一个 sudo 用户,并且你将它从 sudo 组中删除了,那么就无法执行任何管理操作,例如在系统上安装、删除和更新程序。所以,请小心。在我们的下一篇教程中,我们将解释如何恢复用户的 sudo 权限。 + +就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ + +作者:[SK][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 From a1d9540d9b89a5808b777a91f9fcdf6d5bdc7f38 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 25 Feb 2019 09:00:49 +0800 Subject: [PATCH 319/813] translating --- ...213 How to use Linux Cockpit to manage system performance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md index 0633b0b3ab..8619feb6c2 100644 --- a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md +++ b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 843c41a589b5a1e5b84bf304b4f7660cd85400d4 Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Mon, 25 Feb 2019 10:15:19 +0800 Subject: [PATCH 320/813] =?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 --- ...0190219 Logical - in Bash.md => 20190219 Logical - in Bash.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{T20190219 Logical - in Bash.md => 20190219 Logical - in Bash.md} (100%) diff --git a/translated/tech/T20190219 Logical - in Bash.md b/translated/tech/20190219 Logical - in Bash.md similarity index 100% rename from translated/tech/T20190219 Logical - in Bash.md rename to translated/tech/20190219 Logical - in Bash.md From 0551e2b2bcdae5c4147503e3fa646f75ab874af9 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Mon, 25 Feb 2019 11:00:44 +0800 Subject: [PATCH 321/813] Update 20181220 7 CI-CD tools for sysadmins.md --- .../20181220 7 CI-CD tools for sysadmins.md | 77 ++++++------------- 1 file changed, 23 insertions(+), 54 deletions(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index a3b3c89687..f3c1be0972 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -7,113 +7,82 @@ [#]: via: (https://opensource.com/article/18/12/cicd-tools-sysadmins) [#]: author: (Dan Barker https://opensource.com/users/barkerd427) -7 CI/CD tools for sysadmins 系统管理员的 7 个 CI/CD 工具 ====== -An easy guide to the top open source continuous integration, continuous delivery, and continuous deployment tools. -一篇简单指南:常见的开源持续集成、持续交付和持续部署工具。 +本文是一篇简单指南:介绍一些常见的开源 CI/CD 工具。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) -Continuous integration, continuous delivery, and continuous deployment (CI/CD) have all existed in the developer community for many years. Some organizations have involved their operations counterparts, but many haven't. For most organizations, it's imperative for their operations teams to become just as familiar with CI/CD tools and practices as their development compatriots are. -虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 +虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施经验,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 -CI/CD practices can equally apply to infrastructure and third-party applications and internally developed applications. Also, there are many different tools but all use similar models. And possibly most importantly, leading your company into this new practice will put you in a strong position within your company, and you'll be a beacon for others to follow. -无论是基础设施、第三方应用还是内部开发应用,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有相似的设计模型。而且可能最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,成为他人学习的榜样。 +无论是基础设施、第三方应用还是内部开发的应用,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有着相似的设计模型。而且可能最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,成为他人学习的榜样。 -Some organizations have been using CI/CD practices on infrastructure, with tools like [Ansible][1], [Chef][2], or [Puppet][3], for several years. Other tools, like [Test Kitchen][4], allow tests to be performed on infrastructure that will eventually host applications. In fact, those tests can even deploy the application into a production-like environment and execute application-level tests with production loads in more advanced configurations. However, just getting to the point of being able to test the infrastructure individually is a huge feat. Terraform can also use Test Kitchen for even more [ephemeral][5] and [idempotent][6] infrastructure configurations than some of the original configuration-management tools. Add in Linux containers and Kubernetes, and you can now test full infrastructure and application deployments with prod-like specs and resources that come and go in hours rather than months or years. Everything is wiped out before being deployed and tested again. -一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在用于生产的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建可复用的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 +一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在最终要部署应用的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建[可复用][6]的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 -However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. -当然,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数开发管道(pipeline)都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 +当然,作为初学者,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数用于开发的管道(pipeline)都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 -For example, I regularly write a newsletter within my company, and I maintain it in version control using [MJML][7]. I needed to be able to host a web version, and some folks liked being able to get a PDF, so I built a [pipeline][8]. Now when I create a new newsletter, I submit it for a merge request in GitLab. This automatically creates an index.html with links to HTML and PDF versions of the newsletter. The HTML and PDF files are also created in the pipeline. None of this is published until someone comes and reviews these artifacts. Then, GitLab Pages publishes the website and I can pull down the HTML to send as a newsletter. In the future, I'll automatically send the newsletter when the merge request is merged or after a special approval step. This seems simple, but it has saved me a lot of time. This is really at the core of what these tools can do for you. They will save you time. -举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[管道][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在管道里同时生成。这些文件不会被直接发布出去,除非有人来检查确认。GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求通过或者在特殊的审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 +举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[管道][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在管道里同时生成。除非有人来检查确认,这些文件不会被直接发布出去。使用 GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求成功或者在某个审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 -The key is creating tools to work in the abstract so that they can apply to multiple problems with little change. I should also note that what I created required almost no code except [some light HTML templating][9], some [node to loop through the HTML files][10], and some more [node to populate the index page with all the HTML pages and PDFs][11]. -关键是要在抽象层创建出工具,这样它们稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成 index 页面的 nodejs 代码][11]。 +关键是要在抽象层创建出工具,这样稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成 index 页面的 nodejs 代码][11]。 -Some of this might look a little complex, but most of it was taken from the tutorials of the different tools I'm using. And many developers are happy to work with you on these types of things, as they might also find them useful when they're done. The links I've provided are to a newsletter we plan to start for [DevOps KC][12], and all the code for creating the site comes from the work I did on our internal newsletter. -这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也乐意跟你合作干这些事,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 +这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也会乐意跟你合作,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 -Many of the tools listed below can offer this type of interaction, but some offer a slightly different model. The emerging model in this space is that of a declarative description of a pipeline in something like YAML with each stage being ephemeral and idempotent. Many of these systems also ensure correct sequencing by creating a [directed acyclic graph][13] (DAG) over the different stages of the pipeline. -下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明性的语言如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段排序的正确性。 +下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明式的方法例如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段排序的正确性。 -These stages are often run in Linux containers and can do anything you can do in a container. Some tools, like [Spinnaker][14], focus only on the deployment component and offer some operational features that others don't normally include. [Jenkins][15] has generally kept pipelines in an XML format and most interactions occur within the GUI, but more recent implementations have used a [domain specific language][16] (DSL) using [Groovy][17]. Further, Jenkins jobs normally execute on nodes with a special Java agent installed and consist of a mix of plugins and pre-installed components. -这些阶段一般运行在 Linux 容器里,和普通的容器没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件而且提供一些其他工具没有的操作特性。[Jenkins][15] 通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用 [领域专用语言(DSL)][16] 如[Groovy][17]。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点会装一个专门的 Java 程序还有一堆混杂的插件和预装组件。 +这些阶段一般运行在 Linux 容器里,和普通的容器并没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件,而且提供一些其他工具没有的操作特性。[Jenkins][15] 则通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用[领域专用语言(DSL)][16]如[Groovy][17]。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点上会装一个专门的 Java 程序还有一堆混杂的插件和预装组件。 -Jenkins introduced pipelines in its tool, but they were a bit challenging to use and contained several caveats. Recently, the creator of Jenkins decided to move the community toward a couple different initiatives that will hopefully breathe new life into the project—which is the one that really brought CI/CD to the masses. I think its most interesting initiative is creating a Cloud Native Jenkins that can turn a Kubernetes cluster into a Jenkins CI/CD platform. Jenkins 在自己的工具里引入了管道的概念,但使用起来却并不轻松,甚至包含一些禁区。最近,Jenkins 的创始人决定带领社区向新的方向前进,希望能为这个项目注入新的活力,把 CI/CD 真正推广开(译者注:详见后面的 Jenkins 章节)。我认为其中最有意思的想法是构建一个云原生 Jenkins,能把 Kubernetes 集群转变成 Jenkins CI/CD 平台。 -As you learn more about these tools and start bringing these practices into your company or your operations division, you'll quickly gain followers. You will increase your own productivity as well as that of others. We all have years of backlog to get to—how much would your co-workers love if you could give them enough time to start tackling that backlog? Not only that, but your customers will start to see increased application reliability, and your management will see you as a force multiplier. That certainly can't hurt during your next salary negotiation or when interviewing with all your new skills. -当你更多地了解这些工具并把实践带入你的公司和运维部门,你很快就会有追随者,因为你有办法提升自己和别人的工作效率。我们都有多年积累下来的技术债要解决,如果你能给同事们提供足够的时间来处理这些积压的工作,他们该会有多感激呢?不止如此,你的客户也会开始看到应用稳定性的提升,管理层会把你看作得力干将,你也会在下次谈薪资待遇或参加面试时更有底气。 +当你更多地了解这些工具并把实践带入你的公司和运维部门,你很快就会有追随者,因为你有办法提升自己和别人的工作效率。我们都有多年积累下来的技术债要解决,如果你能给同事们提供足够的时间来处理这些积压的工作,他们该会有多感激呢?不止如此,你的客户也会开始看到应用变得越来越稳定,管理层会把你看作得力干将,你也会在下次谈薪资待遇或参加面试时更有底气。 -Let's dig into the tools a bit more. We'll briefly cover each one and share links to more information. 让我们开始深入了解这些工具吧,我们将对每个工具做简短的介绍,并分享一些有用的链接。 ### GitLab CI -GitLab is a fairly new entrant to the CI/CD space, but it's already achieved the top spot in the [Forrester Wave for Continuous Integration Tools][20]. That's a huge achievement in such a crowded and highly qualified field. What makes GitLab CI so great? It uses a YAML file to describe the entire pipeline. It also has a functionality called Auto DevOps that allows for simpler projects to have a pipeline built automatically with multiple tests built-in. This system uses [Herokuish buildpacks][21] to determine the language and how to build the application. Some languages can also manage databases, which is a real game-changer for building new applications and getting them deployed to production from the beginning of the development process. The system has native integrations into Kubernetes and will deploy your application automatically into a Kubernetes cluster using one of several different deployment methodologies, like percentage-based rollouts and blue-green deployments. -GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。在一个高水平、竞争激烈的领域里,这是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。它还有一个功能叫做 Auto DevOps,可以为简单的工程自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 整合地很紧密,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 +GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。在一个高水平、竞争充分的领域里,这是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。另有一个功能叫做 Auto DevOps,可以为较简单的项目自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 紧密整合,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 -In addition to its CI functionality, GitLab offers many complementary features like operations and monitoring with Prometheus deployed automatically with your application; portfolio and project management using GitLab Issues, Epics, and Milestones; security checks built into the pipeline with the results provided as an aggregate across multiple projects; and the ability to edit code right in GitLab using the WebIDE, which can even provide a preview or execute part of a pipeline for faster feedback. 除了它的持续集成功能,GitLab 还提供了许多补充特性,比如:将 Prometheus 和你的应用一同部署,以提供监控功能;通过 GitLab 提供的 Issues、Epics 和 Milestones 功能来实现项目评估和管理;管道中集成了安全检测功能,多个项目的检测结果会聚合显示;你可以通过 GitLab 提供的网页版 IDE 在线编辑代码,还可以快速查看管道的预览或执行状态。 ### GoCD -GoCD comes from the great minds at Thoughtworks, which is testimony enough for its capabilities and efficiency. To me, GoCD's main differentiator from the rest of the pack is its [Value Stream Map][22] (VSM) feature. In fact, pipelines can be chained together with one pipeline providing the "material" for the next pipeline. This allows for increased independence for different teams with different responsibilities in the deployment process. This may be a useful feature when introducing this type of system in older organizations that intend to keep these teams separate—but having everyone using the same tool will make it easier later to find bottlenecks in the VSM and reorganize the teams or work to increase efficiencies. -GoCD 是由老牌软件公司 Thoughtworks 出品,这已经足够证明它的能力和效率。对我而言,GoCD 最有亮点的特性是它的[价值流视图(VSM)][22]。实际上,一个管道的输出可以变成下一个管道的输入,从而把管道串联起来。这样做有助于提高不同开发团队在整个开发流程中的独立性。比如在引入 CI/CD 系统时,有些成立较久的机构希望保持他们各个团队相互隔离,这时候 VSM 就很有用了:让每个人都使用相同的工具就很容易在 VSM 中发现工作流程上的瓶颈,然后可以按图索骥调整团队或者想办法提高工作效率。 +GoCD 是由老牌软件公司 Thoughtworks 出品,这已经足够证明它的能力和效率。对我而言,GoCD 最具亮点的特性是它的[价值流视图(VSM)][22]。实际上,一个管道的输出可以变成下一个管道的输入,从而把管道串联起来。这样做有助于提高不同开发团队在整个开发流程中的独立性。比如在引入 CI/CD 系统时,有些成立较久的机构希望保持他们各个团队相互隔离,这时候 VSM 就很有用了:让每个人都使用相同的工具就很容易在 VSM 中发现工作流程上的瓶颈,然后可以按图索骥调整团队或者想办法提高工作效率。 -It's incredibly valuable to have a VSM for each product in a company; that GoCD allows this to be [described in JSON or YAML][23] in version control and presented visually with all the data around wait times makes this tool even more valuable to an organization trying to understand itself better. Start by installing GoCD and mapping out your process with only manual approval gates. Then have each team use the manual approvals so you can start collecting data on where bottlenecks might exist. -为公司的每个产品配置 VSM 是非常有价值的;GoCD 可以使用 [JSON 或 YAML 格式存储配置][23],还能以可视化的方式展示等待时间,这让一个机构能有效减少学习它的成本。刚开始使用 GoCD 创建你自己的流程时,建议使用手动批复的方式。让每个团队也采用手动批复,这样你就可以开始收集数据并且找到可能的瓶颈点。 +为公司的每个产品配置 VSM 是非常有价值的;GoCD 可以使用 [JSON 或 YAML 格式存储配置][23],还能以可视化的方式展示等待时间,这让一个机构能有效减少学习它的成本。刚开始使用 GoCD 创建你自己的流程时,建议使用人工审核的方式。让每个团队也采用人工审核,这样你就可以开始收集数据并且找到可能的瓶颈点。 ### Travis CI -Travis CI was my first experience with a Software as a Service (SaaS) CI system, and it's pretty awesome. The pipelines are stored as YAML with your source code, and it integrates seamlessly with tools like GitHub. I don't remember the last time a pipeline failed because of Travis CI or the integration—Travis CI has a very high uptime. Not only can it be used as SaaS, but it also has a version that can be hosted. I haven't run that version—there were a lot of components, and it looked a bit daunting to install all of it. I'm guessing it would be much easier to deploy it all to Kubernetes with [Helm charts provided by Travis CI][26]. Those charts don't deploy everything yet, but I'm sure it will grow even more in the future. There is also an enterprise version if you don't want to deal with the hassle. -我使用的第一个软件既服务(SaaS)类型的 CI 系统就是 Travis CI,体验很不错。管道配置以源码形式用 YAML 保存,它与 GitHub 等工具无缝整合。我印象中管道从来没有失效过,因为 Travis CI 的在线率很高。除了 SaaS 版之外,你也可以使用自行部署的版本。我还没有自行部署过,它的组件非常多,要全部安装的话,工作量就有点吓人了。我猜更简单的办法是把它部署到 Kubernetes 上,[Travis CI 提供了 Helm charts][26],这些 charts 目前不包含所有要部署的组件,但我相信以后会越来越多的。如果你不想处理这些细枝末节的问题,还有一个企业版可以试试。 +我使用的第一个软件既服务(SaaS)类型的 CI 系统就是 Travis CI,体验很不错。管道配置以源码形式用 YAML 保存,它与 GitHub 等工具无缝整合。我印象中管道从来没有失效过,因为 Travis CI 的在线率很高。除了 SaaS 版之外,你也可以使用自行部署的版本。我还没有自行部署过,它的组件非常多,要全部安装的话,工作量就有点吓人了。我猜更简单的办法是把它部署到 Kubernetes 上,[Travis CI 提供了 Helm charts][26],这些 charts 目前不包含所有要部署的组件,但我相信以后会越来越丰富的。如果你不想处理这些细枝末节的问题,还有一个企业版可以试试。 -However, if you're developing open source code, you can use the SaaS version of Travis CI for free. That is an awesome service provided by an awesome team! This alleviates a lot of overhead and allows you to use a fairly common platform for developing open source code without having to run anything. -如果你在开发一个开源项目,你就可以免费使用 SaaS 版的 Travis CI,享受顶尖团队提供的优质服务!这样能省去很多麻烦,你能在一个相对通用的平台上研发开源项目,而不用运行任何东西。 +假如你在开发一个开源项目,你就能免费使用 SaaS 版的 Travis CI,享受顶尖团队提供的优质服务!这样能省去很多麻烦,你可以在一个相对通用的平台上(如 GitHub)研发开源项目,而不用找服务器来运行任何东西。 ### Jenkins -Jenkins is the original, the venerable, de facto standard in CI/CD. If you haven't already, you need to read "[Jenkins: Shifting Gears][27]" from Kohsuke, the creator of Jenkins and CTO of CloudBees. It sums up all of my feelings about Jenkins and the community from the last decade. What he describes is something that has been needed for several years, and I'm happy CloudBees is taking the lead on this transformation. Jenkins will be a bit overwhelming to most non-developers and has long been a burden on its administrators. However, these are items they're aiming to fix. -Jenkins在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我强烈建议你读一读这篇文章:"[Jenkins: Shifting Gears][27]",作者 Kohsuke 是 Jenkins 的创始人兼 CloudBees 公司 CTO。这篇文章总结了我在过去十年里对 Jenkins 及其社区的感受。他在文中阐述了一些这几年呼声很高的需求,我很乐意看到 CloudBees 引领这场变革。长期以来,Jenkins 对于非开发人员来说有点难以接受,并且一直是其管理员的重担。还好,这些问题正是他们想要着手解决的。 +Jenkins在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我强烈建议你读一读这篇文章:"[Jenkins: Shifting Gears][27]",作者 Kohsuke 是 Jenkins 的创始人兼 CloudBees 公司 CTO。这篇文章契合了我在过去十年里对 Jenkins 及其社区的感受。他在文中阐述了一些这几年呼声很高的需求,我很乐意看到 CloudBees 引领这场变革。长期以来,Jenkins 对于非开发人员来说有点难以接受,并且一直是其管理员的重担。还好,这些问题正是他们想要着手解决的。 -[Jenkins Configuration as Code][28] (JCasC) should help fix the complex configuration issues that have plagued admins for years. This will allow for a zero-touch configuration of Jenkins masters through a YAML file, similar to other CI/CD systems. [Jenkins Evergreen][29] aims to make this process even easier by providing predefined Jenkins configurations based on different use cases. These distributions should be easier to maintain and upgrade than the normal Jenkins distribution. [Jenkins 配置既代码][28](JCasC)应该可以帮助管理员解决困扰了他们多年的配置复杂性问题。与其他 CI/CD 系统类似,只需要修改一个简单的 YAML 文件就可以完成 Jenkins 主节点的配置工作。[Jenkins Evergreen][29] 的出现让配置工作变得更加轻松,它提供了很多预设的使用场景,你只管套用就可以了。这些发行版会比官方的标准版本 Jenkins 更容易维护和升级。 -Jenkins 2 introduced native pipeline functionality with two types of pipelines, which [I discuss][30] in a LISA17 presentation. Neither is as easy to navigate as YAML when you're doing something simple, but they're quite nice for doing more complex tasks. Jenkins 2 引入了两种原生的管道(pipeline)功能,我在 LISA(一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 -[Jenkins X][31] is the full transformation of Jenkins and will likely be the implementation of Cloud Native Jenkins (or at least the thing most users see when using Cloud Native Jenkins). It will take JCasC and Evergreen and use them at their best natively on Kubernetes. These are exciting times for Jenkins, and I look forward to its innovation and continued leadership in this space. [Jenkins X][31] 是 Jenkins 的一个全新变种,用来实现云端原生 Jenkins(至少在用户看来是这样)。它会使用 JCasC 及 Evergreen,并且和 Kubernetes 整合的更加紧密。对于 Jenkins 来说这是个令人激动的时刻,我很乐意看到它在这一领域的创新,并且继续发挥领袖作用。 ### Concourse CI -I was first introduced to Concourse through folks at Pivotal Labs when it was an early beta version—there weren't many tools like it at the time. The system is made of microservices, and each job runs within a container. One of its most useful features that other tools don't have is the ability to run a job from your local system with your local changes. This means you can develop locally (assuming you have a connection to the Concourse server) and run your builds just as they'll run in the real build pipeline. Also, you can rerun failed builds from your local system and inject specific changes to test your fixes. -我第一次知道 Concourse 是通过 Pivotal Labs 的伙计们介绍的,当时它处于早期 beta 版本,而且那时候也很少有类似的工具。这套系统是基于微服务构建的,每个任务运行在一个容器里。它独有的一个优良特性是能够在你本地系统上运行任务,体现你本地的改动。这意味着你完全可以在本地开发(假设你已经连接到了 Concourse 的服务器),像在真实的管道构建流程一样从你本地构建项目。而且,你可以在本地修改过代码后直接重新运行构建,来检验你的改动结果。 +我第一次知道 Concourse 是通过 Pivotal Labs 的伙计们介绍的,当时它处于早期 beta 版本,而且那时候也很少有类似的工具。这套系统是基于微服务构建的,每个任务运行在一个容器里。它独有的一个优良特性是能够在你本地系统上运行任务,体现你本地的改动。这意味着你完全可以在本地开发(假设你已经连接到了 Concourse 的服务器),像在真实的管道构建流程一样从你本地构建项目。而且,你可以在修改过代码后从本地直接重新运行构建,来检验你的改动结果。 -Concourse also has a simple extension system that relies on the fundamental concept of resources. Basically, each new feature you want to provide to your pipeline can be implemented in a Docker image and included as a new resource type in your configuration. This keeps all functionality encapsulated in a single, immutable artifact that can be upgraded and modified independently, and breaking changes don't necessarily have to break all your builds at the same time. Concourse 还有一个简单的扩展系统,它依赖于资源这一基础概念。基本上,你想给管道添加的每个新功能都可以用一个 Docker 镜像实现,并作为一个新的资源类型包含在你的配置中。这样可以保证每个功能都被封装在一个不易改变的独立工件中,方便对其单独修改和升级,改变其中一个时不会影响其他构建。 ### Spinnaker -Spinnaker comes from Netflix and is more focused on continuous deployment than continuous integration. It can integrate with other tools, including Travis and Jenkins, to kick off test and deployment pipelines. It also has integrations with monitoring tools like Prometheus and Datadog to make decisions about deployments based on metrics provided by these systems. For example, the canary deployment uses a judge concept and the metrics being collected to determine if the latest canary deployment has caused any degradation in pertinent metrics and should be rolled back or if deployment can continue. -Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在一次金丝雀发布(canary deployment)里,我们可以根据收集到的相关监控指标来做出判断:最近这次发布导致了服务降级应该立刻回滚;或者看起来一切OK,于是继续执行部署。 +Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在一次金丝雀发布(canary deployment)里,我们可以根据收集到的相关监控指标来做出判断:最近的这次发布是否导致了服务降级,应该立刻回滚;还是说看起来一切OK,应该继续执行部署。 -A couple of additional, unique features related to deployments cover an area that is often overlooked when discussing continuous deployment, and might even seem antithetical, but is critical to success: Spinnaker helps make continuous deployment a little less continuous. It will prevent a stage from running during certain times to prevent a deployment from occurring during a critical time in the application lifecycle. It can also enforce manual approvals to ensure the release occurs when the business will benefit the most from the change. In fact, the whole point of continuous integration and continuous deployment is to be ready to deploy changes as quickly as the business needs to change. -谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止执行,以阻止可能发生的部署错误。但它也可以在最关键的时刻让手动审核强制通过,发布新版本上线,使整体收益最大化。实际上,CI/CD 的主要目的就是在商业模式需要调整时,能够让待更新的代码立即得到部署。 +谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止执行,以阻止可能发生的部署错误。但它也可以在最关键的时刻让人工审核强制通过,发布新版本上线,使整体收益最大化。实际上,CI/CD 的主要目的就是在商业模式需要调整时,能够让待更新的代码立即得到部署。 ### Screwdriver -Screwdriver is an impressively simple piece of engineering. It uses a microservices approach and relies on tools like Nomad, Kubernetes, and Docker to act as its execution engine. There is a pretty good [deployment tutorial][34] for deploying to AWS and Kubernetes, but it could be improved once the in-progress [Helm chart][35] is completed. Screwdriver 是个简单而又强大的软件。它采用微服务架构,依赖像 Nomad、Kubernetes 和 Docker 这样的工具作为执行引擎。官方有一篇很不错的[部署教学文档][34],介绍了如何将它部署到 AWS 和 Kubernetes 上,但如果相应的 [Helm chart][35] 也完成的话,就更完美了。 -Screwdriver also uses YAML for its pipeline descriptions and includes a lot of sensible defaults, so there's less boilerplate configuration for each pipeline. The configuration describes an advanced workflow that can have complex dependencies among jobs. For example, a job can be guaranteed to run after or before another job. Jobs can run in parallel and be joined afterward. You can also use logical operators to run a job, for example, if any of its dependencies are successful or only if all are successful. Even better is that you can specify certain jobs to be triggered from a pull request. Also, dependent jobs won't run when this occurs, which allows easy segregation of your pipeline for when an artifact should go to production and when it still needs to be reviewed. -Screwdriver 也使用 YAML 来描述它的管道,并且有很多合理的默认值,这样可以有效减少各个管道重复的配置项。用配置文件可以组织起高级的工作流,来描述各个 job 间复杂的依赖关系。例如,一项工作可以确保在另一个工作开始前或结束后运行;各个工作可以并行也可以串行执行;更赞的是你可以预先定义一项工作,只在特定的 pull request 请求时被触发,而且与之有依赖关系的工作并不会被执行,这能让你的管道具有一定的隔离性:什么时候被构造的工件应该被部署到生产环境,什么时候应该被审核。 +Screwdriver 也使用 YAML 来描述它的管道,并且有很多合理的默认值,这样可以有效减少各个管道重复的配置项。用配置文件可以组织起高级的工作流,来描述各个 job 间复杂的依赖关系。例如,一项任务可以在另一个任务开始前或结束后运行;各个任务可以并行也可以串行执行;更赞的是你可以预先定义一项任务,只在特定的 pull request 请求时被触发,而且与之有依赖关系的任务并不会被执行,这能让你的管道具有一定的隔离性:什么时候被构造的工件应该被部署到生产环境,什么时候应该被审核。 -This is only a brief description of these CI/CD tools—each has even more cool features and differentiators you can investigate. They are all open source and free to use, so go deploy them and see which one fits your needs best. -以上只是我对这些 CI/CD 工具的简单介绍,它们还有许多很酷的特性和差异值得你深入探索。它们都是开源软件,可以自由使用,去部署一下看看,究竟哪个才是最适合你的那个。 +以上只是我对这些 CI/CD 工具的简单介绍,它们还有许多很酷的特性等待你深入探索。而且它们都是开源软件,可以自由使用,去部署一下看看吧,究竟哪个才是最适合你的那个。 -------------------------------------------------------------------------------- @@ -121,7 +90,7 @@ via: https://opensource.com/article/18/12/cicd-tools-sysadmins 作者:[Dan Barker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[jdh8383](https://github.com/jdh8383) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 986b9376742dfd112e76be5d60e6bb16ca4dfd06 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Mon, 25 Feb 2019 11:03:42 +0800 Subject: [PATCH 322/813] Update 20181220 7 CI-CD tools for sysadmins.md --- sources/talk/20181220 7 CI-CD tools for sysadmins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md index f3c1be0972..fe00691a9a 100644 --- a/sources/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -9,7 +9,7 @@ 系统管理员的 7 个 CI/CD 工具 ====== -本文是一篇简单指南:介绍一些常见的开源 CI/CD 工具。 +本文是一篇简单指南:介绍一些常见的开源 CI/CD 工具。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) 虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施经验,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 From ddbcf3b6a8734f2e3f39adf30168844e348e50c8 Mon Sep 17 00:00:00 2001 From: Jerry Li Date: Mon, 25 Feb 2019 11:18:21 +0800 Subject: [PATCH 323/813] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?20181220=207=20CI-CD=20tools=20for=20sysadmins.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talk/20181220 7 CI-CD tools for sysadmins.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20181220 7 CI-CD tools for sysadmins.md (100%) diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/translated/talk/20181220 7 CI-CD tools for sysadmins.md similarity index 100% rename from sources/talk/20181220 7 CI-CD tools for sysadmins.md rename to translated/talk/20181220 7 CI-CD tools for sysadmins.md From ecf27f0d7e32ec008e31de4e019d38ba8e4ed45d Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 25 Feb 2019 11:59:14 +0800 Subject: [PATCH 324/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190223=20Regex?= =?UTF-8?q?=20groups=20and=20numerals=20sources/tech/20190223=20Regex=20gr?= =?UTF-8?q?oups=20and=20numerals.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190223 Regex groups and numerals.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20190223 Regex groups and numerals.md diff --git a/sources/tech/20190223 Regex groups and numerals.md b/sources/tech/20190223 Regex groups and numerals.md new file mode 100644 index 0000000000..764ec1dfd5 --- /dev/null +++ b/sources/tech/20190223 Regex groups and numerals.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Regex groups and numerals) +[#]: via: (https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/) +[#]: author: (Dr.Drang https://leancrew.com) + +Regex groups and numerals +====== + +A week or so ago, I was editing a program and decided I should change some variable names. I thought it would be a simple regex find/replace, and it was. Just not as simple as I thought. + +The variables were named `a10`, `v10`, and `x10`, and I wanted to change them to `a30`, `v30`, and `x30`, respectively. I brought up BBEdit’s Find window and entered this: + +![Mistaken BBEdit replacement pattern][2] + +I couldn’t just replace `10` with `30` because there were instances of `10` in the code that weren’t related to the variables. And because I think I’m clever, I didn’t want to do three non-regex replacements, one each for `a10`, `v10`, and `x10`. But I wasn’t clever enough to notice the blue coloring in the replacement pattern. Had I done so, I would have seen that BBEdit was interpreting my replacement pattern as “Captured group 13, followed by `0`” instead of “Captured group 1, followed by `30`,” which was what I intended. Since captured group 13 was blank, all my variable names were replaced with `0`. + +You see, BBEdit can capture up to 99 groups in the search pattern and, strictly speaking, we should use two-digit numbers when referring to them in the replacement pattern. But in most cases, we can use `\1` through `\9` instead of `\01` through `\09` because there’s no ambiguity. In other words, if I had been trying to change `a10`, `v10`, and `x10` to `az`, `vz`, and `xz`, a replacement pattern of `\1z` would have been just fine, because the trailing `z` means there’s no way to misinterpret the intent of the `\1` in that pattern. + +So after undoing the replacement, I changed the pattern to this, + +![Two-digit BBEdit replacement pattern][3] + +and all was right with the world. + +There was another option: a named group. Here’s how that would have looked, using `var` as the pattern name: + +![Named BBEdit replacement pattern][4] + +I don’t think I’ve ever used a named group in any situation, whether the regex was in a text editor or a script. My general feeling is that if the pattern is so complicated I have to use variables to keep track of all the groups, I should stop and break the problem down into smaller parts. + +By the way, you may have heard that BBEdit is celebrating its [25th anniversary][5] of not sucking. When a well-documented app has such a long history, the manual starts to accumulate delightful callbacks to the olden days. As I was looking up the notation for named groups in the BBEdit manual, I ran across this note: + +![BBEdit regex manual excerpt][6] + +BBEdit is currently on Version 12.5; Version 6.5 came out in 2001. But the manual wants to make sure that long-time customers (I believe it was on Version 4 when I first bought it) don’t get confused by changes in behavior, even when those changes occurred nearly two decades ago. + + +-------------------------------------------------------------------------------- + +via: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ + +作者:[Dr.Drang][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://leancrew.com +[b]: https://github.com/lujun9972 +[1]: https://leancrew.com/all-this/2019/02/automation-evolution/ +[2]: https://leancrew.com/all-this/images2019/20190223-Mistaken%20BBEdit%20replacement%20pattern.png (Mistaken BBEdit replacement pattern) +[3]: https://leancrew.com/all-this/images2019/20190223-Two-digit%20BBEdit%20replacement%20pattern.png (Two-digit BBEdit replacement pattern) +[4]: https://leancrew.com/all-this/images2019/20190223-Named%20BBEdit%20replacement%20pattern.png (Named BBEdit replacement pattern) +[5]: https://merch.barebones.com/ +[6]: https://leancrew.com/all-this/images2019/20190223-BBEdit%20regex%20manual%20excerpt.png (BBEdit regex manual excerpt) From 2eeb3e4a605687c2d286ff716518cc924c981213 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 25 Feb 2019 12:00:39 +0800 Subject: [PATCH 325/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Automa?= =?UTF-8?q?tion=20evolution=20sources/tech/20190220=20Automation=20evoluti?= =?UTF-8?q?on.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20190220 Automation evolution.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20190220 Automation evolution.md diff --git a/sources/tech/20190220 Automation evolution.md b/sources/tech/20190220 Automation evolution.md new file mode 100644 index 0000000000..09167521c6 --- /dev/null +++ b/sources/tech/20190220 Automation evolution.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automation evolution) +[#]: via: (https://leancrew.com/all-this/2019/02/automation-evolution/) +[#]: author: (Dr.Drang https://leancrew.com) + +Automation evolution +====== + +In my experience, scripts and macros almost never end up the way they start. This shouldn’t be a surprise. Just as spending time performing a particular task makes you realize it should be automated, spending time working with the automation makes you realize how it can be improved. Contra [XKCD][3], this doesn’t mean the decision to automate a task puts you on an endless treadmill of tweaking that’s never worth the time you invest. It means you’re continuing to think about how you do things and how your methods can be improved. I have an example that I’ve been working on for years. + +Two of the essential but dull parts of my job involve sending out invoices to clients and following up when those invoices aren’t paid on time. I’ve gradually built up a system to handle both of these interrelated duties. I’ve written about certain details before, but here I want to talk about how and why the system has evolved. + +It started with [TextExpander][4] snippets. One was for the text of the email that accompanied the invoice when it was first sent, and it looked like this (albeit less terse): + +``` +Attached is invoice A for $B on project C. Payment is due on D. +``` + +where the A, B, C, and D were [fill-in fields][5]. Similarly, there was a snippet for the followup emails. + +``` +The attached invoice, X for $Y on project Z, is still outstanding +and is now E days old. Pay up. +``` + +While these snippets was certainly better than typing this boilerplate out again and again, they weren’t using the computer for what it’s good at: looking things up and calculating. The invoices are PDFs that came out of my company’s accounting system and contain the information for X, Y, Z, and D. The age of the invoice, E, can be calculated from D and the current date. + +So after a month or two of using the snippets, I wrote an invoicing script in Python that read the invoice PDF and created an email message with all of the parts filled in. It also added a subject line and used a project database to look up the client’s email address to put in the To field. A similar script created a dunning email message. Both of these scripts could be run from the Terminal and took the invoice PDF as their argument, e.g., + +``` +invoice 12345.pdf +``` + +and + +``` +dun 12345.pdf +``` + +I should mention that these scripts created the email messages, but they didn’t send them. Sometimes I need to add an extra sentence or two to handle particular situations, and these scripts stopped short of sending so I could do that. + +It didn’t take very long for me to realize that opening a Terminal window just to run a single command was itself a waste of time. I used Automator to add Quick Action workflows that run the `invoice` and `dun` scripts to the Services menu. That allowed me to run the scripts by right-clicking on an invoice PDF file in the Finder. + +This system lasted quite a while. Eventually, though, I decided it was foolish to rely on my memory (or periodic checking of my outstanding invoices) to decide when to send out the followup emails on unpaid bills. I added a section to the `invoice` script that created a reminder along with the invoicing email. The reminder went in the Invoices list of the Reminders app and was given a due date of the first Tuesday at least 45 days after the invoice date. My invoices are net 30, so 45 days seemed like a good starting time for followups. And rather than having the reminder pop up on any day of the week, I set it to Tuesday—early in the week but unlikely to be on a holiday.1 + +Changing the `invoice` script changed the behavior of the Services menu item that called it; I didn’t have to make any changes in Automator. + +This system was the state of the art until it hit me that I could write a script that checked Reminders for every invoice that was past due and run the `dun` script on all of them, creating a series of followup emails in one fell swoop. I wrote this script as a combination of Python and AppleScript and embedded it in a [Keyboard Maestro][6] macro. With this macro in place, I no longer had to hunt for the invoices to right-click on. + +A couple of weeks ago, after reading Federico Viticci’s article on [using a Mac from iOS][7], I began thinking about the hole in my followup system: I have to be at my Mac to run Keyboard Maestro. What if I’m traveling on Tuesday and want to send out followup emails from my iPhone or iPad? OK, sure, I could use Screens to connect to the Mac and run the Keyboard Maestro macro that way, but that’s very slow and clumsy over a cellular network connection, especially when trying to manipulate windows on a 27″ iMac screen as viewed through an iPhone-sized keyhole. + +The obvious solution, which wasn’t obvious to me until I’d thought of and rejected a few other ideas, was to change the `dun` script to create and save the followup email. Saving the email puts it in the Drafts folder, which I can get at from all of my devices. I also changed the Keyboard Maestro macro that executes the `dun` script on every overdue invoice to run every Tuesday morning at 5:00 am. When the reminders pop up later in the day, the emails are already written and waiting for me in the Drafts folder. + +Yesterday was the first “live” test of the new system. I was in an airport restaurant—nothing but the best cuisine for me—when my watch buzzed with reminders for two overdue invoices. I pulled out my phone, opened Mail, and there were the emails, waiting to be sent. In this case, I didn’t have to edit the messages before sending, but it wouldn’t have been a big deal if I had—no more difficult than writing any other email from my phone. + +Am I done with this? History suggests I’m not, and I’m OK with that. By getting rid of more scutwork, I’ve made myself better at following up on old invoices, and my average time-to-collection has improved. Even XKCD would think that’s worth the effort. + +-------------------------------------------------------------------------------- + +via: https://leancrew.com/all-this/2019/02/automation-evolution/ + +作者:[Dr.Drang][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://leancrew.com +[b]: https://github.com/lujun9972 +[1]: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ +[2]: https://leancrew.com/all-this/2019/02/transparency/ +[3]: https://xkcd.com/1319/ +[4]: https://textexpander.com/ +[5]: https://textexpander.com/help/desktop/fillins.html +[6]: https://www.keyboardmaestro.com/main/ +[7]: https://www.macstories.net/ipad-diaries/ipad-diaries-using-a-mac-from-ios-part-1-finder-folders-siri-shortcuts-and-app-windows-with-keyboard-maestro/ From 16c003b699147601ea06b35dcbf032932b9014c7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 12:31:46 +0800 Subject: [PATCH 326/813] PRF:20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @LuuMing --- ... Local System To Remote System In Linux.md | 114 ++++++++++-------- 1 file changed, 61 insertions(+), 53 deletions(-) diff --git a/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md index 3191c8b4e9..3694f7b199 100644 --- a/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md +++ b/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -1,33 +1,35 @@ [#]: collector: (lujun9972) -[#]: translator: ( luming) -[#]: reviewer: ( ) +[#]: translator: (luming) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) [#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) -如何在 Linux 上拷贝文件/文件夹到远程系统? +如何在 Linux 上复制文件/文件夹到远程系统? ====== -从一个服务器拷贝文件到另一个服务器,或是从本地到远程是 Linux 管理员的日常任务之一。 +从一个服务器复制文件到另一个服务器,或者从本地到远程复制是 Linux 管理员的日常任务之一。 + +我觉得不会有人不同意,因为无论在哪里这都是你的日常操作之一。有很多办法都能处理这个任务,我们试着加以概括。你可以挑一个喜欢的方法。当然,看看其他命令也能在别的地方帮到你。 -如果有人说不,我不接受。因为无论去哪这都是你的日常操作之一。 -有很多办法都能解决,我们就试着加以概括。 -你可以挑一个喜欢的方法。当然,看看其他命令也能在别的地方帮到你。 我已经在自己的环境下测试过所有的命令和脚本了,因此你可以直接用到日常工作当中。 -通常大家都倾向 `scp` ,因为它是文件拷贝的原生命令native command之一。但本文所列出的其它命令也很好用,建议你尝试一下。 -文件拷贝可以轻易地用以下四种方法。 - **`SCP`**:`scp` 在网络上的两个主机之间拷贝文件,与 `ssh` 使用相同的认证方式,具有相同的安全性。 - **`RSYNC`**:`rsync`是一个即快速又出众的多功能文件拷贝工具。它能本地拷贝,通过远程 shell 在其它主机之间拷贝,或者远程 `rsync` 守护进程daemon。 -**`PSCP`**:`pscp` 是一个并行拷贝文件到多个主机上的程序。它提供了诸多特性,例如为 scp 配置免密传输,保存输出到 文件,统计时长。 -**`PRSYNC`**:`prsync` 也是一个并行拷贝文件到多个主机上的程序。它也提供了诸多特性,例如为 ssh 配置免密传输,保存输出到 文件,统计时长。 -### 方式1:如何在 Linux 上使用 scp 命令从本地系统向远程系统拷贝文件/文件夹? +通常大家都倾向 `scp`,因为它是文件复制的原生命令native command之一。但本文所列出的其它命令也很好用,建议你尝试一下。 -`scp` 命令可以让我们拷贝文件/文件夹到远程系统上。 +文件复制可以轻易地用以下四种方法。 -我会把 `output.txt` 文件从本地系统拷贝到 `2g.CentOS.com` 远程系统的 `/opt/backup` 文件夹下。 +- `scp`:在网络上的两个主机之间复制文件,它使用 `ssh` 做文件传输,并使用相同的认证方式,具有相同的安全性。 +- `rsync`:是一个既快速又出众的多功能文件复制工具。它能本地复制、通过远程 shell 在其它主机之间复制,或者与远程的 `rsync` 守护进程daemon 之间复制。 +- `pscp`:是一个并行复制文件到多个主机上的程序。它提供了诸多特性,例如为 `scp` 配置免密传输,保存输出到文件,以及超时控制。 +- `prsync`:也是一个并行复制文件到多个主机上的程序。它也提供了诸多特性,例如为 `ssh` 配置免密传输,保存输出到 文件,以及超时控制。 + +### 方式 1:如何在 Linux 上使用 scp 命令从本地系统向远程系统复制文件/文件夹? + +`scp` 命令可以让我们从本地系统复制文件/文件夹到远程系统上。 + +我会把 `output.txt` 文件从本地系统复制到 `2g.CentOS.com` 远程系统的 `/opt/backup` 文件夹下。 ``` # scp output.txt root@2g.CentOS.com:/opt/backup @@ -35,7 +37,7 @@ output.txt 100% 2468 2.4KB/s 00:00 ``` -拷贝两个文件 `output.txt` 和 `passwd-up.sh` 到远程系统 `2g.CentOs.com` 的 `/opt/backup` 文件夹下。 +从本地系统复制两个文件 `output.txt` 和 `passwd-up.sh` 到远程系统 `2g.CentOs.com` 的 `/opt/backup` 文件夹下。 ``` # scp output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup @@ -44,8 +46,9 @@ output.txt 100% 2468 2.4KB/s 00:00 passwd-up.sh 100% 877 0.9KB/s 00:00 ``` -拷贝 `shell-script` 文件夹到远程系统`2g.CentOs.com` 的 `/opt/back` 文件夹下。 -这会连同`/opt/backup`文件夹下所有的文件一同拷贝进去。 +从本地系统复制 `shell-script` 文件夹到远程系统 `2g.CentOs.com` 的 `/opt/back` 文件夹下。 + +这会连同`shell-script` 文件夹下所有的文件一同复制到`/opt/back` 下。 ``` # scp -r /home/daygeek/2g/shell-script/ root@:/opt/backup/ @@ -57,29 +60,31 @@ passwd-up1.sh 100% 7 0.0KB/s 00:00 server-list.txt 100% 23 0.0KB/s 00:00 ``` -### 方式2:如何在 Linux 上使用 scp 命令和 Shell 脚本拷贝文件/文件夹到多个远程系统上? +### 方式 2:如何在 Linux 上使用 scp 命令和 Shell 脚本复制文件/文件夹到多个远程系统上? -如果你想拷贝同一个文件到多个远程服务器上,那就需要创建一个如下面那样的小 shell 脚本。 +如果你想复制同一个文件到多个远程服务器上,那就需要创建一个如下面那样的小 shell 脚本。 -并且,需要将服务器添加进 `server-list.txt` 文件。确保添加成功后,每个服务器之间应当空一行。 +并且,需要将服务器添加进 `server-list.txt` 文件。确保添加成功后,每个服务器应当单独一行。 最终,你想要的脚本就像下面这样: + ``` # file-copy.sh #!/bin/sh for server in `more server-list.txt` do - scp /home/daygeek/2g/shell-script/output.txt root@$server:/opt/backup + scp /home/daygeek/2g/shell-script/output.txt root@$server:/opt/backup done ``` 完成之后,给 `file-copy.sh` 文件设置可执行权限。 + ``` # chmod +x file-copy.sh ``` -最后运行脚本完成拷贝。 +最后运行脚本完成复制。 ``` # ./file-copy.sh @@ -88,7 +93,7 @@ output.txt 100% 2468 2.4KB/s 00:00 output.txt 100% 2468 2.4KB/s 00:00 ``` -使用下面的脚本可以拷贝多个文件到多个远程服务器上。 +使用下面的脚本可以复制多个文件到多个远程服务器上。 ``` # file-copy.sh @@ -96,11 +101,12 @@ output.txt 100% 2468 2.4KB/s 00:00 #!/bin/sh for server in `more server-list.txt` do - scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@$server:/opt/backup + scp /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@$server:/opt/backup done ``` -下面结果显示所有的两个文件都拷贝到两个服务器上。 +下面结果显示所有的两个文件都复制到两个服务器上。 + ``` # ./file-cp.sh @@ -110,7 +116,7 @@ output.txt 100% 2468 2.4KB/s 00:00 passwd-up.sh 100% 877 0.9KB/s 00:00 ``` -使用下面的脚本递归地拷贝文件夹到多个远程服务器上。 +使用下面的脚本递归地复制文件夹到多个远程服务器上。 ``` # file-copy.sh @@ -118,11 +124,12 @@ passwd-up.sh 100% 877 0.9KB/s 00:00 #!/bin/sh for server in `more server-list.txt` do - scp -r /home/daygeek/2g/shell-script/ root@$server:/opt/backup + scp -r /home/daygeek/2g/shell-script/ root@$server:/opt/backup done ``` -上面脚本的输出。 +上述脚本的输出。 + ``` # ./file-cp.sh @@ -139,11 +146,11 @@ passwd-up1.sh 100% 7 0.0KB/s 00:00 server-list.txt 100% 23 0.0KB/s 00:00 ``` -### 方式3:如何在 Linux 上使用 pscp 命令拷贝文件/文件夹到多个远程系统上? +### 方式 3:如何在 Linux 上使用 pscp 命令复制文件/文件夹到多个远程系统上? -`pscp` 命令可以直接让我们拷贝文件到多个远程服务器上。 +`pscp` 命令可以直接让我们复制文件到多个远程服务器上。 -使用下面的 `pscp` 命令拷贝单个文件到远程服务器。 +使用下面的 `pscp` 命令复制单个文件到远程服务器。 ``` # pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt /opt/backup @@ -151,7 +158,7 @@ server-list.txt 100% 23 0.0KB/s 00:00 [1] 18:46:11 [SUCCESS] 2g.CentOS.com ``` -使用下面的 `pscp` 命令拷贝多个文件到远程服务器。 +使用下面的 `pscp` 命令复制多个文件到远程服务器。 ``` # pscp.pssh -H 2g.CentOS.com /home/daygeek/2g/shell-script/output.txt ovh.sh /opt/backup @@ -159,7 +166,7 @@ server-list.txt 100% 23 0.0KB/s 00:00 [1] 18:47:48 [SUCCESS] 2g.CentOS.com ``` -递归地拷贝整个文件夹到远程服务器。 +使用下面的 `pscp` 命令递归地复制整个文件夹到远程服务器。 ``` # pscp.pssh -H 2g.CentOS.com -r /home/daygeek/2g/shell-script/ /opt/backup @@ -167,7 +174,7 @@ server-list.txt 100% 23 0.0KB/s 00:00 [1] 18:48:46 [SUCCESS] 2g.CentOS.com ``` -使用下面的命令拷贝单个文件到多个远程服务器。 +使用下面的 `pscp` 命令使用下面的命令复制单个文件到多个远程服务器。 ``` # pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt /opt/backup @@ -176,7 +183,7 @@ server-list.txt 100% 23 0.0KB/s 00:00 [2] 18:49:48 [SUCCESS] 2g.Debian.com ``` -使用下面的 `pscp` 命令拷贝多个文件到多个远程服务器。 +使用下面的 `pscp` 命令复制多个文件到多个远程服务器。 ``` # pscp.pssh -h server-list.txt /home/daygeek/2g/shell-script/output.txt passwd-up.sh /opt/backup @@ -185,7 +192,7 @@ server-list.txt 100% 23 0.0KB/s 00:00 [2] 18:50:30 [SUCCESS] 2g.CentOS.com ``` -使用下面的命令递归地拷贝文件夹到多个远程服务器。 +使用下面的命令递归地复制文件夹到多个远程服务器。 ``` # pscp.pssh -h server-list.txt -r /home/daygeek/2g/shell-script/ /opt/backup @@ -194,11 +201,11 @@ server-list.txt 100% 23 0.0KB/s 00:00 [2] 18:51:31 [SUCCESS] 2g.CentOS.com ``` -### 方式4:如何在 Linux 上使用 rsync 命令拷贝文件/文件夹到多个远程系统上? +### 方式 4:如何在 Linux 上使用 rsync 命令复制文件/文件夹到多个远程系统上? -`rsync`是一个即快速又出众的多功能文件拷贝工具。它能本地拷贝,通过远程 shell 在其它主机之间拷贝,或者远程 `rsync` 守护进程daemon。 +`rsync` 是一个即快速又出众的多功能文件复制工具。它能本地复制、通过远程 shell 在其它主机之间复制,或者在远程 `rsync` 守护进程daemon 之间复制。 -使用下面的 `rsync` 命令拷贝单个文件到远程服务器。 +使用下面的 `rsync` 命令复制单个文件到远程服务器。 ``` # rsync -avz /home/daygeek/2g/shell-script/output.txt root@:/opt/backup @@ -210,7 +217,7 @@ sent 598 bytes received 31 bytes 1258.00 bytes/sec total size is 2468 speedup is 3.92 ``` -使用下面的 `rsync` 命令拷贝多个文件到远程服务器。 +使用下面的 `rsync` 命令复制多个文件到远程服务器。 ``` # rsync -avz /home/daygeek/2g/shell-script/output.txt passwd-up.sh root@2g.CentOS.com:/opt/backup @@ -223,7 +230,7 @@ sent 737 bytes received 50 bytes 1574.00 bytes/sec total size is 2537 speedup is 3.22 ``` -使用下面的 `rsync` 命令通过 `ssh` 拷贝单个文件到远程服务器。 +使用下面的 `rsync` 命令通过 `ssh` 复制单个文件到远程服务器。 ``` # rsync -avzhe ssh /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup @@ -235,7 +242,7 @@ sent 598 bytes received 31 bytes 419.33 bytes/sec total size is 2.47K speedup is 3.92 ``` -使用下面的 `rsync` 命令通过 `ssh` 递归地拷贝文件夹到远程服务器。这种方式只拷贝文件不包括文件夹。 +使用下面的 `rsync` 命令通过 `ssh` 递归地复制文件夹到远程服务器。这种方式只复制文件不包括文件夹。 ``` # rsync -avzhe ssh /home/daygeek/2g/shell-script/ root@2g.CentOS.com:/opt/backup @@ -252,9 +259,9 @@ sent 3.85K bytes received 281 bytes 8.26K bytes/sec total size is 9.12K speedup is 2.21 ``` -### 如何在 Linux 上使用 rsync 命令和 Shell 脚本拷贝文件/文件夹到多个远程系统上? +### 方式 5:如何在 Linux 上使用 rsync 命令和 Shell 脚本复制文件/文件夹到多个远程系统上? -如果你想拷贝同一个文件到多个远程服务器上,那也需要创建一个如下面那样的小 shell 脚本。 +如果你想复制同一个文件到多个远程服务器上,那也需要创建一个如下面那样的小 shell 脚本。 ``` # file-copy.sh @@ -294,9 +301,9 @@ sent 3.86K bytes received 281 bytes 2.76K bytes/sec total size is 9.13K speedup is 2.21 ``` -### 方式6:如何在 Linux 上使用 scp 命令和 Shell 脚本从本地系统向多个远程系统拷贝文件/文件夹? +### 方式 6:如何在 Linux 上使用 scp 命令和 Shell 脚本从本地系统向多个远程系统复制文件/文件夹? -在上面两个 shell 脚本中,我们需要事先指定好文件和文件夹的路径,这儿我做了些小修改,让脚本可以接收文件或文件夹的输入。当你每天需要多次执行拷贝时,这将会非常有用。 +在上面两个 shell 脚本中,我们需要事先指定好文件和文件夹的路径,这儿我做了些小修改,让脚本可以接收文件或文件夹作为输入参数。当你每天需要多次执行复制时,这将会非常有用。 ``` # file-copy.sh @@ -317,11 +324,11 @@ output1.txt 100% 3558 3.5KB/s 00:00 output1.txt 100% 3558 3.5KB/s 00:00 ``` -### 方式7:如何在Linux 系统上用非标准端口拷贝文件/文件夹到远程系统? +### 方式 7:如何在 Linux 系统上用非标准端口复制文件/文件夹到远程系统? -如果你想使用非标准端口,使用下面的 shell 脚本拷贝文件或文件夹。 +如果你想使用非标准端口,使用下面的 shell 脚本复制文件或文件夹。 -如果你使用了非标准Non-Standard端口,确保像下面 `SCP` 命令那样指定好了端口号。 +如果你使用了非标准Non-Standard端口,确保像下面 `scp` 命令那样指定好了端口号。 ``` # file-copy-scp.sh @@ -354,7 +361,7 @@ rsync -avzhe 'ssh -p 2222' $1 root@2g.CentOS.com$server:/opt/backup done ``` -运行脚本,输入文件名 +运行脚本,输入文件名。 ``` # ./file-copy-rsync.sh passwd-up.sh @@ -370,6 +377,7 @@ passwd-up.sh sent 238 bytes received 35 bytes 26.00 bytes/sec total size is 159 speedup is 0.58 ``` + -------------------------------------------------------------------------------- via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/ @@ -377,7 +385,7 @@ via: https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in 作者:[Prakash Subramanian][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/) 荣誉推出 From 406023f66e441c5d72b1be83d9872ce7d0ad351a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 12:32:33 +0800 Subject: [PATCH 327/813] PUB:20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @LuuMing https://linux.cn/article-10569-1.html --- ...le-Folder From A Local System To Remote System In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md (99%) diff --git a/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md similarity index 99% rename from translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md rename to published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md index 3694f7b199..e1b9ae9103 100644 --- a/translated/tech/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md +++ b/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (luming) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10569-1.html) [#]: subject: (How To Copy A File/Folder From A Local System To Remote System In Linux?) [#]: via: (https://www.2daygeek.com/linux-scp-rsync-pscp-command-copy-files-folders-in-multiple-servers-using-shell-script/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) From ef458fb670bef96787fd227eff46eed005b77ed3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 23:17:10 +0800 Subject: [PATCH 328/813] PRF:20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @cycoe --- ...and Tricks to Improve Your Productivity.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md index 2bf9202b79..eb5c8998cd 100644 --- a/translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md +++ b/translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @@ -7,23 +7,23 @@ 你能够轻松地配置 Plasma 桌面并且使用它大量方便且节省时间的特性来加速你的工作,拥有一个能够帮助你而非阻碍你的桌面环境。 -这些提示并没有特定顺序,因此你无需按次序阅读。你只需要挑出最适合你的工作流的那几个即可。 +以下这些提示并没有特定顺序,因此你无需按次序阅读。你只需要挑出最适合你的工作流的那几个即可。 - **相关阅读** : [10 个你应该尝试的最佳 KDE Plasma 应用][1] +**相关阅读**:[10 个你应该尝试的最佳 KDE Plasma 应用][1] -### 1. 多媒体控制 +### 1、多媒体控制 -这点算不太上是一条提示,因为它是很容易被记在脑海里的。Plasma 可在各处进行多媒体控制。当你需要暂停、继续或跳过一首歌时,你不需要每次都打开你的媒体播放器。你能够通过将鼠标移至最小化窗口之上,甚至通过锁屏进行控制。当你需要切换歌曲或忘了暂停时,你也不必麻烦地登录再进行操作。 +这点不太算得上是一条提示,因为它是很容易被记在脑海里的。Plasma 可在各处进行多媒体控制。当你需要暂停、继续或跳过一首歌时,你不需要每次都打开你的媒体播放器。你能够通过将鼠标移至那个最小化窗口之上,甚至通过锁屏进行控制。当你需要切换歌曲或忘了暂停时,你也不必麻烦地登录再进行操作。 -### 2. KRunner +### 2、KRunner ![KDE Plasma KRunner][2] -KRunner 是 Plasma 桌面中一个经常受到赞誉的特性。大部分人习惯于深挖应用启动菜单来找到想要启动的程序。当你使用 KRunner 时就不需要这么做。 +KRunner 是 Plasma 桌面中一个经常受到赞誉的特性。大部分人习惯于穿过层层的应用启动菜单来找到想要启动的程序。当你使用 KRunner 时就不需要这么做。 -为了使用 KRunner,确保你当前的焦点在桌面本身(点击桌面而不是窗口)。然后开始输入你想要启动的应用名称,KRunner 将会带着建议项从你的屏幕顶部自动下拉。在你寻找的匹配项上点击或敲击 Enter 键。这比记住你每个应用所属的类别要更快。 +为了使用 KRunner,确保你当前的活动焦点在桌面本身(点击桌面而不是窗口)。然后开始输入你想要启动的应用名称,KRunner 将会带着建议项从你的屏幕顶部自动下拉。在你寻找的匹配项上点击或敲击回车键。这比记住你每个应用所属的类别要更快。 -### 3. 跳转列表 +### 3、跳转列表 ![KDE Plasma 的跳转列表][3] @@ -31,7 +31,7 @@ KRunner 是 Plasma 桌面中一个经常受到赞誉的特性。大部分人习 因此如果你在菜单栏上有一个应用启动图标,你可以通过右键得到可跳转位置的列表。选择你想要跳转的位置,然后就可以“起飞”了。 -### 4. KDE Connect +### 4、KDE Connect ![KDE Connect Android 客户端菜单][4] @@ -41,15 +41,15 @@ KRunner 是 Plasma 桌面中一个经常受到赞誉的特性。大部分人习 KDE Connect 也允许你在手机和电脑间发送文件或共享网页。你可以轻松地从一个设备转移至另一设备,而无需烦恼或打乱思绪。 -### 5. Plasma Vaults +### 5、Plasma Vaults ![KDE Plasma Vault][7] -Plasma Vaults 是 Plasma 桌面的另一个新功能。它的 KDE 为加密文件和文件夹提供的简单解决方案。如果你不使用加密文件,此项功能不会为你节省时间。如果你使用,Vaults是一个更简单的途径。 +Plasma Vaults 是 Plasma 桌面的另一个新功能。它的 KDE 为加密文件和文件夹提供的简单解决方案。如果你不使用加密文件,此项功能不会为你节省时间。如果你使用,Vaults 是一个更简单的途径。 Plasma Vaults 允许你以无 root 权限的普通用户创建加密目录,并通过你的任务栏来管理它们。你能够快速地挂载或卸载目录,而无需外部程序或附加权限。 -### 6. Pager 控件 +### 6、Pager 控件 ![KDE Plasma Pager][8] @@ -57,19 +57,19 @@ Plasma Vaults 允许你以无 root 权限的普通用户创建加密目录,并 将控件添加到你的菜单栏上,然后你就可以在多个工作区间滑动切换。每个工作区都与你原桌面的尺寸相同,因此你能够得到数倍于完整屏幕的空间。这就使你能够排布更多的窗口,而不必受到一堆混乱的最小化窗口的困扰。 -### 7. 创建一个 Dock +### 7、创建一个 Dock ![KDE Plasma Dock][9] Plasma 以其灵活性和可配置性出名,同时也是它的优势。如果你有常用的程序,你可以考虑将常用程序设置为 OS X 风格的 dock。你能够通过单击启动,而不必深入菜单或输入它们的名字。 -### 8. 为 Dolphin 添加文件树 +### 8、为 Dolphin 添加文件树 ![Plasma Dolphin 目录][10] 通过目录树来浏览文件夹会更加简单。Dolphin 作为 Plasma 的默认文件管理器,具有在文件夹窗口一侧,以树的形式展示目录列表的内置功能。 -为了启用目录树,点击“控制”标签,然后“配置 Dolphin”,“显示模式”,“详细”,最后选择“可展开文件夹”。 +为了启用目录树,点击“控制”标签,然后“配置 Dolphin”、“显示模式”、“详细”,最后选择“可展开文件夹”。 记住这些仅仅是提示,不要强迫自己做阻碍自己的事情。你可能讨厌在 Dolphin 中使用文件树,你也可能从不使用 Pager,这都没关系。当然也可能会有你喜欢但是此处没列举出来的功能。选择对你有用处的,也就是说,这些技巧中总有一些能帮助你度过日常工作中的艰难时刻。 @@ -79,7 +79,7 @@ via: https://www.maketecheasier.com/kde-plasma-tips-tricks-improve-productivity/ 作者:[Nick Congleton][a] 译者:[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/) 荣誉推出 From 7f77123f11f9ea9ad7b065ae6e576bd37adcff19 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 23:17:43 +0800 Subject: [PATCH 329/813] PUB:20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @cycoe https://linux.cn/article-10570-1.html --- ...2 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md (100%) diff --git a/translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md similarity index 100% rename from translated/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md rename to published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md From ae7523545f8809fc4e37ec5d0a7cc28f5ffd9fd3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 25 Feb 2019 23:21:05 +0800 Subject: [PATCH 330/813] PRF:20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md --- ...File-Folder From A Local System To Remote System In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md index e1b9ae9103..66407b0156 100644 --- a/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md +++ b/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md @@ -208,7 +208,7 @@ server-list.txt 100% 23 0.0KB/s 00:00 使用下面的 `rsync` 命令复制单个文件到远程服务器。 ``` -# rsync -avz /home/daygeek/2g/shell-script/output.txt root@:/opt/backup +# rsync -avz /home/daygeek/2g/shell-script/output.txt root@2g.CentOS.com:/opt/backup sending incremental file list output.txt From 4a20ffa991c080e6c431a8a167bf15dab3b34f14 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 00:02:35 +0800 Subject: [PATCH 331/813] PRF:20190207 How to determine how much memory is installed, used on Linux systems.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @leommxj 恭喜你完成了第一篇贡献! --- ...ory is installed, used on Linux systems.md | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md index 5732d2a1c5..6d162984db 100644 --- a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md +++ b/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md @@ -1,39 +1,42 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to determine how much memory is installed, used on Linux systems) [#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -如何在Linux系统中判断安装、使用了多少内存 +如何在 Linux 系统中判断安装、使用了多少内存 ====== + +> 有几个命令可以报告在 Linux 系统上安装和使用了多少内存。根据你使用的命令,你可能会被细节淹没,也可能获得快速简单的答案。 + ![](https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg) -在Linux系统中有很多种方法获取有关安装了多少内存的信息及查看多少内存正在被使用。有些命令提供了大量的细节,而其他命令提供了简洁但不一定易于理解的答案。在这篇文章中,我们将介绍一些查看内存及其使用状态的有用的工具。 +在 Linux 系统中有很多种方法获取有关安装了多少内存的信息及查看多少内存正在被使用。有些命令提供了大量的细节,而其他命令提供了简洁但不一定易于理解的答案。在这篇文章中,我们将介绍一些查看内存及其使用状态的有用的工具。 -在我们开始之前,让我们先来回顾一些基础知识。物理内存和虚拟内存并不是一回事。后者包括配置为 swap 的磁盘空间。Swap 空间可能包括为此目的特意留出来的分区,以及在创建新的 swap 分区不可行时创建的用来增加可用 swap 空间的文件。有些Linux命令提供关于两者的信息。 +在我们开始之前,让我们先来回顾一些基础知识。物理内存和虚拟内存并不是一回事。后者包括配置为交换空间的磁盘空间。交换空间可能包括为此目的特意留出来的分区,以及在创建新的交换分区不可行时创建的用来增加可用交换空间的文件。有些 Linux 命令会提供关于两者的信息。 -Swap 通过提供当物理内存占满时可以用来存放内存中非活动页的磁盘空间来扩展内存。 +当物理内存占满时,交换空间通过提供可以用来存放内存中非活动页的磁盘空间来扩展内存。 -**/proc/kcore** 是在内存管理中起作用的一个文件。这个文件看上去是个普通文件(虽然非常大),但它并不占用任何空间。它就像其他 /proc 下的文件一样是个虚拟文件。 +`/proc/kcore` 是在内存管理中起作用的一个文件。这个文件看上去是个普通文件(虽然非常大),但它并不占用任何空间。它就像其他 `/proc` 下的文件一样是个虚拟文件。 ``` $ ls -l /proc/kcore -r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore ``` -有趣的是,下面查询的两个系统并没有安装相同大小的内存,但 /proc/kcore 的大小却是相同的。第一个系统安装了 4 GB 的内存,而第二个系统安装了 6 GB。 +有趣的是,下面查询的两个系统并没有安装相同大小的内存,但 `/proc/kcore` 的大小却是相同的。第一个系统安装了 4 GB 的内存,而第二个系统安装了 6 GB。 ``` system1$ ls -l /proc/kcore -r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore system2$ ls -l /proc/kcore --r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore +-r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore ``` -一种不靠谱的解释说这个文件代表可用虚拟内存的大小(没准要加 4 KB),如果这样,这些系统的虚拟内存可就是 128TB 了!这个数字似乎代表了64位系统可以寻址多少内存,而不是当前系统有多少可用内存。在命令行中计算 128 TB 和这个文件大小加上 4 KB 很容易。 +一种不靠谱的解释说这个文件代表可用虚拟内存的大小(没准要加 4 KB),如果这样,这些系统的虚拟内存可就是 128TB 了!这个数字似乎代表了 64 位系统可以寻址多少内存,而不是当前系统有多少可用内存。在命令行中计算 128 TB 和这个文件大小加上 4 KB 很容易。 ``` $ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 @@ -42,7 +45,7 @@ $ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096 140737488359424 ``` -另一个用来检查内存的更人性化的命令是 **free**。它会给出一个易于理解的内存报告。 +另一个用来检查内存的更人性化的命令是 `free`。它会给出一个易于理解的内存报告。 ``` $ free @@ -51,7 +54,7 @@ Mem: 6102476 812244 4090752 13112 1199480 4984140 Swap: 2097148 0 2097148 ``` -使用 **-g** 选项,free会以 GB 为单位返回结果。 +使用 `-g` 选项,`free` 会以 GB 为单位返回结果。 ``` $ free -g @@ -60,7 +63,7 @@ Mem: 5 0 3 0 1 4 Swap: 1 0 1 ``` -使用 **-t** 选项,free 会显示与无附加选项时相同的值(不要把 -t 选项与 TB 搞混),并额外在输出的底部添加一行总计数据。 +使用 `-t` 选项,`free` 会显示与无附加选项时相同的值(不要把 `-t` 选项理解成 TB),并额外在输出的底部添加一行总计数据。 ``` $ free -t @@ -82,7 +85,7 @@ Total: 7 0 5 如果你尝试用这个报告来解释“这个系统安装了多少内存?”,你可能会感到失望。上面的报告就是在前文说的装有 6 GB 内存的系统上运行的结果。这并不是说这个结果是错的,这就是系统对其可使用的内存的看法。 -free 命令也提供了每隔 X 秒刷新显示的选项(下方示例中 X 为 10)。 +`free` 命令也提供了每隔 X 秒刷新显示的选项(下方示例中 X 为 10)。 ``` $ free -s 10 @@ -95,7 +98,7 @@ Mem: 6102476 812260 4090712 13112 1199504 4984120 Swap: 2097148 0 2097148 ``` -使用 **-l** 选项,free命令会提供高低内存使用信息。 +使用 `-l` 选项,`free` 命令会提供高低内存使用信息。 ``` $ free -l @@ -106,7 +109,7 @@ High: 0 0 0 Swap: 2097148 0 2097148 ``` -查看内存的另一个选择是 **/proc/meminfo** 文件。像 /proc/kcore 一样,这也是一个虚拟文件,它可以提供关于安装/使用了多少内存以及可用内存的报告。显然,空闲内存和可用内存并不是同一回事。MemFree 看起来代表未使用的 RAM。MemAvailable则是对于启动新程序时可使用的内存的一个估计。 +查看内存的另一个选择是 `/proc/meminfo` 文件。像 `/proc/kcore` 一样,这也是一个虚拟文件,它可以提供关于安装或使用了多少内存以及可用内存的报告。显然,空闲内存和可用内存并不是同一回事。`MemFree` 看起来代表未使用的 RAM。`MemAvailable` 则是对于启动新程序时可使用的内存的一个估计。 ``` $ head -3 /proc/meminfo @@ -124,7 +127,7 @@ $ grep MemTotal /proc/meminfo MemTotal: 6102476 kB ``` -**DirectMap** 将内存信息分为几类。 +`DirectMap` 将内存信息分为几类。 ``` $ grep DirectMap /proc/meminfo @@ -132,9 +135,9 @@ DirectMap4k: 213568 kB DirectMap2M: 6076416 kB ``` -DirectMap4k 代表被映射成标准 4 k 页的内存大小,DirectMap2M 则显示了被映射为 2 MB 的页的内存大小。 +`DirectMap4k` 代表被映射成标准 4 k 页的内存大小,`DirectMap2M` 则显示了被映射为 2 MB 的页的内存大小。 -**getconf** 命令将会提供比我们大多数人想要看到的更多的信息。 +`getconf` 命令将会提供比我们大多数人想要看到的更多的信息。 ``` $ getconf -a | more @@ -174,9 +177,9 @@ $ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) tota 上面的命令通过将下方输出的第一行和最后一行的值相乘来计算内存。 ``` -PAGESIZE 4096 <== -_AVPHYS_PAGES 1022511 -_PHYS_PAGES 1525619 <== +PAGESIZE 4096 <== +_AVPHYS_PAGES 1022511 +_PHYS_PAGES 1525619 <== ``` 自己动手计算一下,我们就知道这个值是怎么来的了。 @@ -186,9 +189,9 @@ $ expr 4096 \* 1525619 / 1024 6102476 ``` -显然值得为以上的指令之一设置个 alias。 +显然值得为以上的指令之一设置个 `alias`。 -另一个具有非常易于理解的输出的命令是 **top** 。在 top 输出的前五行,你可以看到一些数字显示多少内存正被使用。 +另一个具有非常易于理解的输出的命令是 `top` 。在 `top` 输出的前五行,你可以看到一些数字显示多少内存正被使用。 ``` $ top @@ -206,9 +209,7 @@ $ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB" 6GB ``` -取决于你想要获取多少细节,Linux系统提供了许多用来查看系统安装内存以及使用/空闲内存的选择。 - -在 [Facebook][1] 或 [LinkedIn][2] 上加入 Network World 社区,评论最重要的话题。 +取决于你想要获取多少细节,Linux 系统提供了许多用来查看系统安装内存以及使用/空闲内存的选择。 -------------------------------------------------------------------------------- @@ -217,7 +218,7 @@ via: https://www.networkworld.com/article/3336174/linux/how-much-memory-is-insta 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[leommxj](https://github.com/leommxj) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 67a839bfb3e9b86aadca82beda78a2eb2485ee0b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 00:03:51 +0800 Subject: [PATCH 332/813] PUB:20190207 How to determine how much memory is installed, used on Linux systems.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @leommxj 本文首发地址: https://linux.cn/article-10571-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/leommxj 请注册领取 LCCN: https://lctt.linux.cn/ --- ...ine how much memory is installed, used on Linux systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190207 How to determine how much memory is installed, used on Linux systems.md (99%) diff --git a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md b/published/20190207 How to determine how much memory is installed, used on Linux systems.md similarity index 99% rename from translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md rename to published/20190207 How to determine how much memory is installed, used on Linux systems.md index 6d162984db..96b474f7e4 100644 --- a/translated/tech/20190207 How to determine how much memory is installed, used on Linux systems.md +++ b/published/20190207 How to determine how much memory is installed, used on Linux systems.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10571-1.html) [#]: subject: (How to determine how much memory is installed, used on Linux systems) [#]: via: (https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From ef1e0c8a0cf334f946b3be5b7c01cfa2f269ec75 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 26 Feb 2019 09:01:00 +0800 Subject: [PATCH 333/813] translated --- ... map yourself using FreeMind and Fedora.md | 81 ------------------- ... map yourself using FreeMind and Fedora.md | 81 +++++++++++++++++++ 2 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md create mode 100644 translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md diff --git a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md deleted file mode 100644 index e52673707c..0000000000 --- a/sources/tech/20190123 Mind map yourself using FreeMind and Fedora.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Mind map yourself using FreeMind and Fedora) -[#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) -[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) - -Mind map yourself using FreeMind and Fedora -====== -![](https://fedoramagazine.org/wp-content/uploads/2019/01/freemind-816x345.jpg) - -A mind map of yourself sounds a little far-fetched at first. Is this process about neural pathways? Or telepathic communication? Not at all. Instead, a mind map of yourself is a way to describe yourself to others visually. It also shows connections among the characteristics you use to describe yourself. It’s a useful way to share information with others in a clever but also controllable way. You can use any mind map application for this purpose. This article shows you how to get started using [FreeMind][1], available in Fedora. - -### Get the application - -The FreeMind application has been around a while. While the UI is a bit dated and could use a refresh, it’s a powerful app that offers many options for building mind maps. And of course it’s 100% open source. There are other mind mapping apps available for Fedora and Linux users, as well. Check out [this previous article that covers several mind map options][2]. - -Install FreeMind from the Fedora repositories using the Software app if you’re running Fedora Workstation. Or use this [sudo][3] command in a terminal: - -``` -$ sudo dnf install freemind -``` - -You can launch the app from the GNOME Shell Overview in Fedora Workstation. Or use the application start service your desktop environment provides. FreeMind shows you a new, blank map by default: - -![][4] -FreeMind initial (blank) mind map - -A map consists of linked items or descriptions — nodes. When you think of something related to a node you want to capture, simply create a new node connected to it. - -### Mapping yourself - -Click in the initial node. Replace it with your name by editing the text and hitting **Enter**. You’ve just started your mind map. - -What would you think of if you had to fully describe yourself to someone? There are probably many things to cover. How do you spend your time? What do you enjoy? What do you dislike? What do you value? Do you have a family? All of this can be captured in nodes. - -To add a node connection, select the existing node, and hit **Insert** , or use the “light bulb” icon for a new child node. To add another node at the same level as the new child, use **Enter**. - -Don’t worry if you make a mistake. You can use the **Delete** key to remove an unwanted node. There’s no rules about content. Short nodes are best, though. They allow your mind to move quickly when creating the map. Concise nodes also let viewers scan and understand the map easily later. - -This example uses nodes to explore each of these major categories: - -![][5] -Personal mind map, first level - -You could do another round of iteration for each of these areas. Let your mind freely connect ideas to generate the map. Don’t worry about “getting it right.” It’s better to get everything out of your head and onto the display. Here’s what a next-level map might look like. - -![][6] -Personal mind map, second level - -You could expand on any of these nodes in the same way. Notice how much information you can quickly understand about John Q. Public in the example. - -### How to use your personal mind map - -This is a great way to have team or project members introduce themselves to each other. You can apply all sorts of formatting and color to the map to give it personality. These are fun to do on paper, of course. But having one on your Fedora system means you can always fix mistakes, or even make changes as you change. - -Have fun exploring your personal mind map! - - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ - -作者:[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]: http://freemind.sourceforge.net/wiki/index.php/Main_Page -[2]: https://fedoramagazine.org/three-mind-mapping-tools-fedora/ -[3]: https://fedoramagazine.org/howto-use-sudo/ -[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-17-04-1024x736.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-32-38-1024x736.png -[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-38-00-1024x736.png diff --git a/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md new file mode 100644 index 0000000000..2e2331e698 --- /dev/null +++ b/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mind map yourself using FreeMind and Fedora) +[#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +在 Fedora 中使用 FreeMind 制作自己的思维导图 +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/01/freemind-816x345.jpg) + +你自己的思维导图一开始听起来有些牵强。它是关于神经通路么?还是心灵感应?完全不是。相反,自己的思维导图是一种在视觉上向他人描述自己的方式。它还展示了你拿来描述的特征之间的联系。这是一种以聪明的同时可控的与他人分享信息的有用方式。你可以使用任何思维导图应用来做到。本文向你展示如何使用 Fedora 中提供的 [FreeMind][1]。 + +### 获取应用 + +FreeMind 已经出现有一段时间了。虽然 UI 有点过时,你也可以使用新的,但它是一个功能强大的应用,提供了许多构建思维导图的选项。当然,它是 100% 开源的。还有其他思维导图应用可供 Fedora 和 Linux 用户使用。查看[此前一篇涵盖多个思维导图选择的文章][2]。 + +如果你运行的是 Fedora Workstation,请使用“软件”应用从 Fedora 仓库安装 FreeMind。或者在终端中使用这个 [sudo][3] 命令: + +``` +$ sudo dnf install freemind +``` + +你可以从 Fedora Workstation 中的 GNOME Shell Overview 启动应用。或者使用桌面环境提供的应用启动服务。默认情况下,FreeMind 会显示一个新的空白脑图: + +![][4] +FreeMind 初始(空白)思维导图 + +脑图由链接的项目或描述(节点)组成。当你想到与节点相关的内容时,只需创建一个与其连接的新节点即可。 + +### + +单击初始节点。编辑文本并点击**回车**将其替换为你的姓名。你就能开始你的思维导图。 + +如果你必须向某人充分描述自己,你会怎么想?可能会有很多东西。你平时做什么?你喜欢什么?你不喜欢什么?你有什么价值?你有家庭吗?所有这些都可以在节点中体现。 + +要添加节点连接,请选择现有节点,然后单击**插入**,或使用“灯泡”图标作为新的子节点。要在与新子级相同的层级添加另一个节点,请使用**回车**。 + +如果你弄错了,别担心。你可以使用 **Delete** 键删除不需要的节点。内容上没有规则。但是最好是短节点。它们能让你在创建导图时思维更快。简洁的节点还能让其他浏览者更轻松地查看和理解。 + +该示例使用节点规划了每个主要类别: + +![][5] +个人思维导图,第一级 + +你可以为这些区域中的每个区域另外迭代一次。让你的思想自由地连接想法以生成导图。不要担心“做得正确“。最好将所有内容从头脑中移到显示屏上。这是下一级导图的样子。 + +![][6] +个人思维导图,第二级 + +你可以以相同的方式扩展任何这些节点。请注意你在示例中可以了解多少有关 John Q. Public 的信息。 + +### 如何使用你的个人思维导图 + +这是让团队或项目成员互相介绍的好方法。你可以将各种格式和颜色应用于导图以赋予其个性。当然,这些在纸上做很有趣。但是在 Fedora 中安装一个就意味着你可以随时修复错误,甚至可以在你改变的时候做出修改。 + +祝你在探索个人思维导图上玩得开心! + + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ + +作者:[Paul 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/pfrields/ +[b]: https://github.com/lujun9972 +[1]: http://freemind.sourceforge.net/wiki/index.php/Main_Page +[2]: https://fedoramagazine.org/three-mind-mapping-tools-fedora/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-17-04-1024x736.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-32-38-1024x736.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/01/Screenshot-from-2019-01-19-15-38-00-1024x736.png From 0f49777779e00efd6e4f71e7226740a5a0f5a7dd Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 26 Feb 2019 09:04:35 +0800 Subject: [PATCH 334/813] translating --- .../20190104 Midori- A Lightweight Open Source Web Browser.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md b/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md index a2e31daf6c..fa1bd9c2c2 100644 --- a/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md +++ b/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9918e8a8b0faae952e44d51a8572e9e7981aa22b Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 26 Feb 2019 11:42:20 +0800 Subject: [PATCH 335/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190109=20Config?= =?UTF-8?q?ure=20Anaconda=20on=20Emacs=20=E2=80=93=20iD=20sources/tech/201?= =?UTF-8?q?90109=20Configure=20Anaconda=20on=20Emacs=20-=20iD.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190109 Configure Anaconda on Emacs - iD.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/tech/20190109 Configure Anaconda on Emacs - iD.md diff --git a/sources/tech/20190109 Configure Anaconda on Emacs - iD.md b/sources/tech/20190109 Configure Anaconda on Emacs - iD.md new file mode 100644 index 0000000000..d11565e8f9 --- /dev/null +++ b/sources/tech/20190109 Configure Anaconda on Emacs - iD.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Configure Anaconda on Emacs – iD) +[#]: via: (https://idevji.com/configure-anaconda-on-emacs/) +[#]: author: (Devji Chhanga https://idevji.com/author/admin/) + +Configure Anaconda on Emacs – iD +====== + +Perhaps my quest for an ultimate IDE ends with [Emacs.][1] My goal was to use Emacs as full-flagged Python IDE. This post describes how to setup Anaconda on Emacs. + +My Setup: + +``` +OS: Trisquel 8.0 +Emacs: GNU Emacs 25.3.2 +``` + +Quick Key Guide [(See full guide)][2] : + +``` +C-x = Ctrl + x +M-x = Alt + x +RET = ENTER +``` + +### 1. Downloading and installing Anaconda + +**1.1 Download:** +Download Anaconda [from here.][3] You should download Python 3.x version as Python 2 will run out of support in 2020. You don’t need Python 3.x on your machine. It will be installed by this install script. + +**1.2 Install:** + +``` + cd ~/Downloads +bash Anaconda3-2018.12-Linux-x86.sh +``` + + +### 2. Adding Anaconda to Emacs + +**2.1 Adding MELPA to Emacs** +Emacs package named _anaconda-mode_ can be used. This package is on the MELPA repository. Emacs25 requires this repository to be added explicitly. + +[Important : Follow this post on how to add MELPA to Emacs.][4] + +**2.2 Installing anaconda-mode package on Emacs** + +``` +M-x package-install RET +anaconda-mode RET +``` + +**2.3 Configure anaconda-mode in Emacs** + +``` +echo "(add-hook 'python-mode-hook 'anaconda-mode)" > ~/.emacs.d/init.el +``` + + +### 3\. Running your first script on Anaconda from Emacs + +**3.1 Create new .py file** + +``` +C-x C-f +HelloWorld.py RET +``` + +**3.2 Add the code** + +``` +print ("Hello World from Emacs") +``` + +**3.3 Running it** + +``` + C-c C-p +C-c C-c +``` + +Output + +``` +Python 3.7.1 (default, Dec 14 2018, 19:46:24) +[GCC 7.3.0] :: Anaconda, Inc. on linux +Type "help", "copyright", "credits" or "license" for more information. +>>> python.el: native completion setup loaded +>>> Hello World from Emacs +>>> +``` + +_I was encouraged for Emacs usage by[Codingquark;][5] +Errors and omissions should be reported in comments. Cheers!_ + +-------------------------------------------------------------------------------- + +via: https://idevji.com/configure-anaconda-on-emacs/ + +作者:[Devji Chhanga][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://idevji.com/author/admin/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/software/emacs/ +[2]: https://www.math.uh.edu/~bgb/emacs_keys.html +[3]: https://www.anaconda.com/download/#linux +[4]: https://melpa.org/#/getting-started +[5]: https://codingquark.com From d1983dfc78ebfcc7560b15c9e0b4fbe949709c3e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 14:22:23 +0800 Subject: [PATCH 336/813] PRF:20190104 Midori- A Lightweight Open Source Web Browser.md @name1e5s --- ...ator Application in The Entire Universe.md | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md index a9f7b3e590..fa65d2cdfa 100644 --- a/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md +++ b/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md @@ -1,5 +1,6 @@ -Qalculate! – 全宇宙最好的计算器软件 +Qalculate! :全宇宙最好的计算器软件 ====== + 十多年来,我一直都是 GNU-Linux 以及 [Debian][1] 的用户。随着我越来越频繁的使用桌面环境,我发现对我来说除了少数基于 web 的服务以外我的大多数需求都可以通过 Debian 软件库里自带的[桌面应用][2]解决。 我的需求之一就是进行单位换算。尽管有很多很多在线服务可以做这件事,但是我还是需要一个可以在桌面环境使用的应用。这主要是因为隐私问题以及我不想一而再再而三的寻找在线服务做事。为此我搜寻良久,直到找到 Qalculate!。 @@ -12,15 +13,15 @@ Qalculate! – 全宇宙最好的计算器软件 > 强大易用的桌面计算器 - GTK+ 版 > -> Qalculate! 是一款外表简单易用,内核强大且功能丰富的应用。其功能包含自定广义函数,单位,计算精度,作图以及可以输入一行表达式(有容错措施)的图形界面(也可以选择使用传统按钮)。 +> Qalculate! 是一款外表简单易用,内核强大且功能丰富的应用。其功能包含自定义函数、单位、高计算精度、作图以及可以输入一行表达式(有容错措施)的图形界面(也可以选择使用传统按钮)。 这款应用也发行过 KDE 的界面,但是至少在 Debian Testing 软件库里,只出现了 GTK+ 版的界面,你也可以在 GitHub 上的这个[仓库][5]里面看到。 -不必多说, Qalculate! 在 Debian 的软件源内处于可用状态,因此可以使用 [apt][6] 命令或者是基于 Debian 的发行版比如 Ubuntu 提供的软件中心轻松安装。在 Windows 或者 macOS 上也可以使用这款软件。 +不必多说,Qalculate! 在 Debian 的软件源内处于可用状态,因此可以使用 [apt][6] 命令或者是基于 Debian 的发行版比如 Ubuntu 提供的软件中心轻松安装。在 Windows 或者 macOS 上也可以使用这款软件。 -### Qalculate! 特性一览 +#### Qalculate! 特性一览 -列出全部的功能清单会有点长,请允许我只列出一部分功能并使用截图来展示极少数 Qalculate! 提供的功能。这么做是为了让你熟悉 Qalculate! 的基本功能并在之后可以自由探索 Qalculate! 到底还能干什么。 +列出全部的功能清单会有点长,请允许我只列出一部分功能并使用截图来展示极少数 Qalculate! 提供的功能。这么做是为了让你熟悉 Qalculate! 的基本功能,并在之后可以自由探索 Qalculate! 到底还能干什么。 * 代数 * 微积分 @@ -30,7 +31,7 @@ Qalculate! – 全宇宙最好的计算器软件 * 日期与时间 * 经济学 * 对数和指数 -* 集合 +* 几何 * 逻辑学 * 向量和矩阵 * 杂项 @@ -38,8 +39,6 @@ Qalculate! – 全宇宙最好的计算器软件 * 统计学 * 三角学 - - #### 使用 Qalculate! Qalculate! 的使用不是很难。你甚至可以在里面写简单的英文。但是我还是推荐先[阅读手册][7]以便充分发挥 Qalculate! 的潜能。 @@ -51,48 +50,48 @@ Qalculate! 的使用不是很难。你甚至可以在里面写简单的英文。 #### qalc 是 Qalculate! 的命令行版 你也可以使用 Qalculate! 的命令行版 `qalc`: + ``` $ qalc 62499836 byte to gibibyte 62499836 * byte = approx. 0.058207508 gibibyte $ qalc 40 degree celsius to fahrenheit (40 * degree) * celsius = 104 deg*oF - ``` Qalculate! 的命令行界面可以让不喜欢 GUI 而是喜欢命令行界面(CLI)或者是使用无头结点(没有 GUI)的人可以使用 Qalculate!。这些人大多是在服务器环境下工作。 -如果你想要在脚本里使用这一软件的话,我想 libqalculate 是最好的解决方案。看一看 qalc 以及 qalculate-gtk 是如何依赖于它工作的就足以知晓如何使用了。 +如果你想要在脚本里使用这一软件的话,我想 libqalculate 是最好的解决方案。看一看 `qalc` 以及 qalculate-gtk 是如何依赖于它工作的就足以知晓如何使用了。 -再提一嘴,你还可以了解下如何根据一系列数据绘图,其他应用方式就留给你自己发掘了。不要忘记查看 /usr/share/doc/qalculate/index.html 以获取 Qalculate! 的全部功能。 +再提一嘴,你还可以了解下如何根据一系列数据绘图,其他应用方式就留给你自己发掘了。不要忘记查看 `/usr/share/doc/qalculate/index.html` 以获取 Qalculate! 的全部功能。 -注释:- 注意 Debian 更喜欢 [gnuplot][10],因为其输出的图片很精美。 +注释:注意 Debian 更喜欢 [gnuplot][10],因为其输出的图片很精美。 -#### 额外贴士: 你可以通过在 Debian 下通过命令行感谢开发者 +#### 附加技巧:你可以通过在 Debian 下通过命令行感谢开发者 如果你使用 Debian 而且喜欢哪个包的话,你可以使用如下命令感谢 Debian 下这个软件包的开发者或者是维护者: + ``` reportbug --kudos $PACKAGENAME - ``` 因为我喜欢 Qalculate!,我想要对 Debian 的开发者以及维护者 Vincent Legout 的卓越工作表示感谢: + ``` reportbug --kudos qalculate - ``` -建议各位阅读我写的关于如何使用报错工具的详细指南 [在 Debian 中上报 BUG][11]. +建议各位阅读我写的关于如何使用报错工具[在 Debian 中上报 BUG][11]的详细指南。 #### 一位高分子化学家对 Qalculate! 的评价 经由作者 [Philip Prado][12],我们联系上了 Timothy Meyers 先生,他目前是在高分子实验室工作的高分子化学家。 -他对 Qaclulate! 的专业评价是 - +他对 Qaclulate! 的专业评价是: -> 看起来这个软件几乎任何科学家都可以使用,因为如果你直到指令以及如何使其生效的话,几乎任何数据计算都可以使用这个软件计算。 +> 看起来几乎任何科学家都可以使用这个软件,因为如果你知道指令以及如何使其生效的话,几乎任何数据计算都可以使用这个软件计算。 -> 我觉得这个软件少了些物理常数,但我想不起来缺了哪些。我觉得那里没有很多有关[流体动力学][13]的东西,再就是少了点部分化合物的[光吸收][14]系数,但这些东西只对我这个化学家来说比较重要,我不知道这些是不是对别人来说也是特别必要的。 自由能也许会这样。 +> 我觉得这个软件少了些物理常数,但我想不起来缺了哪些。我觉得它没有太多有关[流体动力学][13]的东西,再就是少了点部分化合物的[光吸收][14]系数,但这些东西只对我这个化学家来说比较重要,我不知道这些是不是对别人来说也是特别必要的。[自由能][15]可能也是。 最后,我分享的关于 Qalculate! 的介绍十分简陋,其实际功能与你的需要以及你的想象力有关系。希望你能喜欢 Qalculate! @@ -103,20 +102,20 @@ via: https://itsfoss.com/qalculate/ 作者:[Shirish][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[name1e5s](https://github.com/name1e5s) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://itsfoss.com/author/shirish/ [1]:https://www.debian.org/ [2]:https://itsfoss.com/essential-linux-applications/ -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/qalculate-app-featured-1-800x450.jpeg +[3]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/05/qalculate-app-featured-1.jpeg?w=800&ssl=1 [4]:https://qalculate.github.io/ [5]:https://github.com/Qalculate [6]:https://itsfoss.com/apt-command-guide/ [7]:https://qalculate.github.io/manual/index.html -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-byte-conversion.png -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/qalculate-gtk-weather-conversion.png +[8]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/04/qalculate-byte-conversion.png?zoom=2&ssl=1 +[9]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/04/qalculate-gtk-weather-conversion.png?zoom=2&ssl=1 [10]:http://www.gnuplot.info/ [11]:https://itsfoss.com/bug-report-debian/ [12]:https://itsfoss.com/author/phillip/ From fb15f424ab3d624d33b4a34b211d378ea7451b56 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 14:23:05 +0800 Subject: [PATCH 337/813] PUB:20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md @name1e5s https://linux.cn/article-10572-1.html --- ...e- - The Best Calculator Application in The Entire Universe.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md (100%) diff --git a/translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md similarity index 100% rename from translated/tech/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md rename to published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md From 39dbd2b9a3f65d5e45f691da228cdcdbe1fb936c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 14:38:37 +0800 Subject: [PATCH 338/813] PRF:20190219 3 tools for viewing files at the command line.md @MjSeven --- ...s for viewing files at the command line.md | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/translated/tech/20190219 3 tools for viewing files at the command line.md b/translated/tech/20190219 3 tools for viewing files at the command line.md index f0c90c22df..7068b62290 100644 --- a/translated/tech/20190219 3 tools for viewing files at the command line.md +++ b/translated/tech/20190219 3 tools for viewing files at the command line.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (3 tools for viewing files at the command line) @@ -9,10 +9,12 @@ 在命令行查看文件的 3 个工具 ====== -看一下 less, Antiword 和 odt2xt 这三个实用程序,它们都可以在终端中查看文件。 + +> 看一下 `less`、Antiword 和 `odt2xt` 这三个实用程序,它们都可以在终端中查看文件。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) -我常说,你不需要使用命令行也可以高效使用 Linux - 我知道许多 Linux 用户从不打开终端窗口,并且他们也很高兴。然而,即使我不认为自己是一名技术人员,我也会在命令行上花费大约 20% 的计算时间,包括操作文件,处理文本和使用实用程序。 +我常说,你不需要使用命令行也可以高效使用 Linux —— 我知道许多 Linux 用户从不打开终端窗口,并且也用的挺好。然而,即使我不认为自己是一名技术人员,我也会在命令行上花费大约 20% 的计算时间,包括操作文件、处理文本和使用实用程序。 我经常在终端窗口中做的一件事是查看文件,无论是文本还是需要用到文字处理器的文件。有时使用命令行实用程序比启动文本编辑器或文字处理器更容易。 @@ -20,9 +22,9 @@ ### less -[less][1] 的美妙之处在于它易于使用,它将你正在查看的文件分解为离散的块(或页面),这使得它们更易于阅读。你可以使用它在命令行查看文本文件,例如 README,HTML 文件,LaTeX 文件或其他任何纯文本文件。我在[上一篇文章][2]中介绍了 less。 +[less][1] 的美妙之处在于它易于使用,它将你正在查看的文件分解为块(或页面),这使得它们更易于阅读。你可以使用它在命令行查看文本文件,例如 README、HTML 文件、LaTeX 文件或其他任何纯文本文件。我在[上一篇文章][2]中介绍了 `less`。 -要使用 less,只需输入: +要使用 `less`,只需输入: ``` less file_name @@ -30,13 +32,13 @@ less file_name ![](https://opensource.com/sites/default/files/uploads/less.png) -通过按键盘上的空格键或 PgDn 键向下滚动文件,按 PgUp 键向上移动文件。要停止查看文件,按键盘上的 Q 键。 +通过按键盘上的空格键或 `PgDn` 键向下滚动文件,按 `PgUp` 键向上移动文件。要停止查看文件,按键盘上的 `Q` 键。 ### Antiword [Antiword][3] 是一个很好地实用小程序,你可以使用它将 Word 文档转换为纯文本。只要你想,还可以将它们转换为 [PostScript][4] 或 [PDF][5]。在本文中,让我们继续使用文本转换。 -Antiword 可以读取和转换 Word 2.0 到 2003 版本创建的文件(to 校正:这里 Word 2.0 应该是 2000 吧)。它不能读取 DOCX 文件 - 如果你尝试这样做,Antiword 会显示一条错误消息,表明你尝试读取的是一个 ZIP 文件。这在技术上是正确的,但仍然令人沮丧。 +Antiword 可以读取和转换 Word 2.0 到 2003 版本创建的文件(LCTT 译注:此处疑为 Word 2000,因为 Word 2.0 for DOS 发布于 1984 年,而 WinWord 2.0 发布于 1991 年,都似乎太老了)。它不能读取 DOCX 文件 —— 如果你尝试这样做,Antiword 会显示一条错误消息,表明你尝试读取的是一个 ZIP 文件。这在技术上说是正确的,但仍然令人沮丧。 要使用 Antiword 查看 Word 文档,输入以下命令: @@ -44,13 +46,13 @@ Antiword 可以读取和转换 Word 2.0 到 2003 版本创建的文件(to 校 antiword file_name.doc ``` -Antiword 将文档转换为文本并显示在终端窗口中。不幸的是,它不能在终端中将文档分解成页面。不过,你可以将 Antiword 的输出重定向到 less 或 [more][6] 之类的实用程序,一遍对其进行分页。通过输入以下命令来执行此操作: +Antiword 将文档转换为文本并显示在终端窗口中。不幸的是,它不能在终端中将文档分解成页面。不过,你可以将 Antiword 的输出重定向到 `less` 或 [more][6] 之类的实用程序,一遍对其进行分页。通过输入以下命令来执行此操作: ``` antiword file_name.doc | less ``` -如果你是命令行的新手,那么我告诉你 | 称为管道。这就是重定向。 +如果你是命令行的新手,那么我告诉你 `|` 称为管道。这就是重定向。 ![](https://opensource.com/sites/default/files/uploads/antiword.png) @@ -58,13 +60,13 @@ antiword file_name.doc | less 作为一个优秀的开源公民,你会希望尽可能多地使用开放格式。对于你的文字处理需求,你可能需要处理 [ODT][7] 文件(由诸如 LibreOffice Writer 和 AbiWord 等文字处理器使用)而不是 Word 文件。即使没有,也可能会遇到 ODT 文件。而且,即使你的计算机上没有安装 Writer 或 AbiWord,也很容易在命令行中查看它们。 -怎样做呢?用一个名叫 [odt2txt][8] 的实用小程序。正如你猜到的那样,odt2txt 将 ODT 文件转换为纯文本。要使用它,运行以下命令: +怎样做呢?用一个名叫 [odt2txt][8] 的实用小程序。正如你猜到的那样,`odt2txt` 将 ODT 文件转换为纯文本。要使用它,运行以下命令: ``` odt2txt file_name.odt ``` -与 Antiword 一样,odt2txt 将文档转换为文本并在终端窗口中显示。和 Antiword 一样,它不会对文档进行分页。但是,你也可以使用以下命令将 odt2txt 的输出管道传输到 less 或 more 这样的实用程序中: +与 Antiword 一样,`odt2txt` 将文档转换为文本并在终端窗口中显示。和 Antiword 一样,它不会对文档进行分页。但是,你也可以使用以下命令将 `odt2txt` 的输出管道传输到 `less` 或 `more` 这样的实用程序中: ``` odt2txt file_name.odt | more @@ -80,8 +82,8 @@ via: https://opensource.com/article/19/2/view-files-command-line 作者:[Scott Nesbitt][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9c530c4ec569961e13eecddcb0ecaa6ca61f2dae Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 14:39:35 +0800 Subject: [PATCH 339/813] PUB:20190219 3 tools for viewing files at the command line.md @MjSeven https://linux.cn/article-10573-1.html --- .../20190219 3 tools for viewing files at the command line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190219 3 tools for viewing files at the command line.md (98%) diff --git a/translated/tech/20190219 3 tools for viewing files at the command line.md b/published/20190219 3 tools for viewing files at the command line.md similarity index 98% rename from translated/tech/20190219 3 tools for viewing files at the command line.md rename to published/20190219 3 tools for viewing files at the command line.md index 7068b62290..eb975657c2 100644 --- a/translated/tech/20190219 3 tools for viewing files at the command line.md +++ b/published/20190219 3 tools for viewing files at the command line.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10573-1.html) [#]: subject: (3 tools for viewing files at the command line) [#]: via: (https://opensource.com/article/19/2/view-files-command-line) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) From a4d519bdef76c05ad19f479b07c47f051bde8f00 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Feb 2019 15:29:17 +0800 Subject: [PATCH 340/813] PRF:20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @tomjlw --- ...eriences Every Linux Gamer Never Wanted.md | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md index 0b3dc1ba7e..b50dea4644 100644 --- a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md +++ b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @@ -1,28 +1,29 @@ -每个 Linux 平台上的玩家都从不想要的恼人经历 -============================================================ - [![Linux 平台上玩家的问题](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] +每个 Linux 游戏玩家都绝不想要的恼人体验 +=================== -[在 Linux 平台上玩游戏][12] 已经走了很远,现在有专门的 [Linux 游戏型发行版]。但是这不意味着在 Linux 上打游戏的感觉和在 Windows 上一样顺畅。 +[![Linux 平台上玩家的问题](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] -为了确保我们和 Windows 用户同样地享受游戏,什么是我们应该考虑的困难呢? +[在 Linux 平台上玩游戏][12] 并不是什么新鲜事,现在甚至有专门的 [Linux 游戏发行版][13],但是这不意味着在 Linux 上打游戏的体验和在 Windows 上一样顺畅。 -[Wine][14],[PlayOnLinux][15] 和其它类似软件不总是能够玩所有流行的 Windows 游戏。在这篇文章里,我想讨论一下为了拥有一个最好的 Linux 游戏体验所必须处理好的若干因素。 +为了确保我们和 Windows 用户同样地享受游戏乐趣,哪些问题是我们应该考虑的呢? -### #1 SteamOS 是一个开源平台,Steam for Linux 并不是 +[Wine][14]、[PlayOnLinux][15] 和其它类似软件不总是能够让我们玩所有流行的 Windows 游戏。在这篇文章里,我想讨论一下为了拥有最好的 Linux 游戏体验所必须处理好的若干因素。 -正如 [StemOS 主页][16]所说, 即便 SteamOS 是一个开源平台,Steam for Linux 仍然是专有的。如果 Steam for Linux 也开源,那么它从开源社区得到的支持将会是巨大的。既然它不是,那么 [Ascension 计划的诞生自然是不可避免的][17]: +### #1 SteamOS 是开源平台,但 Steam for Linux 并不是 + +正如 [StemOS 主页][16]所说, 即便 SteamOS 是一个开源平台,但 Steam for Linux 仍然是专有的软件。如果 Steam for Linux 也开源,那么它从开源社区得到的支持将会是巨大的。既然它不是,那么 [Ascension 计划的诞生自然是不可避免的][17]: [video](https://youtu.be/07UiS5iAknA) -Ascension 计划是一个开源的能够启动从任何平台购买、下载的游戏的游戏启动器。这些游戏可以是 Steam 平台的,[Origin 游戏]平台的,Uplay 平台的,以及直接从游戏开发者主页或者从 DVD、CD-ROM 拷下来的。 +Ascension 开源的游戏启动器,旨在能够启动从任何平台购买、下载的游戏。这些游戏可以是 Steam 平台的、[Origin 游戏][18]平台的、Uplay 平台的,以及直接从游戏开发者主页或者从 DVD、CD-ROM 下载下来的。 -这是 Ascension 计划如何开始的:[头脑风暴][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表自己的观点并给出建议。 +这是 Ascension 计划如何开始的:[头脑风暴][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表了自己的观点并给出建议。 ### #2 与 Windows 平台的性能比较 在 Linux 平台上运行 Windows 游戏并不总是一件轻松的任务。但是感谢一个叫做 [CSMT][20](多线程命令流)的特性,尽管离 Windows 级别的性能还有相当长的路要走,PlayOnLinux 现在依旧可以更好地解决这些性能方面的问题。 -原生态 Linux 对游戏的支持在过去发行的游戏中从未如人意。 +Linux 对游戏的原生支持在过去发行的游戏中从未如人意。 去年,有报道说 SteamOS 比 Windows 在游戏方面的表现要[差得多][21]。古墓丽影去年在 SteamOS 及 Steam for Linux 上发行,然而基准测试的结果与 Windows 上的性能无法抗衡。 @@ -34,63 +35,59 @@ Ascension 计划是一个开源的能够启动从任何平台购买、下载的 [视频](https://youtu.be/-IeY5ZS-LlA) -下面是另一个有趣的比较,它显示出使用 Wine+CSMT 带来的游戏性能比 Steam 上原生的 Linux 版游戏带来的游戏性能要好得多!这就是开源的力量! - -[推荐阅读:一个新 Linux 操作系统 "OSu",力争成为 Arch Linux 世界中的 Ubuntu][26] +下面是另一个有趣的比较,它显示出使用 Wine + CSMT 带来的游戏性能比 Steam 上原生的 Linux 版游戏带来的游戏性能要好得多!这就是开源的力量! [视频](https://youtu.be/sCJkC6oJ08A) 以防 FPS 损失,TressFX 已经被关闭。 -以下是另一个有关在 Linux 上最新发布的 “[Life is Strange][27]”在 Linux 与 Windows上的比较: +以下是另一个有关在 Linux 上最新发布的 “[Life is Strange][27]” 在 Linux 与 Windows 上的比较: [视频](https://youtu.be/Vlflu-pIgIY) -[_Steam for Linux_][28] 开始在这个游戏上展示出比 Windows 更好的游戏性能,这是一件好事。 +[Steam for Linux][28] 开始在这个新游戏上展示出比 Windows 更好的游戏性能,这是一件好事。 -在发布任何 Linux 版的游戏前,开发者应该考虑优化游戏,特别是基于 DirectX 并需要 OpenGL转换的游戏。我们十分希望[ Linux 上的杀出重围:人类分裂][29] 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX的游戏,我们希望它能良好地移植到 Linux 上。以下是[游戏执行总监不得不说的话][30]。 +在发布任何 Linux 版的游戏前,开发者应该考虑优化游戏,特别是基于 DirectX 并需要 OpenGL 转换的游戏。我们十分希望 Linux 上的[杀出重围:人类分裂][29]Deus Ex: Mankind Divided on Linux 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX 的游戏,我们希望它能良好地移植到 Linux 上。以下是该[游戏执行总监不得不说的话][30]。 ### #3 专有的 NVIDIA 驱动 -相比于 [NVIDIA][32],[AMD 对于开源的支持][31]绝对是值得称赞的。尽管 [AMD][33] 因其更好的开源驱动在 Linux 上的驱动支持挺不错,NVIDIA 显卡用户由于开源版本的 NVIDIA 显卡驱动 “Nouveau” 有限的能力,仍不得不用专有的 NVIDIA 驱动。 +相比于 [NVIDIA][32],[AMD 对于开源的支持][31]绝对是值得称赞的。尽管 [AMD][33] 因其更好的开源驱动在 Linux 上的驱动支持挺不错,而 NVIDIA 显卡用户由于开源版本的 NVIDIA 显卡驱动 “Nouveau” 有限的能力,仍不得不用专有的 NVIDIA 驱动。 -在过去,传奇般的 Linus Torvalds 同样分享了他关于“来自 NIVIDIA 的 Linux 支持完全不可接受”的想法。 +在过去,传奇般的 Linus Torvalds 同样分享了他关于“来自 NVIDIA 的 Linux 支持完全不可接受”的想法。 [视频](https://youtu.be/O0r6Pr_mdio) -你可以在这里观看完整的[讲话][35],尽管 NVIDIA 用 [承诺更好的 Linux 平台支持][36]作为回复,开源显卡驱动仍如之前一样毫无起色。 +你可以在这里观看完整的[谈话][35],尽管 NVIDIA 用 [承诺更好的 Linux 平台支持][36]作为回复,但其开源显卡驱动仍如之前一样毫无起色。 -### #4 需要 Uplay 和 Origin 在 Linux 平台上的 DRM 支持 +### #4 需要Linux 平台上的 Uplay 和 Origin 的 DRM 支持 [视频](https://youtu.be/rc96NFwyxWU) -以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。上传者还建议使用 Wine 作为 Linux 上的主要的应用和游戏支持软件并不推荐。相反,使用原生的应用更值得鼓励。 +以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。视频上传者还建议说并不推荐使用 Wine 作为 Linux 上的主要的应用和游戏支持软件。相反,使用原生的应用更值得鼓励。 以下视频是一个关于如何在 Linux 上安装 [Origin][38] DRM 的教程。 [视频](https://youtu.be/ga2lNM72-Kw) -数字版权管理软件给游戏运行又加了一层阻碍,使得在 Linux 上良好运行 Windows 游戏这一本就充满挑战性的任务更有难度。因此除了使游戏能够运行之外,W.I.N.E 不得不同时负责运行像 Uplay 或 Origin 之类的 DRM 软件。如果能像 Steam 一样,Linux 也能够有自己原生版本的 Uplay 和 Origin 那就好了。 - -[推荐阅读:Linux 基金会会长称 2017 是 Linux 桌面之年......尽管他自己正使用苹果的 macOS][39] +数字版权管理(DRM)软件给游戏运行又加了一层阻碍,使得在 Linux 上良好运行 Windows 游戏这一本就充满挑战性的任务更有难度。因此除了使游戏能够运行之外,W.I.N.E 不得不同时负责运行像 Uplay 或 Origin 之类的 DRM 软件。如果能像 Steam 一样,Linux 也能够有自己原生版本的 Uplay 和 Origin 那就好了。 ### #5 DirectX 11 对于 Linux 的支持 -尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套插件需求。尽管去年通过 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣[发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 +尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套调整需求。尽管去年通过 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣 [发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 -### #6 100%的 Steam 游戏在 Linux 上无法获得 +### #6 100% 的 Steam 游戏不适用于 Linux 随着 Linux 游戏玩家持续错过每一款主要游戏的发行,这是需要考虑的一个重点,因为大部分主要游戏都在 Windows 上发行。以下是[如何在 Linux 上安装 Windows 版的 Steam 的教程][46]。 -### #7 游戏发行商对OpenGL更好的支持 +### #7 游戏发行商对 OpenGL 更好的支持 目前开发者和发行商主要着眼于 DirectX 而不是 OpenGL 来开发游戏。现在随着 Steam 正式登录 Linux,开发者应该同样考虑在 OpenGL 下开发。 [Direct3D][47] 仅仅是为了 Windows 平台打造。而 OpenGL API 拥有开放性标准,并且它不仅能在 Windows 上同样也能在其它各种各样的平台上实现。 -尽管是一篇很老的文章,[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。所提出的观点确实十分明智,基于按时间排序的事件给予读者启迪。 +尽管是一篇很老的文章,[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。其所提出的观点确实十分明智,基于按时间排序的事件也能给予读者启迪。 -在 Linux 平台上发布大作的发行商绝不应该忽视一个事实:在 OpenGL 下直接开发游戏要比从 DirectX 移植到 OpenGL 合算得多。如果不得不转换平台,移植必须被仔细优化并谨慎研究。发布游戏可能会有延迟但这绝对值得。 +在 Linux 平台上发布大作的发行商绝不应该忽视一个事实:在 OpenGL 下直接开发游戏要比从 DirectX 移植到 OpenGL 合算得多。如果必须进行平台转制,移植必须被仔细优化并谨慎研究。发布游戏可能会有延迟,但这绝对值得。 有更多的烦恼要分享?务必在评论区让我们知道。 @@ -100,7 +97,7 @@ via: https://itsfoss.com/linux-gaming-problems/ 作者:[Avimanyu Bandyopadhyay ][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 75dcbb3f08fc2caed5a7ea4513b78c313c063b64 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 26 Feb 2019 16:11:16 +0800 Subject: [PATCH 341/813] translate done: 20190109 Configure Anaconda on Emacs - iD.md --- ...190109 Configure Anaconda on Emacs - iD.md | 117 ------------------ ...190109 Configure Anaconda on Emacs - iD.md | 117 ++++++++++++++++++ 2 files changed, 117 insertions(+), 117 deletions(-) delete mode 100644 sources/tech/20190109 Configure Anaconda on Emacs - iD.md create mode 100644 translated/tech/20190109 Configure Anaconda on Emacs - iD.md diff --git a/sources/tech/20190109 Configure Anaconda on Emacs - iD.md b/sources/tech/20190109 Configure Anaconda on Emacs - iD.md deleted file mode 100644 index d11565e8f9..0000000000 --- a/sources/tech/20190109 Configure Anaconda on Emacs - iD.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Configure Anaconda on Emacs – iD) -[#]: via: (https://idevji.com/configure-anaconda-on-emacs/) -[#]: author: (Devji Chhanga https://idevji.com/author/admin/) - -Configure Anaconda on Emacs – iD -====== - -Perhaps my quest for an ultimate IDE ends with [Emacs.][1] My goal was to use Emacs as full-flagged Python IDE. This post describes how to setup Anaconda on Emacs. - -My Setup: - -``` -OS: Trisquel 8.0 -Emacs: GNU Emacs 25.3.2 -``` - -Quick Key Guide [(See full guide)][2] : - -``` -C-x = Ctrl + x -M-x = Alt + x -RET = ENTER -``` - -### 1. Downloading and installing Anaconda - -**1.1 Download:** -Download Anaconda [from here.][3] You should download Python 3.x version as Python 2 will run out of support in 2020. You don’t need Python 3.x on your machine. It will be installed by this install script. - -**1.2 Install:** - -``` - cd ~/Downloads -bash Anaconda3-2018.12-Linux-x86.sh -``` - - -### 2. Adding Anaconda to Emacs - -**2.1 Adding MELPA to Emacs** -Emacs package named _anaconda-mode_ can be used. This package is on the MELPA repository. Emacs25 requires this repository to be added explicitly. - -[Important : Follow this post on how to add MELPA to Emacs.][4] - -**2.2 Installing anaconda-mode package on Emacs** - -``` -M-x package-install RET -anaconda-mode RET -``` - -**2.3 Configure anaconda-mode in Emacs** - -``` -echo "(add-hook 'python-mode-hook 'anaconda-mode)" > ~/.emacs.d/init.el -``` - - -### 3\. Running your first script on Anaconda from Emacs - -**3.1 Create new .py file** - -``` -C-x C-f -HelloWorld.py RET -``` - -**3.2 Add the code** - -``` -print ("Hello World from Emacs") -``` - -**3.3 Running it** - -``` - C-c C-p -C-c C-c -``` - -Output - -``` -Python 3.7.1 (default, Dec 14 2018, 19:46:24) -[GCC 7.3.0] :: Anaconda, Inc. on linux -Type "help", "copyright", "credits" or "license" for more information. ->>> python.el: native completion setup loaded ->>> Hello World from Emacs ->>> -``` - -_I was encouraged for Emacs usage by[Codingquark;][5] -Errors and omissions should be reported in comments. Cheers!_ - --------------------------------------------------------------------------------- - -via: https://idevji.com/configure-anaconda-on-emacs/ - -作者:[Devji Chhanga][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://idevji.com/author/admin/ -[b]: https://github.com/lujun9972 -[1]: https://www.gnu.org/software/emacs/ -[2]: https://www.math.uh.edu/~bgb/emacs_keys.html -[3]: https://www.anaconda.com/download/#linux -[4]: https://melpa.org/#/getting-started -[5]: https://codingquark.com diff --git a/translated/tech/20190109 Configure Anaconda on Emacs - iD.md b/translated/tech/20190109 Configure Anaconda on Emacs - iD.md new file mode 100644 index 0000000000..09dcfd9a1c --- /dev/null +++ b/translated/tech/20190109 Configure Anaconda on Emacs - iD.md @@ -0,0 +1,117 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(Configure Anaconda on Emacs – iD) +[#]:via:(https://idevji.com/configure-anaconda-on-emacs/) +[#]:author:(Devji Chhanga https://idevji.com/author/admin/) + +在 Emacs 上配置 Anaconda +====== + +也许我所最求的究极 IDE 就是 [Emacs][1] 了。我的目标是使 Emacs 成为一款全能的 Python IDE。本文描述了如何在 Emacs 上配置 Anaconda。 + +我的配置信息: + +``` +OS: Trisquel 8.0 +Emacs: GNU Emacs 25.3.2 +``` + +快捷键说明 [(参见完全指南 )][2]: + +``` +C-x = Ctrl + x +M-x = Alt + x +RET = ENTER +``` + +### 1。下载并安装 Anaconda + +#### 1.1 下载: +[从这儿 ][3] 下载 Anaconda。你应该下载 Python 3.x 版本因为 Python 2 在 2020 年就不再支持了。你无需预先安装 Python 3.x。安装脚本会自动进行安装。 + +#### 1.2 安装: + +``` + cd ~/Downloads +bash Anaconda3-2018.12-Linux-x86.sh +``` + + +### 2。将 Anaconda 添加到 Emacs + +#### 2.1 将 MELPA 添加到 Emacs +我们需要用到 _anaconda-mode_ 这个 Emacs 包。该包位于 MELPA 仓库中。Emacs25 需要手工添加该仓库。 + +[注意:点击本文查看如何将 MELPA 添加到 Emacs。][4] + +#### 2.2 为 Emacs 安装 anaconda-mode 包 + +``` +M-x package-install RET +anaconda-mode RET +``` + +#### 2.3 为 Emacs 配置 anaconda-mode + +``` +echo "(add-hook 'python-mode-hook 'anaconda-mode)" > ~/.emacs.d/init.el +``` + + +### 3。在 Emacs 上通过 Anaconda 运行你第一个脚本 + +#### 3.1 创建新 .py 文件 + +``` +C-x C-f +HelloWorld.py RET +``` + +#### 3.2 输入下面代码 + +``` +print ("Hello World from Emacs") +``` + +#### 3.3 运行之 + +``` +C-c C-p +C-c C-c +``` + +输出为 + +``` +Python 3.7.1 (default, Dec 14 2018, 19:46:24) +[GCC 7.3.0] :: Anaconda, Inc. on linux +Type "help", "copyright", "credits" or "license" for more information. +>>> python.el: native completion setup loaded +>>> Hello World from Emacs +>>> +``` + +我是受到 [Codingquark;][5] 的影响才开始使用 Emacs 的。 +有任何错误和遗漏请在评论中之处。干杯! + +-------------------------------------------------------------------------------- + +via: https://idevji.com/configure-anaconda-on-emacs/ + +作者:[Devji Chhanga][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://idevji.com/author/admin/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/software/emacs/ +[2]: https://www.math.uh.edu/~bgb/emacs_keys.html +[3]: https://www.anaconda.com/download/#linux +[4]: https://melpa.org/#/getting-started +[5]: https://codingquark.com From 8d5797f8fc13dfa31261665c31a85bed9ea45465 Mon Sep 17 00:00:00 2001 From: runningwater Date: Tue, 26 Feb 2019 17:36:03 +0800 Subject: [PATCH 342/813] =?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 --- .../20180906 What a shell dotfile can do for you.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sources/tech/20180906 What a shell dotfile can do for you.md b/sources/tech/20180906 What a shell dotfile can do for you.md index 35593e1e32..16ee0936e3 100644 --- a/sources/tech/20180906 What a shell dotfile can do for you.md +++ b/sources/tech/20180906 What a shell dotfile can do for you.md @@ -1,3 +1,11 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What a shell dotfile can do for you) +[#]: via: (https://opensource.com/article/18/9/shell-dotfile) +[#]: author: (H.Waldo Grunenwald https://opensource.com/users/gwaldo) What a shell dotfile can do for you ====== @@ -223,7 +231,7 @@ via: https://opensource.com/article/18/9/shell-dotfile 作者:[H.Waldo Grunenwald][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/) 荣誉推出 From 6c552a9128e3fb8a2461d325b88599b0f3b58332 Mon Sep 17 00:00:00 2001 From: Leopold Date: Tue, 26 Feb 2019 19:06:00 +0800 Subject: [PATCH 343/813] leommxj translating --- ...SLR protects Linux systems from buffer overflow attacks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md b/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md index 41d4e47acc..73aaa88e66 100644 --- a/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md +++ b/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (leommxj) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -119,7 +119,7 @@ via: https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-li 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[leommxj](https://github.com/leommxj) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 494ee8705507b4ee38c11b5f2538915c1e1281b1 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 26 Feb 2019 20:26:19 +0800 Subject: [PATCH 344/813] translate done: 20181216 Schedule a visit with the Emacs psychiatrist.md --- ...ule a visit with the Emacs psychiatrist.md | 62 ------------------- ...ule a visit with the Emacs psychiatrist.md | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md create mode 100644 translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md diff --git a/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md b/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md deleted file mode 100644 index e96da9aeea..0000000000 --- a/sources/tech/20181216 Schedule a visit with the Emacs psychiatrist.md +++ /dev/null @@ -1,62 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Schedule a visit with the Emacs psychiatrist) -[#]: via: (https://opensource.com/article/18/12/linux-toy-eliza) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Schedule a visit with the Emacs psychiatrist -====== -Eliza is a natural language processing chatbot hidden inside of one of Linux's most popular text editors. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-eliza.png?itok=3ioiBik_) - -Welcome to another day of the 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Today's selection is a hidden gem inside of Emacs: Eliza, the Rogerian psychotherapist, a terminal toy ready to listen to everything you have to say. - -A brief aside: While this toy is amusing, your health is no laughing matter. Please take care of yourself this holiday season, physically and mentally, and if stress and anxiety from the holidays are having a negative impact on your wellbeing, please consider seeing a professional for guidance. It really can help. - -To launch [Eliza][1], first, you'll need to launch Emacs. There's a good chance Emacs is already installed on your system, but if it's not, it's almost certainly in your default repositories. - -Since I've been pretty fastidious about keeping this series in the terminal, launch Emacs with the **-nw** flag to keep in within your terminal emulator. - -``` -$ emacs -nw -``` - -Inside of Emacs, type M-x doctor to launch Eliza. For those of you like me from a Vim background who have no idea what this means, just hit escape, type x and then type doctor. Then, share all of your holiday frustrations. - -Eliza goes way back, all the way to the mid-1960s a the MIT Artificial Intelligence Lab. [Wikipedia][2] has a rather fascinating look at her history. - -Eliza isn't the only amusement inside of Emacs. Check out the [manual][3] for a whole list of fun toys. - - -![Linux toy: eliza animated][5] - -Do you have a favorite command-line toy that you think I ought to profile? We're running out of time, but I'd still love to hear your suggestions. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Head to the arcade in your Linux terminal with this Pac-man clone][6], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-eliza - -作者:[Jason Baker][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://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://www.emacswiki.org/emacs/EmacsDoctor -[2]: https://en.wikipedia.org/wiki/ELIZA -[3]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Amusements.html -[4]: /file/417326 -[5]: https://opensource.com/sites/default/files/uploads/linux-toy-eliza-animated.gif (Linux toy: eliza animated) -[6]: https://opensource.com/article/18/12/linux-toy-myman diff --git a/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md b/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md new file mode 100644 index 0000000000..7e05a0e930 --- /dev/null +++ b/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md @@ -0,0 +1,62 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(Schedule a visit with the Emacs psychiatrist) +[#]:via:(https://opensource.com/article/18/12/linux-toy-eliza) +[#]:author:(Jason Baker https://opensource.com/users/jason-baker) + +预约 Emacs 心理医生 +====== +Eliza 是一个隐藏于某个 Linux 最流行文本编辑器中的自然语言处理聊天机器人。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-eliza.png?itok=3ioiBik_) + +欢迎你,今天时期 24 天的 Linux 命令行玩具的又一天。如果你是第一次访问本系列,你可能会问什么是命令行玩具呢。我们将会逐步确定这个概念,但一般来说,它可能是一个游戏,或任何能让你在终端玩的开心的其他东西。 + +可能你们已经见过了很多我们之前挑选的那些玩具,但我们依然希望对所有人来说都至少有一件新鲜事物。 + +今天的选择是 Emacs 中的一个彩蛋:Eliza,Rogerian 心理医生,一个准备好倾听你述说一切的终端玩具。 + +旁白:虽然这个玩具很好玩,但你的健康不是用来开玩笑的。请在假期期间照顾好你自己,无论时身体上还是精神上,若假期中的压力和焦虑对你的健康产生负面影响,请考虑找专业人士进行指导。真的有用。 + +要启动 [Eliza][1],首先,你需要启动 Emacs。很有可能 Emacs 已经安装在你的系统中了,但若没有,它基本上也肯定在你默认的软件仓库中。 + +由于我要求本系列的工具一定要时运行在终端内,因此使用 **-nw** 标志来启动 Emacs 让它在你的终端模拟器中运行。 + +``` +$ emacs -nw +``` + +在 Emacs 中,输入 M-x doctor 来启动 Eliza。对于像我这样有 Vim 背景的人可能不知道这是什么意思,只需要按下 escape,输入 x 然后输入 doctor。然后,向它倾述所有假日的烦恼吧。 + +Eliza 历史悠久,最早可以追溯到 1960 年代中期的 MIT 人工智能实验室。[维基百科 ][2] 上有它历史的详细说明。 + +Eliza 并不是 Emacs 中唯一的娱乐工具。查看 [手册 ][3] 可以看到一整列好玩的玩具。 + + +![Linux toy:eliza animated][5] + +你有什么喜欢的命令行玩具值得推荐吗?我们时间不多了,但我还是想听听你的建议。请在下面评论中告诉我,我会查看的。另外也欢迎告诉我你们对本次玩具的想法。 + +请一定要看看昨天的玩具,[带着这个复刻版吃豆人来到 Linux 终端游乐中心 ][6],然后明天再来看另一个玩具! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-eliza + +作者:[Jason Baker][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://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://www.emacswiki.org/emacs/EmacsDoctor +[2]: https://en.wikipedia.org/wiki/ELIZA +[3]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Amusements.html +[4]: /file/417326 +[5]: https://opensource.com/sites/default/files/uploads/linux-toy-eliza-animated.gif (Linux toy: eliza animated) +[6]: https://opensource.com/article/18/12/linux-toy-myman From e5eceb5b4bf898c3a41ba9baf6134ac3239f2227 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Tue, 26 Feb 2019 08:30:46 -0600 Subject: [PATCH 345/813] Submitted Translated Passage for Review Submitted Translated Passage for Review --- ... source tools for scientific publishing.md | 79 ------------------- ... source tools for scientific publishing.md | 76 ++++++++++++++++++ 2 files changed, 76 insertions(+), 79 deletions(-) delete mode 100644 sources/tech/20180307 3 open source tools for scientific publishing.md create mode 100644 translated/tech/20180307 3 open source tools for scientific publishing.md diff --git a/sources/tech/20180307 3 open source tools for scientific publishing.md b/sources/tech/20180307 3 open source tools for scientific publishing.md deleted file mode 100644 index ffb844e5dc..0000000000 --- a/sources/tech/20180307 3 open source tools for scientific publishing.md +++ /dev/null @@ -1,79 +0,0 @@ -tomjlw is translating -3 open source tools for scientific publishing -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_science.png?itok=WDKARWGV) -One industry that lags behind others in the adoption of digital or open source tools is the competitive and lucrative world of scientific publishing. Worth over £19B ($26B) annually, according to figures published by Stephen Buranyi in [The Guardian][1] last year, the system for selecting, publishing, and sharing even the most important scientific research today still bears many of the constraints of print media. New digital-era technologies present a huge opportunity to accelerate discovery, make science collaborative instead of competitive, and redirect investments from infrastructure development into research that benefits society. - -The non-profit [eLife initiative][2] was established by the funders of research, in part to encourage the use of these technologies to this end. In addition to publishing an open-access journal for important advances in life science and biomedical research, eLife has made itself into a platform for experimentation and showcasing innovation in research communication—with most of this experimentation based around the open source ethos. - -Working on open publishing infrastructure projects gives us the opportunity to accelerate the reach and adoption of the types of technology and user experience (UX) best practices that we consider important to the advancement of the academic publishing industry. Speaking very generally, the UX of open source products is often left undeveloped, which can in some cases dissuade people from using it. As part of our investment in OSS development, we place a strong emphasis on UX in order to encourage users to adopt these products. - -All of our code is open source, and we actively encourage community involvement in our projects, which to us means faster iteration, more experimentation, greater transparency, and increased reach for our work. - -The projects that we are involved in, such as the development of Libero (formerly known as [eLife Continuum][3]) and the [Reproducible Document Stack][4], along with our recent collaboration with [Hypothesis][5], show how OSS can be used to bring about positive changes in the assessment, publication, and communication of new discoveries. - -### Libero - -Libero is a suite of services and applications available to publishers that includes a post-production publishing system, a full front-end user interface pattern suite, Libero's Lens Reader, an open API, and search and recommendation engines. - -Last year, we took a user-driven approach to redesigning the front end of Libero, resulting in less distracting site “furniture” and a greater focus on research articles. We tested and iterated all the key functional areas of the site with members of the eLife community to ensure the best possible reading experience for everyone. The site’s new API also provides simpler access to content for machine readability, including text mining, machine learning, and online application development. - -The content on our website and the patterns that drive the new design are all open source to encourage future product development for both eLife and other publishers that wish to use it. - -### The Reproducible Document Stack - -In collaboration with [Substance][6] and [Stencila][7], eLife is also engaged in a project to create a Reproducible Document Stack (RDS)—an open stack of tools for authoring, compiling, and publishing computationally reproducible manuscripts online. - -Today, an increasing number of researchers are able to document their computational experiments through languages such as [R Markdown][8] and [Python][9]. These can serve as important parts of the experimental record, and while they can be shared independently from or alongside the resulting research article, traditional publishing workflows tend to relegate these assets as a secondary class of content. To publish papers, researchers using these languages often have little option but to submit their computational results as “flattened” outputs in the form of figures, losing much of the value and reusability of the code and data references used in the computation. And while electronic notebook solutions such as [Jupyter][10] can enable researchers to publish their code in an easily reusable and executable form, that’s still in addition to, rather than as an integral part of, the published manuscript. - -The [Reproducible Document Stack][11] project aims to address these challenges through development and publication of a working prototype of a reproducible manuscript that treats code and data as integral parts of the document, demonstrating a complete end-to-end technology stack from authoring through to publication. It will ultimately allow authors to submit their manuscripts in a format that includes embedded code blocks and computed outputs (statistical results, tables, or graphs), and have those assets remain both visible and executable throughout the publication process. Publishers will then be able to preserve these assets directly as integral parts of the published online article. - -### Open annotation with Hypothesis - -Most recently, we introduced open annotation in collaboration with [Hypothesis][12] to enable users of our website to make comments, highlight important sections of articles, and engage with the reading public online. - -Through this collaboration, the open source Hypothesis software was customized with new moderation features, single sign-on authentication, and user-interface customization options, giving publishers more control over its implementation on their sites. These enhancements are already driving higher-quality discussions around published scholarly content. - -The tool can be integrated seamlessly into publishers’ websites, with the scholarly publishing platform [PubFactory][13] and content solutions provider [Ingenta][14] already taking advantage of its improved feature set. [HighWire][15] and [Silverchair][16] are also offering their publishers the opportunity to implement the service. - -### Other industries and open source - -Over time, we hope to see more publishers adopt Hypothesis, Libero, and other projects to help them foster the discovery and reuse of important scientific research. But the opportunities for innovation eLife has been able to leverage because of these and other OSS technologies are also prevalent in other industries. - -The world of data science would be nowhere without the high-quality, well-supported open source software and the communities built around it; [TensorFlow][17] is a leading example of this. Thanks to OSS and its communities, all areas of AI and machine learning have seen rapid acceleration and advancement compared to other areas of computing. Similar is the explosion in usage of Linux as a cloud web host, followed by containerization with Docker, and now the growth of Kubernetes, one of the most popular open source projects on GitHub. - -All of these technologies enable organizations to do more with less and focus on innovation instead of reinventing the wheel. And in the end, that’s the real benefit of OSS: It lets us all learn from each other’s failures while building on each other's successes. - -We are always on the lookout for opportunities to engage with the best emerging talent and ideas at the interface of research and technology. Find out more about some of these engagements on [eLife Labs][18], or contact [innovation@elifesciences.org][19] for more information. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/scientific-publishing-software - -作者:[Paul Shanno][a] -译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/pshannon -[1]:https://www.theguardian.com/science/2017/jun/27/profitable-business-scientific-publishing-bad-for-science -[2]:https://elifesciences.org/about -[3]:https://elifesciences.org/inside-elife/33e4127f/elife-introduces-continuum-a-new-open-source-tool-for-publishing -[4]:https://elifesciences.org/for-the-press/e6038800/elife-supports-development-of-open-technology-stack-for-publishing-reproducible-manuscripts-online -[5]:https://elifesciences.org/for-the-press/81d42f7d/elife-enhances-open-annotation-with-hypothesis-to-promote-scientific-discussion-online -[6]:https://github.com/substance -[7]:https://github.com/stencila/stencila -[8]:https://rmarkdown.rstudio.com/ -[9]:https://www.python.org/ -[10]:http://jupyter.org/ -[11]:https://elifesciences.org/labs/7dbeb390/reproducible-document-stack-supporting-the-next-generation-research-article -[12]:https://github.com/hypothesis -[13]:http://www.pubfactory.com/ -[14]:http://www.ingenta.com/ -[15]:https://github.com/highwire -[16]:https://www.silverchair.com/community/silverchair-universe/hypothesis/ -[17]:https://www.tensorflow.org/ -[18]:https://elifesciences.org/labs -[19]:mailto:innovation@elifesciences.org diff --git a/translated/tech/20180307 3 open source tools for scientific publishing.md b/translated/tech/20180307 3 open source tools for scientific publishing.md new file mode 100644 index 0000000000..697b8d50ea --- /dev/null +++ b/translated/tech/20180307 3 open source tools for scientific publishing.md @@ -0,0 +1,76 @@ +3款用于学术发表的开源工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_science.png?itok=WDKARWGV) +有一个行业在采用数字或者开源工具方面已落后其它行业,那就是竞争与利润并存的学术出版业。根据 Stephen Buranyi 去年在 [The Guardian][1] 发表的一份图表,这个估值超过190亿英镑(260亿美元)的行业至今在其选择、发表甚至分享最重要的科学研究的系统方面,仍受限于印刷媒介的诸多限制。全新的数字时代科技展现了一个能够加速探索、推动科学合作性而不是竞争性以及将投入重新从基础建设导向有益社会的研究的巨大的机遇。 + +非盈利性的 [eLife 倡议][2] 是由研究的资金赞助方建立,旨在通过使用数字或者开源技术来走出上述僵局。除了为生活中科学和生物医疗方面的重大成就出版开放式获取的杂志,eLife 已将自己变成了一个在研究交流方面的创新实验窗口——而大部分的实验都是基于开源精神的。 + +参与开源出版项目给予我们加速接触、采用科学技术,提升用户体验的机会。我们认为这种机会对于推动学术出版行业是重要的。大而化之地说,开源产品的用户体验经常是有待开发的,而有时候这种情况会阻止其他人去使用它。作为我们在 OSS 开发中投入的一部分,为了鼓励更多用户使用这些产品,我们十分注重用户体验。 + +我们所有的代码都是开源的并且我们也积极鼓励开源社区参与进我们的项目中。这对我们来说意味着更快的迭代、更多的实验、更大的透明度,同时也拓宽了我们工作的外延。 + +我们现在参与的项目,例如 Libero (之前称作 [eLife Continuum][3])和 [可复制文档栈][4] 的开发以及我们最近和 [Hypothesis][5] 的合作,展示了 OSS 是如何在校队、发表以及新发现的沟通方面带来正面影响的。 + +### Libero + +Libero 是面向发布者的服务及应用套餐,它包括一个后生产出版系统、整套前端用户界面、Libero 的棱镜阅读器、一个开放式的API以及一个搜索推荐引擎。 + +去年我们采取了用户导向的途径重新设计了 Libero 的前端,做出了一个使用户较少地分心并更多地集中注意在研究文章上的站点。我们和 eLife 社区成员测试并迭代了站点所有的核心功能以确保给所有人最好的阅读体验。网站的新 API 也给可供机器阅读的内容提供了更简单的访问途径,其中包括文字挖掘、机器学习以及在线应用开发。我们网站上的内容以及引领新设计的样式都是开源的,以鼓励 eLife 和其它想要使用它的发布者后续的开发。 + +### 可复制文档栈 + +在与 [Substance][6] 和 [Stencila][7] 的合作下,eLife 也参与了一个项目来创建可复制的文档栈(RDS)——一个开放式的创作、编纂以及在线出版可复制的计算型手稿的工具栈。 + +今天越来越多的研究员能够通过 [R、Markdown][8] 和 [Python][9] 等语言记录他们的计算型实验。这些可以作为实验记录的重要部分,但是尽管它们可以通过最终的研究文章独立地分享,传统出版流程经常将它们视为次级内容。为了发表论文,使用这些语言的研究员除了将他们的计算结果用图片的形式“扁平化”提交外别无他法。但是这导致了许多实验价值和代码和计算数据可重复利用性的流失。诸如 [Jupyter][10] 的电子笔记本解决方案确实可以使研究员以一种可重复利用、可执行的简单形式发布,但是这种方案仍然独立于整个手稿发布过程之外,而不是集成在其中。 + +[可复制文档栈][11] 项目着眼于通过开发、发布一个能够把代码和数据集成在文档自身的产品雏形来突出这些挑战并阐述一个端对端的从创作到出版的完整科技。它将最终允许用户以一种包含嵌入代码块和计算结果(统计结果、图表或图片)的形式提交他们的手稿并在出版过程中保留这些可视、可执行的部分。那时发布者就可以将这些作为发布的在线文章的整体所保存。 + +### 用 Hypothesis 进行开放式注解 + +最近,我们与 [Hypothesis][12] 合作引进了开放式注解,使得我们网站的用户们可以写评语、高亮文章重要部分以及与在线阅读的群体互动。 + +通过这样的合作,开源的 Hypothesis 软件被定制得更具有现代化的特性如单次登录验证、用户界面定制选项,给予了发布者在他们自己网站上更多的控制。这些提升正引导着关于发表的学术内容高质量的讨论。 + +这个工具可以无缝集成进发布者的网站,学术发表平台 [PubFactory][13] 和内容解决方案供应商 [Ingenta][14] 已经利用了它优化后的特性集。[HighWire][15] 和 [Silverchair][16] 也为他们的发布者提供了实施这套方案的机会。 + + ### 其它产业和开源软件 + +过段时间,我们希望看到更多的发布者采用 Hypothesis、Libero 以及其它开源软件去帮助他们促进重要科学研究的发现以及循环利用。但是 eLife 所能利用的因这些软件和其它 OSS 科技带来的创新机会在其他产业也很普遍。 + +数据科学的世界离不开高质量、强支持的开源软件和围绕它们形成的社区;[TensorFlow][17] 就是这样一个好例子。感谢 OSS 以及其社区,AI 的所有领域和机器学习相比于计算机的其它领域有了迅速的提升和发展。与之类似的是 Linux 云端网页主机、Docker 容器、Github上最流行的开源项目之一的 Kubernetes 使用的爆炸性增长。 + +所有的这些科技使得不同团体能够四两拨千斤并集中在创新而不是造轮子上。最后,那才是 OSS 真正的好处:它使得我们从互相的失败中学习,在互相的成功中成长。 + +我们总是在寻找与研究和科技界面方面最好的人才和想法交流的机会。你可以在 [eLife Labs][18] 上或者联系 [innovation@elifesciences.org][19] 找到更多这种交流的信息。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/scientific-publishing-software + +作者:[Paul Shanno][a] +译者:[tomjlw](https://github.com/tomjlw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/pshannon +[1]:https://www.theguardian.com/science/2017/jun/27/profitable-business-scientific-publishing-bad-for-science +[2]:https://elifesciences.org/about +[3]:https://elifesciences.org/inside-elife/33e4127f/elife-introduces-continuum-a-new-open-source-tool-for-publishing +[4]:https://elifesciences.org/for-the-press/e6038800/elife-supports-development-of-open-technology-stack-for-publishing-reproducible-manuscripts-online +[5]:https://elifesciences.org/for-the-press/81d42f7d/elife-enhances-open-annotation-with-hypothesis-to-promote-scientific-discussion-online +[6]:https://github.com/substance +[7]:https://github.com/stencila/stencila +[8]:https://rmarkdown.rstudio.com/ +[9]:https://www.python.org/ +[10]:http://jupyter.org/ +[11]:https://elifesciences.org/labs/7dbeb390/reproducible-document-stack-supporting-the-next-generation-research-article +[12]:https://github.com/hypothesis +[13]:http://www.pubfactory.com/ +[14]:http://www.ingenta.com/ +[15]:https://github.com/highwire +[16]:https://www.silverchair.com/community/silverchair-universe/hypothesis/ +[17]:https://www.tensorflow.org/ +[18]:https://elifesciences.org/labs +[19]:mailto:innovation@elifesciences.org From 673010cd33a3085b3f4b7712f7c2d87821c6ea08 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 27 Feb 2019 08:54:32 +0800 Subject: [PATCH 346/813] translated --- ... manipulating PDFs on the Linux desktop.md | 99 ------------------- ... manipulating PDFs on the Linux desktop.md | 99 +++++++++++++++++++ 2 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md create mode 100644 translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md diff --git a/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md b/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md deleted file mode 100644 index ac2167f093..0000000000 --- a/sources/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Two graphical tools for manipulating PDFs on the Linux desktop) -[#]: via: (https://opensource.com/article/19/2/manipulating-pdfs-linux) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Two graphical tools for manipulating PDFs on the Linux desktop -====== -PDF-Shuffler and PDF Chain are great tools for modifying PDFs in Linux. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4) - -With the way I talk and write about PDFs and tools for working with them, some people think I'm in love with the format. I'm not, for a variety of reasons I won't go into here. - -I won't go so far as saying PDFs are a necessary evil in my personal and professional life—rather they're a necessary not-so-good. Often I have to use PDFs, even though there are better alternatives for delivering documents. - -When I work with PDFs, usually at the day job and with one of those other operating systems, I fiddle with them using Adobe Acrobat. But what about when I have to work with PDFs on the Linux desktop? Let's take a look at two of the graphical tools I use to manipulate PDFs. - -### PDF-Shuffler - -As its name suggests, you can use [PDF-Shuffler][1] to move pages around in a PDF file. It can do a little more, but the software's capabilities are limited. That doesn't mean PDF-Shuffler isn't useful. It is. Very useful. - -You can use PDF-Shuffler to: - - * Extract pages from PDF files - * Add pages to a file - * Rearrange the pages in a file - - - -Be aware that PDF-Shuffler has a few dependencies, like pyPDF and python-gtk. Usually, installing it via a package manager is the fastest and least frustrating route. - -Let's say you want to extract pages from a PDF, maybe to act as a sample chapter from your book. Open the PDF file by selecting **File > Add**. - -![](https://opensource.com/sites/default/files/uploads/pdfshuffler-book.png) - -To extract pages 7 to 9, press Ctrl and click-select the pages. Then, right-click and select **Export selection**. - -![](https://opensource.com/sites/default/files/uploads/pdfshuffler-export.png) - -Choose the directory where you want to save the file, give it a name, and click **Save**. - -To add a file—for example, to add a cover or re-insert scanned, signed pages of a contract or application—open a PDF file, then select **File > Add** and find the PDF file that you want to add. Click **Open**. - -PDF-Shuffler has an annoying habit of adding pages at the end of the PDF file you're working on. Click and drag the page you added to where you want it to go in the file. You can only click and drag one page in a file at a time. - -![](https://opensource.com/sites/default/files/uploads/pdfshuffler-move.png) - -### PDF Chain - -I'm a big fan of [PDFtk][2], a command-line app for doing some interesting things with and to PDFs. Since I don't use it frequently, I don't remember all of PDFtk's commands and options. - -[PDF Chain][3] is a very good alternative to PDFtk's command line. It gives you one-click access to PDFtk's most frequently used commands. Without touching a menu, you can: - - * Merge PDFs (including rotating the pages of one or more files) - * Extract pages from a PDF and save them to individual files - * Add a background or watermark to a PDF - * Add attachments to a file - -![](https://opensource.com/sites/default/files/uploads/pdfchain1.png) - -You can also do more. Click on the **Tools** menu to: - - * Extract attachments from a PDF - * Compress or uncompress a file - * Extract the metadata from the file - * Fill in PDF forms from an external [data file][4] - * [Flatten][5] a PDF - * Drop [XML Forms Architecture][6] (XFA) data from PDF forms - - - -To be honest, I only use the commands to extract attachments and compress or uncompress PDFs with PDF Chain or PDFtk. The rest are pretty much terra incognita for me. - -### Summing up - -The number of tools available on Linux for working with PDFs never ceases to amaze me. And neither does the breadth and depth of their features and functions. I can usually find one, whether command line or graphical, that does what I need to do. For the most part, PDF Mod and PDF Chain work well for me. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/manipulating-pdfs-linux - -作者:[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://savannah.nongnu.org/projects/pdfshuffler/ -[2]: https://en.wikipedia.org/wiki/PDFtk -[3]: http://pdfchain.sourceforge.net/ -[4]: http://www.verypdf.com/pdfform/fdf.htm -[5]: http://pdf-tips-tricks.blogspot.com/2009/03/flattening-pdf-layers.html -[6]: http://en.wikipedia.org/wiki/XFA diff --git a/translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md b/translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md new file mode 100644 index 0000000000..adcf6de0d3 --- /dev/null +++ b/translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Two graphical tools for manipulating PDFs on the Linux desktop) +[#]: via: (https://opensource.com/article/19/2/manipulating-pdfs-linux) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +两款 Linux 桌面中的图形化操作 PDF 的工具 +====== +PDF-Shuffler 和 PDF Chain 是在 Linux 中修改 PDF 的绝佳工具。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4) + +由于我谈论并且写了些工作中使用 PDF 及其工具的文章,有些人认为我喜欢这种格式。其实我并不是,由于各种原因,我不会深入它。 + +我不会说 PDF 是我个人和职业生活中的一个躲不开的坏事 - 相反,它们不是那么好。通常即使有更好的替代方案来交付文档,我也必须使用 PDF。 + +当我使用 PDF 时,通常是在白天工作时在其他的操作系统上使用,我使用 Adobe Acrobat 进行操作。但是当我必须在 Linux 桌面上使用 PDF 时呢?我们来看看我用来操作 PDF 的两个图形工具。 + +### PDF-Shuffler + +顾名思义,你可以使用 [PDF-Shuffler][1] 在 PDF 文件中移动页面。它可以做得更多,但软件的功能是有限的。这并不意味着 PDF-Shuffler 没用。它有用,很有用。 + +你可以将 PDF-Shuffler 用来: + + * 从 PDF 文件中提取页面 + * 将页面添加到文件中 + * 重新排列文件中的页面 + + + +请注意,PDF-Shuffler 有一些依赖项,如 pyPDF 和 python-gtk。通常,通过包管理器安装它是最快且最不令人沮丧的途径。 + +假设你想从 PDF 中提取页面,也许是作为你书中的样本章节。选择**文件>添加**打开 PDF 文件。 + +![](https://opensource.com/sites/default/files/uploads/pdfshuffler-book.png) + +要提取第 7 页到第 9 页,请按住 Ctrl 并单击选择页面。然后,右键单击并选择**导出选择**。 + +![](https://opensource.com/sites/default/files/uploads/pdfshuffler-export.png) + +选择要保存文件的目录,为其命名,然后单击**保存**。 + +要添加文件 - 例如,要添加封面或重新插入已扫描的且已签名的合同或者应用 - 打开 PDF 文件,然后选择**文件>添加**并找到要添加的 PDF 文件。单击**打开**。 + +PDF-Shuffler 有个不好的东西就是在你正在处理的 PDF 文件末尾添加页面。单击并将添加的页面拖动到文件中的所需位置。你一次只能在文件中单击并拖动一个页面。 + +![](https://opensource.com/sites/default/files/uploads/pdfshuffler-move.png) + +### PDF Chain + +我是 [PDFtk][2] 的忠实粉丝,它是一个可以对 PDF 做一些有趣操作的命令行工具。由于我不经常使用它,我不记得所有 PDFtk 的命令和选项。 + +[PDF Chain][3] 是 PDFtk 命令行的一个很好的替代品。它可以让你一键使用 PDFtk 最常用的命令。无需使用菜单,你可以: + + * 合并 PDF(包括旋转一个或多个文件的页面) +  * 从 PDF 中提取页面并将其保存到单个文件中 +  * 为 PDF 添加背景或水印 +  * 将附件添加到文件 + +![](https://opensource.com/sites/default/files/uploads/pdfchain1.png) + +你也可以做得更多。点击**工具**菜单,你可以: + + * 从 PDF 中提取附件 +  * 压缩或解压缩文件 +  * 从文件中提取元数据 +  * 用外部[数据][4]填充 PDF 表格 +  * [扁平化][5] PDF +  * 从 PDF 表单中删除 [XML 表格结构][6](XFA)数据 + + + +老实说,我只使用 PDF Chain 或 PDFtk 提取附件、压缩或解压缩 PDF。其余的对我来说基本没听说。 + +### 总结 + +Linux 上用于处理 PDF 的工具数量一直让我感到吃惊。它们的特性和功能的广度和深度也是如此。我通常可以找到一个,无论是命令行还是图形,它都能做我需要的。在大多数情况下,PDF Mod 和 PDF Chain 对我来说效果很好。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/manipulating-pdfs-linux + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://savannah.nongnu.org/projects/pdfshuffler/ +[2]: https://en.wikipedia.org/wiki/PDFtk +[3]: http://pdfchain.sourceforge.net/ +[4]: http://www.verypdf.com/pdfform/fdf.htm +[5]: http://pdf-tips-tricks.blogspot.com/2009/03/flattening-pdf-layers.html +[6]: http://en.wikipedia.org/wiki/XFA From ba67aebf9267f05bb9dfb354c500b8d2ca52f1a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 27 Feb 2019 09:04:56 +0800 Subject: [PATCH 347/813] translating --- ...6 FinalCrypt - An Open Source File Encryption Application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md b/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md index 3d03dcfa0a..af54453727 100644 --- a/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md +++ b/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ec8fb1fc90effa57732a630b826dfde1797e2e59 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 27 Feb 2019 13:31:01 +0800 Subject: [PATCH 348/813] Translating 7 steps for hunting down Python code bugs. --- ... 7 steps for hunting down Python code bugs.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 276a32c3c0..ae9840b05f 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -35,23 +35,23 @@ * 打面糊 * 加面粉 -You have started making your cake, you have started making the batter, and you are adding the flour. Greasing the pan is not on the list since you already finished that, and making the frosting is not on the list because you have not started that. +你已经开始做蛋糕,你已经开始打面糊,而你现在正在加面粉。锅底抹油不在这个列表中因为你已经做完了,而做糖霜不在这个列表上因为你还没开始做。 -If you are fuzzy on the stack, I highly recommend playing around on [Python Tutor][1], where you can watch the stack as you execute lines of code. +如果你对调用栈不清楚,我强烈建议你使用 [Python Tutor][1],它能帮你在执行代码时观察调用栈。 -Now, if something goes wrong with your Python program, the interpreter helpfully prints out the stack for you. This means that whatever the program was doing at the moment it became apparent that something went wrong is on the bottom. +现在,如果你的 Python 程序出现了错误,接收器会帮你打印出当前调用栈。这意味着无论那一时刻程序在做什么,很明显调用栈的底部发生了错误。 ### 3. 始终先检查 stack 的底部 -Not only is the bottom of the stack where you can see which error occurred, but often the last line of the stack is where you can find the issue. If the bottom doesn't help, and your code has not been linted in a while, it is amazing how helpful it can be to run. I recommend pylint or flake8. More often than not, it points right to where there is an error that I have been overlooking. +你不仅能在栈底看到发生了哪个错误,而且通常可以在调用栈的最后一行发现问题。如果栈底对你没有帮助,而你的代码还没有经过代码分析,那么使用代码分析非常有用。我推荐 pylint 或者 flake8。通常情况下,它会指出我一直忽略的错误的地方。 -If the error is something that seems obscure, your next move might just be to Google it. You will have better luck if you don't include information that is relevant only to your code, like the name of variables, files, etc. If you are using Python 3 (which you should be), it's helpful to include the 3 in the search; otherwise, Python 2 solutions tend to dominate the top. +如果对错误看起来很迷惑,你下一步行动可能是用 Google 搜索它。如果你搜索的内容不包含你的代码的相关信息,如变量名、文件等,那你将获得更好的搜索结果。如果你使用的是 Python 3(你应该使用它),那么搜索内容包含 Python 3 是有帮助的,否则 Python 2 的解决方案往往会占据大多数。 -Once upon a time, developers had to troubleshoot without the benefit of a search engine. This was a dark time. Take advantage of all the tools available to you. +很久以前,开发者需要在没有搜索引擎的帮助下解决问题。这是一段黑暗的时光。充分利用你可以使用的所有工具。 -Unfortunately, sometimes the problem occurred earlier and only became apparent during the line executed on the bottom of the stack. Think about how forgetting to add the baking powder becomes obvious when the cake doesn't rise. +不幸的是,有时候问题发生得比较早但只有在调用栈底部执行的地方才变得明显。就像当蛋糕没有膨胀时,忘记加发酵粉的事才被发现。 -It is time to look up the stack. Chances are quite good that the problem is in your code, and not Python core or even third-party packages, so scan the stack looking for lines in your code first. Plus it is usually much easier to put a breakpoint in your own code. Stick the breakpoint in your code a little further up the stack and look around to see if things look like they should. +那就该检查整个调用栈。问题很可能在于你的代码而不算 Python 核心或者第三方包,所以先检查调用栈内你的代码。另外,在你的代码中放置断点通常会更容易检查代码。在调用栈的代码中放置断点然后看看周围是否如你预期。 "But Maria," I hear you say, "this is all helpful if I have a stack trace, but I just have a failing test. Where do I start?" From 398185b0106f74d05a9e610891464beadd52c6f8 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:34:25 +0800 Subject: [PATCH 349/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190222=20Q4OS?= =?UTF-8?q?=20Linux=20Revives=20Your=20Old=20Laptop=20with=20Windows?= =?UTF-8?q?=E2=80=99=20Looks=20sources/tech/20190222=20Q4OS=20Linux=20Revi?= =?UTF-8?q?ves=20Your=20Old=20Laptop=20with=20Windows-=20Looks.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ves Your Old Laptop with Windows- Looks.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20190222 Q4OS Linux Revives Your Old Laptop with Windows- Looks.md diff --git a/sources/tech/20190222 Q4OS Linux Revives Your Old Laptop with Windows- Looks.md b/sources/tech/20190222 Q4OS Linux Revives Your Old Laptop with Windows- Looks.md new file mode 100644 index 0000000000..93549ac45b --- /dev/null +++ b/sources/tech/20190222 Q4OS Linux Revives Your Old Laptop with Windows- Looks.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Q4OS Linux Revives Your Old Laptop with Windows’ Looks) +[#]: via: (https://itsfoss.com/q4os-linux-review) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Q4OS Linux Revives Your Old Laptop with Windows’ Looks +====== + +There are quite a few Linux distros available that seek to make new users feel at home by [imitating the look and feel of Windows][1]. Today, we’ll look at a distro that attempts to do this with limited success We’ll be looking at [Q4OS][2]. + +### Q4OS Linux focuses on performance on low hardware + +![Q4OS Linux desktop after first boot][3]Q4OS after first boot + +> Q4OS is a fast and powerful operating system based on the latest technologies while offering highly productive desktop environment. We focus on security, reliability, long-term stability and conservative integration of verified new features. System is distinguished by speed and very low hardware requirements, runs great on brand new machines as well as legacy computers. It is also very applicable for virtualization and cloud computing. +> +> Q4OS Website + +Q4OS currently has two different release branches: 2.# Scorpion and 3.# Centaurus. Scorpion is the Long-Term-Support (LTS) release and will be supported for five years. That support should last until 2022. The most recent version of Scorpion is 2.6, which is based on [Debian][4] 9 Stretch. Centaurus is considered the testing branch and is based on Debian Buster. Centaurus will become the LTS when Debian Buster becomes stable. + +Q4OS is one of the few Linux distros that still support both 32-bit and 64-bit. It has also been ported to ARM devices, specifically the Raspberry PI and the PineBook. + +The one major thing that separates Q4OS from the majority of Linux distros is their use of the Trinity Desktop Environment as the default desktop environment. + +#### The not-so-famous Trinity Desktop Environment + +![][5]Trinity Desktop Environment + +I’m sure that most people are unfamiliar with the [Trinity Desktop Environment (TDE)][6]. I didn’t know until I discovered Q4OS a couple of years ago. TDE is a fork of [KDE][7], specifically KDE 3.5. TDE was created by Timothy Pearson and the first release took place in April 2010. + +From what I read, it sounds like TDE was created for the same reason as [MATE][8]). Early versions of KDE 4 were prone to crash and users were unhappy with the direction the new release was taking, it was decided to fork the previous release. That is where the similarities end. MATE has taken on a life of its own and grew to become an equal among desktop environments. Development of TDE seems to have slowed. There were two years between the last two point releases. + +Quick side note: TDE uses its own fork of Qt 3, named TQt. + +#### System Requirements + +According to the [Q4OS download page][9], the system requirements differ based on the desktop environment you install. + +**TDE Version** + + * At least 300MHz CPU + * 128 MB of RAM + * 3 GB Storage + + + +**KDE Version** + + * At least 1GHz CPU + * 1 GB of RAM + * 5 GB Storage + + + +You can see from the system requirements that Q4OS is a [lightweight Linux distribution suitable for older computers][10]. + +#### Included apps by default + +The following applications are included in the full install of Q4OS: + + * Google Chrome + * Thunderbird + * LibreOffice + * VLC player + * Konqueror browser + * Dolphin file manager + * AisleRiot Solitaire + * Konsole + * Software Center + + + * KMines + * Ockular + * KBounce + * DigiKam + * Kooka + * KolourPaint + * KSnapshot + * Gwenview + * Ark + + + * KMail + * SMPlayer + * KRec + * Brasero + * Amarok player + * qpdfview + * KOrganizer + * KMag + * KNotes + + + +Of course, you can install additional applications through the software center. Since Q4OS is based on Debian, you can also [install applications from deb packages][11]. + +#### Q4OS can be installed from within Windows + +I was able to successfully install TrueOS on my Dell Latitude D630 without any issues. This laptop has an Intel Centrino Duo Core processor running at 2.00 GHz, NVIDIA Quadro NVS 135M graphics chip, and 4 GB of RAM. + +You have a couple of options to choose from when installing Q4OS. You can either install Q4OS with a CD (Live or install) or you can install it from inside Window. The Windows installer asks for the drive location you want to install to, how much space you want Q4OS to take up and what login information do you want to use. + +![][12]Q4OS Windows installer + +Compared to most distros, the Live ISOs are small. The KDE version weighs less than 1GB and the TDE version is just a little north of 500 MB. + +### Experiencing Q4OS: Feels like older Windows versions + +Please note that while there is a KDE installation ISO, I used the TDE installation ISO. The KDE Live CD is a recent addition, so TDE is more in line with the project’s long term goals. + +When you boot into Q4OS for the first time, it feels like you jumped through a time portal and are staring at Windows 2000. The initial app offerings are very slim, you have access to a file manager, a web browser and not much else. There isn’t even a screenshot tool installed. + +![][13]Konqueror film manager + +When you try to use the TDE browser (Konqueror), a dialog box pops up recommending using the Desktop Profiler to [install Google Chrome][14] or some other recent web browser. + +The Desktop Profiler allows you to choose between a bare-bones, basic or full desktop and which desktop environment you wish to use as default. You can also use the Desktop Profiler to install other desktop environments, such as MATE, Xfce, LXQT, LXDE, Cinnamon and GNOME. + +![Q4OS Welcome Screen][15]![Q4OS Welcome Screen][15]Q4OS Welcome Screen + +Q4OS comes with its own application center. However, the offerings are limited to less than 20 options, including Synaptic, Google Chrome, Chromium, Firefox, LibreOffice, Update Manager, VLC, Multimedia codecs, Thunderbird, LookSwitcher, NVIDIA drivers, Network Manager, Skype, GParted, Wine, Blueman, X2Go server, X2Go Client, and Virtualbox additions. + +![][16]Q4OS Software Centre + +If you want to install anything else, you need to either use the command line or the [synaptic package manager][17]. Synaptic is a very good package manager and has been very serviceable for many years, but it isn’t quite newbie friendly. + +If you install an application from the Software Centre, you are treated to an installer that looks a lot like a Windows installer. I can only imagine that this is for people converting to Linux from Windows. + +![][18]Firefox installer + +As I mentioned earlier, when you boot into Q4OS’ desktop for the first time it looks like something out of the 1990s. Thankfully, you can install a utility named LookSwitcher to install a different theme. Initially, you are only shown half a dozen themes. There are other themes that are considered works-in-progress. You can also enhance the default theme by picking a more vibrant background and making the bottom panel transparent. + +![][19]Q4OS using the Debonair theme + +### Final Thoughts on Q4OS + +I may have mentioned a few times in this review that Q4OS looks like a dated version of Windows. It is obviously a very conscious decision because great care was taken to make even the control panel and file manager look Windows-eque. The problem is that it reminds me more of [ReactOS][20] than something modern. The Q4OS website says that it is made using the latest technology. The look of the system disagrees and will probably put some new users off. + +The fact that the install ISOs are smaller than most means that they are very quick to download. Unfortunately, it also means that if you want to be productive, you’ll have to spend quite a bit of time downloading software, either manually or automatically. You’ll also need an active internet connection. There is a reason why most ISOs are several gigabytes. + +I made sure to test the Windows installer. I installed a test copy of Windows 10 and ran the Q4OS installer. The process took a few minutes because the installer, which is less than 10 MB had to download an ISO. When the process was done, I rebooted. I selected Q4OS from the menu, but it looked like I was booting into Windows 10 (got the big blue circle). I thought that the install failed, but I eventually got to Q4OS. + +One of the few things that I liked about Q4OS was how easy it was to install the NVIDIA drivers. After I logged in for the first time, a little pop-up told me that there were NVIDIA drivers available and asked me if I wanted to install them. + +Using Q4OS was definitely an interesting experience, especially using TDE for the first time and the Windows look and feel. However, the lack of apps in the Software Centre and some of the design choices stop me from recommending this distro. + +**Do you like Q4OS?** + +Have you ever used Q4OS? What is your favorite Debian-based distro? 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][21]. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/q4os-linux-review + +作者:[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://itsfoss.com/windows-like-linux-distributions/ +[2]: https://q4os.org/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os1.jpg?resize=800%2C500&ssl=1 +[4]: https://www.debian.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os4.jpg?resize=800%2C412&ssl=1 +[6]: https://www.trinitydesktop.org/ +[7]: https://en.wikipedia.org/wiki/KDE +[8]: https://en.wikipedia.org/wiki/MATE_(software +[9]: https://q4os.org/downloads1.html +[10]: https://itsfoss.com/lightweight-linux-beginners/ +[11]: https://itsfoss.com/list-installed-packages-ubuntu/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os-windows-installer.jpg?resize=800%2C610&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os2.jpg?resize=800%2C606&ssl=1 +[14]: https://itsfoss.com/install-chrome-ubuntu/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os10.png?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os3.jpg?resize=800%2C507&ssl=1 +[17]: https://www.nongnu.org/synaptic/ +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os5.jpg?resize=800%2C616&ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os8Debonaire.jpg?resize=800%2C500&ssl=1 +[20]: https://www.reactos.org/ +[21]: http://reddit.com/r/linuxusersgroup +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os1.jpg?fit=800%2C500&ssl=1 From 9e07df4c063d4d5e667428c29df89ac97967c317 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:37:11 +0800 Subject: [PATCH 350/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Bash-I?= =?UTF-8?q?nsulter=20:=20A=20Script=20That=20Insults=20An=20User=20When=20?= =?UTF-8?q?Typing=20A=20Wrong=20Command=20sources/tech/20190221=20Bash-Ins?= =?UTF-8?q?ulter=20-=20A=20Script=20That=20Insults=20An=20User=20When=20Ty?= =?UTF-8?q?ping=20A=20Wrong=20Command.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lts An User When Typing A Wrong Command.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md diff --git a/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md b/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md new file mode 100644 index 0000000000..bd81a843ac --- /dev/null +++ b/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash-Insulter : A Script That Insults An User When Typing A Wrong Command) +[#]: via: (https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash-Insulter : A Script That Insults An User When Typing A Wrong Command +====== + +This is such a nice and funny script that insult an user whenever they are typing a wrong command in terminal. + +It’s make you to feel happy when you are working on some issues. + +But somebody feel bad when the get an insult. However, i really feel happy when i get an insulted on terminal. + +It’s a funny CLI tool that insults you with random phrases if you do mistake. + +Also, it allows you to update your own phrases. + +### How To Install Bash-Insulter In Linux? + +Make sure, git package were installed on your system before performing Bash-Insulter installation. If no, use the following command to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install git. + +``` +$ sudo dnf install git +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install git. + +``` +$ sudo apt install git +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install git. + +``` +$ sudo pacman -S git +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install git. + +``` +$ sudo yum install git +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install git. + +``` +$ sudo zypper install git +``` + +We can easily install it by cloning the developer github repository. + +First clone the Bash-insulter repository. + +``` +$ git clone https://github.com/hkbakke/bash-insulter.git bash-insulter +``` + +Move the downloaded file under `/etc` folder. + +``` +$ sudo cp bash-insulter/src/bash.command-not-found /etc/ +``` + +Append the following lines into `/etc/bash.bashrc` file. + +``` +$ vi /etc/bash.bashrc + +#Bash Insulter +if [ -f /etc/bash.command-not-found ]; then + . /etc/bash.command-not-found +fi +``` + +Run the following command to take the changes to effect. + +``` +$ sudo source /etc/bash.bashrc +``` + +Do you want to test this? if so, type some wrong command in terminal and see how it insult you. + +``` +$ unam -a + +$ pin 2daygeek.com +``` + +![][8] + +If you would like to append your own phrases then navigate to the following file and update it. + +You can add your phrases within `messages` section. + +``` +# vi /etc/bash.command-not-found + +print_message () { + + local messages + local message + + messages=( + "Boooo!" + "Don't you know anything?" + "RTFM!" + "Haha, n00b!" + "Wow! That was impressively wrong!" + "Pathetic" + "The worst one today!" + "n00b alert!" + "Your application for reduced salary has been sent!" + "lol" + "u suk" + "lol... plz" + "plz uninstall" + "And the Darwin Award goes to.... ${USER}!" + "ERROR_INCOMPETENT_USER" + "Incompetence is also a form of competence" + "Bad." + "Fake it till you make it!" + "What is this...? Amateur hour!?" + "Come on! You can do it!" + "Nice try." + "What if... you type an actual command the next time!" + "What if I told you... it is possible to type valid commands." + "Y u no speak computer???" + "This is not Windows" + "Perhaps you should leave the command line alone..." + "Please step away from the keyboard!" + "error code: 1D10T" + "ACHTUNG! ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS! DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKEN. IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HÄNDER IN DAS POCKETS MUSS. ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN." + "Pro tip: type a valid command!" + "Go outside." + "This is not a search engine." + "(╯°□°)╯︵ ┻━┻" + "¯\_(ツ)_/¯" + "So, I'm just going to go ahead and run rm -rf / for you." + "Why are you so stupid?!" + "Perhaps computers is not for you..." + "Why are you doing this to me?!" + "Don't you have anything better to do?!" + "I am _seriously_ considering 'rm -rf /'-ing myself..." + "This is why you get to see your children only once a month." + "This is why nobody likes you." + "Are you even trying?!" + "Try using your brain the next time!" + "My keyboard is not a touch screen!" + "Commands, random gibberish, who cares!" + "Typing incorrect commands, eh?" + "Are you always this stupid or are you making a special effort today?!" + "Dropped on your head as a baby, eh?" + "Brains aren't everything. In your case they're nothing." + "I don't know what makes you so stupid, but it really works." + "You are not as bad as people say, you are much, much worse." + "Two wrongs don't make a right, take your parents as an example." + "You must have been born on a highway because that's where most accidents happen." + "If what you don't know can't hurt you, you're invulnerable." + "If ignorance is bliss, you must be the happiest person on earth." + "You're proof that god has a sense of humor." + "Keep trying, someday you'll do something intelligent!" + "If shit was music, you'd be an orchestra." + "How many times do I have to flush before you go away?" + ) +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/ + +作者:[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/dnf-command-examples-manage-packages-fedora-system/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[7]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[8]: https://www.2daygeek.com/wp-content/uploads/2019/02/bash-insulter-insults-the-user-when-typing-wrong-command-1.png From ef44c05d1d4310c3e9817c22bcb613375d80738d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:40:15 +0800 Subject: [PATCH 351/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Testin?= =?UTF-8?q?g=20Bash=20with=20BATS=20sources/tech/20190221=20Testing=20Bash?= =?UTF-8?q?=20with=20BATS.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190221 Testing Bash with BATS.md | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 sources/tech/20190221 Testing Bash with BATS.md diff --git a/sources/tech/20190221 Testing Bash with BATS.md b/sources/tech/20190221 Testing Bash with BATS.md new file mode 100644 index 0000000000..16c65b2670 --- /dev/null +++ b/sources/tech/20190221 Testing Bash with BATS.md @@ -0,0 +1,265 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Testing Bash with BATS) +[#]: via: (https://opensource.com/article/19/2/testing-bash-bats) +[#]: author: (Darin London https://opensource.com/users/dmlond) + +Testing Bash with BATS +====== +The Bash Automated Testing System puts Bash code through the same types of testing processes used by Java, Ruby, and Python developers. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf) + +Software developers writing applications in languages such as Java, Ruby, and Python have sophisticated libraries to help them maintain their software's integrity over time. They create tests that run applications through a series of executions in structured environments to ensure all of their software's aspects work as expected. + +These tests are even more powerful when they're automated in a continuous integration (CI) system, where every push to the source repository causes the tests to run, and developers are immediately notified when tests fail. This fast feedback increases developers' confidence in the functional integrity of their applications. + +The Bash Automated Testing System ([BATS][1]) enables developers writing Bash scripts and libraries to apply the same practices used by Java, Ruby, Python, and other developers to their Bash code. + +### Installing BATS + +The BATS GitHub page includes installation instructions. There are two BATS helper libraries that provide more powerful assertions or allow overrides to the Test Anything Protocol ([TAP][2]) output format used by BATS. These can be installed in a standard location and sourced by all scripts. It may be more convenient to include a complete version of BATS and its helper libraries in the Git repository for each set of scripts or libraries being tested. This can be accomplished using the **[git submodule][3]** system. + +The following commands will install BATS and its helper libraries into the **test** directory in a Git repository. + +``` +git submodule init +git submodule add https://github.com/sstephenson/bats test/libs/bats +git submodule add https://github.com/ztombol/bats-assert test/libs/bats-assert +git submodule add https://github.com/ztombol/bats-support test/libs/bats-support +git add . +git commit -m 'installed bats' +``` + +To clone a Git repository and install its submodules at the same time, use the +**\--recurse-submodules** flag to **git clone**. + +Each BATS test script must be executed by the **bats** executable. If you installed BATS into your source code repo's **test/libs** directory, you can invoke the test with: + +``` +./test/libs/bats/bin/bats +``` + +Alternatively, add the following to the beginning of each of your BATS test scripts: + +``` +#!/usr/bin/env ./test/libs/bats/bin/bats +load 'libs/bats-support/load' +load 'libs/bats-assert/load' +``` + +and **chmod +x **. This will a) make them executable with the BATS installed in **./test/libs/bats** and b) include these helper libraries. BATS test scripts are typically stored in the **test** directory and named for the script being tested, but with the **.bats** extension. For example, a BATS script that tests **bin/build** should be called **test/build.bats**. + +You can also run an entire set of BATS test files by passing a regular expression to BATS, e.g., **./test/lib/bats/bin/bats test/*.bats**. + +### Organizing libraries and scripts for BATS coverage + +Bash scripts and libraries must be organized in a way that efficiently exposes their inner workings to BATS. In general, library functions and shell scripts that run many commands when they are called or executed are not amenable to efficient BATS testing. + +For example, [build.sh][4] is a typical script that many people write. It is essentially a big pile of code. Some might even put this pile of code in a function in a library. But it's impossible to run a big pile of code in a BATS test and cover all possible types of failures it can encounter in separate test cases. The only way to test this pile of code with sufficient coverage is to break it into many small, reusable, and, most importantly, independently testable functions. + +It's straightforward to add more functions to a library. An added benefit is that some of these functions can become surprisingly useful in their own right. Once you have broken your library function into lots of smaller functions, you can **source** the library in your BATS test and run the functions as you would any other command to test them. + +Bash scripts must also be broken down into multiple functions, which the main part of the script should call when the script is executed. In addition, there is a very useful trick to make it much easier to test Bash scripts with BATS: Take all the code that is executed in the main part of the script and move it into a function, called something like **run_main**. Then, add the following to the end of the script: + +``` +if [[ "${BASH_SOURCE[0]}" == "${0}" ]] +then +  run_main +fi +``` + +This bit of extra code does something special. It makes the script behave differently when it is executed as a script than when it is brought into the environment with **source**. This trick enables the script to be tested the same way a library is tested, by sourcing it and testing the individual functions. For example, here is [build.sh refactored for better BATS testability][5]. + +### Writing and running tests + +As mentioned above, BATS is a TAP-compliant testing framework with a syntax and output that will be familiar to those who have used other TAP-compliant testing suites, such as JUnit, RSpec, or Jest. Its tests are organized into individual test scripts. Test scripts are organized into one or more descriptive **@test** blocks that describe the unit of the application being tested. Each **@test** block will run a series of commands that prepares the test environment, runs the command to be tested, and makes assertions about the exit and output of the tested command. Many assertion functions are imported with the **bats** , **bats-assert** , and **bats-support** libraries, which are loaded into the environment at the beginning of the BATS test script. Here is a typical BATS test block: + +``` +@test "requires CI_COMMIT_REF_SLUG environment variable" { +  unset CI_COMMIT_REF_SLUG +  assert_empty "${CI_COMMIT_REF_SLUG}" +  run some_command +  assert_failure +  assert_output --partial "CI_COMMIT_REF_SLUG" +} +``` + +If a BATS script includes **setup** and/or **teardown** functions, they are automatically executed by BATS before and after each test block runs. This makes it possible to create environment variables, test files, and do other things needed by one or all tests, then tear them down after each test runs. [**Build.bats**][6] is a full BATS test of our newly formatted **build.sh** script. (The **mock_docker** command in this test will be explained below, in the section on mocking/stubbing.) + +When the test script runs, BATS uses **exec** to run each **@test** block as a separate subprocess. This makes it possible to export environment variables and even functions in one **@test** without affecting other **@test** s or polluting your current shell session. The output of a test run is a standard format that can be understood by humans and parsed or manipulated programmatically by TAP consumers. Here is an example of the output for the **CI_COMMIT_REF_SLUG** test block when it fails: + +``` + ✗ requires CI_COMMIT_REF_SLUG environment variable +   (from function `assert_output' in file test/libs/bats-assert/src/assert.bash, line 231, +    in test file test/ci_deploy.bats, line 26) +     `assert_output --partial "CI_COMMIT_REF_SLUG"' failed + +   -- output does not contain substring -- +   substring (1 lines): +     CI_COMMIT_REF_SLUG +   output (3 lines): +     ./bin/deploy.sh: join_string_by: command not found +     oc error +     Could not login +   -- + +   ** Did not delete , as test failed ** + +1 test, 1 failure +``` + +Here is the output of a successful test: + +``` +✓ requires CI_COMMIT_REF_SLUG environment variable +``` + +### Helpers + +Like any shell script or library, BATS test scripts can include helper libraries to share common code across tests or enhance their capabilities. These helper libraries, such as **bats-assert** and **bats-support** , can even be tested with BATS. + +Libraries can be placed in the same test directory as the BATS scripts or in the **test/libs** directory if the number of files in the test directory gets unwieldy. BATS provides the **load** function that takes a path to a Bash file relative to the script being tested (e.g., **test** , in our case) and sources that file. Files must end with the prefix **.bash** , but the path to the file passed to the **load** function can't include the prefix. **build.bats** loads the **bats-assert** and **bats-support** libraries, a small **[helpers.bash][7]** library, and a **docker_mock.bash** library (described below) with the following code placed at the beginning of the test script below the interpreter magic line: + +``` +load 'libs/bats-support/load' +load 'libs/bats-assert/load' +load 'helpers' +load 'docker_mock' +``` + +### Stubbing test input and mocking external calls + +The majority of Bash scripts and libraries execute functions and/or executables when they run. Often they are programmed to behave in specific ways based on the exit status or output ( **stdout** , **stderr** ) of these functions or executables. To properly test these scripts, it is often necessary to make fake versions of these commands that are designed to behave in a specific way during a specific test, a process called "stubbing." It may also be necessary to spy on the program being tested to ensure it calls a specific command, or it calls a specific command with specific arguments, a process called "mocking." For more on this, check out this great [discussion of mocking and stubbing][8] in Ruby RSpec, which applies to any testing system. + +The Bash shell provides tricks that can be used in your BATS test scripts to do mocking and stubbing. All require the use of the Bash **export** command with the **-f** flag to export a function that overrides the original function or executable. This must be done before the tested program is executed. Here is a simple example that overrides the **cat** executable: + +``` +function cat() { echo "THIS WOULD CAT ${*}" } +export -f cat +``` + +This method overrides a function in the same manner. If a test needs to override a function within the script or library being tested, it is important to source the tested script or library before the function is stubbed or mocked. Otherwise, the stub/mock will be replaced with the actual function when the script is sourced. Also, make sure to stub/mock before you run the command you're testing. Here is an example from **build.bats** that mocks the **raise** function described in **build.sh** to ensure a specific error message is raised by the login fuction: + +``` +@test ".login raises on oc error" { +  source ${profile_script} +  function raise() { echo "${1} raised"; } +  export -f raise +  run login +  assert_failure +  assert_output -p "Could not login raised" +} +``` + +Normally, it is not necessary to unset a stub/mock function after the test, since **export** only affects the current subprocess during the **exec** of the current **@test** block. However, it is possible to mock/stub commands (e.g. **cat** , **sed** , etc.) that the BATS **assert** * functions use internally. These mock/stub functions must be **unset** before these assert commands are run, or they will not work properly. Here is an example from **build.bats** that mocks **sed** , runs the **build_deployable** function, and unsets **sed** before running any assertions: + +``` +@test ".build_deployable prints information, runs docker build on a modified Dockerfile.production and publish_image when its not a dry_run" { +  local expected_dockerfile='Dockerfile.production' +  local application='application' +  local environment='environment' +  local expected_original_base_image="${application}" +  local expected_candidate_image="${application}-candidate:${environment}" +  local expected_deployable_image="${application}:${environment}" +  source ${profile_script} +  mock_docker build --build-arg OAUTH_CLIENT_ID --build-arg OAUTH_REDIRECT --build-arg DDS_API_BASE_URL -t "${expected_deployable_image}" - +  function publish_image() { echo "publish_image ${*}"; } +  export -f publish_image +  function sed() { +    echo "sed ${*}" >&2; +    echo "FROM application-candidate:environment"; +  } +  export -f sed +  run build_deployable "${application}" "${environment}" +  assert_success +  unset sed +  assert_output --regexp "sed.*${expected_dockerfile}" +  assert_output -p "Building ${expected_original_base_image} deployable ${expected_deployable_image} FROM ${expected_candidate_image}" +  assert_output -p "FROM ${expected_candidate_image} piped" +  assert_output -p "build --build-arg OAUTH_CLIENT_ID --build-arg OAUTH_REDIRECT --build-arg DDS_API_BASE_URL -t ${expected_deployable_image} -" +  assert_output -p "publish_image ${expected_deployable_image}" +} +``` + +Sometimes the same command, e.g. foo, will be invoked multiple times, with different arguments, in the same function being tested. These situations require the creation of a set of functions: + + * mock_foo: takes expected arguments as input, and persists these to a TMP file + * foo: the mocked version of the command, which processes each call with the persisted list of expected arguments. This must be exported with export -f. + * cleanup_foo: removes the TMP file, for use in teardown functions. This can test to ensure that a @test block was successful before removing. + + + +Since this functionality is often reused in different tests, it makes sense to create a helper library that can be loaded like other libraries. + +A good example is **[docker_mock.bash][9]**. It is loaded into **build.bats** and used in any test block that tests a function that calls the Docker executable. A typical test block using **docker_mock** looks like: + +``` +@test ".publish_image fails if docker push fails" { +  setup_publish +  local expected_image="image" +  local expected_publishable_image="${CI_REGISTRY_IMAGE}/${expected_image}" +  source ${profile_script} +  mock_docker tag "${expected_image}" "${expected_publishable_image}" +  mock_docker push "${expected_publishable_image}" and_fail +  run publish_image "${expected_image}" +  assert_failure +  assert_output -p "tagging ${expected_image} as ${expected_publishable_image}" +  assert_output -p "tag ${expected_image} ${expected_publishable_image}" +  assert_output -p "pushing image to gitlab registry" +  assert_output -p "push ${expected_publishable_image}" +} +``` + +This test sets up an expectation that Docker will be called twice with different arguments. With the second call to Docker failing, it runs the tested command, then tests the exit status and expected calls to Docker. + +One aspect of BATS introduced by **mock_docker.bash** is the **${BATS_TMPDIR}** environment variable, which BATS sets at the beginning to allow tests and helpers to create and destroy TMP files in a standard location. The **mock_docker.bash** library will not delete its persisted mocks file if a test fails, but it will print where it is located so it can be viewed and deleted. You may need to periodically clean old mock files out of this directory. + +One note of caution regarding mocking/stubbing: The **build.bats** test consciously violates a dictum of testing that states: [Don't mock what you don't own!][10] This dictum demands that calls to commands that the test's developer didn't write, like **docker** , **cat** , **sed** , etc., should be wrapped in their own libraries, which should be mocked in tests of scripts that use them. The wrapper libraries should then be tested without mocking the external commands. + +This is good advice and ignoring it comes with a cost. If the Docker CLI API changes, the test scripts will not detect this change, resulting in a false positive that won't manifest until the tested **build.sh** script runs in a production setting with the new version of Docker. Test developers must decide how stringently they want to adhere to this standard, but they should understand the tradeoffs involved with their decision. + +### Conclusion + +Introducing a testing regime to any software development project creates a tradeoff between a) the increase in time and organization required to develop and maintain code and tests and b) the increased confidence developers have in the integrity of the application over its lifetime. Testing regimes may not be appropriate for all scripts and libraries. + +In general, scripts and libraries that meet one or more of the following should be tested with BATS: + + * They are worthy of being stored in source control + * They are used in critical processes and relied upon to run consistently for a long period of time + * They need to be modified periodically to add/remove/modify their function + * They are used by others + + + +Once the decision is made to apply a testing discipline to one or more Bash scripts or libraries, BATS provides the comprehensive testing features that are available in other software development environments. + +Acknowledgment: I am indebted to [Darrin Mann][11] for introducing me to BATS testing. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/testing-bash-bats + +作者:[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://github.com/sstephenson/bats +[2]: http://testanything.org/ +[3]: https://git-scm.com/book/en/v2/Git-Tools-Submodules +[4]: https://github.com/dmlond/how_to_bats/blob/preBats/build.sh +[5]: https://github.com/dmlond/how_to_bats/blob/master/bin/build.sh +[6]: https://github.com/dmlond/how_to_bats/blob/master/test/build.bats +[7]: https://github.com/dmlond/how_to_bats/blob/master/test/helpers.bash +[8]: https://www.codewithjason.com/rspec-mocks-stubs-plain-english/ +[9]: https://github.com/dmlond/how_to_bats/blob/master/test/docker_mock.bash +[10]: https://github.com/testdouble/contributing-tests/wiki/Don't-mock-what-you-don't-own +[11]: https://github.com/dmann From 23994a367392a64a00b257dcfd9eb3fc3bab761a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:45:16 +0800 Subject: [PATCH 352/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=204=20se?= =?UTF-8?q?crets=20management=20tools=20for=20Git=20encryption=20sources/t?= =?UTF-8?q?ech/20190219=204=20secrets=20management=20tools=20for=20Git=20e?= =?UTF-8?q?ncryption.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ets management tools for Git encryption.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20190219 4 secrets management tools for Git encryption.md diff --git a/sources/tech/20190219 4 secrets management tools for Git encryption.md b/sources/tech/20190219 4 secrets management tools for Git encryption.md new file mode 100644 index 0000000000..303bc0ef87 --- /dev/null +++ b/sources/tech/20190219 4 secrets management tools for Git encryption.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 secrets management tools for Git encryption) +[#]: via: (https://opensource.com/article/19/2/secrets-management-tools-git) +[#]: author: (Austin Dewey https://opensource.com/users/adewey) + +4 secrets management tools for Git encryption +====== +See how Git-crypt, BlackBox, SOPS, and Transcrypt stack up for storing secrets in Git. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko) + +There are a lot of great open source tools out there for storing secrets in Git. It can be hard to determine the right one for you and your organization—it depends on your use cases and requirements. To help you compare and choose, we'll look at four of the most popular open source tools for secrets management and see how they stack up against each other: + ++ [Git-crypt](https://github.com/AGWA/git-crypt) ++ [BlackBox](https://github.com/StackExchange/blackbox) ++ [SOPS](https://github.com/mozilla/sops) ++ [Transcrypt](https://github.com/elasticdog/transcrypt) + + +We won't review larger solutions like HashiCorp Vault. A production-ready Vault can be a rather large hurdle, especially if your organization is just getting started with secrets management. The tools above are easy to use and set up quickly. + +### Encryption types + +These secrets management tools use GNU Privacy Guard ([GPG][1]), symmetric key encryption, and/or cloud key services. + + * GPG-based tools require users to create a GPG keypair. The public key is used to encrypt and is shared with other users, while the private key is used to decrypt and is known by only one user. + * Symmetric key tools are password-based and work when given the correct password. + * Cloud key services—Amazon Key Management Service (KMS), Google Cloud KMS, and Azure Key Vault-based tools—allow integration with services from cloud providers. + + + +The encryption types these secrets management tools use are: +| | GPG | Symmetric key | Amazon KMS | Google KMS | Azure Key Vault | +| Git-crypt | X | X | | | | +| BlackBox | X | | | | | +| SOPS | X | | X | X | X | +| Transcrypt | | X | | | | + +As you can see, Git-crypt and SOPS use more than one encryption basis. This means Git-crypt can achieve encryption by using GPG OR a symmetric key, and SOPS can use GPG OR one of the cloud services. + +### Goals + +These tools have similar goals: + +| | Transparency with Git | Whole-file encryption | Partial-file encryption | +| Git-crypt | X | X | | +| BlackBox | X | X | | +| SOPS | | X | X | +| Transcrypt | X | X | | + +All but SOPS are transparent with Git, which means they have built-in mechanisms to ensure that files in source control are encrypted without much effort from users. They help prevent a **git push** from accidentally pushing plaintext secrets to Git. + +At this point, you might be wondering, "Why is SOPS here if it doesn't encrypt transparently with Git? Isn't this a post about Git encryption tools?" The reason is because of how it handles key-value-based files, such as YAML and JSON. When encrypting these types of files, SOPS will leave the keys unencrypted but will encrypt the values. There are often cases, especially in configuration management, where these types of files need to be encrypted in Git, but it would also be convenient to see what kind of information they contain. While SOPS does not provide native Git transparency, tools like [git-secrets][2] can be used alongside SOPS to help ensure plaintext secrets are not pushed to Git. + +Finally, all of these tools support whole-file encryption, in which secrets files are encrypted in their entirety. + +### Workflows and differences + +None of these tools are particularly difficult to use, but they all have quirks and operational challenges to consider. + +#### GPG + +The basic workflow for a GPG-based tool is: + + 1. Initialize the repository with the encryption tool + 2. Create GPG keys for users that are allowed to manage secret files + 3. Add the corresponding public keys to the tool + 4. Designate the files that should be treated as "secret" + 5. Encrypt the files using the tool + 6. Repeat steps 2, 3, and 5 for each new user that is granted permission + 7. To revoke a user, remove the user and repeat step 5 + + + +In theory, this workflow is simple. One operational issue is GPG key maintenance. Your team will need to back up its GPG keys to prevent a lock-out scenario if GPG keys are accidentally deleted. If you are using the tool for automation, you will also need to consider who will be responsible for creating and maintaining keys for that service. Additionally, if you need to add, remove, or rotate a key, you'll need to re-encrypt each file for the changes to take effect. + +Advantages and disadvantages of the GPG-based tools include: + + * Git-crypt cannot remove GPG users natively, which means step 7 above is not easy to do. There are workarounds available, but it's not a built-in feature. + * Git-crypt will transparently perform step 5 above on a **git push** —even when new users are added. + * BlackBox provides a **blackbox_update_all_files** command, which can perform step 5 by re-encrypting all secret files in one command. This comes in handy in key rotation and adding/removing GPG keys, where all files need to be re-encrypted. + * SOPS makes key rotation and adding/removing GPG keys the most difficult, as it requires each file to be manually re-encrypted. + * BlackBox has a **blackbox_list_admins** command that returns the email address that corresponds with registered users' GPG keys. This makes it easier to discern who has access to the secrets versus trying to map plain GPG fingerprints. + + + +#### Cloud key services + +Here is a sample workflow using SOPS with Amazon KMS: + + 1. Create identity and access management (IAM) entities + 2. Create KMS master key + 3. Grant IAM entities access to the master key + 4. Add the master key to each secret file with SOPS and encrypt the file (adding keys and encrypting is usually a one-step process with SOPS) + 5. Re-encrypt when adding or removing master keys + + + +Of these four tools, SOPS is the only one that allows users to configure encryption with a cloud-based key service. Cloud key services ease much of the operational burden that GPG-based solutions carry. Take Amazon KMS, for example: The master key is added to SOPS and access to secret files is controlled through IAM policies. Adding and removing users is as simple as granting or revoking permission with IAM, meaning secret files do not need to be re-encrypted when changing permissions, since nothing changed from SOPS's perspective. This solution does have its own set of operational challenges, however. Each member of the team must have an AWS account before they can access secret files. Also, admins must configure and maintain the IAM policies and KMS master key(s). + +#### Symmetric key encryption + +The workflow for symmetric key-based tools is probably the simplest: + + 1. Initialize the repository with the encryption tool + 2. Designate files that should be treated as "secret" + 3. **git push** to transparently encrypt the files + 4. Share the symmetric key with other users who need access + 5. Rotate the key each time a user is revoked access + + + +Git-crypt and Transcrypt both provide a complex password as the symmetric key. The operational challenges are to find a secure way to share the symmetric key and to be sure to rotate the key each time a user is removed. + +Here are a few differences between Git-crypt and Transcrypt, our symmetric key-compatible tools: + + * Git-crypt is compatible with both GPG and symmetric key encryption + * Git-crypt doesn't support symmetric key rotation, so you can't complete step 5 if you use it with a symmetric key + * Transcrypt provides a convenient **\--rekey** command for key rotation + + + +### Other features + +Other features and characteristics of the tools include: + +| | Editor-in-place | Auditing | Repo-level permission | File-level permission | +| Git-crypt | | | X | | +| BlackBox | X | | X | | +| SOPS | X | X | | X | +| Transcrypt | | | X | | + +Both BlackBox and SOPS feature an "editor-in-place" tool, which decrypts the file and opens a text editor specified by the **$EDITOR** environment variable. This enables the user to make in-place edits to the file before it is saved and re-encrypted, so users can modify secret files without requiring them to be "decrypted in place" first. + +SOPS is the only tool that provides an auditing feature. This feature tracks and monitors SOPS usage by forwarding events to a database. It requires a certain amount of setup, so check out SOPS's [README][3] for more information. + +Git-crypt, BlackBox, and Transcrypt handle access at the repo level, meaning that if you can view one decrypted file, you can view them all. Depending on your use case, this is either a feature or a misfeature. SOPS handles permissions at the file level, meaning just because users can view one file, they can't necessarily view other files in the repo. + +### For more information + +Hopefully, this high-level overview of four open source secrets management tools will help you make an educated decision about the right tool for you. For more information on the tools, please check out their GitHub pages (linked at the top of this article). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/secrets-management-tools-git + +作者:[Austin 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/adewey +[b]: https://github.com/lujun9972 +[1]: https://www.gnupg.org/ +[2]: https://github.com/awslabs/git-secrets +[3]: https://github.com/mozilla/sops/blob/master/README.rst#auditing From f6d19bbff127bd1591ea3c47682b738fa8aa1f7a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:56:57 +0800 Subject: [PATCH 353/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Do=20L?= =?UTF-8?q?inux=20distributions=20still=20matter=20with=20containers=3F=20?= =?UTF-8?q?sources/talk/20190220=20Do=20Linux=20distributions=20still=20ma?= =?UTF-8?q?tter=20with=20containers.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tributions still matter with containers.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/talk/20190220 Do Linux distributions still matter with containers.md diff --git a/sources/talk/20190220 Do Linux distributions still matter with containers.md b/sources/talk/20190220 Do Linux distributions still matter with containers.md new file mode 100644 index 0000000000..c1c7886d0d --- /dev/null +++ b/sources/talk/20190220 Do Linux distributions still matter with containers.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Do Linux distributions still matter with containers?) +[#]: via: (https://opensource.com/article/19/2/linux-distributions-still-matter-containers) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +Do Linux distributions still matter with containers? +====== +There are two major trends in container builds: using a base image and building from scratch. Each has engineering tradeoffs. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ) + +Some people say Linux distributions no longer matter with containers. Alternative approaches, like distroless and scratch containers, seem to be all the rage. It appears we are considering and making technology decisions based more on fashion sense and immediate emotional gratification than thinking through the secondary effects of our choices. We should be asking questions like: How will these choices affect maintenance six months down the road? What are the engineering tradeoffs? How does this paradigm shift affect our build systems at scale? + +It's frustrating to watch. If we forget that engineering is a zero-sum game with measurable tradeoffs—advantages and disadvantages, with costs and benefits of different approaches— we do ourselves a disservice, we do our employers a disservice, and we do our colleagues who will eventually maintain our code a disservice. Finally, we do all of the maintainers ([hail the maintainers!][1]) a disservice by not appreciating the work they do. + +### Understanding the problem + +To understand the problem, we have to investigate why we started using Linux distributions in the first place. I would group the reasons into two major buckets: kernels and other packages. Compiling kernels is actually fairly easy. Slackware and Gentoo (I still have a soft spot in my heart) taught us that. + +On the other hand, the tremendous amount of development and runtime software that needs to be packaged for a usable Linux system can be daunting. Furthermore, the only way you can ensure that millions of permutations of packages can be installed and work together is by using the old paradigm: compile it and ship it together as a thing (i.e., a Linux distribution). So, why do Linux distributions compile kernels and all the packages together? Simple: to make sure things work together. + +First, let's talk about kernels. The kernel is special. Booting a Linux system without a compiled kernel is a bit of a challenge. It's the core of a Linux operating system, and it's the first thing we rely on when a system boots. Kernels have a lot of different configuration options when they're being compiled that can have a tremendous effect on how hardware and software run on one. A secondary problem in this bucket is that system software, like compilers, C libraries, and interpreters, must be tuned for the options you built into the kernel. Gentoo taught us this in a visceral way, which turned everyone into a miniature distribution maintainer. + +Embarrassingly (because I have worked with containers for the last five years), I must admit that I have compiled kernels quite recently. I had to get nested KVM working on RHEL 7 so that I could run [OpenShift on OpenStack][2] virtual machines, in a KVM virtual machine on my laptop, as well as [our Container Development Kit (CDK][3]). #justsayin Suffice to say, I fired RHEL7 up on a brand new 4.X kernel at the time. Like any good sysadmin, I was a little worried that I missed some important configuration options and patches. And, of course, I had missed some things. Sleep mode stopped working right, my docking station stopped working right, and there were numerous other small, random errors. But it did work well enough for a live demo of OpenShift on OpenStack, in a single KVM virtual machine on my laptop. Come on, that's kinda' fun, right? But I digress… + +Now, let's talk about all the other packages. While the kernel and associated system software can be tricky to compile, the much, much bigger problem from a workload perspective is compiling thousands and thousands of packages to give us a useable Linux system. Each package requires subject matter expertise. Some pieces of software require running only three commands: **./configure** , **make** , and **make install**. Others require a lot of subject matter expertise ranging from adding users and configuring specific defaults in **etc** to running post-install scripts and adding systemd unit files. The set of skills necessary for the thousands of different pieces of software you might use is daunting for any single person. But, if you want a usable system with the ability to try new software whenever you want, you have to learn how to compile and install the new software before you can even begin to learn to use it. That's Linux without a Linux distribution. That's the engineering problem you are agreeing to when you forgo a Linux distribution. + +The point is that you have to build everything together to ensure it works together with any sane level of reliability, and it takes a ton of knowledge to build a usable cohort of packages. This is more knowledge than any single developer or sysadmin is ever going to reasonably learn and retain. Every problem I described applies to your [container host][4] (kernel and system software) and [container image][5] (system software and all other packages)—notice the overlap; there are compilers, C libraries, interpreters, and JVMs in the container image, too. + +### The solution + +You already know this, but Linux distributions are the solution. Stop reading and send your nearest package maintainer (again, hail the maintainers!) an e-card (wait, did I just give my age away?). Seriously though, these people do a ton of work, and it's really underappreciated. Kubernetes, Istio, Prometheus, and Knative: I am looking at you. Your time is coming too, when you will be in maintenance mode, overused, and underappreciated. I will be writing this same article again, probably about Kubernetes, in about seven to 10 years. + +### First principles with container builds + +There are tradeoffs to building from scratch and building from base images. + +#### Building from base images + +Building from base images has the advantage that most build operations are nothing more than a package install or update. It relies on a ton of work done by package maintainers in a Linux distribution. It also has the advantage that a patching event six months—or even 10 years—from now (with RHEL) is an operations/systems administrator event (yum update), not a developer event (that requires picking through code to figure out why some function argument no longer works). + +Let's double-click on that a bit. Application code relies on a lot of libraries ranging from JSON munging libraries to object-relational mappers. Unlike the Linux kernel and Glibc, these types of libraries change with very little regard to breaking API compatibility. That means that three years from now your patching event likely becomes a code-changing event, not a yum update event. Got it, let that sink in. Developers, you are getting paged at 2 AM if the security team can't find a firewall hack to block the exploit. + +Building from a base image is not perfect; there are disadvantages, like the size of all the dependencies that get dragged in. This will almost always make your container images larger than building from scratch. Another disadvantage is you will not always have access to the latest upstream code. This can be frustrating for developers, especially when you just want to get something out the door, but not as frustrating as being paged to look at a library you haven't thought about in three years that the upstream maintainers have been changing the whole time. + +If you are a web developer and rolling your eyes at me, I have one word for you: DevOps. That means you are carrying a pager, my friend. + +#### Building from scratch + +Scratch builds have the advantage of being really small. When you don't rely on a Linux distribution in the container, you have a lot of control, which means you can customize everything for your needs. This is a best-of-breed model, and it's valid in certain use cases. Another advantage is you have access to the latest packages. You don't have to wait for a Linux distro to update anything. You are in control, so you choose when to spend the engineering work to incorporate new software. + +Remember, there is a cost to controlling everything. Often, updating to new libraries with new features drags in unwanted API changes, which means fixing incompatibilities in code (in other words, [shaving yaks][6]). Shaving yaks at 2 AM when the application doesn't work is not fun. Luckily, with containers, you can roll back and shave the yaks the next business day, but it will still eat into your time for delivering new value to the business, new features to your applications. Welcome to the life of a sysadmin. + +OK, that said, there are times that building from scratch makes sense. I will completely concede that statically compiled Golang programs and C programs are two decent candidates for scratch/distroless builds. With these types of programs, every container build is a compile event. You still have to worry about API breakage three years from now, but if you are a Golang shop, you should have the skillset to fix things over time. + +### Conclusion + +Basically, Linux distributions do a ton of work to save you time—on a regular Linux system or with containers. The knowledge that maintainers have is tremendous and leveraged so much without really being appreciated. The adoption of containers has made the problem even worse because it's even further abstracted. + +With container hosts, a Linux distribution offers you access to a wide hardware ecosystem, ranging from tiny ARM systems, to giant 128 CPU x86 boxes, to cloud-provider VMs. They offer working container engines and container runtimes out of the box, so you can just fire up your containers and let somebody else worry about making things work. + +For container images, Linux distributions offer you easy access to a ton of software for your projects. Even when you build from scratch, you will likely look at how a package maintainer built and shipped things—a good artist is a good thief—so, don't undervalue this work. + +So, thank you to all of the maintainers in Fedora, RHEL (Frantisek, you are my hero), Debian, Gentoo, and every other Linux distribution. I appreciate the work you do, even though I am a "container guy." + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/linux-distributions-still-matter-containers + +作者:[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://aeon.co/essays/innovation-is-overvalued-maintenance-often-matters-more +[2]: https://blog.openshift.com/openshift-on-openstack-delivering-applications-better-together/ +[3]: https://developers.redhat.com/blog/2018/02/13/red-hat-cdk-nested-kvm/ +[4]: https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.8tyd9p17othl +[5]: https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.dqlu6589ootw +[6]: https://en.wiktionary.org/wiki/yak_shaving From 4a02c9679f17b4af807dffe54b31c201f3be16f6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:59:33 +0800 Subject: [PATCH 354/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Some?= =?UTF-8?q?=20Incredible=20Stories=20Around=20Tux:=20Our=20Lovable=20Linux?= =?UTF-8?q?=20Mascot!=20sources/tech/20190221=20Some=20Incredible=20Storie?= =?UTF-8?q?s=20Around=20Tux-=20Our=20Lovable=20Linux=20Mascot.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...es Around Tux- Our Lovable Linux Mascot.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20190221 Some Incredible Stories Around Tux- Our Lovable Linux Mascot.md diff --git a/sources/tech/20190221 Some Incredible Stories Around Tux- Our Lovable Linux Mascot.md b/sources/tech/20190221 Some Incredible Stories Around Tux- Our Lovable Linux Mascot.md new file mode 100644 index 0000000000..626dae5afe --- /dev/null +++ b/sources/tech/20190221 Some Incredible Stories Around Tux- Our Lovable Linux Mascot.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some Incredible Stories Around Tux: Our Lovable Linux Mascot!) +[#]: via: (https://itsfoss.com/tux-trivia) +[#]: author: (Avimanyu Bandyopadhyay https://itsfoss.com/author/avimanyu/) + +Some Incredible Stories Around Tux: Our Lovable Linux Mascot! +====== + +We’ve all heard about our favorite Linux Mascot! In this Linux trivia series, I’ve scoured every nook and corner of the web I could reach out to, to dig up some old archives to gather some interesting trivia about our cute and friendly penguin, starting from its early days. + +![History of Linux logo][1] + +Chances are you might have already heard about its origins. But in this article exclusively dedicated to Tux, we are jotting down some interesting stories around the cute little fella with some info that might have gone unknown! + +The first discussion about a mascot goes back to the early days of the Linux release, when [Linus Torvalds][2] shared his thoughts about choosing one that would gracefully be the torch-bearer of our beloved OS. That’s when many people dived in to contribute with their suggestions for the same. + +The first email that cites the discussion of bringing in a Mascot goes back to 1996. It started with a hot debate about choosing creatures such as sharks or eagles which stopped the moment Linus mentioned that he was rather fond of penguins! + +``` +Re: Linux Logo prototype. +Linus Torvalds (torvalds@cs.helsinki.fi) +Thu, 9 May 1996 17:48:56 +0300 (EET DST) +. +Somebody had a logo competition announcement, maybe people can send their ideas to a web-site.. +. +Anyway, this one looks like the poor penguin is not really strong enough to hold up the world, and it’s going to get squashed. Not a good, positive logo, in that respect.. +. +Now, when you think about penguins, first take a deep calming breath, and then think “cuddly”. Take another breath, and think “cute”. Go back to “cuddly” for a while (and go on breathing), then think “contented”. +. +With me so far? Good.. +. +Now, with penguins, (cuddly such), “contented” means it has either just gotten laid, or it’s stuffed on herring. Take it from me, I’m an expert on penguins, those are really the only two options. +. +Now, working on that angle, we don’t really want to be associated with a randy penguin (well, we do, but it’s not politic, so we won’t), so we should be looking at the “stuffed to its brim with herring” angle here. +. +So when you think “penguin”, you should be imagining a slighly overweight penguin (*), sitting down after having gorged itself, and having just burped. It’s sitting there with a beatific smile – the world is a good place to be when you have just eaten a few gallons of raw fish and you can feel another “burp” coming. +. +(*) Not FAT, but you should be able to see that it’s sitting down because it’s really too stuffed to stand up. Think “bean bag” here. +. +Now, if you have problems associating yourself with something that gets off by eating raw fish, think “chocolate” or something, but you get the idea. +. +Ok, so we should be thinking of a lovable, cuddly, stuffed penguin sitting down after having gorged itself on herring. Still with me? +. +NOW comes the hard part. With this image firmly etched on your eyeballs, you then scetch a stylizied version of it. Not a lot of detail – just a black brush-type outline (you know the effect you get with a brush where the thickness of the line varies). THAT requires talent. Give people the outline, and they should say [ sickly sweet voice, babytalk almost ]”Ooh, what a cuddly penguin, I bet he is just stuffed with herring”, and small children will jump up and down and scream “mommy mommy, can I have one too?”. +. +Then we can do a larger version with some more detail (maybe leaning against a globe of the world, but I don’t think we really want to give any “macho penguin” image here about Atlas or anything). That more detailed version can spank billy-boy to tears for all I care, or play ice-hockey with the FreeBSD demon. But the simple, single penguin would be the logo, and the others would just be that cuddly penguin being used as an actor in some tableau. +. +Linus +``` + +There have been numerous reports about the origins of Tux on various portals. I could have focused on just the origins but thought rather bring into light some other lesser known facts instead. + +### How was Tux first created? + +Let’s start by discussing the tool with which Tux was designed. Yes, we have already covered it on It’s FOSS earlier. It’s [GIMP][4]! + +Based on discussions on a linux-kernel mailing list about Tux and an initial suggestion by Alan Cox, Larry Ewing used GIMP 0.54 to create the first Tux image! + +The majority of the drawing was done on a 486 DX2/50 running Linux with nothing but a mouse and GIMP. Since it was initially created on an 8-bit display, the final smoothing with GIMP was done on an SGI Crimson. + +Larry drew the image as a black and white outline as we can see below in the first attempt which was later colorized in a series of steps: + +![][5]How Tux came into existence + +One tool that he mentions in GIMP is [Convolve][6], which proved quite helpful after the shape and primary shading had been done. He used it to carry out hand anti-aliasing, controlled smoothing, and a host of other neat effects on Tux. It aided in blurring the image with several different brush sizes to smooth out the shading. The air-brush extensively lightened or darkened areas that had smoothed a little too flat. + +A complete description of Tux’s creation experience has been shared in his own words by Larry’s own page where he [notes][7] every detail of how Tux came to be as we know today. + +We hope this also inspires you to create your own mascot if you think of one someday! + +**Recommended** : [The Earliest Linux Distros: Before Mainstream Distros Became So Popular][8] + +### A Mascot Contender + +![This could have been the Linux mascot][9]Could this have been the Linux mascot? + +These were some other contenders that couldn’t make it to the spot while competing with Tux. Apart from debating about eagles or sharks, there were also people who did not accept Tux as a mascot in the early days and preferred it to be a Fox instead. Seems like a sly pun! But it could not remain such a contender for long. The aura of Tux is too overpowering you know! + +### Linux Logo vs Mascot + +![Earlier Linux logo][10]Earlier Linux logo + +Not a mascot but it was this logo for Linux 2.0 by Matt Ericson that could not replace Tux eventually in spite of winning a poll many years ago (1997). The logo got 785 votes whereas Tux got only 541. But look today! Tux is dominant everywhere! Tux is where Linux is! + +### The smallest known image of Tux! + +![Smallest image of Tux. The size is about 130 microns.][11]Smallest image of Tux. The size is about 130 microns. + +A chip designer reported a miniature replica of Tux of about 130 microns in size (1 micron = 1 x 10−6 meters), with the Linux penguin nesting in the pad ring of an integrated circuit of unknown type and function. It was probably a special microprocessor that was optimized for its operating system. + +The report that was briefly made about the same no longer exists on the internet. But thanks to the Way Back machine, you can still take a [look][12]! + +### When Tux went to Space! + +This was definitely an incredible feat on January 18, 2011, by the Linux community in Australia with a noble fund-raiser goal at the Linux Conference at Brisbane, for the Queensland Premier’s flood relief charity. Despite the terrible flood, the Conference still happened undauntedly clearing all initial doubts about the same. + +We’ve shared the photo with you before on our previous [NASA article][13]. A hard copy of the photo was signed by Vint Cerf (one of the “fathers” of the Internet), Eric Allman (of “sendmail” fame) and Linus Torvalds (the initiator of the Linux OS kernel). Tux and his photo were then auctioned at the conference dinner that followed, raising over $23,000AUD for the flood relief. + +[Project Horus][14], which made Tux a successful space tourist, was powered by Ham Radio, Linux, Open Source, and Open Hardware. Horus 14 – the high altitude balloon made it to space by reaching an altitude of 30-40km, about 3 times the altitude of a regular jet aircraft. The horizon was at a few 100 km, the black space-ish sky and the curvature of the Earth are quite visible. Air pressure was about 5% of the ground level and the temperature was -50 °C. The tracking beacon was powered by an [Arduino][15] micro. + +This last one is undoubtedly my favorite Tux Trivia! + +Hope you liked reading about all of these short but intriguing events in [Tux’s history][16] (You can refer to this hyperlink as a Tux Trivia Encyclopedia!). + +If you have been part of any memorable event that relates with Tux, please share with us in the comments below and we’d be delighted to read them! + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/tux-trivia + +作者:[Avimanyu Bandyopadhyay][a] +选题:[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/avimanyu/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/history-of-linux-logo-mascot.png?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/linus-torvalds-facts/ +[3]: /cdn-cgi/l/email-protection +[4]: https://itsfoss.com/gimp-2-10-release/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/How-Larry-Ewing-Created-Tux-With-Gimp.jpg?resize=782%2C800&ssl=1 +[6]: https://docs.gimp.org/2.2/en/gimp-tool-convolve.html +[7]: http://isc.tamu.edu/~lewing/linux/notes.html +[8]: https://itsfoss.com/earliest-linux-distros/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/Linux-Fox-The-Lesser-Known-Alternative-Mascot.jpg?ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/11/Linux-2-0-Logo.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/micro-tux.jpg?ssl=1 +[12]: https://web.archive.org/web/20180620175359/https://micro.magnet.fsu.edu/creatures/pages/linuxpenguin.html +[13]: https://itsfoss.com/nasa-open-science/ +[14]: http://www.projecthorus.org/ +[15]: _wp_link_placeholder +[16]: https://sjbaker.org/wiki/index.php?title=The_History_of_Tux_the_Linux_Penguin +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/history-of-linux-logo-mascot.png?fit=800%2C450&ssl=1 From baab2f9964073eb401d78bdca9023f5e08319dbf Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:07:57 +0800 Subject: [PATCH 355/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Infras?= =?UTF-8?q?tructure=20monitoring:=20Defense=20against=20surprise=20downtim?= =?UTF-8?q?e=20sources/tech/20190220=20Infrastructure=20monitoring-=20Defe?= =?UTF-8?q?nse=20against=20surprise=20downtime.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ring- Defense against surprise downtime.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md diff --git a/sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md b/sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md new file mode 100644 index 0000000000..d71c3c521b --- /dev/null +++ b/sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Infrastructure monitoring: Defense against surprise downtime) +[#]: via: (https://opensource.com/article/19/2/infrastructure-monitoring) +[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) + +Infrastructure monitoring: Defense against surprise downtime +====== +A strong monitoring and alert system based on open source tools prevents problems before they affect your infrastructure. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV) + +Infrastructure monitoring is an integral part of infrastructure management. It is an IT manager's first line of defense against surprise downtime. Severe issues can inject considerable downtime to live infrastructure, sometimes causing heavy loss of money and material. + +Monitoring collects time-series data from your infrastructure so it can be analyzed to predict upcoming issues with the infrastructure and its underlying components. This gives the IT manager or support staff time to prepare and apply a resolution before a problem occurs. + +A good monitoring system provides: + + 1. Measurement of the infrastructure's performance over time + 2. Node-level analysis and alerts + 3. Network-level analysis and alerts + 4. Downtime analysis and alerts + 5. Answers to the 5 W's of incident management and root cause analysis (RCA): + * What was the actual issue? + * When did it happen? + * Why did it happen? + * What was the downtime? + * What needs to be done to avoid it in the future? + + + +### Building a strong monitoring system + +There are a number of tools available that can build a viable and strong monitoring system. The only decision to make is which to use; your answer lies in what you want to achieve with monitoring as well as various financial and business factors you must consider. + +While some monitoring tools are proprietary, many open source tools, either unmanaged or community-managed software, will do the job even better than the closed source options. + +In this article, I will focus on open source tools and how to use them to create a strong monitoring architecture. + +### Log collection and analysis + +To say "logs are helpful" would be an understatement. Logs not only help in debugging issues; they also provide a lot of information to help you predict an upcoming issue. Logs are the first door to open when you encounter issues with software components. + +Both [Fluentd][1] and [Logstash][2] can be used for log collection; the only reason I would choose Fluentd over Logstash is because of its independence from the Java process; it is written in C+ Ruby, which is widely supported by container runtimes like Docker and orchestration tools like Kubernetes. + +Log analytics is the process of analyzing the log data you collect over time and producing real-time logging metrics. [Elasticsearch][3] is a powerful tool that can do just that. + +Finally, you need a tool that can collect logging metrics and enable you to visualize the log trends using charts and graphs that are easy to understand. [Kibana][4] is my favorite option for that purpose. + +![Logging workflow][6] + +Logging workflow + +Because logs can hold sensitive information, here are a few security pointers to remember: + + * Always transport logs over a secure connection. + * The logging/monitoring infrastructure should be implemented inside the restricted subnet. + * Access to monitoring user interfaces (e.g., Kibana and [Grafana][7]) should be restricted or authenticated only to stakeholders. + + + +### Node-level metrics + +Not everything is logged! + +Yes, you heard that right: Logging monitors a software or a process, not every component in the infrastructure. + +Operating system disks, externally mounted data disks, Elastic Block Store, CPU, I/O, network packets, inbound and outbound connections, physical memory, virtual memory, buffer space, and queues are some of the major components that rarely appear in logs unless something fails for them. + +So, how could you collect this data? + +[Prometheus][8] is one answer. You just need to install software-specific exporters on the virtual machine nodes and configure Prometheus to collect time-based data from those unattended components. Grafana uses the data Prometheus collects to provide a live visual representation of your node's current status. + +If you are looking for a simpler solution to collect time-series metrics, consider [Metricbeat][9], [Elastic.io][10]'s in-house open source tool, which can be used with Kibana to replace Prometheus and Grafana. + +### Alerts and notifications + +You can't take advantage of monitoring without alerts and notifications. Unless stakeholders—no matter where they are in this big, big world—receive a notification about an issue, there's no way they can analyze and fix the issue, prevent the customer from being impacted, and avoid it in the future. + +Prometheus, with predefined alerting rules using its in-house [Alertmanager][11] and Grafana, can send alerts based on configured rules. [Sensu][12] and [Nagios][13] are other open source tools that offer alerting and monitoring services. + +The only problem people have with open source alerting tools is that the configuration time and the process sometimes seem hard, but once they are set up, these tools function better than proprietary alternatives. + +However, open source tools' biggest advantage is that we have control over their behavior. + +### Monitoring workflow and architecture + +A good monitoring architecture is the backbone of a strong and stable monitoring system. It might look something like this diagram. + +![](https://opensource.com/sites/default/files/uploads/image_2_architecture.png) + +In the end, you must choose a tool based on your needs and infrastructure. The open source tools discussed in this article are used by many organizations for monitoring their infrastructure and blessing it with high uptime. + +This article was adapted from a post on [Medium.com][14]'s [Hacker Noon][15] and is republished here with the author's permission. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/infrastructure-monitoring + +作者:[Abhishek Tamrakar][a] +选题:[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/tamrakar +[b]: https://github.com/lujun9972 +[1]: https://www.fluentd.org/ +[2]: https://www.elastic.co/products/logstash +[3]: https://www.elastic.co/products/elasticsearch +[4]: https://www.elastic.co/products/kibana +[5]: /file/420766 +[6]: https://opensource.com/sites/default/files/uploads/infrastructure-monitoring_logging.jpeg (Logging workflow) +[7]: https://grafana.com/ +[8]: https://prometheus.io/ +[9]: https://www.elastic.co/products/beats/metricbeat +[10]: http://Elastic.io +[11]: https://prometheus.io/docs/alerting/alertmanager/ +[12]: https://sensu.io/ +[13]: https://www.nagios.org/ +[14]: http://Medium.com +[15]: https://medium.com/@abhishek.tamrakar/infrastructure-monitoring-defense-against-surprise-downtime-ed32416df0c5 From faa08b7a7076f641ae7a7ed8b165e7a3819722af Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:13:42 +0800 Subject: [PATCH 356/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Set=20?= =?UTF-8?q?up=20two-factor=20authentication=20for=20SSH=20on=20Fedora=20so?= =?UTF-8?q?urces/tech/20190220=20Set=20up=20two-factor=20authentication=20?= =?UTF-8?q?for=20SSH=20on=20Fedora.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...factor authentication for SSH on Fedora.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md diff --git a/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md new file mode 100644 index 0000000000..7410262f3f --- /dev/null +++ b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up two-factor authentication for SSH on Fedora) +[#]: via: (https://fedoramagazine.org/two-factor-authentication-ssh-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +Set up two-factor authentication for SSH on Fedora +====== + +![](https://fedoramagazine.org/wp-content/uploads/2019/02/twofactor-auth-ssh-816x345.png) + +Every day there seems to be a security breach reported in the news where our data is at risk. Despite the fact that SSH is a secure way to connect remotely to a system, you can still make it even more secure. This article will show you how. + +That’s where two-factor authentication (2FA) comes in. Even if you disable passwords and only allow SSH connections using public and private keys, an unauthorized user could still gain access to your system if they steal your keys. + +With two-factor authentication, you can’t connect to a server with just your SSH keys. You also need to provide the randomly generated number displayed by an authenticator application on a mobile phone. + +The Time-based One-time Password algorithm (TOTP) is the method shown in this article. [Google Authenticator][1] is used as the server application. Google Authenticator is available by default in Fedora. + +For your mobile phone, you can use any two-way authentication application that is compatible with TOTP. There are numerous free applications for Android or IOS that work with TOTP and Google Authenticator. This article uses [FreeOTP][2] as an example. + +### Install and set up Google Authenticator + +First, install the Google Authenticator package on your server. + +``` +$ sudo dnf install -y google-authenticator +``` + +Run the application. + +``` +$ google-authenticator +``` + +The application presents you with a series of questions. The snippets below show you how to answer for a reasonably secure setup. + +``` +Do you want authentication tokens to be time-based (y/n) y +Do you want me to update your "/home/user/.google_authenticator" file (y/n)? y +``` + +The app provides you with a secret key, verification code, and recovery codes. Keep these in a secure, safe location. The recovery codes are the **only** way to access your server if you lose your mobile phone. + +### Set up mobile phone authentication + +Install the authenticator application (FreeOTP) on your mobile phone. You can find it in Google Play if you have an Android phone, or in the iTunes store for an Apple iPhone. + +A QR code is displayed on the screen. Open up the FreeOTP app on your mobile phone. To add a new account, select the QR code shaped tool at the top on the app, and then scan the QR code. After the setup is complete, you’ll have to provide the random number generated by the authenticator application every time you connect to your server remotely. + +### Finish configuration + +The application asks further questions. The example below shows you how to answer to set up a reasonably secure configuration. + +``` +Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it increases your chances to notice or even prevent man-in-the-middle attacks (y/n) y +By default, tokens are good for 30 seconds. In order to compensate for possible time-skew between the client and the server, we allow an extra token before and after the current time. If you experience problems with poor time synchronization, you can increase the window from its default size of +-1min (window size of 3) to about +-4min (window size of 17 acceptable tokens). +Do you want to do so? (y/n) n +If the computer that you are logging into isn't hardened against brute-force login attempts, you can enable rate-limiting for the authentication module. By default, this limits attackers to no more than 3 login attempts every 30s. +Do you want to enable rate-limiting (y/n) y +``` + +Now you have to set up SSH to take advantage of the new two-way authentication. + +### Configure SSH + +Before completing this step, **make sure you’ve already established a working SSH connection** using public SSH keys, since we’ll be disabling password connections. If there is a problem or mistake, having a connection will allow you to fix the problem. + +On your server, use [sudo][3] to edit the /etc/pam.d/sshd file. + +``` +$ sudo vi /etc/pam.d/ssh +``` + +Comment out the auth substack password-auth line: + +``` +#auth       substack     password-auth +``` + +Add the following line to the bottom of the file. + +``` +auth sufficient pam_google_authenticator.so +``` + +Save and close the file. Next, edit the /etc/ssh/sshd_config file. + +``` +$ sudo vi /etc/ssh/sshd_config +``` + +Look for the ChallengeResponseAuthentication line and change it to yes. + +``` +ChallengeResponseAuthentication yes +``` + +Look for the PasswordAuthentication line and change it to no. + +``` +PasswordAuthentication no +``` + +Add the following line to the bottom of the file. + +``` +AuthenticationMethods publickey,password publickey,keyboard-interactive +``` + +Save and close the file, and then restart SSH. + +``` +$ sudo systemctl restart sshd +``` + +### Testing your two-factor authentication + +When you attempt to connect to your server you’re now prompted for a verification code. + +``` +[user@client ~]$ ssh user@example.com +Verification code: +``` + +The verification code is randomly generated by your authenticator application on your mobile phone. Since this number changes every few seconds, you need to enter it before it changes. + +![][4] + +If you do not enter the verification code, you won’t be able to access the system, and you’ll get a permission denied error: + +``` +[user@client ~]$ ssh user@example.com + +Verification code: + +Verification code: + +Verification code: + +Permission denied (keyboard-interactive). + +[user@client ~]$ +``` + +### Conclusion + +By adding this simple two-way authentication, you’ve now made it much more difficult for an unauthorized user to gain access to your server. + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/two-factor-authentication-ssh-fedora/ + +作者:[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://en.wikipedia.org/wiki/Google_Authenticator +[2]: https://freeotp.github.io/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/02/freeotp-1.png From 1838d01ad6e57a988d8cf6cbdd5433752df7a5de Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:17:23 +0800 Subject: [PATCH 357/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20An=20A?= =?UTF-8?q?utomated=20Way=20To=20Install=20Essential=20Applications=20On?= =?UTF-8?q?=20Ubuntu=20sources/tech/20190220=20An=20Automated=20Way=20To?= =?UTF-8?q?=20Install=20Essential=20Applications=20On=20Ubuntu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nstall Essential Applications On Ubuntu.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md diff --git a/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md new file mode 100644 index 0000000000..5dd7abbaa2 --- /dev/null +++ b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Automated Way To Install Essential Applications On Ubuntu) +[#]: via: (https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +An Automated Way To Install Essential Applications On Ubuntu +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/02/alfred-720x340.png) + +The default Ubuntu installation doesn’t come with all essential applications pre-installed . You may need to spend few hours on Internet or ask any Linux user’s help to find and install the necessary applications for your Ubuntu box. If you’re newbie, then you certainly need to spend more time to learn how to search and install applications either from command line (using apt-get or dpkg) or from the Ubuntu software center. Some users, especially newbies, might want to easily and quickly install every applications they like. If you’re one of them, no worries. In this guide, we will see how to install essential applications on Ubuntu using a simple command line utility called **“Alfred”**. + +Alfred is a free, open source script written in **Python** programming language. It uses **Zenity** to create a simple graphical interface that allows the users to easily select and install the applications of their choice with a few mouse clicks. You need not to spend hours to search for all essential applications, PPAs, debs, AppImage, snaps or flatpaks. Alfred brings all common applications, tools and utilities under one-roof and automatically installs the selected applications. If you’re a newbie who is recently migrated from Windows to Ubuntu Linux, Alfred helps you to do an unattended software installation on a freshly installed Ubuntu system, without much user intervention. Please be mindful that there is also a Mac OS app with similar name, but both serves different purposes. + +### Installing Alfred On Ubuntu + +Alfred installation is easy! Just download the script and launch it. It is that simple. + +``` +$ wget https://raw.githubusercontent.com/derkomai/alfred/master/alfred.py + +$ python3 alfred.py +``` + +Alternatively, download the script using wget as shown above and just move the **alfred.py** file to your $PATH: + +``` +$ sudo cp alfred.py /usr/local/bin/alfred +``` + +Make it executable: + +``` +$ sudo chmod +x /usr/local/bin/alfred +``` + +And, launch it using command: + +``` +$ alfred +``` + +### Easily And Quickly Install Essential Applications On Ubuntu Using Alfred Script + +Launch Alfred script as described in the installation section above. This is how Alfred default interface looks like. + +![][2] + +As you can see, Alfred lists a lot of most commonly used application types such as, + + * Web browsers, + * Mail clients, + * Messengers, + * Cloud storage clients, + * Hardware drivers, + * Codecs, + * Developer tools, + * Android, + * Text editors, + * Git, + * Kernel update tool, + * Audio/video players, + * Screenshot tools, + * Screen recorders, + * Video encoders, + * Streaming apps, + * 3D modelling and animation tools, + * Image viewers and editors, + * CAD software, + * Pdf tools, + * Gaming emulators, + * Disk management tools, + * Encryption tools, + * Password managers, + * Archive tools, + * Ftp software, + * System resource monitors, + * Application launchers and many. + + + +You can pick any one or multiple applications of your choice and install them at once. Here, I am going to install the ‘Developer bundle’, hence I chose it and click OK button. + +![][3] + +Now, Alfred script will automatically add the necessary repositories, ppas on your Ubuntu system and start installing the selected applications. + +![][4] + +Once the installation is completed, you will see the following message. + +![][5] + +Congratulations! The selected packages have been installed. + +You can [**check recently installed applications**][6] on Ubuntu using the following command: + +``` +$ grep " install " /var/log/dpkg.log +``` + +You may need to reboot your system in-order to use some of the installed applications. Similarly, you can install any applications from the list without much hazzle. + +For your information, there is also a similar script named **post_install.sh** written by different developer. It is exactly same as Alfred, but provides a few different set of applications. Please check the following link for more details. + +These two scripts allows the lazy users, especially newbies, to be able to easily and fastly install most common apps, tools, updates, utilities they want to use in their Ubuntu Linux with few mouse clicks away, and stop depending on the help of official or non-official documentations. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-1.png +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-2.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-4.png +[5]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-5-1.png +[6]: https://www.ostechnix.com/list-installed-packages-sorted-installation-date-linux/ From 6f082b41ccc1ecea0f7f179bffc1a3d1363ee482 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:20:24 +0800 Subject: [PATCH 358/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20Get=20?= =?UTF-8?q?started=20and=20organized=20with=20TiddlyWiki=20sources/tech/20?= =?UTF-8?q?190218=20Get=20started=20and=20organized=20with=20TiddlyWiki.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t started and organized with TiddlyWiki.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190218 Get started and organized with TiddlyWiki.md diff --git a/sources/tech/20190218 Get started and organized with TiddlyWiki.md b/sources/tech/20190218 Get started and organized with TiddlyWiki.md new file mode 100644 index 0000000000..25d6883a3a --- /dev/null +++ b/sources/tech/20190218 Get started and organized with TiddlyWiki.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started and organized with TiddlyWiki) +[#]: via: (https://opensource.com/article/19/2/tiddlywiki) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Get started and organized with TiddlyWiki +====== +Take notes, manage tasks, keep a journal, and otherwise stay organized with TiddlyWiki. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_paperclips.png?itok=j48op49T) + +When you think of the word wiki, chances are the first thing that comes to mind is Wikipedia. That's not a surprise, considering that Wikipedia did help put the concept of the wiki into the popular consciousness. Wikis, which are websites you can edit, are great tools for collaborating and organizing. But wikis usually require a lot of digital plumbing and a bit of care to use and maintain. All of that's overkill for personal use. + +While you can install [desktop wikis][1] on your computer, they're not as portable as some people want or need them to be. + +Enter [TiddlyWiki][2], the brainchild of British software developer [Jeremy Ruston][3]. Not only is it great for organizing yourself, but it's also easy to use and very portable. + +Let's take a quick look at the basics of using TiddlyWiki to get organized. + +### What's TiddlyWiki? + +TiddlyWiki isn't software quite as you know it. It's a large web page (consisting of HTML and a lot of JavaScript) that weighs in at around 2MB. You can edit and save the file in a web browser. + +It's very flexible. You can use TiddlyWiki to take notes, manage task lists, save bookmarks, publish a blog or website, create a presentation, and a lot more. And people have used it to do some [interesting things][4]. + +As I mentioned, TiddlyWiki is very portable. You can put it in a folder in, say, [Nextcloud][5] and share a TiddlyWiki between computers and mobile devices. Or, you can carry it around on a flash drive. + +### Getting started + +Head over to the [TiddlyWiki website][6] and download the file empty.html. Rename that file to something a bit more meaningful and descriptive. Then open it in a web browser. + +You'll see the Getting Started tiddler (more on tiddlers in a moment): + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-get-started.png) + +Click the pencil icon in the top-right corner and change the information. Then, click the checkmark icon to save the TiddlyWiki. + +#### A note about saving your TiddlyWiki + +Since your web browser thinks a TiddlyWiki is a file, it'll save your TiddlyWiki to the folder on your computer where downloads go. And when it does that, your browser will probably save it with a file name like tiddlywiki(1).html. You don't want that. + +If you're using Chrome or Chromium, set the browser to ask you where to save files by selecting **Settings** , then clicking **Show advanced settings** on the Settings page. Then click the **Ask where to save each file before downloading** option. + +If you're using Firefox, click on the stacker menu in the top-right corner and select **Options**. Find the **Downloads** option, and click **Always ask you where to save files**. + +### Working with TiddlyWiki + +You can use TiddlyWiki for just about anything. And people have done just that. But instead of jumping into the scary depths, let's look at the basics of using TiddlyWiki. + +Since I prefer to focus on specific tasks with my tools, I'm going to look at using TiddlyWiki for: + + * Taking notes + * Managing tasks + * Keeping a journal + + + +#### Taking notes + +To get going, create a new tiddler, which is an individual page within TiddlyWiki. To be honest, I don't know how many tiddlers a single TiddlyWiki can contain before it slows down, but I wouldn't be surprised if it's in the hundreds or thousands. + +Create a new tiddler by clicking the **+** icon. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-new-tiddler.png) + +Give your tiddler a name, like Notes for netbooks essay. You can also type a tag in the **Tag name** field—doing that will let you filter your tiddlers so you can find them quickly when you have a lot of them. Then start typing. + +You can format your tiddler using TiddlyWiki's markup. You can also use the formatting toolbar to add character formatting, lists, quotes, headings, images, and links. + +When you're done, click the checkmark icon to save the tiddler. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-example-tiddler.png) + +#### Creating a task list + +Again, create a new tiddler. Give it a name like Tasks - 4 May 2019 and type Tasks in the **Tag name** field. + +From there, type your tasks—one line for each. Put an asterisk (*) in front of each one to create a bullet list. Then save your list. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-task-list.png) + +To mark off a completed task, edit the tiddler, highlight the task, and click the Strikethrough button on the toolbar. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-complete-task.png) + +That's a pretty simple, and frankly lame, way to deal with tasks. If you're looking for something more visually appealing, [watch this video][7]. This method requires a bit more setup, but you also get nifty checkboxes that you can click when you finish a task. + +#### Keeping a journal + +If you want to keep a journal, first click the **Tools** tab and select the **New journal** option. That puts the **Create a new journal tiddler** button on the main TiddlyWiki toolbar. + +Click that button and you'll notice that the journal tiddler has today's date as its name and has been tagged **Journal**. + +As with any other tiddler, type your text and save the tiddler when you're done. + +### The power of plugins + +What if you want or need more from TiddlyWiki? You can use [plugins][8] to extend and customize TiddlyWiki's capabilities. You can change its appearance, add [editors][9] and [support for Markdown][10], turn TiddlyWiki into a personal [kanban board][11] (à la [WeKan][12]), add a more powerful search engine, and more. + +TiddlyWiki has a plugin library, which you can access from its control panel. There's a [list of plugins][13] created by users, and [this toolmap][14] lists over 600 plugins, tips, and tricks. + +### One TiddlyWiki or several? + +You can load up your TiddlyWiki with everything you need to do. Eventually, though, it could get so full of tiddlers that it's difficult to easily find what you need to find, even with good tagging. + +An alternative to that is to have several TiddlyWiki files—for example, one for notes, one for tasks, one for outlines, one for journaling. Keeping track of those files could become a chore. The [desktop version][15] can help you better organize two or more TiddlyWiki files. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-desktop.png) + +### Learning more + +I've only covered the basics of using TiddlyWiki. There is a lot you can do with it, even if (like me) you're using it just for simple tasks. + +Here are some good resources that can help you learn more about using TiddlyWiki: + + * The [TiddlyWiki website][6] has a number of tutorials in the Learning section + * Francis Meetze has created [several videos][16] explaining how to do things with TiddlyWiki + * A [one-page][17] TiddlyWiki cheatsheet PDF + * [Five Steps to TiddlyWiki 5][18], which helps you get up and running with TiddlyWiki + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/tiddlywiki + +作者:[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/article/17/2/3-desktop-wikis +[2]: http://tiddlywiki.com/ +[3]: https://jermolene.com/ +[4]: https://tiddlywiki.com/static/Examples.html +[5]: https://nextcloud.com/ +[6]: http://www.tiddlywiki.com +[7]: https://www.youtube.com/watch?v=mzoMhKx0j8g +[8]: https://tiddlywiki.com/#Plugins +[9]: https://tiddlywiki.com/plugins/tiddlywiki/codemirror/ +[10]: https://tiddlywiki.com/plugins/tiddlywiki/markdown/ +[11]: https://ibnishak.github.io/Tesseract/projects/tekan/Tekan.html +[12]: https://opensource.com/article/17/12/wekan-manage-your-work +[13]: https://tiddlywiki.com/#OfficialPlugins +[14]: https://dynalist.io/d/zUP-nIWu2FFoXH-oM7L7d9DM +[15]: https://github.com/Jermolene/TiddlyDesktop +[16]: https://www.youtube.com/channel/UCCYN_nzlUKKMiTj5rerv2lQ/videos +[17]: http://www.tcm.phy.cam.ac.uk/~mdt26/PWT/hints.pdf +[18]: http://www.richshumaker.com/tw5/FiveStepsToTiddlyWiki5.htm From dc6a4b363571348cd1520318872b9901e582d3bb Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:22:11 +0800 Subject: [PATCH 359/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How=20?= =?UTF-8?q?Linux=20testing=20has=20changed=20and=20what=20matters=20today?= =?UTF-8?q?=20sources/talk/20190219=20How=20Linux=20testing=20has=20change?= =?UTF-8?q?d=20and=20what=20matters=20today.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ting has changed and what matters today.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/talk/20190219 How Linux testing has changed and what matters today.md diff --git a/sources/talk/20190219 How Linux testing has changed and what matters today.md b/sources/talk/20190219 How Linux testing has changed and what matters today.md new file mode 100644 index 0000000000..ad26d6dbec --- /dev/null +++ b/sources/talk/20190219 How Linux testing has changed and what matters today.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Linux testing has changed and what matters today) +[#]: via: (https://opensource.com/article/19/2/phoronix-michael-larabel) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +How Linux testing has changed and what matters today +====== +Michael Larabel, the founder of Phoronix, shares his insights on the evolution of Linux and open hardware. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mistake_bug_fix_find_error.png?itok=PZaz3dga) + +If you've ever wondered how your Linux computer stacks up against other Linux, Windows, and MacOS machines or searched for reviews of Linux-compatible hardware, you're probably familiar with [Phoronix][1]. Along with its website, which attracts more than 250 million visitors a year to its Linux reviews and news, the company also offers the [Phoronix Test Suite][2], an open source hardware benchmarking tool, and [OpenBenchmarking.org][3], where test result data is stored. + +According to [Michael Larabel][4], who started Phoronix in 2004, the site "is frequently cited as being the leading source for those interested in computer hardware and Linux. It offers insights regarding the development of the Linux kernel, product reviews, interviews, and news regarding free and open source software." + +I recently had the opportunity to interview Michael about Phoronix and his work. + +The questions and answers have been edited for length and clarity. + +**Don Watkins:** What inspired you to start Phoronix? + +**Michael Larabel:** When I started [Phoronix.com][5] in June 2004, it was still challenging to get a mouse or other USB peripherals working on the popular distributions of the time, like Mandrake, Yoper, MEPIS, and others. So, I set out to work on reviewing different hardware components and their compatibility with Linux. Over time, that shifted more from "does the basic device work?" to how well they perform and what features are supported or unsupported under Linux. + +It's been interesting to see the evolution and the importance of Linux on hardware rise. Linux was very common to LAMP/web servers, but Linux has also become synonymous with high-performance computing (HPC), Android smartphones, cloud software, autonomous vehicles, edge computing, digital signage, and related areas. While Linux hasn't quite dominated the desktop, it's doing great practically everywhere else. + +I also developed the Phoronix Test Suite, with its initial 1.0 public release in 2008, to increase the viability of testing on Linux, engage with more hardware and software vendors on best practices for testing, and just get more test cases running on Linux. At the time, there weren't any really shiny benchmarks on Linux like there were on Windows. + +**DW:** Who are your website's readers? + +**ML:** Phoronix's audience is as diverse as the content. Initially, it was quite desktop/gamer/enthusiast oriented, but as Linux's dominance has grown in HPC, cloud, embedded, etc., my testing has expanded in those areas and thus so has the readership. Readers tend to be interested in open source/Linux ecosystem advancements, performance, and a slight bent towards graphics processor and hardware driver interests. + +**DW:** How important is testing in the Linux world and how has it changed from when you started? + +**ML:** Testing has changed radically since 2004. Back then, many open source projects weren't carrying out any continuous integration (CI) or testing for regressions—both functional issues and performance problems. The hardware vendors supporting Linux were mostly trying to get things working and maintained while being less concerned about performance or scratching away at catching up to Mac, Solaris, and Windows. With time, we've seen the desktop reach close parity with (or exceed, depending upon your views) alternative operating systems. Most PC hardware now works out-of-the-box on Linux, most open source projects engage in some form of CI or testing, and more time and resources are afforded to advancing Linux performance. With high-frequency trading and cloud platforms relying on Linux, performance has become of utmost importance. + +Most of my testing at Phoronix.com is focused on benchmarking processors, graphics cards, storage devices, and other areas of interest to gamers and enthusiasts, but also interesting server platforms. Readers are also quite interested in testing of software components like the Linux kernel, code compilers, and filesystems. But in terms of the Phoronix Test Suite, its scope is rather limitless, with a framework in which new tests can be easily added and automated. There are currently more than 1,000 different profiles/suites, and new ones are routinely added—from machine learning tests to traditional benchmarks. + +**DW:** How important is open source hardware? Where do you see it going? + +**ML:** Open hardware is of increasing importance, especially in light of all the security vulnerabilities and disclosures in recent years. Facebook's work on the [Open Compute Project][6] can be commended, as can Google leveraging [Coreboot][7] in its Chromebook devices, and [Raptor Computing Systems][8]' successful, high-performance, open source POWER9 desktops/workstations/servers. [Intel][9] potentially open sourcing its firmware support package this year is also incredibly tantalizing and will hopefully spur more efforts in this space. + +Outside of that, open source hardware has had a really tough time cracking the consumer space due to the sheer amount of capital necessary and the complexities of designing a modern chip, etc., not to mention competing with the established hardware vendors' marketing budgets and other resources. So, while I would love for 100% open source hardware to dominate—or even compete in features and performance with proprietary hardware—in most segments, that is sadly unlikely to happen, especially with open hardware generally being much more expensive due to economies of scale. + +Software efforts like [OpenBMC][10], Coreboot/[Libreboot][11], and [LinuxBoot][12] are opening up hardware much more. Those efforts at liberating hardware have proven successful and will hopefully continue to be endorsed by more organizations. + +As for [OSHWA][13], I certainly applaud their efforts and the enthusiasm they bring to open source hardware. Certainly, for niche and smaller-scale devices, open source hardware can be a great fit. It will certainly be interesting to see what comes about with OSHWA and some of its partners like Lulzbot, Adafruit, and System76. + +**DW:** Can people install Phoronix Test Suite on their own computers? + +ML: The Phoronix Test Suite benchmarking software is open source under the GPL and can be downloaded from [Phoronix-Test-Suite.com][2] and [GitHub][14]. The benchmarking software works on not only Linux systems but also MacOS, Solaris, BSD, and Windows 10/Windows Server. The Phoronix Test Suite works on x86/x86_64, ARM/AArch64, POWER, RISC-V, and other architectures. + +**DW:** How does [OpenBenchmarking.org][15] work with the Phoronix Test Suite? + +**ML:** OpenBenchmarking.org is, in essence, the "cloud" component to the Phoronix Test Suite. It stores test profiles/test suites in a package manager-like fashion, allows users to upload their own benchmarking results, and offers related functionality around our benchmarking software. + +OpenBenchmarking.org is seamlessly integrated into the Phoronix Test Suite, but from the web interface, it is also where anyone can see the public benchmark results, inspect the open source test profiles to understand their methodology, research hardware and software data, and use similar functionality. + +Another component developed as part of the Phoronix Test Suite is [Phoromatic][16], which effectively allows anyone to deploy their own OpenBenchmarking-like environment within their own private intranet/LAN. This allows organizations to archive their benchmark results locally (and privately), orchestrate benchmarks automatically against groups of systems, manage the benchmark systems, and develop new test cases. + +**DW:** How can people stay up to date on Phoronix? + +**ML:** You can follow [me][17], [Phoronix][18], [Phoronix Test Suite][19], and [OpenBenchMarking.org][20] on Twitter. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/phoronix-michael-larabel + +作者:[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://www.phoronix.com/ +[2]: https://www.phoronix-test-suite.com/ +[3]: https://openbenchmarking.org/ +[4]: https://www.michaellarabel.com/ +[5]: http://Phoronix.com +[6]: https://www.opencompute.org/ +[7]: https://www.coreboot.org/ +[8]: https://www.raptorcs.com/ +[9]: https://www.phoronix.com/scan.php?page=news_item&px=Intel-Open-Source-FSP-Likely +[10]: https://en.wikipedia.org/wiki/OpenBMC +[11]: https://libreboot.org/ +[12]: https://linuxboot.org/ +[13]: https://www.oshwa.org/ +[14]: https://github.com/phoronix-test-suite/ +[15]: http://OpenBenchmarking.org +[16]: http://www.phoronix-test-suite.com/index.php?k=phoromatic +[17]: https://twitter.com/michaellarabel +[18]: https://twitter.com/phoronix +[19]: https://twitter.com/Phoromatic +[20]: https://twitter.com/OpenBenchmark From 37cde7fb434992deac435e293e2ee93f35408b84 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 17:28:13 +0800 Subject: [PATCH 360/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020160921=20lawyer?= =?UTF-8?q?=20The=20MIT=20License,=20Line=20by=20Line=20sources/talk/20160?= =?UTF-8?q?921=20lawyer=20The=20MIT=20License,=20Line=20by=20Line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...21 lawyer The MIT License, Line by Line.md | 296 ++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 sources/talk/20160921 lawyer The MIT License, Line by Line.md diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md new file mode 100644 index 0000000000..78abc6b9f1 --- /dev/null +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -0,0 +1,296 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (lawyer The MIT License, Line by Line) +[#]: via: (https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html) +[#]: author: (Kyle E. Mitchell https://kemitchell.com/) + +lawyer The MIT License, Line by Line +====== + +### The MIT License, Line by Line + +[The MIT License][1] is the most popular open-source software license. Here’s one read of it, line by line. + +#### Read the License + +If you’re involved in open-source software and haven’t taken the time to read the license from top to bottom—it’s only 171 words—you need to do so now. Especially if licenses aren’t your day-to-day. Make a mental note of anything that seems off or unclear, and keep trucking. I’ll repeat every word again, in chunks and in order, with context and commentary. But it’s important to have the whole in mind. + +> The MIT License (MIT) +> +> Copyright (c) +> +> 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. + +The license is arranged in five paragraphs, but breaks down logically like this: + + * **Header** + * **License Title** : “The MIT License” + * **Copyright Notice** : “Copyright (c) …” + * **License Grant** : “Permission is hereby granted …” + * **Grant Scope** : “… to deal in the Software …” + * **Conditions** : “… subject to …” + * **Attribution and Notice** : “The above … shall be included …” + * **Warranty Disclaimer** : “The software is provided ‘as is’ …” + * **Limitation of Liability** : “In no event …” + + + +Here we go: + +#### Header + +##### License Title + +> The MIT License (MIT) + +“The MIT License” is a not a single license, but a family of license forms derived from language prepared for releases from the Massachusetts Institute of Technology. It has seen a lot of changes over the years, both for the original projects that used it, and also as a model for other projects. The Fedora Project maintains a [kind of cabinet of MIT license curiosities][2], with insipid variations preserved in plain text like anatomical specimens in formaldehyde, tracing a wayward kind of evolution. + +Fortunately, the [Open Source Initiative][3] and [Software Package Data eXchange][4] groups have standardized a generic MIT-style license form as “The MIT License”. OSI in turn has adopted SPDX’ standardized [string identifiers][5] for common open-source licenses, with `MIT` pointing unambiguously to the standardized form “MIT License”. If you want MIT-style terms for a new project, use [the standardized form][1]. + +Even if you include “The MIT License” or “SPDX:MIT” in a `LICENSE` file, any responsible reviewer will still run a comparison of the text against the standard form, just to be sure. While various license forms calling themselves “MIT License” vary only in minor details, the looseness of what counts as an “MIT License” has tempted some authors into adding bothersome “customizations”. The canonical horrible, no good, very bad example of this is [the JSON license][6], an MIT-family license plus “The Software shall be used for Good, not Evil.”. This kind of thing might be “very Crockford”. It is definitely a pain in the ass. Maybe the joke was supposed to be on the lawyers. But they laughed all the way to the bank. + +Moral of the story: “MIT License” alone is ambiguous. Folks probably have a good idea what you mean by it, but you’re only going to save everyone—yourself included—time by copying the text of the standard MIT License form into your project. If you use metadata, like the `license` property in package manager metadata files, to designate the `MIT` license, make sure your `LICENSE` file and any header comments use the standard form text. All of this can be [automated][7]. + +##### Copyright Notice + +> Copyright (c) + +Until the 1976 Copyright Act, United States copyright law required specific actions, called “formalities”, to secure copyright in creative works. If you didn’t follow those formalities, your rights to sue others for unauthorized use of your work were limited, often completely lost. One of those formalities was “notice”: Putting marks on your work and otherwise making it known to the market that you were claiming copyright. The © is a standard symbol for marking copyrighted works, to give notice of copyright. The ASCII character set doesn’t have the © symbol, but `Copyright (c)` gets the same point across. + +The 1976 Copyright Act, which “implemented” many requirements of the international Berne Convention, eliminated formalities for securing copyright. At least in the United States, copyright holders still need to register their copyrighted works before suing for infringement, with potentially higher damages if they register before infringement begins. In practice, however, many register copyright right before bringing suit against someone in particular. You don’t lose your copyright just by failing to put notices on it, registering, sending a copy to the Library of Congress, and so on. + +Even if copyright notices aren’t as absolutely necessary as they used to be, they are still plenty useful. Stating the year a work was authored and who the copyright belonged to give some sense of when copyright in the work might expire, bringing the work into the public domain. The identity of the author or authors is also useful: United States law calculates copyright terms differently for individual and “corporate” authors. Especially in business use, it may also behoove a company to think twice about using software from a known competitor, even if the license terms give very generous permission. If you’re hoping others will see your work and want to license it from you, copyright notices serve nicely for attribution. + +As for “copyright holder”: Not all standard form licenses have a space to write this out. More recent license forms, like [Apache 2.0][8] and [GPL 3.0][9], publish `LICENSE` texts that are meant to be copied verbatim, with header comments and separate files elsewhere to indicate who owns copyright and is giving the license. Those approaches neatly discourage changes to the “standard” texts, accidental or intentional. They also make automated license identification more reliable. + +The MIT License descends from language written for releases of code by institutions. For institutional releases, there was just one clear “copyright holder”, the institution releasing the code. Other institutions cribbed these licenses, replacing “MIT” with their own names, leading eventually to the generic forms we have now. This process repeated for other short-form institutional licenses of the era, notably the [original four-clause BSD License][10] for the University of California, Berkeley, now used in [three-clause][11] and [two-clause][12] variants, as well as [The ISC License][13] for the Internet Systems Consortium, an MIT variant. + +In each case, the institution listed itself as the copyright holder in reliance on rules of copyright ownership, called “[works made for hire][14]” rules, that give employers and clients ownership of copyright in some work their employees and contractors do on their behalf. These rules don’t usually apply to distributed collaborators submitting code voluntarily. This poses a problem for project-steward foundations, like the Apache Foundation and Eclipse Foundation, that accept contributions from a more diverse group of contributors. The usual foundation approach thus far has been to use a house license that states a single copyright holder—[Apache 2.0][8] and [EPL 1.0][15]—backed up by contributor license agreements—[Apache CLAs][16] and [Eclipse CLAs][17]—to collect rights from contributors. Collecting copyright ownership in one place is even more important under “copyleft” licenses like the GPL, which rely on copyright owners to enforce license conditions to promote software-freedom values. + +These days, loads of projects without any kind of institutional or business steward use MIT-style license terms. SPDX and OSI have helped these use cases by standardizing forms of licenses like MIT and ISC that don’t refer to a specific entity or institutional copyright holder. Armed with those forms, the prevailing practice of project authors is to fill their own name in the copyright notice of the form very early on … and maybe bump the year here and there. At least under United States copyright law, the resulting copyright notice doesn’t give a full picture. + +The original owner of a piece of software retains ownership of their work. But while MIT-style license terms give others rights to build on and change the software, creating what the law calls “derivative works”, they don’t give the original author ownership of copyright in others’ contributions. Rather, each contributor has copyright in any [even marginally creative][18] work they make using the existing code as a starting point. + +Most of these projects also balk at the idea of taking contributor license agreements, to say nothing of signed copyright assignments. That’s both naive and understandable. Despite the assumption of some newer open-source developers that sending a pull request on GitHub “automatically” licenses the contribution for distribution on the terms of the project’s existing license, United States law doesn’t recognize any such rule. Strong copyright protection, not permissive licensing, is the default. + +Update: GitHub later changed its site-wide terms of service to include an attempt to flip this default, at least on GitHub.com. I’ve written up some thoughts on that development, not all of them positive, in [another post][19]. + +To fill the gap between legally effective, well-documented grants of rights in contributions and no paper trail at all, some projects have adopted the [Developer Certificate of Origin][20], a standard statement contributors allude to using `Signed-Off-By` metadata tags in their Git commits. The Developer Certificate of Origin was developed for Linux kernel development in the wake of the infamous SCO lawsuits, which alleged that chunks of Linux’ code derived from SCO-owned Unix source. As a means of creating a paper trail showing that each line of Linux came from a contributor, the Developer Certificate of Origin functions nicely. While the Developer Certificate of Origin isn’t a license, it does provide lots of good evidence that those submitting code expected the project to distribute their code, and for others to use it under the kernel’s existing license terms. The kernel also maintains a machine-readable `CREDITS` file listing contributors with name, affiliation, contribution area, and other metadata. I’ve done [some][21] [experiments][22] adapting that approach for projects that don’t use the kernel’s development flow. + +#### License Grant + +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), + +The meat of The MIT License is, you guessed it, a license. In general terms, a license is permission that one person or legal entity—the “licensor”—gives another—the “licensee”—to do something the law would otherwise let them sue for. The MIT License is a promise not to sue. + +The law sometimes distinguishes licenses from promises to give licenses. If someone breaks a promise to give a license, you may be able to sue them for breaking their promise, but you may not end up with a license. “Hereby” is one of those hokey, archaic-sounding words lawyers just can’t get rid of. It’s used here to show that the license text itself gives the license, and not just a promise of a license. It’s a legal [IIFE][23]. + +While many licenses give permission to a specific, named licensee, The MIT License is a “public license”. Public licenses give everybody—the public at large—permission. This is one of the three great ideas in open-source licensing. The MIT License captures this idea by giving a license “to any person obtaining a copy of … the Software”. As we’ll see later, there is also a condition to receiving this license that ensures others will learn about their permission, too. + +The parenthetical with a capitalized term in quotation marks (a “Definition”), is the standard way to give terms specific meanings in American-style legal documents. Courts will reliably look back to the terms of the definition when they see a defined, capitalized term used elsewhere in the document. + +##### Grant Scope + +> to deal in the Software without restriction, + +From the licensee’s point of view, these are the seven most important words in The MIT License. The key legal concerns are getting sued for copyright infringement and getting sued for patent infringement. Neither copyright law nor patent law uses “to deal in” as a term of art; it has no specific meaning in court. As a result, any court deciding a dispute between a licensor and a licensee would ask what the parties meant and understood by this language. What the court will see is that the language is intentionally broad and open-ended. It gives licensees a strong argument against any claim by a licensor that they didn’t give permission for the licensee to do that specific thing with the software, even if the thought clearly didn’t occur to either side when the license was given. + +> 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, + +No piece of legal writing is perfect, “fully settled in meaning”, or unmistakably clear. Beware anyone who pretends otherwise. This is the least perfect part of The MIT License. There are three main issues: + +First, “including without limitation” is a legal antipattern. It crops up in any number of flavors: + + * “including, without limitation” + * “including, without limiting the generality of the foregoing” + * “including, but not limited to” + * many, many pointless variations + + + +All of these share a common purpose, and they all fail to achieve it reliably. Fundamentally, drafters who use them try to have their cake and eat it, too. In The MIT License, that means introducing specific examples of “dealing in the Software”—“use, copy, modify” and so on—without implying that licensee action has to be something like the examples given to count as “dealing in”. The trouble is that, if you end up needing a court to review and interpret the terms of a license, the court will see its job as finding out what those fighting meant by the language. If the court needs to decide what “deal in” means, it cannot “unsee” the examples, even if you tell it to. I’d argue that “deal in the Software without restriction” alone would be better for licensees. Also shorter. + +Second, the verbs given as examples of “deal in” are a hodgepodge. Some have specific meanings under copyright or patent law, others almost do or just plain don’t: + + * use appears in [United States Code title 35, section 271(a)][24], the patent law’s list of what patent owners can sue others for doing without permission. + + * copy appears in [United States Code title 17, section 106][25], the copyright law’s list of what copyright owners can sue others for doing without permission. + + * modify doesn’t appear in either copyright or patent statute. It is probably closest to “prepare derivative works” under the copyright statute, but may also implicate improving or otherwise derivative inventions. + + * merge doesn’t appear in either copyright or patent statute. “Merger” has a specific meaning in copyright, but that’s clearly not what’s intended here. Rather, a court would probably read “merge” according to its meaning in industry, as in “to merge code”. + + * publish doesn’t appear in either copyright or patent statute. Since “the Software” is what’s being published, it probably hews closest to “distribute” under the [copyright statute][25]. That statute also covers rights to perform and display works “publicly”, but those rights apply only to specific kinds of copyrighted work, like plays, sound recordings, and motion pictures. + + * distribute appears in the [copyright statute][25]. + + * sublicense is a general term of intellectual property law. The right to sublicense means the right to give others licenses of their own, to do some or all of what you have permission to do. The MIT License’s right to sublicense is actually somewhat unusual in open-source licenses generally. The norm is what Heather Meeker calls a “direct licensing” approach, where everyone who gets a copy of the software and its license terms gets a license direct from the owner. Anyone who might get a sublicense under the MIT License will probably end up with a copy of the license telling them they have a direct license, too. + + * sell copies of is a mongrel. It is close to “offer to sell” and “sell” in the [patent statute][24], but refers to “copies”, a copyright concept. On the copyright side, it seems close to “distribute”, but the [copyright statute][25] makes no mention of sales. + + * permit persons to whom the Software is furnished to do so seems redundant of “sublicense”. It’s also unnecessary to the extent folks who get copies also get a direct license. + + + + +Lastly, as a result of this mishmash of legal, industry, general-intellectual-property, and general-use terms, it isn’t clear whether The MIT License includes a patent license. The general language “deal in” and some of the example verbs, especially “use”, point toward a patent license, albeit a very unclear one. The fact that the license comes from the copyright holder, who may or may not have patent rights in inventions in the software, as well as most of the example verbs and the definition of “the Software” itself, all point strongly toward a copyright license. More recent permissive open-source licenses, like [Apache 2.0][8], address copyright, patent, and even trademark separately and specifically. + +##### Three License Conditions + +> subject to the following conditions: + +There’s always a catch! MIT has three! + +If you don’t follow The MIT License’s conditions, you don’t get the permission the license offers. So failing to do what the conditions say at least theoretically leaves you open to a lawsuit, probably a copyright lawsuit. + +Using the value of the software to the licensee to motivate compliance with conditions, even though the licensee paid nothing for the license, is the second great idea of open-source licensing. The last, not found in The MIT License, builds off license conditions: “Copyleft” licenses like the [GNU General Public License][9] use license conditions to control how those making changes can license and distribute their changed versions. + +##### Notice Condition + +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +If you give someone a copy of the software, you need to include the license text and any copyright notice. This serves a few critical purposes: + + 1. Gives others notice that they have permission for the software under the public license. This is a key part of the direct-licensing model, where each user gets a license direct from the copyright holder. + + 2. Makes known who’s behind the software, so they can be showered in praises, glory, and cold, hard cash donations. + + 3. Ensures the warranty disclaimer and limitation of liability (coming up next) follow the software around. Everyone who gets a copy should get a copy of those licensor protections, too. + + + + +There’s nothing to stop you charging for providing a copy, or even a copy in compiled form, without source code. But when you do, you can’t pretend that the MIT code is your own proprietary code, or provided under some other license. Those receiving get to know their rights under the “public license”. + +Frankly, compliance with this condition is breaking down. Nearly every open-source license has such an “attribution” condition. Makers of system and installed software often understand they’ll need to compile a notices file or “license information” screen, with copies of license texts for libraries and components, for each release of their own. The project-steward foundations have been instrumental in teaching those practices. But web developers, as a whole, haven’t got the memo. It can’t be explained away by a lack of tooling—there is plenty—or the highly modular nature of packages from npm and other repositories—which uniformly standardize metadata formats for license information. All the good JavaScript minifiers have command-line flags for preserving license header comments. Other tools will concatenate `LICENSE` files from package trees. There’s really no excuse. + +##### Warranty Disclaimer + +> 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. + +Nearly every state in the United States has enacted a version of the Uniform Commercial Code, a model statute of laws governing commercial transactions. Article 2 of the UCC—“Division 2” in California—governs contracts for sales of goods, from used automobiles bought off the lot to large shipments of industrial chemicals to manufacturing plants. + +Some of the UCC’s rules about sales contracts are mandatory. These rules always apply, whether those buying and selling like them or not. Others are just “defaults”. Unless buyers and sellers opt out in writing, the UCC implies that they want the baseline rule found in the UCC’s text for their deal. Among the default rules are implied “warranties”, or promises by sellers to buyers about the quality and usability of the goods being sold. + +There is a big theoretical debate about whether public licenses like The MIT License are contracts—enforceable agreements between licensors and licensees—or just licenses, which go one way, but may come with strings attached, their conditions. There is less debate about whether software counts as “goods”, triggering the UCC’s rules. There is no debate among licensors on liability: They don’t want to get sued for lots of money if the software they give away for free breaks, causes problems, doesn’t work, or otherwise causes trouble. That’s exactly the opposite of what three default rules for “implied warranties” do: + + 1. The implied warranty of “merchantability” under [UCC section 2-314][26] is a promise that “the goods”—the Software—are of at least average quality, properly packaged and labeled, and fit for the ordinary purposes they are intended to serve. This warranty applies only if the one giving the software is a “merchant” with respect to the software, meaning they deal in software and hold themselves out as skilled in software. + + 2. The implied warranty of “fitness for a particular purpose” under [UCC section 2-315][27] kicks in when the seller knows the buyer is relying on them to provide goods for a particular purpose. The goods need to actually be “fit” for that purpose. + + 3. The implied warranty of “noninfringement” is not part of the UCC, but is a common feature of general contract law. This implied promise protects the buyer if it turns out the goods they received infringe somebody else’s intellectual property rights. That would be the case if the software under The MIT License didn’t actually belong to the one trying to license it, or if it fell under a patent owned by someone else. + + + + +[Section 2-316(3)][28] of the UCC requires language opting out of, or “excluding”, implied warranties of merchantability and fitness for a particular purpose to be conspicuous. “Conspicuous” in turn means written or formatted to call attention to itself, the opposite of microscopic fine print meant to slip past unwary consumers. State law may impose a similar attention-grabbing requirement for disclaimers of noninfringement. + +Lawyers have long suffered under the delusion that writing anything in `ALL-CAPS` meets the conspicuous requirement. That isn’t true. Courts have criticized the Bar for pretending as much, and most everyone agrees all-caps does more to discourage reading than compel it. All the same, most open-source-license forms set their warranty disclaimers in all-caps, in part because that’s the only obvious way to make it stand out in plain-text `LICENSE` files. I’d prefer to use asterisks or other ASCII art, but that ship sailed long, long ago. + +##### Limitation of Liability + +> 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. + +The MIT License gives permission for software “free of charge”, but the law does not assume that folks receiving licenses free of charge give up their rights to sue when things go wrong and the licensor is to blame. “Limitations of liability”, often paired with “damages exclusions”, work a lot like licenses, as promises not to sue. But these are protections for the licensor against lawsuits by licensees. + +In general, courts read limitations of liability and damages exclusions warily, since they can shift an incredible amount of risk from one side to another. To protect the community’s vital interest in giving folks a way to redress wrongs done in court, they “strictly construe” language limiting liability, reading it against the one protected by it where possible. Limitations of liability have to be specific to stand up. Especially in “consumer” contracts and other situations where those giving up the right to sue lack sophistication or bargaining power, courts have sometimes refused to honor language that seemed buried out of sight. Partly for that reason, partly by sheer force of habit, lawyers tend to give limits of liability the all-caps treatment, too. + +Drilling down a bit, the “limitation of liability” part is a cap on the amount of money a licensee can sue for. In open-source licenses, that limit is always no money at all, $0, “not liable”. By contrast, in commercial licenses, it’s often a multiple of license fees paid in the last 12-month period, though it’s often negotiated. + +The “exclusion” part lists, specifically, kinds of legal claims—reasons to sue for damages—the licensor cannot use. Like many, many legal forms, The MIT License mentions actions “of contract”—for breaching a contract—and “of tort”. Tort rules are general rules against carelessly or maliciously harming others. If you run someone down on the road while texting, you have committed a tort. If your company sells faulty headphones that burn peoples’ ears off, your company has committed a tort. If a contract doesn’t specifically exclude tort claims, courts sometimes read exclusion language in a contract to prevent only contract claims. For good measure, The MIT License throws in “or otherwise”, just to catch the odd admiralty law or other, exotic kind of legal claim. + +The phrase “arising from, out of or in connection with” is a recurring tick symptomatic of the legal draftsman’s inherent, anxious insecurity. The point is that any lawsuit having anything to do with the software is covered by the limitation and exclusions. On the off chance something can “arise from”, but not “out of”, or “in connection with”, it feels better to have all three in the form, so pack ‘em in. Never mind that any court forced to split hairs in this part of the form will have to come up with different meanings for each, on the assumption that a professional drafter wouldn’t use different words in a row to mean the same thing. Never mind that in practice, where courts don’t feel good about a limitation that’s disfavored to begin with, they’ll be more than ready to read the scope trigger narrowly. But I digress. The same language appears in literally millions of contracts. + +#### Overall + +All these quibbles are a bit like spitting out gum on the way into church. The MIT License is a legal classic. The MIT License works. It is by no means a panacea for all software IP ills, in particular the software patent scourge, which it predates by decades. But MIT-style licenses have served admirably, fulfilling a narrow purpose—reversing troublesome default rules of copyright, sales, and contract law—with a minimal combination of discreet legal tools. In the greater context of computing, its longevity is astounding. The MIT License has outlasted and will outlast the vast majority of software licensed under it. We can only guess how many decades of faithful legal service it will have given when it finally loses favor. It’s been especially generous to those who couldn’t have afforded their own lawyer. + +We’ve seen how the The MIT License we know today is a specific, standardized set of terms, bringing order at long last to a chaos of institution-specific, haphazard variations. + +We’ve seen how its approach to attribution and copyright notice informed intellectual property management practices for academic, standards, commercial, and foundation institutions. + +We’ve seen how The MIT Licenses grants permission for software to all, for free, subject to conditions that protect licensors from warranties and liability. + +We’ve seen that despite some crusty verbiage and lawyerly affectation, one hundred and seventy one little words can get a hell of a lot of legal work done, clearing a path for open-source software through a dense underbrush of intellectual property and contract. + +I’m so grateful for all who’ve taken the time to read this rather long post, to let me know they found it useful, and to help improve it. As always, I welcome your comments via [e-mail][29], [Twitter][30], and [GitHub][31]. + +A number of folks have asked where they can read more, or find run-downs of other licenses, like the GNU General Public License or the Apache 2.0 license. No matter what your particular continuing interest may be, I heartily recommend the following books: + + * Andrew M. St. Laurent’s [Understanding Open Source & Free Software Licensing][32], from O’Reilly. + +I start with this one because, while it’s somewhat dated, its approach is also closest to the line-by-line approach used above. O’Reilly has made it [available online][33]. + + * Heather Meeker’s [Open (Source) for Business][34] + +In my opinion, by far the best writing on the GNU General Public License and copyleft more generally. This book covers the history, the licenses, their development, as well as compatibility and compliance. It’s the book I lend to clients considering or dealing with the GPL. + + * Larry Rosen’s [Open Source Licensing][35], from Prentice Hall. + +A great first book, also available for free [online][36]. This is the best introduction to open-source licensing and related law for programmers starting from scratch. This one is also a bit dated in some specific details, but Larry’s taxonomy of licenses and succinct summary of open-source business models stand the test of time. + + + + +All of these were crucial to my own education as an open-source licensing lawyer. Their authors are professional heroes of mine. Have a read! — K.E.M + +I license this article under a [Creative Commons Attribution-ShareAlike 4.0 license][37]. + + +-------------------------------------------------------------------------------- + +via: https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html + +作者:[Kyle E. Mitchell][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://kemitchell.com/ +[b]: https://github.com/lujun9972 +[1]: http://spdx.org/licenses/MIT +[2]: https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT +[3]: https://opensource.org +[4]: https://spdx.org +[5]: http://spdx.org/licenses/ +[6]: https://spdx.org/licenses/JSON +[7]: https://www.npmjs.com/package/licensor +[8]: https://www.apache.org/licenses/LICENSE-2.0 +[9]: https://www.gnu.org/licenses/gpl-3.0.en.html +[10]: http://spdx.org/licenses/BSD-4-Clause +[11]: https://spdx.org/licenses/BSD-3-Clause +[12]: https://spdx.org/licenses/BSD-2-Clause +[13]: http://www.isc.org/downloads/software-support-policy/isc-license/ +[14]: http://worksmadeforhire.com/ +[15]: https://www.eclipse.org/legal/epl-v10.html +[16]: https://www.apache.org/licenses/#clas +[17]: https://wiki.eclipse.org/ECA +[18]: https://en.wikipedia.org/wiki/Feist_Publications,_Inc.,_v._Rural_Telephone_Service_Co. +[19]: https://writing.kemitchell.com/2017/02/16/Against-Legislating-the-Nonobvious.html +[20]: http://developercertificate.org/ +[21]: https://github.com/berneout/berneout-pledge +[22]: https://github.com/berneout/authors-certificate +[23]: https://en.wikipedia.org/wiki/Immediately-invoked_function_expression +[24]: https://www.govinfo.gov/app/details/USCODE-2017-title35/USCODE-2017-title35-partIII-chap28-sec271 +[25]: https://www.govinfo.gov/app/details/USCODE-2017-title17/USCODE-2017-title17-chap1-sec106 +[26]: https://leginfo.legislature.ca.gov/faces/codes_displaySection.xhtml?sectionNum=2314.&lawCode=COM +[27]: https://leginfo.legislature.ca.gov/faces/codes_displaySection.xhtml?sectionNum=2315.&lawCode=COM +[28]: https://leginfo.legislature.ca.gov/faces/codes_displaySection.xhtml?sectionNum=2316.&lawCode=COM +[29]: mailto:kyle@kemitchell.com +[30]: https://twitter.com/kemitchell +[31]: https://github.com/kemitchell/writing/tree/master/_posts/2016-09-21-MIT-License-Line-by-Line.md +[32]: https://lccn.loc.gov/2006281092 +[33]: http://www.oreilly.com/openbook/osfreesoft/book/ +[34]: https://www.amazon.com/dp/1511617772 +[35]: https://lccn.loc.gov/2004050558 +[36]: http://www.rosenlaw.com/oslbook.htm +[37]: https://creativecommons.org/licenses/by-sa/4.0/legalcode From c9020684e080086a463250cc08f08117363579ab Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Feb 2019 17:48:29 +0800 Subject: [PATCH 361/813] PRF:20180128 Get started with Org mode without Emacs.md @lujun9972 --- ...Get started with Org mode without Emacs.md | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/translated/tech/20180128 Get started with Org mode without Emacs.md b/translated/tech/20180128 Get started with Org mode without Emacs.md index c61600bd52..da4443e4f1 100644 --- a/translated/tech/20180128 Get started with Org mode without Emacs.md +++ b/translated/tech/20180128 Get started with Org mode without Emacs.md @@ -1,29 +1,30 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(Get started with Org mode without Emacs) -[#]:via:(https://opensource.com/article/19/1/productivity-tool-org-mode) -[#]:author:(Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Org mode without Emacs) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-org-mode) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -在没有 Emacs 的情况下开始使用 Org mode +开始使用 Org 模式吧,在没有 Emacs 的情况下 ====== -不,你不需要 Emacs 也能用 Org,这是我开源工具系列的第 16 集,将会让你在 2019 年变得更加有生产率。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) +> 不,你不需要 Emacs 也能用 Org,这是我开源工具系列的第 16 集,将会让你在 2019 年变得更加有生产率。 -每到年初似乎总有这么一个疯狂的冲动来寻找提高生产率的方法。新年决心,正确地开始一年的冲动,以及"向前看"的态度都是这种冲动的表现。软件推荐通常都会选择闭源和专利软件。但这不是必须的。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +每到年初似乎总有这么一个疯狂的冲动来寻找提高生产率的方法。新年决心,正确地开始一年的冲动,以及“向前看”的态度都是这种冲动的表现。软件推荐通常都会选择闭源和专利软件。但这不是必须的。 这是我 2019 年改进生产率的 19 个新工具中的第 16 个。 ### Org (非 Emacs) -[Org mode][1] (或者就是 Org) 并不是新鲜货,但依然有许多人没有用过。他们很乐意试用一下以体验 Org 是如何改善生产率的。但最大的障碍来自于 Org 是与 Emacs 相沟联的,而且很多人都认为两者缺一不可。并不是这样的!一旦你理解了其基础,Org 就可以与各种其他工具和编辑器一起使用。 +[Org 模式][1] (或者就称为 Org) 并不是新鲜货,但依然有许多人没有用过。他们很乐意试用一下以体验 Org 是如何改善生产率的。但最大的障碍来自于 Org 是与 Emacs 相关联的,而且很多人都认为两者缺一不可。并不是这样的!一旦你理解了其基础,Org 就可以与各种其他工具和编辑器一起使用。 ![](https://opensource.com/sites/default/files/uploads/org-1.png) -Org,本质上,是一个结构化的文本文件。它有标题,子标题,以及各种关键字,其他工具可以根据这些关键字将文件解析成日程表和代办列表。Org 文件可以被任何纯文本编辑器编辑(例如。,[Vim][2],[Atom][3],或 [Visual Studio Code][4]),而且很多编辑器都有插件可以帮你创建和管理 Org 文件。 +Org,本质上,是一个结构化的文本文件。它有标题、子标题,以及各种关键字,其他工具可以根据这些关键字将文件解析成日程表和代办列表。Org 文件可以被任何纯文本编辑器编辑(例如,[Vim][2]、[Atom][3] 或 [Visual Studio Code][4]),而且很多编辑器都有插件可以帮你创建和管理 Org 文件。 一个基础的 Org 文件看起来是这样的: @@ -40,21 +41,21 @@ Org,本质上,是一个结构化的文本文件。它有标题,子标题    SCHEDULED: <2019-01-31 13:30-14:30> ``` -Org 是一种大纲格式,它使用 ***** 作为标识指明事项的级别。任何以 TODO( 是的,全大些) 开头的事项都代办事项。标注为 DONE 的工作表示该工作已经完成。SCHEDULED 和 DEADLINE 标识与该事务相关的日期和时间。如何任何地方都没有时间,则该事务被视为全天活动。 +Org 是一种大纲格式,它使用 `*` 作为标识指明事项的级别。任何以 `TODO`(是的,全大些)开头的事项都是代办事项。标注为 `DONE` 的工作表示该工作已经完成。`SCHEDULED` 和 `DEADLINE` 标识与该事务相关的日期和时间。如何任何地方都没有时间,则该事务被视为全天活动。 -使用正确的插件,你喜欢的文本编辑器可以成为一个充满生产率和组织能力的强大工具。例如,[vim-orgmode][5] 插件拥有函数来创建 Org 文件,语法高亮,以及各种用来生成跨文件的日程和综合代办事项列表的关键命令。 +使用正确的插件,你喜欢的文本编辑器可以成为一个充满生产率和组织能力的强大工具。例如,[vim-orgmode][5] 插件包括创建 Org 文件、语法高亮的功能,以及各种用来生成跨文件的日程和综合代办事项列表的关键命令。 ![](https://opensource.com/sites/default/files/uploads/org-2.png) -Atom 的 [Organized][6] 插件在屏幕右边添加一个侧边栏,用来现实 Org 文件中的日程和代办事项。默认情况下它从配置项中设置的路径中读取多个 Org 文件。Todo 侧边栏允许你通过点击未完事项来将其标记为已完成,它会自动更新源 Org 文件。 +Atom 的 [Organized][6] 插件可以在屏幕右边添加一个侧边栏,用来显示 Org 文件中的日程和代办事项。默认情况下它从配置项中设置的路径中读取多个 Org 文件。Todo 侧边栏允许你通过点击未完事项来将其标记为已完成,它会自动更新源 Org 文件。 ![](https://opensource.com/sites/default/files/uploads/org-3.png) -还有一大堆 Org 工具可以帮助你保持生产率。使用 Python,Perl,PHP,NodeJS 等库,你可以开发自己的脚本和工具。当然,少不了 [Emacs][7],它的核心功能就包括支持 Org。 +还有一大堆 Org 工具可以帮助你保持生产率。使用 Python、Perl、PHP、NodeJS 等库,你可以开发自己的脚本和工具。当然,少不了 [Emacs][7],它的核心功能就包括支持 Org。 ![](https://opensource.com/sites/default/files/uploads/org-4.png) -Org mode 是跟踪需要完成的工作和时间的最好工具之一。而且,与传闻相反,它无需 Emacs,任何一个文本编辑器都行。 +Org 模式是跟踪需要完成的工作和时间的最好工具之一。而且,与传闻相反,它无需 Emacs,任何一个文本编辑器都行。 -------------------------------------------------------------------------------- @@ -63,7 +64,7 @@ via: https://opensource.com/article/19/1/productivity-tool-org-mode 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8a72c8f14788cb454402655f38e03174d38414cd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Feb 2019 17:49:00 +0800 Subject: [PATCH 362/813] PRF:20180128 Get started with Org mode without Emacs.md @lujun9972 --- .../tech/20180128 Get started with Org mode without Emacs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20180128 Get started with Org mode without Emacs.md b/translated/tech/20180128 Get started with Org mode without Emacs.md index da4443e4f1..136a07538e 100644 --- a/translated/tech/20180128 Get started with Org mode without Emacs.md +++ b/translated/tech/20180128 Get started with Org mode without Emacs.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with Org mode without Emacs) From c2c0f07c3e2769b19ced4ac492c74e76618ff0e7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Feb 2019 17:52:15 +0800 Subject: [PATCH 363/813] PUB:20180128 Get started with Org mode without Emacs.md @lujun9972 https://linux.cn/article-10574-1.html --- .../20180128 Get started with Org mode without Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180128 Get started with Org mode without Emacs.md (98%) diff --git a/translated/tech/20180128 Get started with Org mode without Emacs.md b/published/20180128 Get started with Org mode without Emacs.md similarity index 98% rename from translated/tech/20180128 Get started with Org mode without Emacs.md rename to published/20180128 Get started with Org mode without Emacs.md index 136a07538e..1da7853e74 100644 --- a/translated/tech/20180128 Get started with Org mode without Emacs.md +++ b/published/20180128 Get started with Org mode without Emacs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10574-1.html) [#]: subject: (Get started with Org mode without Emacs) [#]: via: (https://opensource.com/article/19/1/productivity-tool-org-mode) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) From 5afd3b77296bb8e3c462ab00dd2db16e22b0b0b3 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Wed, 27 Feb 2019 06:39:03 -0600 Subject: [PATCH 364/813] Apply for Translating Apply for Translating --- sources/tech/20180122 Ick- a continuous integration system.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180122 Ick- a continuous integration system.md b/sources/tech/20180122 Ick- a continuous integration system.md index 4620e2c036..bd58198825 100644 --- a/sources/tech/20180122 Ick- a continuous integration system.md +++ b/sources/tech/20180122 Ick- a continuous integration system.md @@ -1,3 +1,4 @@ +tomjlw is translating Ick: a continuous integration system ====== **TL;DR:** Ick is a continuous integration or CI system. See for more information. From 5d9d71c0b5c0ca2f73c43967cb17b1dcf49b7d0e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 22:05:24 +0800 Subject: [PATCH 365/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170721=20Firefo?= =?UTF-8?q?x=20and=20org-protocol=20URL=20Capture=20sources/tech/20170721?= =?UTF-8?q?=20Firefox=20and=20org-protocol=20URL=20Capture.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...21 Firefox and org-protocol URL Capture.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20170721 Firefox and org-protocol URL Capture.md diff --git a/sources/tech/20170721 Firefox and org-protocol URL Capture.md b/sources/tech/20170721 Firefox and org-protocol URL Capture.md new file mode 100644 index 0000000000..b3d9032da4 --- /dev/null +++ b/sources/tech/20170721 Firefox and org-protocol URL Capture.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Firefox and org-protocol URL Capture) +[#]: via: (http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html) +[#]: author: (Andreas Viklund http://andreasviklund.com/) + +Firefox and org-protocol URL Capture +====== + +### Introduction + +As an Emacs guy, I attempt to force all my workflow into [org-mode][1] – for me life is better in text. + +I tend to prefer to store bookmarks in [org-mode][1] todo lists, and [org-protocol][2] allows external processes to interact with some of [org-mode's][1] features. Setup, though, is an hassle. There are plenty of tutorials out there ([search][3]), and there are Firefox [extensions][4], but overall I've not had great luck with them. + +I therefore decided to put my current setup in this blog post as another data point for those trying to get it all working. + +### Setup your Emacs Org Mode Configuration + +Enable org-protocol: + +``` +(require 'org-protocol) +``` + +Add a capture template - here's mine: + +``` +(setq org-capture-templates + (quote (... + ("w" "org-protocol" entry (file "~/org/refile.org") + "* TODO Review %a\n%U\n%:initial\n" :immediate-finish) + ...))) +``` + +The [capture templates][5] section in the [org-mode][1] manual will help. + +Add the default template to use: + +``` +(setq org-protocol-default-template-key "w") +``` + +Eval those additions so they're active in your current Emacs session. + +### A Quick Test + +Before going further, it's a good idea to test your configuration: + +``` +emacsclient -n "org-protocol:///capture?url=http%3a%2f%2fduckduckgo%2ecom&title=DuckDuckGo" +``` + +This should pop open a capture window based on the template you added. Until this works, no point in going forward. If it doesn't work, go back through the configuration above and ensure that you've eval'd the code blocks. + +If you have an old version of [org-mode][1] (older than 7, I believe), the format is different: the urlencoded form is replaced by slashes as separators of the url and title. A quick search will show you the difference. + +### Firefox Protocol + +Now to setup Firefox. Browse to about:config. Right-click on the list of configuration items, choose New -> Boolean, and enter network.protocol-handler.expose.org-protocol for the name and toggle the value to true. + +Some tutorials indicate this step is optional – YMMV. + +### Add Desktop File + +Most of the tutorials include this: + +Add ~/.local/share/applications/org-protocol.desktop: + +``` +[Desktop Entry] +Name=org-protocol +Exec=/path/to/emacsclient -n %u +Type=Application +Terminal=false +Categories=System; +MimeType=x-scheme-handler/org-protocol; +``` + +Then run your updater. For i3 I use (same as for gnome): + +``` +update-desktop-database ~/.local/share/applications/ +``` + +KDE has a different method… again some of the tutorials for getting org-protocol working can help. + +### Setup Capture Button in Firefox + +Create a bookmark (I create it in the toolbar) with the following "Location": + +``` +javascript:location.href="org-protocol:///capture?url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title||"[untitled page]") +``` + +After you save it, should you edit the bookmark, expect to see any spaces replaced by '%20' – the url encoding for a "space". + +Now when you click the bookmark, you should get a window opened in an Emacs frame, any random frame, showing your template. + + + +-------------------------------------------------------------------------------- + +via: http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html + +作者:[Andreas Viklund][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://andreasviklund.com/ +[b]: https://github.com/lujun9972 +[1]: http://orgmode.org/ +[2]: http://orgmode.org/worg/org-contrib/org-protocol.html +[3]: https://duckduckgo.com/?q=org-protocol+firefox&t=ffab&ia=qa +[4]: https://addons.mozilla.org/en-US/firefox/search/?q=org-protocol&cat=1,0&appver=53.0&platform=linux +[5]: http://orgmode.org/manual/Capture-templates.html From b2a79c62012b6ce54fe0e2416378e21b1502465a Mon Sep 17 00:00:00 2001 From: leommxj Date: Wed, 27 Feb 2019 23:55:23 +0800 Subject: [PATCH 366/813] translated --- ...ux systems from buffer overflow attacks.md | 133 ------------------ ...ux systems from buffer overflow attacks.md | 132 +++++++++++++++++ 2 files changed, 132 insertions(+), 133 deletions(-) delete mode 100644 sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md create mode 100644 translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md diff --git a/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md b/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md deleted file mode 100644 index 73aaa88e66..0000000000 --- a/sources/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md +++ /dev/null @@ -1,133 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (leommxj) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How ASLR protects Linux systems from buffer overflow attacks) -[#]: via: (https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -How ASLR protects Linux systems from buffer overflow attacks -====== - -![](https://images.idgesg.net/images/article/2019/01/shuffling-cards-100784640-large.jpg) - -Address Space Layout Randomization (ASLR) is a memory-protection process for operating systems that guards against buffer-overflow attacks. It helps to ensure that the memory addresses associated with running processes on systems are not predictable, thus flaws or vulnerabilities associated with these processes will be more difficult to exploit. - -ASLR is used today on Linux, Windows, and MacOS systems. It was first implemented on Linux in 2005. In 2007, the technique was deployed on Microsoft Windows and MacOS. While ASLR provides the same function on each of these operating systems, it is implemented differently on each one. - -The effectiveness of ASLR is dependent on the entirety of the address space layout remaining unknown to the attacker. In addition, only executables that are compiled as Position Independent Executable (PIE) programs will be able to claim the maximum protection from ASLR technique because all sections of the code will be loaded at random locations. PIE machine code will execute properly regardless of its absolute address. - -**[ Also see:[Invaluable tips and tricks for troubleshooting Linux][1] ]** - -### ASLR limitations - -In spite of ASLR making exploitation of system vulnerabilities more difficult, its role in protecting systems is limited. It's important to understand that ASLR: - - * Doesn't _resolve_ vulnerabilities, but makes exploiting them more of a challenge - * Doesn't track or report vulnerabilities - * Doesn't offer any protection for binaries that are not built with ASLR support - * Isn't immune to circumvention - - - -### How ASLR works - -ASLR increases the control-flow integrity of a system by making it more difficult for an attacker to execute a successful buffer-overflow attack by randomizing the offsets it uses in memory layouts. - -ASLR works considerably better on 64-bit systems, as these systems provide much greater entropy (randomization potential). - -### Is ASLR working on your Linux system? - -Either of the two commands shown below will tell you whether ASLR is enabled on your system. - -``` -$ cat /proc/sys/kernel/randomize_va_space -2 -$ sysctl -a --pattern randomize -kernel.randomize_va_space = 2 -``` - -The value (2) shown in the commands above indicates that ASLR is working in full randomization mode. The value shown will be one of the following: - -``` -0 = Disabled -1 = Conservative Randomization -2 = Full Randomization -``` - -If you disable ASLR and run the commands below, you should notice that the addresses shown in the **ldd** output below are all the same in the successive **ldd** commands. The **ldd** command works by loading the shared objects and showing where they end up in memory. - -``` -$ sudo sysctl -w kernel.randomize_va_space=0 <== disable -[sudo] password for shs: -kernel.randomize_va_space = 0 -$ ldd /bin/bash - linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) - /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) -$ ldd /bin/bash - linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) - /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) -``` - -If the value is set back to **2** to enable ASLR, you will see that the addresses will change each time you run the command. - -``` -$ sudo sysctl -w kernel.randomize_va_space=2 <== enable -[sudo] password for shs: -kernel.randomize_va_space = 2 -$ ldd /bin/bash - linux-vdso.so.1 (0x00007fff47d0e000) <== first set of addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f1cb7ce0000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1cb7cda000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1cb7af0000) - /lib64/ld-linux-x86-64.so.2 (0x00007f1cb8045000) -$ ldd /bin/bash - linux-vdso.so.1 (0x00007ffe1cbd7000) <== second set of addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fed59742000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed5973c000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed59552000) - /lib64/ld-linux-x86-64.so.2 (0x00007fed59aa7000) -``` - -### Attempting to bypass ASLR - -In spite of its advantages, attempts to bypass ASLR are not uncommon and seem to fall into several categories: - - * Using address leaks - * Gaining access to data relative to particular addresses - * Exploiting implementation weaknesses that allow attackers to guess addresses when entropy is low or when the ASLR implementation is faulty - * Using side channels of hardware operation - - - -### Wrap-up - -ASLR is of great value, especially when run on 64 bit systems and implemented properly. While not immune from circumvention attempts, it does make exploitation of system vulnerabilities considerably more difficult. Here is a reference that can provide a lot more detail [on the Effectiveness of Full-ASLR on 64-bit Linux][2], and here is a paper on one circumvention effort to [bypass ASLR][3] using branch predictors. - -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/3331199/linux/what-does-aslr-do-for-linux.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[leommxj](https://github.com/leommxj) -校对:[校对者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/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html -[2]: https://cybersecurity.upv.es/attacks/offset2lib/offset2lib-paper.pdf -[3]: http://www.cs.ucr.edu/~nael/pubs/micro16.pdf -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md b/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md new file mode 100644 index 0000000000..5d0c059f9b --- /dev/null +++ b/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (leommxj) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How ASLR protects Linux systems from buffer overflow attacks) +[#]: via: (https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +ASLR是如何保护Linux系统免受缓冲区溢出攻击的 +====== + +![](https://images.idgesg.net/images/article/2019/01/shuffling-cards-100784640-large.jpg) + +地址空间随机化( ASLR )是一种操作系统用来抵御缓冲区溢出攻击的内存保护机制。这种技术使得系统上运行的进程的内存地址无法预测,使得与这些进程有关的漏洞变得更加难以利用。 + +ASLR目前在 Linux , Windows 以及 MacOS 系统上都有使用。其最早出现在 2005 的Linux系统上。2007 年,这项技术被 Windows 和 MacOS 部署使用。尽管 ASLR 在各个系统上都提供相同的功能,却有着不同的实现。 + +ASLR的有效性依赖于整个地址空间布局对于攻击者保持未知。此外,只有编译时作为位置无关可执行文件(PIE)的程序才能得到ASLR最大的保护,因为只有这样,可执行文件的所有代码节区才会被加载在随机地址。PIE 代码不管绝对地址是多少都可以正确执行。 + +**[ 参见:[用于排除Linux故障的宝贵提示和技巧][1] ]** + +### ASLR 的局限性 + +尽管 ASLR 使得对系统漏洞的利用更加困难了,但其保护系统的能力是有限的。理解关于 ASLR 的以下几点是很重要的: + + * 不能解决漏洞,而是增加利用漏洞的难度 + * 并不追踪或报告漏洞 + * 不能对编译时没有开启 ASLR 支持的二进制文件提供保护 + * 不能避免被绕过 + + + +### ASLR 是如何工作的 + + + +ASLR通过对攻击者在进行缓冲区溢出攻击时所要用到的内存布局中的偏移做随机化来加大攻击成功的难度,从而增强了系统的控制流完整性。 + + +通常认为 ASLR 在64位系统上效果更好,因为64位系统提供了更大的熵(可随机的地址范围)。 + +### ASLR 是否正在你的 Linux 系统上运行? + +下面展示的两条命令都可以告诉你你的系统是否启用了 ASLR 功能 + +``` +$ cat /proc/sys/kernel/randomize_va_space +2 +$ sysctl -a --pattern randomize +kernel.randomize_va_space = 2 +``` + +上方指令结果中的数值 (2) 表示 ASLR 工作在全随机化模式。其可能为下面的几个数值之一: + +``` +0 = Disabled +1 = Conservative Randomization +2 = Full Randomization +``` + +如果你关闭了 ASLR 并且执行下面的指令,你将会注意到前后两条**ldd**的输出是完全一样的。**ldd**命令会加载共享对象并显示他们在内存中的地址。 + +``` +$ sudo sysctl -w kernel.randomize_va_space=0 <== disable +[sudo] password for shs: +kernel.randomize_va_space = 0 +$ ldd /bin/bash + linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) + /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) +$ ldd /bin/bash + linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) + /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) +``` + +如果将其重新设置为**2**来启用 ASLR,你将会看到每次运行**ldd**,得到的内存地址都不相同。 + +``` +$ sudo sysctl -w kernel.randomize_va_space=2 <== enable +[sudo] password for shs: +kernel.randomize_va_space = 2 +$ ldd /bin/bash + linux-vdso.so.1 (0x00007fff47d0e000) <== first set of addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f1cb7ce0000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1cb7cda000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1cb7af0000) + /lib64/ld-linux-x86-64.so.2 (0x00007f1cb8045000) +$ ldd /bin/bash + linux-vdso.so.1 (0x00007ffe1cbd7000) <== second set of addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fed59742000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed5973c000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed59552000) + /lib64/ld-linux-x86-64.so.2 (0x00007fed59aa7000) +``` + +### 尝试绕过 ASLR + +尽管这项技术有很多优点,绕过ASLR的攻击并不罕见,主要有以下几类: + + * 利用地址泄露 + * 访问与特定地址关联的数据 + * 针对ASLR 实现的缺陷来猜测地址,常见于系统熵过低或 ASLR 实现不完善。 + * 利用侧信道攻击 + +### 总结 + +ASLR 有很大的价值,尤其是在64位系统上运行并被正确实现时。虽然不能避免被绕过,但这项技术的确使得利用系统漏洞变得更加困难了。这份参考资料可以提供更多有关细节 [on the Effectiveness of Full-ASLR on 64-bit Linux][2] ,这篇论文介绍了一种利用分支预测绕过ASLR的技术 [bypass ASLR][3]。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[leommxj](https://github.com/leommxj) +校对:[校对者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/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[2]: https://cybersecurity.upv.es/attacks/offset2lib/offset2lib-paper.pdf +[3]: http://www.cs.ucr.edu/~nael/pubs/micro16.pdf +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 7aa0545e76e09ee077f68308bde07883e46adfb4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Feb 2019 23:59:54 +0800 Subject: [PATCH 367/813] PRF:20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @tomjlw --- ...eriences Every Linux Gamer Never Wanted.md | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md index b50dea4644..895ab25f2f 100644 --- a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md +++ b/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @@ -3,6 +3,8 @@ [![Linux 平台上玩家的问题](https://itsfoss.com/wp-content/uploads/2016/09/Linux-Gaming-Problems.jpg)][10] +(LCTT 译注:本文原文发表于 2016 年,可能有些信息已经过时。) + [在 Linux 平台上玩游戏][12] 并不是什么新鲜事,现在甚至有专门的 [Linux 游戏发行版][13],但是这不意味着在 Linux 上打游戏的体验和在 Windows 上一样顺畅。 为了确保我们和 Windows 用户同样地享受游戏乐趣,哪些问题是我们应该考虑的呢? @@ -13,79 +15,81 @@ 正如 [StemOS 主页][16]所说, 即便 SteamOS 是一个开源平台,但 Steam for Linux 仍然是专有的软件。如果 Steam for Linux 也开源,那么它从开源社区得到的支持将会是巨大的。既然它不是,那么 [Ascension 计划的诞生自然是不可避免的][17]: -[video](https://youtu.be/07UiS5iAknA) +- [Destination: Project Ascension • UI Design Mockups Reveal](https://youtu.be/07UiS5iAknA) -Ascension 开源的游戏启动器,旨在能够启动从任何平台购买、下载的游戏。这些游戏可以是 Steam 平台的、[Origin 游戏][18]平台的、Uplay 平台的,以及直接从游戏开发者主页或者从 DVD、CD-ROM 下载下来的。 +Ascension 是一个开源的游戏启动器,旨在能够启动从任何平台购买、下载的游戏。这些游戏可以是 Steam 平台的、[Origin 游戏][18]平台的、Uplay 平台的,以及直接从游戏开发者主页下载的,或者来自 DVD、CD-ROM 的。 -这是 Ascension 计划如何开始的:[头脑风暴][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表了自己的观点并给出建议。 +Ascension 计划的开端是这样:[某个观点的分享][19]激发了一场与游戏社区读者之间有趣的讨论,在这场讨论中读者们纷纷发表了自己的观点并给出建议。 ### #2 与 Windows 平台的性能比较 -在 Linux 平台上运行 Windows 游戏并不总是一件轻松的任务。但是感谢一个叫做 [CSMT][20](多线程命令流)的特性,尽管离 Windows 级别的性能还有相当长的路要走,PlayOnLinux 现在依旧可以更好地解决这些性能方面的问题。 +在 Linux 平台上运行 Windows 游戏并不总是一件轻松的任务。但是得益于一个叫做 [CSMT][20](多线程命令流)的特性,尽管离 Windows 级别的性能还有相当长的路要走,PlayOnLinux 现在依旧可以更好地解决这些性能方面的问题。 -Linux 对游戏的原生支持在过去发行的游戏中从未如人意。 +Linux 对游戏的原生支持在过去发行的游戏中从未尽如人意。 -去年,有报道说 SteamOS 比 Windows 在游戏方面的表现要[差得多][21]。古墓丽影去年在 SteamOS 及 Steam for Linux 上发行,然而基准测试的结果与 Windows 上的性能无法抗衡。 +去年,有报道说 SteamOS 比 Windows 在游戏方面的表现要[差得多][21]。古墓丽影去年在 SteamOS 及 Steam for Linux 上发行,然而其基准测试的结果与 Windows 上的性能无法抗衡。 -[视频](https://youtu.be/nkWUBRacBNE) +- [Destination: Tomb Raider benchmark video comparison, Linux vs Windows 10](https://youtu.be/nkWUBRacBNE) 这明显是因为游戏是基于 [DirectX][23] 而不是 [OpenGL][24] 开发的缘故。 -古墓丽影是[第一个使用 TressFX 的游戏][25]。这个视频包涵了 TressFX 的比较: +古墓丽影是[第一个使用 TressFX 的游戏][25]。下面这个视频包涵了 TressFX 的比较: -[视频](https://youtu.be/-IeY5ZS-LlA) +- [Destination: Tomb Raider Benchmark - Ubuntu 15.10 vs Windows 8.1 + Ubuntu 16.04 vs Windows 10](https://youtu.be/-IeY5ZS-LlA) 下面是另一个有趣的比较,它显示出使用 Wine + CSMT 带来的游戏性能比 Steam 上原生的 Linux 版游戏带来的游戏性能要好得多!这就是开源的力量! -[视频](https://youtu.be/sCJkC6oJ08A) +- [Destination: [LinuxBenchmark] Tomb Raider Linux vs Wine comparison](https://youtu.be/sCJkC6oJ08A) 以防 FPS 损失,TressFX 已经被关闭。 以下是另一个有关在 Linux 上最新发布的 “[Life is Strange][27]” 在 Linux 与 Windows 上的比较: -[视频](https://youtu.be/Vlflu-pIgIY) +- [Destination: Life is Strange on radeonsi (Linux nine_csmt vs Windows 10)](https://youtu.be/Vlflu-pIgIY) [Steam for Linux][28] 开始在这个新游戏上展示出比 Windows 更好的游戏性能,这是一件好事。 -在发布任何 Linux 版的游戏前,开发者应该考虑优化游戏,特别是基于 DirectX 并需要 OpenGL 转换的游戏。我们十分希望 Linux 上的[杀出重围:人类分裂][29]Deus Ex: Mankind Divided on Linux 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX 的游戏,我们希望它能良好地移植到 Linux 上。以下是该[游戏执行总监不得不说的话][30]。 +在发布任何 Linux 版的游戏前,开发者都应该考虑优化游戏,特别是基于 DirectX 并需要进行 OpenGL 转制的游戏。我们十分希望 Linux 上的[杀出重围:人类分裂][29]Deus Ex: Mankind Divided 在正式发行时能有一个好的基准测试结果。由于它是基于 DirectX 的游戏,我们希望它能良好地移植到 Linux 上。[该游戏执行总监说过这样的话][30]。 ### #3 专有的 NVIDIA 驱动 相比于 [NVIDIA][32],[AMD 对于开源的支持][31]绝对是值得称赞的。尽管 [AMD][33] 因其更好的开源驱动在 Linux 上的驱动支持挺不错,而 NVIDIA 显卡用户由于开源版本的 NVIDIA 显卡驱动 “Nouveau” 有限的能力,仍不得不用专有的 NVIDIA 驱动。 -在过去,传奇般的 Linus Torvalds 同样分享了他关于“来自 NVIDIA 的 Linux 支持完全不可接受”的想法。 +曾经,Linus Torvalds 大神也分享过他关于“来自 NVIDIA 的 Linux 支持完全不可接受”的想法。 -[视频](https://youtu.be/O0r6Pr_mdio) +- [Destination: Linus Torvalds Publicly Attacks NVidia for lack of Linux & Android Support](https://youtu.be/O0r6Pr_mdio) -你可以在这里观看完整的[谈话][35],尽管 NVIDIA 用 [承诺更好的 Linux 平台支持][36]作为回复,但其开源显卡驱动仍如之前一样毫无起色。 +你可以在这里观看完整的[谈话][35],尽管 NVIDIA 回应 [承诺更好的 Linux 平台支持][36],但其开源显卡驱动仍如之前一样毫无起色。 -### #4 需要Linux 平台上的 Uplay 和 Origin 的 DRM 支持 +### #4 需要 Linux 平台上的 Uplay 和 Origin 的 DRM 支持 -[视频](https://youtu.be/rc96NFwyxWU) +- [Destination: Uplay #1 Rayman Origins em Linux - como instalar - ago 2016](https://youtu.be/rc96NFwyxWU) -以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。视频上传者还建议说并不推荐使用 Wine 作为 Linux 上的主要的应用和游戏支持软件。相反,使用原生的应用更值得鼓励。 +以上的视频描述了如何在 Linux 上安装 [Uplay][37] DRM。视频上传者还建议说并不推荐使用 Wine 作为 Linux 上的主要的应用和游戏支持软件。相反,更鼓励使用原生的应用。 以下视频是一个关于如何在 Linux 上安装 [Origin][38] DRM 的教程。 -[视频](https://youtu.be/ga2lNM72-Kw) +- [Destination: Install EA Origin in Ubuntu with PlayOnLinux (Updated)](https://youtu.be/ga2lNM72-Kw) 数字版权管理(DRM)软件给游戏运行又加了一层阻碍,使得在 Linux 上良好运行 Windows 游戏这一本就充满挑战性的任务更有难度。因此除了使游戏能够运行之外,W.I.N.E 不得不同时负责运行像 Uplay 或 Origin 之类的 DRM 软件。如果能像 Steam 一样,Linux 也能够有自己原生版本的 Uplay 和 Origin 那就好了。 ### #5 DirectX 11 对于 Linux 的支持 -尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套调整需求。尽管去年通过 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣 [发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 +尽管我们在 Linux 平台上有可以运行 Windows 应用的工具,每个游戏为了能在 Linux 上运行都带有自己的配套调整需求。尽管去年在 Code Weavers 有一篇关于 [DirectX 11 对于 Linux 的支持][40] 的公告,在 Linux 上畅玩新发大作仍是长路漫漫。 -### #6 100% 的 Steam 游戏不适用于 Linux +现在你可以[从 Codweavers 购买 Crossover][41] 以获得可得到的最佳 DirectX 11 支持。这个在 Arch Linux 论坛上的[频道][42]清楚展现了将这个梦想成真需要多少的努力。以下是一个 [Reddit 频道][44] 上的有趣 [发现][43]。这个发现提到了[来自 Codeweavers 的 DirectX 11 补丁][45],现在看来这无疑是好消息。 -随着 Linux 游戏玩家持续错过每一款主要游戏的发行,这是需要考虑的一个重点,因为大部分主要游戏都在 Windows 上发行。以下是[如何在 Linux 上安装 Windows 版的 Steam 的教程][46]。 +### #6 不是全部的 Steam 游戏都可跑在 Linux 上 + +随着 Linux 游戏玩家一次次错过主要游戏的发行,这是需要考虑的一个重点,因为大部分主要游戏都在 Windows 上发行。这是[如何在 Linux 上安装 Windows 版的 Steam 的教程][46]。 ### #7 游戏发行商对 OpenGL 更好的支持 -目前开发者和发行商主要着眼于 DirectX 而不是 OpenGL 来开发游戏。现在随着 Steam 正式登录 Linux,开发者应该同样考虑在 OpenGL 下开发。 +目前开发者和发行商主要着眼于用 DirectX 而不是 OpenGL 来开发游戏。现在随着 Steam 正式登录 Linux,开发者应该同样考虑在 OpenGL 下开发。 -[Direct3D][47] 仅仅是为了 Windows 平台打造。而 OpenGL API 拥有开放性标准,并且它不仅能在 Windows 上同样也能在其它各种各样的平台上实现。 +[Direct3D][47] 仅仅是为 Windows 平台而打造。而 OpenGL API 拥有开放性标准,并且它不仅能在 Windows 上同样也能在其它各种各样的平台上实现。 -尽管是一篇很老的文章,[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。其所提出的观点确实十分明智,基于按时间排序的事件也能给予读者启迪。 +尽管是一篇很老的文章,但[这个很有价值的资源][48]分享了许多有关 OpenGL 和 DirectX 现状的很有想法的信息。其所提出的观点确实十分明智,基于按时间排序的事件也能给予读者启迪。 在 Linux 平台上发布大作的发行商绝不应该忽视一个事实:在 OpenGL 下直接开发游戏要比从 DirectX 移植到 OpenGL 合算得多。如果必须进行平台转制,移植必须被仔细优化并谨慎研究。发布游戏可能会有延迟,但这绝对值得。 @@ -95,7 +99,7 @@ Linux 对游戏的原生支持在过去发行的游戏中从未如人意。 via: https://itsfoss.com/linux-gaming-problems/ -作者:[Avimanyu Bandyopadhyay ][a] +作者:[Avimanyu Bandyopadhyay][a] 译者:[tomjlw](https://github.com/tomjlw) 校对:[wxy](https://github.com/wxy) From 15840b2ecca9e0d6d54ef37acc043f85cc1dd0eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Feb 2019 00:00:21 +0800 Subject: [PATCH 368/813] PUB:20160922 Annoying Experiences Every Linux Gamer Never Wanted.md @tomjlw https://linux.cn/article-10575-1.html --- ...0160922 Annoying Experiences Every Linux Gamer Never Wanted.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md (100%) diff --git a/translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/published/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md similarity index 100% rename from translated/tech/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md rename to published/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md From fc6c94dfadb201b1efd58e68427c1b563f9963b5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Feb 2019 00:19:34 +0800 Subject: [PATCH 369/813] PRF:20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @geekpi --- ...move Sudo Privileges To Users On Ubuntu.md | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md index 139301bcf9..f6828a77b9 100644 --- a/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md +++ b/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @@ -1,35 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) [#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -如何在 Ubuntu 上为用户授予和删除 sudo 权限 +如何在 Ubuntu 上为用户授予和移除 sudo 权限 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2019/02/sudo-privileges-720x340.png) -如你所知,用户可以在 Ubuntu 系统上使用 sudo 权限执行任何管理任务。在 Linux 机器上创建新用户时,他们无法执行任何管理任务,直到你将其加入 **“sudo” 组的成员**。在这个简短的教程中,我们将介绍如何将普通用户添加到 sudo 组以及删除给定的权限,使其成为普通用户。 +如你所知,用户可以在 Ubuntu 系统上使用 sudo 权限执行任何管理任务。在 Linux 机器上创建新用户时,他们无法执行任何管理任务,直到你将其加入 `sudo` 组的成员。在这个简短的教程中,我们将介绍如何将普通用户添加到 `sudo` 组以及移除给定的权限,使其成为普通用户。 -**在 Linux 上向普通用户授予 sudo 权限** +### 在 Linux 上向普通用户授予 sudo 权限 -通常,我们使用 **“adduser”** 命令创建新用户,如下所示。 +通常,我们使用 `adduser` 命令创建新用户,如下所示。 ``` $ sudo adduser ostechnix ``` -如果你希望新创建的用户使用 sudo 执行管理任务,只需使用以下命令将它添加到 sudo 组: +如果你希望新创建的用户使用 `sudo` 执行管理任务,只需使用以下命令将它添加到 `sudo` 组: ``` $ sudo usermod -a -G sudo hduser ``` -上面的命令将使名为 **“ostechnix”** 的用户成为 sudo 组的成员。 +上面的命令将使名为 `ostechnix` 的用户成为 `sudo` 组的成员。 -你也可以使用此命令将用户添加到 sudo 组。 +你也可以使用此命令将用户添加到 `sudo` 组。 ``` $ sudo adduser ostechnix sudo @@ -37,57 +38,56 @@ $ sudo adduser ostechnix sudo 现在,注销并以新用户身份登录,以使此更改生效。此时用户已成为管理用户。 -要验证它,只需在任何命令中使用 “sudo” 作为前缀。 +要验证它,只需在任何命令中使用 `sudo` 作为前缀。 ``` $ sudo mkdir /test [sudo] password for ostechnix: ``` -### 删除用户的 sudo 权限 +### 移除用户的 sudo 权限 -有时,你可能希望删除特定用户的 sudo 权限,而不用在 Linux 中删除它。要将任何用户设为普通用户,只需将其从 sudo 组中删除即可。 +有时,你可能希望移除特定用户的 `sudo` 权限,而不用在 Linux 中删除它。要将任何用户设为普通用户,只需将其从 `sudo` 组中删除即可。 -比如说如果要从 sudo 组中删除名为 **ostechnix** 的用户,只需运行: +比如说如果要从 `sudo` 组中删除名为 `ostechnix` 的用户,只需运行: ``` $ sudo deluser ostechnix sudo ``` -**示例输出:** +示例输出: ``` Removing user `ostechnix' from group `sudo' ... Done. ``` -此命令仅从 sudo 组中删除用户 “ostechnix”,但不会永久地从系统中删除用户。现在,它成为了普通用户,无法像 sudo 用户那样执行任何管理任务。 +此命令仅从 `sudo` 组中删除用户 `ostechnix`,但不会永久地从系统中删除用户。现在,它成为了普通用户,无法像 `sudo` 用户那样执行任何管理任务。 -此外,你可以使用以下命令撤消用户的 sudo 访问权限: +此外,你可以使用以下命令撤消用户的 `sudo` 访问权限: ``` $ sudo gpasswd -d ostechnix sudo ``` -从 sudo 组中删除用户时请小心。不要从 “sudo” 组中删除真正的管理员。 +从 `sudo` 组中删除用户时请小心。不要从 `sudo` 组中删除真正的管理员。 -使用命令验证用户 “ostechnix” 是否已从 sudo 组中删除: +使用命令验证用户 `ostechnix` 是否已从 `sudo` 组中删除: ``` $ sudo -l -U ostechnix User ostechnix is not allowed to run sudo on ubuntuserver. ``` -是的,用户 “ostechnix” 已从 sudo 组中删除,他无法执行任何管理任务。 +是的,用户 `ostechnix` 已从 `sudo` 组中删除,他无法执行任何管理任务。 -从 sudo 组中删除用户时请小心。如果你的系统上只有一个 sudo 用户,并且你将它从 sudo 组中删除了,那么就无法执行任何管理操作,例如在系统上安装、删除和更新程序。所以,请小心。在我们的下一篇教程中,我们将解释如何恢复用户的 sudo 权限。 +从 `sudo` 组中删除用户时请小心。如果你的系统上只有一个 `sudo` 用户,并且你将他从 `sudo` 组中删除了,那么就无法执行任何管理操作,例如在系统上安装、删除和更新程序。所以,请小心。在我们的下一篇教程中,我们将解释如何恢复用户的 `sudo` 权限。 就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! 干杯! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ @@ -95,7 +95,7 @@ via: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users- 作者:[SK][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 64d38ff8927bb9807213d822af396b84310fbd1b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Feb 2019 00:20:29 +0800 Subject: [PATCH 370/813] PUB:20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @geekpi https://linux.cn/article-10576-1.html --- ... To Grant And Remove Sudo Privileges To Users On Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md (98%) diff --git a/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/published/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md similarity index 98% rename from translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md rename to published/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md index f6828a77b9..a53e354779 100644 --- a/translated/tech/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md +++ b/published/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10576-1.html) [#]: subject: (How To Grant And Remove Sudo Privileges To Users On Ubuntu) [#]: via: (https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 52168f1c0207cccf070925d9b56b459e70b945ed Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Wed, 27 Feb 2019 17:00:29 +0000 Subject: [PATCH 371/813] Revert "translating by Flowsnow" This reverts commit 590a7c58a515abac030ff061af7486cd0ed3d7d6. --- ...4 An introduction to the Pyramid web framework for Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md b/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md index 03a6fa6494..a16e604774 100644 --- a/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md +++ b/sources/tech/20180514 An introduction to the Pyramid web framework for Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (Flowsnow) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Pyramid web framework for Python) From 22188b56cc39c8f6eaff823462ea4dde367176a8 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Wed, 27 Feb 2019 12:49:12 -0600 Subject: [PATCH 372/813] Submit for Review Submit for Review --- ...22 Ick- a continuous integration system.md | 76 ------------------- ...22 Ick- a continuous integration system.md | 74 ++++++++++++++++++ 2 files changed, 74 insertions(+), 76 deletions(-) delete mode 100644 sources/tech/20180122 Ick- a continuous integration system.md create mode 100644 translated/tech/20180122 Ick- a continuous integration system.md diff --git a/sources/tech/20180122 Ick- a continuous integration system.md b/sources/tech/20180122 Ick- a continuous integration system.md deleted file mode 100644 index bd58198825..0000000000 --- a/sources/tech/20180122 Ick- a continuous integration system.md +++ /dev/null @@ -1,76 +0,0 @@ -tomjlw is translating -Ick: a continuous integration system -====== -**TL;DR:** Ick is a continuous integration or CI system. See for more information. - -More verbose version follows. - -### First public version released - -The world may not need yet another continuous integration system (CI), but I do. I've been unsatisfied with the ones I've tried or looked at. More importantly, I am interested in a few things that are more powerful than what I've ever even heard of. So I've started writing my own. - -My new personal hobby project is called ick. It is a CI system, which means it can run automated steps for building and testing software. The home page is at , and the [download][1] page has links to the source code and .deb packages and an Ansible playbook for installing it. - -I have now made the first publicly advertised release, dubbed ALPHA-1, version number 0.23. It is of alpha quality, and that means it doesn't have all the intended features and if any of the features it does have work, you should consider yourself lucky. - -### Invitation to contribute - -Ick has so far been my personal project. I am hoping to make it more than that, and invite contributions. See the [governance][2] page for the constitution, the [getting started][3] page for tips on how to start contributing, and the [contact][4] page for how to get in touch. - -### Architecture - -Ick has an architecture consisting of several components that communicate over HTTPS using RESTful APIs and JSON for structured data. See the [architecture][5] page for details. - -### Manifesto - -Continuous integration (CI) is a powerful tool for software development. It should not be tedious, fragile, or annoying. It should be quick and simple to set up, and work quietly in the background unless there's a problem in the code being built and tested. - -A CI system should be simple, easy, clear, clean, scalable, fast, comprehensible, transparent, reliable, and boost your productivity to get things done. It should not be a lot of effort to set up, require a lot of hardware just for the CI, need frequent attention for it to keep working, and developers should never have to wonder why something isn't working. - -A CI system should be flexible to suit your build and test needs. It should support multiple types of workers, as far as CPU architecture and operating system version are concerned. - -Also, like all software, CI should be fully and completely free software and your instance should be under your control. - -(Ick is little of this yet, but it will try to become all of it. In the best possible taste.) - -### Dreams of the future - -In the long run, I would ick to have features like ones described below. It may take a while to get all of them implemented. - - * A build may be triggered by a variety of events. Time is an obvious event, as is source code repository for the project changing. More powerfully, any build dependency changing, regardless of whether the dependency comes from another project built by ick, or a package from, say, Debian: ick should keep track of all the packages that get installed into the build environment of a project, and if any of their versions change, it should trigger the project build and tests again. - - * Ick should support building in (or against) any reasonable target, including any Linux distribution, any free operating system, and any non-free operating system that isn't brain-dead. - - * Ick should manage the build environment itself, and be able to do builds that are isolated from the build host or the network. This partially works: one can ask ick to build a container and run a build in the container. The container is implemented using systemd-nspawn. This can be improved upon, however. (If you think Docker is the only way to go, please contribute support for that.) - - * Ick should support any workers that it can control over ssh or a serial port or other such neutral communication channel, without having to install an agent of any kind on them. Ick won't assume that it can have, say, a full Java run time, so that the worker can be, say, a micro controller. - - * Ick should be able to effortlessly handle very large numbers of projects. I'm thinking here that it should be able to keep up with building everything in Debian, whenever a new Debian source package is uploaded. (Obviously whether that is feasible depends on whether there are enough resources to actually build things, but ick itself should not be the bottleneck.) - - * Ick should optionally provision workers as needed. If all workers of a certain type are busy, and ick's been configured to allow using more resources, it should do so. This seems like it would be easy to do with virtual machines, containers, cloud providers, etc. - - * Ick should be flexible in how it can notify interested parties, particularly about failures. It should allow an interested party to ask to be notified over IRC, Matrix, Mastodon, Twitter, email, SMS, or even by a phone call and speech syntethiser. "Hello, interested party. It is 04:00 and you wanted to be told when the hello package has been built for RISC-V." - - - - -### Please give feedback - -If you try ick, or even if you've just read this far, please share your thoughts on it. See the [contact][4] page for where to send it. Public feedback is preferred over private, but if you prefer private, that's OK too. - --------------------------------------------------------------------------------- - -via: https://blog.liw.fi/posts/2018/01/22/ick_a_continuous_integration_system/ - -作者:[Lars Wirzenius][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://blog.liw.fi/ -[1]:http://ick.liw.fi/download/ -[2]:http://ick.liw.fi/governance/ -[3]:http://ick.liw.fi/getting-started/ -[4]:http://ick.liw.fi/contact/ -[5]:http://ick.liw.fi/architecture/ diff --git a/translated/tech/20180122 Ick- a continuous integration system.md b/translated/tech/20180122 Ick- a continuous integration system.md new file mode 100644 index 0000000000..eb1f3c6c45 --- /dev/null +++ b/translated/tech/20180122 Ick- a continuous integration system.md @@ -0,0 +1,74 @@ +Ick:一个连续集成系统 +====== + +**TL;DR:** Ick 是一个连续集成或者 CI 系统。访问 获取跟多信息。 + +更加详细的版本随后会出 + +### 首个公开版本发行 + +世界可能还不需要另一个连续集成系统(CI)但是我需要。我已对我尝试过或者看过的连续集成系统感到不满意了。更重要的是,几样我感兴趣的东西比我所听说过的连续集成系统要强大得多。因此我开始编写我自己的 CI 系统。 + +我的新个人业余项目叫做 ick。它是一个 CI 系统,这意味着他可以运行自动化的步骤来搭建、测试软件。它的主页是,[下载][1]页面有导向源码、.deb 包和用来安装的 Ansible 脚本的链接。 + +我现已发布了首个公开版本,绰号 ALPHA-1,版本号0.23。它现在是 alpha 品质,这意味着它并没拥有所有期望的特性,如果任何一个它已有的特性工作的话,你应该感到庆幸。 + +### 诚邀英才 + +Ick 目前是我的个人项目。我希望能让它不仅限于此,同时我也诚邀英才。访问[管理][2]页面查看章程,[开始][3]页面查看如何开始贡献的的小贴士,[联系][4]页面查看如何联络。 + +### 架构 + +Ick 拥有一个由几个通过 HTTPS 协议通信使用 RESTful API 和 JSON 处理结构化数据的部分组成的架构。访问[架构][5]页面查看细节。 + +### 宣言 + +连续集成(CI)是用于软件开发的强大工具。它不应枯燥、易溃或恼人。它搭建起来应简单快速,除非正在测试、搭建中的码有问题,不然它应在后台安静地工作。 + +一个连续集成系统应该简单、易用、清楚、干净、可扩展、快速、综合、透明、可靠并推动你的生产力。搭建它不应花大力气、不应需要专门为 CI 而造的硬件、不应需要频繁留意以使其保持工作、开发者永远不必思考为什么某样东西不工作。 + +一个连续集成系统应该足够灵活以适应你的搭建、测试需求。只要 CPU 架构和操作系统版本没问题,它应该支持各式操作者。 + +同时像所有软件一样,CI 应该彻彻底底的免费,你的 CI 应由你做主。 + +(目前的 Ick 仅稍具雏形,但是它会尝试着有朝一日变得完美,在最理想的情况下。) + +### 未来的梦想 + +长远来看,我希望 ick 拥有像下面所描述的特性。落实全部特性可能需要一些时间。 + +* 多种多样的事件都可以触发搭建。时间是一个明显的事件因为项目的源代码仓库改变了。更强大的是不管依赖是来自于 ick 搭建的另一个项目或则包比如说来自 Debian,任何用于搭建的依赖都会改变:ick 应当跟踪所有安装进一个项目搭建环境中的包,如果任何一个包的版本改变,都应再次触发项目搭建和测试。 + +* Ick 应该支持搭建任何合理的目标,包括任何 Linux 发行版,任何免费的操作系统,以及任何一息尚存的收费操作系统。 + +* Ick 应当不需要安装任何专门的代理,就能支持各种它能够通过 ssh 或者串口或者其它这种中性交流管道控制的操作者。Ick 不应默认它可以有比如说一个完整的 Java Runtime,如此一来,操作者就可以是一个微控制器了。 + +* Ick 应当能轻松掌控一大批项目。我觉得不管一个新的 Debian 源包何时上传,Ick 都应该要能够跟得上在 Debian 中搭建所有东西的进度。(明显这可行与否取决于是否有足够的资源确实用在搭建上,但是 Ick 自己不应有瓶颈。) + +* 如果有需要的话 Ick 应当有选择性地补给操作者。如果所有特定种类的操作者处于忙碌中且 Ick 被设置成允许使用更多资源的话,它就应该这么做。这看起来用虚拟机、容器、云提供商等做可能会简单一些。 + +* Ick 应当灵活提醒感兴趣的团体特别是关于其失败的方面。它应允许感兴趣的团体通过 IRC,Matrix,Mastodon, Twitter, email, SMS 甚至电话和语音合成来接受通知。例如“您好,感兴趣的团体。现在是四点钟您想被通知 hello 包什么时候为 RISC-V 搭建好。” + + + + +### 请提供反馈 + +如果你尝试 ick 或者甚至你仅仅是读到这,请在上面分享你的想法。[联系][4]页面查看如何发送反馈。相比私下反馈我更偏爱公开反馈。但如果你偏爱私下反馈,那也行。 + +-------------------------------------------------------------------------------- + +via: https://blog.liw.fi/posts/2018/01/22/ick_a_continuous_integration_system/ + +作者:[Lars Wirzenius][a] +译者:[tomjlw](https://github.com/tomjlw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://blog.liw.fi/ +[1]:http://ick.liw.fi/download/ +[2]:http://ick.liw.fi/governance/ +[3]:http://ick.liw.fi/getting-started/ +[4]:http://ick.liw.fi/contact/ +[5]:http://ick.liw.fi/architecture/ From af9643b2804a34bcdb7bd6e330fe805242ec30e8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 28 Feb 2019 08:52:37 +0800 Subject: [PATCH 373/813] translated --- ...ux Cockpit to manage system performance.md | 89 ------------------- ...ux Cockpit to manage system performance.md | 87 ++++++++++++++++++ 2 files changed, 87 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20190213 How to use Linux Cockpit to manage system performance.md create mode 100644 translated/tech/20190213 How to use Linux Cockpit to manage system performance.md diff --git a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md b/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md deleted file mode 100644 index 8619feb6c2..0000000000 --- a/sources/tech/20190213 How to use Linux Cockpit to manage system performance.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use Linux Cockpit to manage system performance) -[#]: via: (https://www.networkworld.com/article/3340038/linux/sitting-in-the-linux-cockpit.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -How to use Linux Cockpit to manage system performance -====== - -Linux Cockpit is a web-based interface that provides graphical administrative access to a system. Here's a look at what it allows you to control. - -![](https://images.idgesg.net/images/article/2019/02/cockpit_airline_airplane_control_pilot-by-southerlycourse-getty-100787904-large.jpg) - -If you haven't tried the relatively new Linux Cockpit, you might be surprised by all it can do. It's a user-friendly web-based console that provides some very easy ways to administer Linux systems — _through the **web**_. You can monitor system resources, add or remove accounts, monitor system usage, shut down the system and perform quite a few other tasks — all through a very accessible web connection. It's also very easy to set up and use. - -While many Linux sysadmins spend most of their time on the command line, access to a remote system using a tool like PuTTY doesn't always provide the most useful command output. Linux Cockpit provides graphs and easy-to-use forms for viewing performance measures and making changes to your systems. - -Linux Cockpit allows you to view many aspects of system performance and make configuration changes, though the task list may depend on the particular flavor of Linux that you are using. Some of the categories of tasks include the following: - - * Monitoring system activity (CPU, memory, disk IO and network traffics) — **System** - * Viewing system log entries — **Logs** - * Seeing how full your disk partitions are — **Storage** - * Watching networking activity (sent and received) — **Networking** - * Taking a look at user accounts — **Accounts** - * Checking the status of system services — **Services** - * Pulling up information on installed applications — **Applications** - * Viewing and installing available updates (if logged in as root) and restart the system if needed — **Software Updates** - * Opening and using a terminal window — **Terminal** - - - -Some Linux Cockpit installations will also allow you to run diagnostic reports, dump the kernel, examine SELinux (security) settings, and list subscriptions. - -Here's an example of system activity as displayed by Linux Cockpit: - -![cockpit activity][1] Sandra Henry-Stocker - -Linux Cockpit display of system activity - -### How to set up Linux Cockpit - -On some Linux installations (e.g., recent RHEL), Linux Cockpit may already be installed and ready for use. On others, you may have to take some easy steps to install it and make it accessible. - -On Ubuntu, for example, these commands should work: - -``` -$ sudo apt-get install cockpit -$ man cockpit <== just checking -$ sudo systemctl enable --now cockpit.socket -$ netstat -a | grep 9090 -tcp6 0 0 [::]:9090 [::]:* LISTEN -$ sudo systemctl enable --now cockpit.socket -$ sudo ufw allow 9090 -``` - -Once Linux Cockpit is enabled, point your browser at **https:// :9090**. - -A list of distributions that work with Cockpit along with installation instructions is available at [the Cockpit Project][2]. - -Linux Cockpit doesn't provide any recognition of **sudo** privileges without some additional configuration. If you are not allowed to make a change using the Cockpit interface, you will see one of those little red international prohibition signs imposed over the button you'd otherwise click on. - -To get sudo privileges working, you need to be sure that the user is in the **wheel** (RHEL) or **adm** (Debian) group in the **/etc/group** file, that the Server Administrator checkbox has been selected for this user account when logged into Cockpit as root and that the user selects "Reuse my password" when logging into Cockpit. - -It's nice to be able to get some graphical control over the Linux systems you administer even when they're thousands of miles away or lacking consoles. While I love working on the console, I like seeing a graph or a button now and then. Linux Cockpit provides a very useful interface for routine administrative tasks. - -Post updated Feb. 13, 11:30am ET - -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/3340038/linux/sitting-in-the-linux-cockpit.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://images.idgesg.net/images/article/2019/02/cockpit-activity-100787994-large.jpg -[2]: https://cockpit-project.org/running.html -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20190213 How to use Linux Cockpit to manage system performance.md b/translated/tech/20190213 How to use Linux Cockpit to manage system performance.md new file mode 100644 index 0000000000..b2c5136494 --- /dev/null +++ b/translated/tech/20190213 How to use Linux Cockpit to manage system performance.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Linux Cockpit to manage system performance) +[#]: via: (https://www.networkworld.com/article/3340038/linux/sitting-in-the-linux-cockpit.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何使用 Linux Cockpit 来管理系统性能 +====== + +Linux Cockpit 是一个基于 Web 界面的应用,它提供了对系统的图形化管理。看下它能够控制哪些。 + +![](https://images.idgesg.net/images/article/2019/02/cockpit_airline_airplane_control_pilot-by-southerlycourse-getty-100787904-large.jpg) + +如果你还没有尝试过相对较新的 Linux Cockpit,你可能会对它所能做的一切感到惊讶。它是一个用户友好的基于 Web 的控制台,提供了一些非常简单的方法来管理 Linux 系统 —_通过**web**_。你可以通过一个非常简单的 web 来监控系统资源、添加或删除帐户、监控系统使用情况、关闭系统以及执行其他一些其他任务。它的设置和使用也非常简单。 + +虽然许多 Linux 系统管理员将大部分时间花在命令行上,但使用 PuTTY 等工具访问远程系统并不总能提供最有用的命令输出。Linux Cockpit 提供了图形和易于使用的表单,来查看性能情况并对系统进行更改。 + +Linux Cockpit 能让你查看系统性能的许多方面并进行配置更改,但任务列表可能取决于你使用的特定 Linux。任务分类包括以下内容: + + * 监控系统活动(CPU、内存、磁盘 IO 和网络流量) — **系统** +  * 查看系统日志条目 — **日志** +  * 查看磁盘分区的容量 — **存储** +  * 查看网络活动(发送和接收) — **网络** +  * 查看用户帐户 — **帐户** +  * 检查系统服务的状态 — **服务** +  * 提取已安装应用的信息 — **应用** +  * 查看和安装可用更新(如果以 root 身份登录)并在需要时重新启动系统 — **软件更新** +  * 打开并使用终端窗口 — **终端** + + + +某些 Linux Cockpit 安装还允许你运行诊断报告、转储内核、检查 SELinux(安全)设置和列表订阅。 + +以下是 Linux Cockpit 显示的系统活动示例: + +![cockpit activity][1] Sandra Henry-Stocker + +Linux Cockpit 显示系统活动 + +### 如何设置 Linux Cockpit + +在某些 Linux 发行版(例如,最新的 RHEL)中,Linux Cockpit 可能已经安装并可以使用。在其他情况下,你可能需要采取一些简单的步骤来安装它并使其可使用。 + +例如,在 Ubuntu 上,这些命令应该可用: + +``` +$ sudo apt-get install cockpit +$ man cockpit <== just checking +$ sudo systemctl enable --now cockpit.socket +$ netstat -a | grep 9090 +tcp6 0 0 [::]:9090 [::]:* LISTEN +$ sudo systemctl enable --now cockpit.socket +$ sudo ufw allow 9090 +``` + +启用 Linux Cockpit 后,在浏览器中打开 **https:// :9090**。 + +可以在 [Cockpit Project]][2] 中找到可以使用 Cockpit 的发行版列表以及安装说明。 + +没有额外的配置,Linux Cockpit 将无法识别 **sudo** 权限。如果你被禁止使用 Cockpit 进行更改,你将会在你点击的按钮上看到一个红色的国际禁止标志。 + +要使 sudo 权限有效,你需要确保用户位于 **/etc/group** 文件中的 **wheel**(RHEL)或 **adm** (Debian)组中,即服务器当以 root 用户身份登录 Cockpit 并且用户在登录 Cockpit 时选择“重用我的密码”时,已勾选了 Server Administrator。 + +在你管理的系统在千里之外或者没有控制台时,能使用图形界面控制也不错。虽然我喜欢在控制台上工作,但我偶然也乐于见到图形或者按钮。Linux Cockpit 为日常管理任务提供了非常有用的界面。 + +在 [Facebook][3] 和 [LinkedIn][4] 中加入 Network World 社区,对你喜欢的文章评论。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3340038/linux/sitting-in-the-linux-cockpit.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://images.idgesg.net/images/article/2019/02/cockpit-activity-100787994-large.jpg +[2]: https://cockpit-project.org/running.html +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From c5e02d912dc630d337616d06dc09750453f6b1b1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 28 Feb 2019 08:57:30 +0800 Subject: [PATCH 374/813] translating --- sources/tech/20190223 Regex groups and numerals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190223 Regex groups and numerals.md b/sources/tech/20190223 Regex groups and numerals.md index 764ec1dfd5..c24505ee6b 100644 --- a/sources/tech/20190223 Regex groups and numerals.md +++ b/sources/tech/20190223 Regex groups and numerals.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From af11140d358c0b2998c2a92192f878fb5b6af89f Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 28 Feb 2019 12:56:53 +0800 Subject: [PATCH 375/813] translate done: 20170721 Firefox and org-protocol URL Capture.md --- ...21 Firefox and org-protocol URL Capture.md | 122 ------------------ ...21 Firefox and org-protocol URL Capture.md | 122 ++++++++++++++++++ 2 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20170721 Firefox and org-protocol URL Capture.md create mode 100644 translated/tech/20170721 Firefox and org-protocol URL Capture.md diff --git a/sources/tech/20170721 Firefox and org-protocol URL Capture.md b/sources/tech/20170721 Firefox and org-protocol URL Capture.md deleted file mode 100644 index b3d9032da4..0000000000 --- a/sources/tech/20170721 Firefox and org-protocol URL Capture.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Firefox and org-protocol URL Capture) -[#]: via: (http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html) -[#]: author: (Andreas Viklund http://andreasviklund.com/) - -Firefox and org-protocol URL Capture -====== - -### Introduction - -As an Emacs guy, I attempt to force all my workflow into [org-mode][1] – for me life is better in text. - -I tend to prefer to store bookmarks in [org-mode][1] todo lists, and [org-protocol][2] allows external processes to interact with some of [org-mode's][1] features. Setup, though, is an hassle. There are plenty of tutorials out there ([search][3]), and there are Firefox [extensions][4], but overall I've not had great luck with them. - -I therefore decided to put my current setup in this blog post as another data point for those trying to get it all working. - -### Setup your Emacs Org Mode Configuration - -Enable org-protocol: - -``` -(require 'org-protocol) -``` - -Add a capture template - here's mine: - -``` -(setq org-capture-templates - (quote (... - ("w" "org-protocol" entry (file "~/org/refile.org") - "* TODO Review %a\n%U\n%:initial\n" :immediate-finish) - ...))) -``` - -The [capture templates][5] section in the [org-mode][1] manual will help. - -Add the default template to use: - -``` -(setq org-protocol-default-template-key "w") -``` - -Eval those additions so they're active in your current Emacs session. - -### A Quick Test - -Before going further, it's a good idea to test your configuration: - -``` -emacsclient -n "org-protocol:///capture?url=http%3a%2f%2fduckduckgo%2ecom&title=DuckDuckGo" -``` - -This should pop open a capture window based on the template you added. Until this works, no point in going forward. If it doesn't work, go back through the configuration above and ensure that you've eval'd the code blocks. - -If you have an old version of [org-mode][1] (older than 7, I believe), the format is different: the urlencoded form is replaced by slashes as separators of the url and title. A quick search will show you the difference. - -### Firefox Protocol - -Now to setup Firefox. Browse to about:config. Right-click on the list of configuration items, choose New -> Boolean, and enter network.protocol-handler.expose.org-protocol for the name and toggle the value to true. - -Some tutorials indicate this step is optional – YMMV. - -### Add Desktop File - -Most of the tutorials include this: - -Add ~/.local/share/applications/org-protocol.desktop: - -``` -[Desktop Entry] -Name=org-protocol -Exec=/path/to/emacsclient -n %u -Type=Application -Terminal=false -Categories=System; -MimeType=x-scheme-handler/org-protocol; -``` - -Then run your updater. For i3 I use (same as for gnome): - -``` -update-desktop-database ~/.local/share/applications/ -``` - -KDE has a different method… again some of the tutorials for getting org-protocol working can help. - -### Setup Capture Button in Firefox - -Create a bookmark (I create it in the toolbar) with the following "Location": - -``` -javascript:location.href="org-protocol:///capture?url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title||"[untitled page]") -``` - -After you save it, should you edit the bookmark, expect to see any spaces replaced by '%20' – the url encoding for a "space". - -Now when you click the bookmark, you should get a window opened in an Emacs frame, any random frame, showing your template. - - - --------------------------------------------------------------------------------- - -via: http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html - -作者:[Andreas Viklund][a] -选题:[lujun9972][b] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://andreasviklund.com/ -[b]: https://github.com/lujun9972 -[1]: http://orgmode.org/ -[2]: http://orgmode.org/worg/org-contrib/org-protocol.html -[3]: https://duckduckgo.com/?q=org-protocol+firefox&t=ffab&ia=qa -[4]: https://addons.mozilla.org/en-US/firefox/search/?q=org-protocol&cat=1,0&appver=53.0&platform=linux -[5]: http://orgmode.org/manual/Capture-templates.html diff --git a/translated/tech/20170721 Firefox and org-protocol URL Capture.md b/translated/tech/20170721 Firefox and org-protocol URL Capture.md new file mode 100644 index 0000000000..0682649ed7 --- /dev/null +++ b/translated/tech/20170721 Firefox and org-protocol URL Capture.md @@ -0,0 +1,122 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(Firefox and org-protocol URL Capture) +[#]:via:(http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html) +[#]:author:(Andreas Viklund http://andreasviklund.com/) + +在 Firefox 上使用 org-protocol 捕获 URL +====== + +### 介绍 + +作为一名 Emacs 人,我尽可能让所有的工作流都在 [org-mode][1] 上进行 – 我比较喜欢文本。 + +我倾向于将书签记录为 [org-mode][1] 代办列表,而 [org-protocol][2] 则允许外部进程利用 [org-mode][1] 的某些功能。然而,要做到这一点配置起来很麻烦。([搜索引擎上 ][3]) 有很多教程,Firefox 也有很多这类 [扩展 ][4],然而我对它们都不太满意。 + +因此我决定将我现在的配置记录在这篇博客中,方便其他有需要的人使用。 + +### 配置 Emacs Org Mode + +启用 org-protocol: + +``` +(require 'org-protocol) +``` + +添加一个捕获模板 (capture template) - 我的配置是这样的: + +``` +(setq org-capture-templates + (quote (... + ("w" "org-protocol" entry (file "~/org/refile.org") + "* TODO Review %a\n%U\n%:initial\n" :immediate-finish) + ...))) +``` + +你可以从 [org-mode][1] 手册中 [capture templates][5] 章节中获取帮助。 + +设置默认使用的模板: + +``` +(setq org-protocol-default-template-key "w") +``` + +执行这些新增配置让它们在当前 Emacs 会话中生效。 + +### 快速测试 + +在下一步开始前,最好测试一下配置: + +``` +emacsclient -n "org-protocol:///capture?url=http%3a%2f%2fduckduckgo%2ecom&title=DuckDuckGo" +``` + +基于的配置的模板,可能会弹出一个捕获窗口。请确保正常工作,否则后面的操作没有任何意义。如果工作不正常,检查刚才的配置并且确保你执行了这些代码块。 + +如果你的 [org-mode][1] 版本比较老(老于 7 版本),测试的格式会有点不同:这种 URL 编码后的格式需要改成用斜杠来分割 url 和标题。在网上搜一下很容易找出这两者的不同。 + +### Firefox 协议 + +现在开始设置 Firefox。浏览 about:config。右击配置项列表,选择 New -> Boolean,然后输入 network.protocol-handler.expose.org-protocol 作为名字并且将值设置为 true。 + +有些教程说这一步是可以省略的 – 配不配因人而异。 + +### 添加 Desktop 文件 + +大多数的教程都有这一步: + +增加一个文件 ~/.local/share/applications/org-protocol.desktop: + +``` +[Desktop Entry] +Name=org-protocol +Exec=/path/to/emacsclient -n %u +Type=Application +Terminal=false +Categories=System; +MimeType=x-scheme-handler/org-protocol; +``` + +然后运行更新器。对于 i3 窗口管理器我使用下面命令(跟 gnome 一样): + +``` +update-desktop-database ~/.local/share/applications/ +``` + +KDE 的方法不太一样… 你可以查询其他相关教程。 + +### 在 FireFox 中设置捕获按钮 + +创建一个书签(我是在工具栏上创建这个书签的),地址栏输入下面内容: + +``` +javascript:location.href="org-protocol:///capture?url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title||"[untitled page]") +``` + +保存该书签后,再次编辑该书签,你应该会看到其中的所有空格都被替换成了 '%20' – 也就是空格的 URL 编码形式。 + +现在当你点击该书签,你就会在某个 Emacs Frame,可能是任何一个 Frame 中,打开一个窗口,显示你预定的模板。 + + + +-------------------------------------------------------------------------------- + +via: http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html + +作者:[Andreas Viklund][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://andreasviklund.com/ +[b]: https://github.com/lujun9972 +[1]: http://orgmode.org/ +[2]: http://orgmode.org/worg/org-contrib/org-protocol.html +[3]: https://duckduckgo.com/?q=org-protocol+firefox&t=ffab&ia=qa +[4]: https://addons.mozilla.org/en-US/firefox/search/?q=org-protocol&cat=1,0&appver=53.0&platform=linux +[5]: http://orgmode.org/manual/Capture-templates.html From 8c1df95647c48a70b82192a4166a167b007156e0 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 28 Feb 2019 13:01:42 +0800 Subject: [PATCH 376/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170519=20zsh=20?= =?UTF-8?q?shell=20inside=20Emacs=20on=20Windows=20sources/tech/20170519?= =?UTF-8?q?=20zsh=20shell=20inside=20Emacs=20on=20Windows.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...70519 zsh shell inside Emacs on Windows.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20170519 zsh shell inside Emacs on Windows.md diff --git a/sources/tech/20170519 zsh shell inside Emacs on Windows.md b/sources/tech/20170519 zsh shell inside Emacs on Windows.md new file mode 100644 index 0000000000..3a93941d0b --- /dev/null +++ b/sources/tech/20170519 zsh shell inside Emacs on Windows.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (zsh shell inside Emacs on Windows) +[#]: via: (https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) +[#]: author: (Peter Mosmans https://www.onwebsecurity.com/) + +zsh shell inside Emacs on Windows +====== + +![zsh shell inside Emacs on Windows][5] + +The most obvious advantage of running a cross-platform shell (for example Bash or zsh) is that you can use the same syntax and scripts on multiple platforms. Setting up (alternative) shells on Windows can be pretty tricky, but the small investment is well worth the reward. + +The MSYS2 subsystem allows you to run shells like Bash or zsh on Windows. An important part of MSYS2 is making sure that the search paths are all pointing to the MSYS2 subsystem: There are a lot of dependencies. + +Bash is the default shell once MSYS2 is installed; zsh can be installed using the package manager: + +``` +pacman -Sy zsh +``` + +Setting zsh as default shell can be done by modifying the ` /etc/passwd` file, for instance: + +``` +mkpasswd -c | sed -e 's/bash/zsh/' | tee -a /etc/passwd +``` + +This will change the default shell from bash to zsh. + +Running zsh under Emacs on Windows can be done by modifying the ` shell-file-name` variable, and pointing it to the zsh binary from the MSYS2 subsystem. The shell binary has to be somewhere in the Emacs ` exec-path` variable. + +``` +(setq shell-file-name (executable-find "zsh.exe")) +``` + +Don't forget to modify the PATH environment variable for Emacs, as the MSYS2 paths should be resolved before Windows paths. Using the same example, where MSYS2 is installed under + +``` +c:\programs\msys2 +``` + +: + +``` +(setenv "PATH" "C:\\programs\\msys2\\mingw64\\bin;C:\\programs\\msys2\\usr\\local\\bin;C:\\programs\\msys2\\usr\\bin;C:\\Windows\\System32;C:\\Windows") +``` + +After setting these two variables in the Emacs configuration file, running + +``` +M-x shell +``` + +in Emacs should bring up the familiar zsh prompt. + +Emacs' terminal settings (eterm) are different than MSYS2' standard terminal settings (xterm-256color). This means that some plugins or themes (prompts) might not work - especially when using oh-my-zsh. + +Detecting whether zsh is started under Emacs is easy, using the variable + +``` +$INSIDE_EMACS +``` + +. This codesnippet in + +``` +.zshrc +``` + +(which will be sourced for interactive shells) only enables the git plugin when being run in Emacs, and changes the theme + +``` +# Disable some plugins while running in Emacs +if [[ -n "$INSIDE_EMACS" ]]; then + plugins=(git) + ZSH_THEME="simple" +else + ZSH_THEME="compact-grey" +fi +``` + +. This codesnippet in(which will be sourced for interactive shells) only enables the git plugin when being run in Emacs, and changes the theme + +By adding the ` INSIDE_EMACS` variable to the local ` ~/.ssh/config` as ` SendEnv` variable... + +``` +Host myhost +SendEnv INSIDE_EMACS +``` + +... and to a ssh server as ` AcceptEnv` variable in ` /etc/ssh/sshd_config` ... + +``` +AcceptEnv LANG LC_* INSIDE_EMACS +``` + +... this even works when ssh'ing inside an Emacs shell session to another ssh server, running zsh. When ssh'ing in the zsh shell inside Emacs on Windows, using the parameters ` -t -t` forces pseudo-tty allocation (which is necessary, as Emacs on Windows don't have a true tty). + +Cross-platform, open-source goodyness... + +-------------------------------------------------------------------------------- + +via: https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html + +作者:[Peter Mosmans][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://www.onwebsecurity.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.onwebsecurity.com/category/configuration.html +[2]: https://www.onwebsecurity.com/tag/emacs.html +[3]: https://www.onwebsecurity.com/tag/msys2.html +[4]: https://www.onwebsecurity.com/tag/zsh.html +[5]: https://www.onwebsecurity.com//images/zsh-shell-inside-emacs-on-windows.png From 7e4c9966d53ec34c35aa2dc9aa0b6b550a1000e1 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 28 Feb 2019 13:03:57 +0800 Subject: [PATCH 377/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170223=20Use=20?= =?UTF-8?q?Emacs=20to=20create=20OAuth=202.0=20UML=20sequence=20diagrams?= =?UTF-8?q?=20sources/tech/20170223=20Use=20Emacs=20to=20create=20OAuth=20?= =?UTF-8?q?2.0=20UML=20sequence=20diagrams.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... create OAuth 2.0 UML sequence diagrams.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md diff --git a/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md b/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md new file mode 100644 index 0000000000..361ca1d49b --- /dev/null +++ b/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs to create OAuth 2.0 UML sequence diagrams) +[#]: via: (https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) +[#]: author: (Peter Mosmans https://www.onwebsecurity.com) + +Use Emacs to create OAuth 2.0 UML sequence diagrams +====== + +![OAuth 2.0 abstract protocol flow][6] + +It seems that the [OAuth 2.0 framework][7] is more and more being used by web (and mobile) applications. Great ! + +Although the protocol itself is not that complex, there are a number of different use-cases, flows and implementations to choose from. As with most things in life, the devil is in the detail. + +When reviewing OAuth 2.0 implementations or writing penetration testing reports I like to draw UML diagrams. That makes it easier to understand what's going on, and to spot potential issues. After all, a picture is worth a thousand words. + +This can be done extremely easy using the GPL-licensed open source [Emacs][8] editor, in conjunction with the GPL-licensed open source tool [PlantUML][9] (and optionally using Eclipse Public Licensed [Graphviz][10]). + +Emacs is worlds' most versatile editor. In this case, it's being used to edit the text, and automatically convert the text to an image. PlantUML is a tool which allows you to write UML in human readable text and does the actual conversion. Graphviz is visualization software, and optionally - in this case, it's used to show certain images. + +Download the [compiled PlantUML jar file][11], [Emacs][12] and optionally download and install [Graphviz][13]. + +Once you have Emacs installed and running, the following Lisp code (actually configuration) in your startup file (` ~/.emacs.d/init.d` ) will + + * configure ` org-mode` (a mode to organize and edit text files) to use PlantUML + * add ` plantuml` to the recognized ` org-babel` languages (which allows you to execute source code from within text files) + * allow the execution of PlantUML code as "safe" + * automatically show you the resulting image + + + +``` + ;; tell org-mode where to find the plantuml JAR file (specify the JAR file) +(setq org-plantuml-jar-path (expand-file-name "~/plantuml.jar")) + +;; use plantuml as org-babel language +(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))) + +;; helper function +(defun my-org-confirm-babel-evaluate (lang body) +"Do not ask for confirmation to evaluate code for specified languages." +(member lang '("plantuml"))) + +;; trust certain code as being safe +(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) + +;; automatically show the resulting image +(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) +``` + +If you don't have a startup file yet, add this code to the file ` ~/.emacs.d/init.el` and restart Emacs. + +Hint: Control-c Control-f allows you to create/open a (new) file. Control-x Control-s saves a file, and Control-x Control-c exits Emacs. + +That's it! + +To test the configuration, create/open a file ( Control-c Control-f ) with the extension ` .org` , e.g. ` test.org` . This makes sure that Emacs switches to "org-mode" and recognizes the "org-babel" syntax. + +Insert the following code, and press Control-c Control-c within the code to test the installation: + +``` +#+BEGIN_SRC plantuml :file test.png +@startuml +version +@enduml +#+END_SRC +``` + +If everything went well, you'll see an image appearing inside Emacs, below the text. + +Note + +To quickly insert code snippets like ` #+BEGIN_SRC` and ` #+END_SRC` , you can use the built-in Easy Templates system: Type user : request authorization +note left +**grant types**: +# authorization code +# implicit +# password +# client_credentials +end note +user --> client : authorization grant +end + +group token is generated +client -> authorization : request token\npresent authorization grant +authorization --> client :var: access token +note left +**response types**: +# code +# token +end note +end group + +group resource can be accessed +client -> resource : request resource\npresent token +resource --> client : resource +end group +@enduml +#+END_SRC +``` + +Don't you just love the versatility of Emacs, and open source tools ? + +-------------------------------------------------------------------------------- + +via: https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html + +作者:[Peter Mosmans][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://www.onwebsecurity.com +[b]: https://github.com/lujun9972 +[1]: https://www.onwebsecurity.com/category/configuration.html +[2]: https://www.onwebsecurity.com/tag/emacs.html +[3]: https://www.onwebsecurity.com/tag/oauth2.html +[4]: https://www.onwebsecurity.com/tag/pentesting.html +[5]: https://www.onwebsecurity.com/tag/security.html +[6]: https://www.onwebsecurity.com/images/oauth2-abstract-protocol-flow.png +[7]: https://tools.ietf.org/html/rfc6749 +[8]: https://www.gnu.org/software/emacs/ +[9]: https://plantuml.com +[10]: http://www.graphviz.org/ +[11]: http://plantuml.com/download +[12]: https://www.gnu.org/software/emacs/download.html +[13]: http://www.graphviz.org/Download.php From 339456790e4d427f3d04fac090a5c7fb10a50e7b Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 28 Feb 2019 13:31:22 +0800 Subject: [PATCH 378/813] Translating 7 steps for hunting down Python code bugs. --- ...190208 7 steps for hunting down Python code bugs.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index ae9840b05f..5be6735dc7 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -53,15 +53,15 @@ 那就该检查整个调用栈。问题很可能在于你的代码而不算 Python 核心或者第三方包,所以先检查调用栈内你的代码。另外,在你的代码中放置断点通常会更容易检查代码。在调用栈的代码中放置断点然后看看周围是否如你预期。 -"But Maria," I hear you say, "this is all helpful if I have a stack trace, but I just have a failing test. Where do I start?" +“但是,玛丽,”我听到你说,“如果我有一个调用栈,那这些都是有帮助的,但我只有一个失败的测试。我该从哪里开始?” -Pdb, the Python Debugger. +Pdb, 一个 Python 调试器。 -Find a place in your code where you know this call should hit. You should be able to find at least one place. Stick a pdb break in there. +找到你代码里会被这个调用命中的地方。你应该能至少找到一个这样的地方。在那里打上一个 pdb 的断点。 -#### A digression +#### 一句题外话 -Why not a print statement? I used to depend on print statements. They still come in handy sometimes. But once I started working with complicated code bases, and especially ones making network calls, print just became too slow. I ended up with print statements all over the place, I lost track of where they were and why, and it just got complicated. But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful. +为什么不使用 print 语句呢?我曾经依赖于 print 语句。他们有时候仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。 But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful. You follow my advice, and put in a pdb break and run your test. And it whooshes on by and fails again, with no break at all. Leave your breakpoint in, and run a test already in your test suite that does something very similar to the broken test. If you have a decent test suite, you should be able to find a test that is hitting the same code you think your failed test should hit. Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. From 5e9c57a5b5934631e6e9cfefd970dbcbf7f741ed Mon Sep 17 00:00:00 2001 From: MjSeven Date: Thu, 28 Feb 2019 15:04:30 +0800 Subject: [PATCH 379/813] Translating by MjSeven --- sources/tech/20190206 Getting started with Vim visual mode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190206 Getting started with Vim visual mode.md b/sources/tech/20190206 Getting started with Vim visual mode.md index e6b9b1da9b..eadc031b88 100644 --- a/sources/tech/20190206 Getting started with Vim visual mode.md +++ b/sources/tech/20190206 Getting started with Vim visual mode.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 43b474fef2236439d6efa15b59ea6d34ef7255b0 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 28 Feb 2019 20:46:57 +0800 Subject: [PATCH 380/813] translate done: 20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md --- ... create OAuth 2.0 UML sequence diagrams.md | 151 ------------------ ... create OAuth 2.0 UML sequence diagrams.md | 151 ++++++++++++++++++ 2 files changed, 151 insertions(+), 151 deletions(-) delete mode 100644 sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md create mode 100644 translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md diff --git a/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md b/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md deleted file mode 100644 index 361ca1d49b..0000000000 --- a/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md +++ /dev/null @@ -1,151 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Emacs to create OAuth 2.0 UML sequence diagrams) -[#]: via: (https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) -[#]: author: (Peter Mosmans https://www.onwebsecurity.com) - -Use Emacs to create OAuth 2.0 UML sequence diagrams -====== - -![OAuth 2.0 abstract protocol flow][6] - -It seems that the [OAuth 2.0 framework][7] is more and more being used by web (and mobile) applications. Great ! - -Although the protocol itself is not that complex, there are a number of different use-cases, flows and implementations to choose from. As with most things in life, the devil is in the detail. - -When reviewing OAuth 2.0 implementations or writing penetration testing reports I like to draw UML diagrams. That makes it easier to understand what's going on, and to spot potential issues. After all, a picture is worth a thousand words. - -This can be done extremely easy using the GPL-licensed open source [Emacs][8] editor, in conjunction with the GPL-licensed open source tool [PlantUML][9] (and optionally using Eclipse Public Licensed [Graphviz][10]). - -Emacs is worlds' most versatile editor. In this case, it's being used to edit the text, and automatically convert the text to an image. PlantUML is a tool which allows you to write UML in human readable text and does the actual conversion. Graphviz is visualization software, and optionally - in this case, it's used to show certain images. - -Download the [compiled PlantUML jar file][11], [Emacs][12] and optionally download and install [Graphviz][13]. - -Once you have Emacs installed and running, the following Lisp code (actually configuration) in your startup file (` ~/.emacs.d/init.d` ) will - - * configure ` org-mode` (a mode to organize and edit text files) to use PlantUML - * add ` plantuml` to the recognized ` org-babel` languages (which allows you to execute source code from within text files) - * allow the execution of PlantUML code as "safe" - * automatically show you the resulting image - - - -``` - ;; tell org-mode where to find the plantuml JAR file (specify the JAR file) -(setq org-plantuml-jar-path (expand-file-name "~/plantuml.jar")) - -;; use plantuml as org-babel language -(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))) - -;; helper function -(defun my-org-confirm-babel-evaluate (lang body) -"Do not ask for confirmation to evaluate code for specified languages." -(member lang '("plantuml"))) - -;; trust certain code as being safe -(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) - -;; automatically show the resulting image -(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) -``` - -If you don't have a startup file yet, add this code to the file ` ~/.emacs.d/init.el` and restart Emacs. - -Hint: Control-c Control-f allows you to create/open a (new) file. Control-x Control-s saves a file, and Control-x Control-c exits Emacs. - -That's it! - -To test the configuration, create/open a file ( Control-c Control-f ) with the extension ` .org` , e.g. ` test.org` . This makes sure that Emacs switches to "org-mode" and recognizes the "org-babel" syntax. - -Insert the following code, and press Control-c Control-c within the code to test the installation: - -``` -#+BEGIN_SRC plantuml :file test.png -@startuml -version -@enduml -#+END_SRC -``` - -If everything went well, you'll see an image appearing inside Emacs, below the text. - -Note - -To quickly insert code snippets like ` #+BEGIN_SRC` and ` #+END_SRC` , you can use the built-in Easy Templates system: Type user : request authorization -note left -**grant types**: -# authorization code -# implicit -# password -# client_credentials -end note -user --> client : authorization grant -end - -group token is generated -client -> authorization : request token\npresent authorization grant -authorization --> client :var: access token -note left -**response types**: -# code -# token -end note -end group - -group resource can be accessed -client -> resource : request resource\npresent token -resource --> client : resource -end group -@enduml -#+END_SRC -``` - -Don't you just love the versatility of Emacs, and open source tools ? - --------------------------------------------------------------------------------- - -via: https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html - -作者:[Peter Mosmans][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://www.onwebsecurity.com -[b]: https://github.com/lujun9972 -[1]: https://www.onwebsecurity.com/category/configuration.html -[2]: https://www.onwebsecurity.com/tag/emacs.html -[3]: https://www.onwebsecurity.com/tag/oauth2.html -[4]: https://www.onwebsecurity.com/tag/pentesting.html -[5]: https://www.onwebsecurity.com/tag/security.html -[6]: https://www.onwebsecurity.com/images/oauth2-abstract-protocol-flow.png -[7]: https://tools.ietf.org/html/rfc6749 -[8]: https://www.gnu.org/software/emacs/ -[9]: https://plantuml.com -[10]: http://www.graphviz.org/ -[11]: http://plantuml.com/download -[12]: https://www.gnu.org/software/emacs/download.html -[13]: http://www.graphviz.org/Download.php diff --git a/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md b/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md new file mode 100644 index 0000000000..996c45aaa2 --- /dev/null +++ b/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @@ -0,0 +1,151 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(Use Emacs to create OAuth 2.0 UML sequence diagrams) +[#]:via:(https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) +[#]:author:(Peter Mosmans https://www.onwebsecurity.com) + +使用 Emacs 创建 OAuth 2.0 的 UML 序列图 +====== + +![OAuth 2.0 abstract protocol flow][6] + +看起来 [OAuth 2.0 框架 ][7] 已经越来越广泛地应用于 web (和 移动) 应用。太棒了! + +虽然协议本身并不复杂,但有很多的使用场景,流程和实现可供选择。正如生活中的大多数事物一样,魔鬼在于细节之中。 + +在审查 OAuth 2.0 实现或编写渗透测试报告时我习惯画出 UML 图。这方便让人理解发生了什么事情,并发现潜在的问题。毕竟,一图抵千言。 + +使用基于 GPL 开源协议 [Emacs][8] 编辑器来实现,再加上基于 GPL 开源协议的工具 [PlantUML][9] (也可以选择基于 Eclipse Public 协议的 [Graphviz][10]) 很容易做到这一点。 + +Emacs 是世界上最万能的编辑器。在这种场景中,我们用它来编辑文本,并自动将文本转换成图片。PlantUML 是一个允许你用人类可读的文本来写 UML 并完成该转换的工具。Graphviz 是一个可视化的软件,这里我们可以用它来显示图片。 + +下载 [预先编译好了的 PlantUML jar 文件 ][11],[Emacs][12] 还可以选择下载并安装 [Graphviz][13]。 + +安装并启动 Emacs,然后将下面 Lisp 代码(实际上是配置)写入你的启动文件中(` ~/.emacs.d/init.d` ),这段代码将会 + + * 配置 ` org-mode` (一种用来组织并编辑文本文件的模式) 来使用 PlantUML + * 将 ` plantuml` 添加到可识别的` org-babel` 语言中 (这让你可以在文本文件中执行源代码) + * 将 PlantUML 代码标注为安全的,从而允许执行 + * 自动显示生成的结果图片 + + + +```elisp + ;; tell org-mode where to find the plantuml JAR file (specify the JAR file) +(setq org-plantuml-jar-path (expand-file-name "~/plantuml.jar")) + +;; use plantuml as org-babel language +(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))) + +;; helper function +(defun my-org-confirm-babel-evaluate (lang body) +"Do not ask for confirmation to evaluate code for specified languages." +(member lang '("plantuml"))) + +;; trust certain code as being safe +(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) + +;; automatically show the resulting image +(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) +``` + +如果你还没有启动文件,那么将该代码加入到 `~/.emacs.d/init.el` 文件中然后重启 Emacs。 + +提示:Control-c Control-f 可以让你创建/打开(新)文件。Control-x Control-s 保存文件,而 Control-x Control-c 退出 Emacs。 + +这就结了! + +要测试该配置,可以创建/打开( Control-c Control-f )后缀为 `.org` 的文件,例如 `test.org` . 这回让 Emacs 切换到 "org-mode" 并识别 "org-babel" 语法。 + +输入下面代码,然后在代码中输入 Control-c Control-c 来测试是否安装正常: + +``` +#+BEGIN_SRC plantuml :file test.png +@startuml +version +@enduml +#+END_SRC +``` + +一切顺利的话,你会在 Emacs 中看到文本下面显示了一张图片。 + +注意 + +要快速插入类似 ` #+BEGIN_SRC` 和 ` #+END_SRC` 这样的代码片段,你可以使用内置的 Easy Templates 系统:输入 user : request authorization +note left +**grant types**: +# authorization code +# implicit +# password +# client_credentials +end note +user --> client : authorization grant +end + +group token is generated +client -> authorization : request token\npresent authorization grant +authorization --> client :var: access token +note left +**response types**: +# code +# token +end note +end group + +group resource can be accessed +client -> resource : request resource\npresent token +resource --> client : resource +end group +@enduml +#+END_SRC +``` + +你难道会不喜欢 Emacs 和开源工具的多功能性吗? + +-------------------------------------------------------------------------------- + +via: https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html + +作者:[Peter Mosmans][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://www.onwebsecurity.com +[b]: https://github.com/lujun9972 +[1]: https://www.onwebsecurity.com/category/configuration.html +[2]: https://www.onwebsecurity.com/tag/emacs.html +[3]: https://www.onwebsecurity.com/tag/oauth2.html +[4]: https://www.onwebsecurity.com/tag/pentesting.html +[5]: https://www.onwebsecurity.com/tag/security.html +[6]: https://www.onwebsecurity.com/images/oauth2-abstract-protocol-flow.png +[7]: https://tools.ietf.org/html/rfc6749 +[8]: https://www.gnu.org/software/emacs/ +[9]: https://plantuml.com +[10]: http://www.graphviz.org/ +[11]: http://plantuml.com/download +[12]: https://www.gnu.org/software/emacs/download.html +[13]: http://www.graphviz.org/Download.php From 5ec6d0a72498e9cd55b000c4bccc4744740a0df6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Feb 2019 21:46:57 +0800 Subject: [PATCH 381/813] PRF:20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @geekpi --- ...g to Take On Biggies Like Final Cut Pro.md | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md index 93f73664a6..1dee51d5ca 100644 --- a/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md +++ b/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @@ -1,30 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro) [#]: via: (https://itsfoss.com/olive-video-editor) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Olive 是一个新的开源视频编辑器,一款类似 Final Cut Pro 的工具 +Olive:一款类似 Final Cut Pro 的开源视频编辑器 ====== -[Olive][1] 是一个正在开发的新开源视频编辑器。这个非线性视频编辑器旨在提供高端专业视频编辑软件的免费替代品。目标高么?我认为是的。 +[Olive][1] 是一个正在开发的新的开源视频编辑器。这个非线性视频编辑器旨在提供高端专业视频编辑软件的免费替代品。目标高么?我认为是的。 如果你读过我们的 [Linux 中的最佳视频编辑器][2]这篇文章,你可能已经注意到大多数“专业级”视频编辑器(如 [Lightworks][3] 或 DaVinciResolve)既不免费也不开源。 -[Kdenlive][4] 和 Shotcut 也出现在了文章中,但它通常无法达到专业视频编辑的标准(这是许多 Linux 用户说的)。 +[Kdenlive][4] 和 Shotcut 也是此类,但它通常无法达到专业视频编辑的标准(这是许多 Linux 用户说的)。 -爱好者和专业视频编辑之间的这种差距促使 Olive 的开发人员启动了这个项目。 +爱好者级和专业级的视频编辑之间的这种差距促使 Olive 的开发人员启动了这个项目。 -![Olive Video Editor][5]Olive Video Editor Interface +![Olive Video Editor][5] -Libre Graphics World 中有一篇详细的[关于 Olive 的评论][6]。实际上,这是我第一次知道 Olive 的地方。如果你有兴趣了解更多信息,请阅读该文章。 +*Olive 视频编辑器界面* + +Libre Graphics World 中有一篇详细的[关于 Olive 的点评][6]。实际上,这是我第一次知道 Olive 的地方。如果你有兴趣了解更多信息,请阅读该文章。 ### 在 Linux 中安装 Olive 视频编辑器 -提醒你一下。Olive 正处于发展的早期阶段。你会发现很多 bug 和缺失/不完整的功能。你不应该把它当作你的主要视频编辑器。 +> 提醒你一下。Olive 正处于发展的早期阶段。你会发现很多 bug 和缺失/不完整的功能。你不应该把它当作你的主要视频编辑器。 如果你想测试 Olive,有几种方法可以在 Linux 上安装它。 @@ -50,11 +52,13 @@ sudo snap install --edge olive-editor 如果你的 [Linux 发行版支持 Flatpak][7],你可以通过 Flatpak 安装 Olive 视频编辑器。 +- [Flatpak 地址](https://flathub.org/apps/details/org.olivevideoeditor.Olive) + #### 通过 AppImage 使用 Olive -不想安装吗?下载 [AppImage][8] 文件,将其设置为可执行文件并运行它。 +不想安装吗?下载 [AppImage][8] 文件,将其设置为可执行文件并运行它。32 位和 64 位 AppImage 文件都有。你应该下载相应的文件。 -32 位和 64 位 AppImage 文件都有。你应该下载相应的文件。 +- [下载 Olive 的 AppImage](https://github.com/olive-editor/olive/releases/tag/continuous) Olive 也可用于 Windows 和 macOS。你可以从它的[下载页面][9]获得它。 @@ -64,10 +68,16 @@ Olive 也可用于 Windows 和 macOS。你可以从它的[下载页面][9]获得 如果你在测试 Olive 时发现一些 bug,请到它们的 GitHub 仓库中报告。 +- [提交 bug 报告以帮助 Olive](https://github.com/olive-editor/olive/issues) + 如果你是程序员,请浏览 Olive 的源代码,看看你是否可以通过编码技巧帮助项目。 +- [Olive 的 GitHub 仓库](https://github.com/olive-editor/olive) + 在经济上为项目做贡献是另一种可以帮助开发开源软件的方法。你可以通过成为赞助人来支持 Olive。 +- [赞助 Olive](https://www.patreon.com/olivevideoeditor) + 如果你没有支持 Olive 的金钱或编码技能,你仍然可以帮助它。在社交媒体或你经常访问的 Linux/软件相关论坛和群组中分享这篇文章或 Olive 的网站。一点微小的口碑都能间接地帮助它。 ### 你如何看待 Olive? @@ -83,7 +93,7 @@ via: https://itsfoss.com/olive-video-editor 作者:[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 a4bb922201368300f133b9511f72ee7d35494be3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Feb 2019 21:47:31 +0800 Subject: [PATCH 382/813] PUB:20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @geekpi https://linux.cn/article-10577-1.html --- ...deo Editor Aiming to Take On Biggies Like Final Cut Pro.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md (98%) diff --git a/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md similarity index 98% rename from translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md rename to published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md index 1dee51d5ca..e5f4b30c73 100644 --- a/translated/tech/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md +++ b/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10577-1.html) [#]: subject: (Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro) [#]: via: (https://itsfoss.com/olive-video-editor) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 3e04566a3fbb1fe4b8bddf21549a75099ae80453 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Feb 2019 21:49:43 +0800 Subject: [PATCH 383/813] PRF:20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md --- ...Video Editor Aiming to Take On Biggies Like Final Cut Pro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md index e5f4b30c73..430b6210dd 100644 --- a/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md +++ b/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md @@ -7,7 +7,7 @@ [#]: via: (https://itsfoss.com/olive-video-editor) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Olive:一款类似 Final Cut Pro 的开源视频编辑器 +Olive:一款以 Final Cut Pro 为目标的开源视频编辑器 ====== [Olive][1] 是一个正在开发的新的开源视频编辑器。这个非线性视频编辑器旨在提供高端专业视频编辑软件的免费替代品。目标高么?我认为是的。 From 307bb08514d96ea5cfc41582505c2c2c6705015a Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Thu, 28 Feb 2019 10:46:43 -0600 Subject: [PATCH 384/813] Apply for Translating Apply for Translating --- ... A Very Strong File Encryption And Decryption CLI Utility.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md b/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md index ad3528f60b..883834d7e7 100644 --- a/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md +++ b/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md @@ -1,3 +1,4 @@ +tomjlw is translatting Toplip – A Very Strong File Encryption And Decryption CLI Utility ====== There are numerous file encryption tools available on the market to protect @@ -260,7 +261,7 @@ Cheers! via: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ 作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) +译者:[tomjlw](https://github.com/tomjlw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 55bf00c94a00000ff668ecc1d80efa8be69668c8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 1 Mar 2019 08:59:14 +0800 Subject: [PATCH 385/813] translated --- ...- A Lightweight Open Source Web Browser.md | 110 ------------------ ...- A Lightweight Open Source Web Browser.md | 110 ++++++++++++++++++ 2 files changed, 110 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md create mode 100644 translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md diff --git a/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md b/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md deleted file mode 100644 index fa1bd9c2c2..0000000000 --- a/sources/tech/20190104 Midori- A Lightweight Open Source Web Browser.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Midori: A Lightweight Open Source Web Browser) -[#]: via: (https://itsfoss.com/midori-browser) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Midori: A Lightweight Open Source Web Browser -====== - -**Here’s a quick review of the lightweight, fast, open source web browser Midori, which has returned from the dead.** - -If you are looking for a lightweight [alternative web browser][1], try Midori. - -[Midori][2] is an open source web browser that focuses more on being lightweight than on providing a ton of features. - -If you have never heard of Midori, you might think that it is a new application but Midori was first released in 2007. - -Because it focused on speed, Midori soon gathered a niche following and became the default browser in lightweight Linux distributions like Bodhi Linux, SilTaz etc. - -Other distributions like [elementary OS][3] also used Midori as its default browser. But the development of Midori stalled around 2016 and its fans started wondering if Midori was dead already. elementary OS dropped it from its latest release, I believe, for this reason. - -The good news is that Midori is not dead. After almost two years of inactivity, the development resumed in the last quarter of 2018. A few extensions including an ad-blocker were added in the later releases. - -### Features of Midori web browser - -![Midori web browser][4] - -Here are some of the main features of the Midori browser - - * Written in Vala with GTK+3 and WebKit rendering engine. - * Tabs, windows and session management - * Speed dial - * Saves tab for the next session by default - * Uses DuckDuckGo as a default search engine. It can be changed to Google or Yahoo. - * Bookmark management - * Customizable and extensible interface - * Extension modules can be written in C and Vala - * Supports HTML5 - * An extremely limited set of extensions include an ad-blocker, colorful tabs etc. No third-party extensions. - * Form history - * Private browsing - * Available for Linux and Windows - - - -Trivia: Midori is a Japanese word that means green. The Midori developer is not Japanese if you were guessing something along that line. - -### Experiencing Midori - -![Midori web browser in Ubuntu 18.04][5] - -I have been using Midori for the past few days. The experience is mostly fine. It supports HTML5 and renders the websites quickly. The ad-blocker is okay. The browsing experience is more or less smooth as you would expect in any standard web browser. - -The lack of extensions has always been a weak point of Midori so I am not going to talk about that. - -What I did notice is that it doesn’t support international languages. I couldn’t find a way to add new language support. It could not render the Hindi fonts at all and I am guessing it’s the same with many other non-[Romance languages][6]. - -I also had my fair share of troubles with YouTube videos. Some videos would throw playback error while others would run just fine. - -Midori didn’t eat my RAM like Chrome so that’s a big plus here. - -If you want to try out Midori, let’s see how can you get your hands on it. - -### Install Midori on Linux - -Midori is no longer available in the Ubuntu 18.04 repository. However, the newer versions of Midori can be easily installed using the [Snap packages][7]. - -If you are using Ubuntu, you can find Midori (Snap version) in the Software Center and install it from there. - -![Midori browser is available in Ubuntu Software Center][8]Midori browser is available in Ubuntu Software Center - -For other Linux distributions, make sure that you have [Snap support enabled][9] and then you can install Midori using the command below: - -``` -sudo snap install midori -``` - -You always have the option to compile from the source code. You can download the source code of Midori from its website. - -If you like Midori and want to help this open source project, please donate to them or [buy Midori merchandise from their shop][10]. - -Do you use Midori or have you ever tried it? How’s your experience with it? What other web browser do you prefer to use? Please share your views in the comment section below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/midori-browser - -作者:[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/open-source-browsers-linux/ -[2]: https://www.midori-browser.org/ -[3]: https://itsfoss.com/elementary-os-juno-features/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Midori-web-browser.jpeg?resize=800%2C450&ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/midori-browser-linux.jpeg?resize=800%2C491&ssl=1 -[6]: https://en.wikipedia.org/wiki/Romance_languages -[7]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/midori-ubuntu-software-center.jpeg?ssl=1 -[9]: https://itsfoss.com/install-snap-linux/ -[10]: https://www.midori-browser.org/shop -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Midori-web-browser.jpeg?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md b/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md new file mode 100644 index 0000000000..9cc0673527 --- /dev/null +++ b/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Midori: A Lightweight Open Source Web Browser) +[#]: via: (https://itsfoss.com/midori-browser) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Midori:轻量级开源 Web 浏览器 +====== + +**这是一个对再次回归的轻量级、快速、开源的 Web 浏览器 Midori 的快速回顾** + +如果你正在寻找一款轻量级[网络浏览器替代品][1],请试试 Midori。 + +[Midori][2]是一款开源的网络浏览器,它更注重轻量级而不是提供大量功能。 + +如果你从未听说过 Midori,你可能会认为它是一个新的应用程序,但实际上 Midori 于 2007 年首次发布。 + +因为它专注于速度,所以 Midori 很快就聚集了一群爱好者,并成为了 Bodhi Linux、SilTaz 等轻量级 Linux 发行版的默认浏览器。 + +其他发行版如 [elementary OS][3] 也使用了 Midori 作为其默认浏览器。但 Midori 的开发在 2016 年左右停滞了,它的粉丝开始怀疑 Midori 已经死了。由于这个原因,elementary OS 从最新版本中删除了它。 + +好消息是 Midori 还没有死。经过近两年的不活跃,开发工作在 2018 年的最后一个季度恢复了。在后来的版本中添加了一些包括广告拦截器的扩展。 + +### Midori 网络浏览器的功能 + +![Midori web browser][4] + +以下是Midori浏览器的一些主要功能 + + * 使用 Vala 编写,带有 GTK+3 和 WebKit 渲染引擎。 +  * 标签、窗口和会话管理 +  * 快速拨号 +  * 默认保存下一个会话的选项卡 +  * 使用 DuckDuckGo 作为默认搜索引擎。可以更改为 Google 或 Yahoo。 +  * 书签管理 +  * 可定制和可扩展的界面 +  * 扩展模块可以用 C 和 Vala 编写 +  * 支持 HTML5 +  * 少量的扩展程序包括广告拦截器、彩色标签等。没有第三方扩展程序。 +  * 表格历史 +  * 隐私浏览 +  * 可用于 Linux 和 Windows + + + +小知识:Midori 是日语单词,意思是绿色。如果你因此在猜想一些东西,Midori 的开发者实际不是日本人。 + +### 体验 Midori + +![Midori web browser in Ubuntu 18.04][5] + +这几天我一直在使用 Midori。体验基本很好。它支持 HTML5 并能快速渲染网站。广告拦截器也没问题。正如你对任何标准 Web 浏览器所期望的那样,浏览体验挺顺滑。 + +缺少扩展一直是 Midori 的弱点所以​​我不打算谈论这个。 + +我注意到的是它不支持国际语言。我找不到添加新语言支持的方法。它根本无法渲染印地语字体,我猜对其他非[罗曼语言][6]也是一样。 + +我也在 YouTube 中也遇到了麻烦。有些视频会抛出播放错误而其他视频没问题。 + +Midori 没有像 Chrome 那样吃我的内存,所以这是一个很大的优势。 + +如果你想尝试 Midori,让我们看下你该如何安装。 + +### 在 Linux 上安装 Midori + +在 Ubuntu 18.04 仓库中不再提供 Midori。但是,可以使用 [Snap 包][7]轻松安装较新版本的 Midori。 + +如果你使用的是 Ubuntu,你可以在软件中心找到 Midori(Snap 版)并从那里安装。 + +![Midori browser is available in Ubuntu Software Center][8]Midori browser is available in Ubuntu Software Center + +对于其他 Linux 发行版,请确保你[已启用 Snap 支持][9],然后你可以使用以下命令安装 Midori: + +``` +sudo snap install midori +``` + +你可以选择从源代码编译。你可以从 Midori 的网站下载它的代码。 + +如果你喜欢 Midori 并希望帮助这个开源项目,请向他们捐赠或[从他们的商店购买 Midori 商品][10]。 + +你在使用 Midori 还是曾经用过么?你的体验如何?你更喜欢使用哪种其他网络浏览器?请在下面的评论栏分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/midori-browser + +作者:[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/open-source-browsers-linux/ +[2]: https://www.midori-browser.org/ +[3]: https://itsfoss.com/elementary-os-juno-features/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Midori-web-browser.jpeg?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/midori-browser-linux.jpeg?resize=800%2C491&ssl=1 +[6]: https://en.wikipedia.org/wiki/Romance_languages +[7]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/midori-ubuntu-software-center.jpeg?ssl=1 +[9]: https://itsfoss.com/install-snap-linux/ +[10]: https://www.midori-browser.org/shop +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Midori-web-browser.jpeg?fit=800%2C450&ssl=1 From fabf2bf516d9c1be554f41cead1dfcd448eb8206 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 1 Mar 2019 09:06:19 +0800 Subject: [PATCH 386/813] translating --- ...Automated Way To Install Essential Applications On Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md index 5dd7abbaa2..719511ce27 100644 --- a/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md +++ b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 78b9838cfd1cde7b9af286b9b4b7f8966a3d691b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Mar 2019 10:19:51 +0800 Subject: [PATCH 387/813] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201902?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...x-Unix App For Prevention Of RSI (Repetitive Strain Injury).md | 0 .../20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md | 0 .../20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md | 0 .../20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md | 0 published/{ => 201902}/20150513 XML vs JSON.md | 0 ...50616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md | 0 ...50616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md | 0 ...0160922 Annoying Experiences Every Linux Gamer Never Wanted.md | 0 published/{ => 201902}/20171215 Top 5 Linux Music Players.md | 0 ...2 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md | 0 .../20180128 Get started with Org mode without Emacs.md | 0 ...6 Building Slack for the Linux community and adopting snaps.md | 0 .../20180530 Introduction to the Pony programming language.md | 0 ...e- - The Best Calculator Application in The Entire Universe.md | 0 ...614 An introduction to the Tornado Python web app framework.md | 0 .../20180621 How to connect to a remote desktop from Linux.md | 0 ...If A Package Is Available On Your Linux Distribution Or Not.md | 0 ... Mount Google Drive Locally As Virtual File System In Linux.md | 0 .../20180809 Two Years With Emacs as a CEO (and now CTO).md | 0 published/{ => 201902}/20181123 Three SSH GUI Tools for Linux.md | 0 ...181124 14 Best ASCII Games for Linux That are Insanely Good.md | 0 .../20181204 4 Unique Terminal Emulators for Linux.md | 0 .../{ => 201902}/20181212 Top 5 configuration management tools.md | 0 ...nitors Power Usage and Improve Laptop Battery Life in Linux.md | 0 published/{ => 201902}/20181224 An Introduction to Go.md | 0 .../20181224 Go on an adventure in your Linux terminal.md | 0 ...iinema - Record And Share Your Terminal Sessions On The Fly.md | 0 .../20190102 How To Display Thumbnail Images In Terminal.md | 0 .../20190103 How to use Magit to manage Git projects.md | 0 .../{ => 201902}/20190108 Hacking math education with Python.md | 0 .../{ => 201902}/20190110 5 useful Vim plugins for developers.md | 0 .../{ => 201902}/20190110 Toyota Motors and its Linux Journey.md | 0 ...n - A Modular System And Hardware Monitoring Tool For Linux.md | 0 published/{ => 201902}/20190114 Remote Working Survival Guide.md | 0 ...ng 3 open source databases- PostgreSQL, MariaDB, and SQLite.md | 0 ...ing started with Sandstorm, an open source web app platform.md | 0 ...The Evil-Twin Framework- A tool for improving WiFi security.md | 0 ... Update-Change Users Password in Linux Using Different Ways.md | 0 ...d with Roland, a random selection tool for the command line.md | 0 ... started with HomeBank, an open source personal finance app.md | 0 ...0121 Get started with TaskBoard, a lightweight kanban board.md | 0 ...Easy And Secure Way To Transfer Files Between Linux Systems.md | 0 ...t started with Go For It, a flexible to-do list application.md | 0 ...A File-Folder From A Local System To Remote System In Linux.md | 0 .../{ => 201902}/20190123 Book Review- Fundamentals of Linux.md | 0 ... Commands to help you monitor activity on your Linux server.md | 0 ... with LogicalDOC, an open source document management system.md | 0 .../{ => 201902}/20190124 Understanding Angle Brackets in Bash.md | 0 .../20190125 PyGame Zero- Games without boilerplate.md | 0 .../20190125 Top 5 Linux Distributions for Development in 2019.md | 0 ...26 Get started with Tint2, an open source taskbar for Linux.md | 0 ...a Tron-influenced terminal program for tablets and desktops.md | 0 .../20190128 3 simple and useful GNOME Shell extensions.md | 0 ...128 Using more to view text files at the Linux command line.md | 0 ...0190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md | 0 ...129 Get started with gPodder, an open source podcast client.md | 0 .../{ => 201902}/20190129 More About Angle Brackets in Bash.md | 0 ...190130 Get started with Budgie Desktop, a Linux environment.md | 0 ...e Video Editor Aiming to Take On Biggies Like Final Cut Pro.md | 0 .../20190131 Will quantum computing break security.md | 0 .../20190201 Top 5 Linux Distributions for New Users.md | 0 published/{ => 201902}/20190205 DNS and Root Certificates.md | 0 ... Installing Kali Linux on VirtualBox- Quickest - Safest Way.md | 0 ...190206 4 cool new projects to try in COPR for February 2019.md | 0 .../{ => 201902}/20190207 10 Methods To Create A File In Linux.md | 0 ...termine how much memory is installed, used on Linux systems.md | 0 .../20190208 How To Install And Use PuTTY On Linux.md | 0 published/{ => 201902}/20190214 Drinking coffee with AWK.md | 0 ... How To Grant And Remove Sudo Privileges To Users On Ubuntu.md | 0 .../20190219 3 tools for viewing files at the command line.md | 0 ... to List Installed Packages on Ubuntu and Debian -Quick Tip.md | 0 71 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201902}/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md (100%) rename published/{ => 201902}/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md (100%) rename published/{ => 201902}/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md (100%) rename published/{ => 201902}/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md (100%) rename published/{ => 201902}/20150513 XML vs JSON.md (100%) rename published/{ => 201902}/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md (100%) rename published/{ => 201902}/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md (100%) rename published/{ => 201902}/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md (100%) rename published/{ => 201902}/20171215 Top 5 Linux Music Players.md (100%) rename published/{ => 201902}/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md (100%) rename published/{ => 201902}/20180128 Get started with Org mode without Emacs.md (100%) rename published/{ => 201902}/20180206 Building Slack for the Linux community and adopting snaps.md (100%) rename published/{ => 201902}/20180530 Introduction to the Pony programming language.md (100%) rename published/{ => 201902}/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md (100%) rename published/{ => 201902}/20180614 An introduction to the Tornado Python web app framework.md (100%) rename published/{ => 201902}/20180621 How to connect to a remote desktop from Linux.md (100%) rename published/{ => 201902}/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md (100%) rename published/{ => 201902}/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md (100%) rename published/{ => 201902}/20180809 Two Years With Emacs as a CEO (and now CTO).md (100%) rename published/{ => 201902}/20181123 Three SSH GUI Tools for Linux.md (100%) rename published/{ => 201902}/20181124 14 Best ASCII Games for Linux That are Insanely Good.md (100%) rename published/{ => 201902}/20181204 4 Unique Terminal Emulators for Linux.md (100%) rename published/{ => 201902}/20181212 Top 5 configuration management tools.md (100%) rename published/{ => 201902}/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md (100%) rename published/{ => 201902}/20181224 An Introduction to Go.md (100%) rename published/{ => 201902}/20181224 Go on an adventure in your Linux terminal.md (100%) rename published/{ => 201902}/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md (100%) rename published/{ => 201902}/20190102 How To Display Thumbnail Images In Terminal.md (100%) rename published/{ => 201902}/20190103 How to use Magit to manage Git projects.md (100%) rename published/{ => 201902}/20190108 Hacking math education with Python.md (100%) rename published/{ => 201902}/20190110 5 useful Vim plugins for developers.md (100%) rename published/{ => 201902}/20190110 Toyota Motors and its Linux Journey.md (100%) rename published/{ => 201902}/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md (100%) rename published/{ => 201902}/20190114 Remote Working Survival Guide.md (100%) rename published/{ => 201902}/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md (100%) rename published/{ => 201902}/20190115 Getting started with Sandstorm, an open source web app platform.md (100%) rename published/{ => 201902}/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md (100%) rename published/{ => 201902}/20190117 How to Update-Change Users Password in Linux Using Different Ways.md (100%) rename published/{ => 201902}/20190119 Get started with Roland, a random selection tool for the command line.md (100%) rename published/{ => 201902}/20190120 Get started with HomeBank, an open source personal finance app.md (100%) rename published/{ => 201902}/20190121 Get started with TaskBoard, a lightweight kanban board.md (100%) rename published/{ => 201902}/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md (100%) rename published/{ => 201902}/20190122 Get started with Go For It, a flexible to-do list application.md (100%) rename published/{ => 201902}/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md (100%) rename published/{ => 201902}/20190123 Book Review- Fundamentals of Linux.md (100%) rename published/{ => 201902}/20190123 Commands to help you monitor activity on your Linux server.md (100%) rename published/{ => 201902}/20190124 Get started with LogicalDOC, an open source document management system.md (100%) rename published/{ => 201902}/20190124 Understanding Angle Brackets in Bash.md (100%) rename published/{ => 201902}/20190125 PyGame Zero- Games without boilerplate.md (100%) rename published/{ => 201902}/20190125 Top 5 Linux Distributions for Development in 2019.md (100%) rename published/{ => 201902}/20190126 Get started with Tint2, an open source taskbar for Linux.md (100%) rename published/{ => 201902}/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md (100%) rename published/{ => 201902}/20190128 3 simple and useful GNOME Shell extensions.md (100%) rename published/{ => 201902}/20190128 Using more to view text files at the Linux command line.md (100%) rename published/{ => 201902}/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md (100%) rename published/{ => 201902}/20190129 Get started with gPodder, an open source podcast client.md (100%) rename published/{ => 201902}/20190129 More About Angle Brackets in Bash.md (100%) rename published/{ => 201902}/20190130 Get started with Budgie Desktop, a Linux environment.md (100%) rename published/{ => 201902}/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md (100%) rename published/{ => 201902}/20190131 Will quantum computing break security.md (100%) rename published/{ => 201902}/20190201 Top 5 Linux Distributions for New Users.md (100%) rename published/{ => 201902}/20190205 DNS and Root Certificates.md (100%) rename published/{ => 201902}/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md (100%) rename published/{ => 201902}/20190206 4 cool new projects to try in COPR for February 2019.md (100%) rename published/{ => 201902}/20190207 10 Methods To Create A File In Linux.md (100%) rename published/{ => 201902}/20190207 How to determine how much memory is installed, used on Linux systems.md (100%) rename published/{ => 201902}/20190208 How To Install And Use PuTTY On Linux.md (100%) rename published/{ => 201902}/20190214 Drinking coffee with AWK.md (100%) rename published/{ => 201902}/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md (100%) rename published/{ => 201902}/20190219 3 tools for viewing files at the command line.md (100%) rename published/{ => 201902}/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md (100%) diff --git a/published/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/published/201902/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md similarity index 100% rename from published/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md rename to published/201902/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md diff --git a/published/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/published/201902/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md similarity index 100% rename from published/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md rename to published/201902/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md diff --git a/published/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/published/201902/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md similarity index 100% rename from published/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md rename to published/201902/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md diff --git a/published/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/published/201902/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md similarity index 100% rename from published/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md rename to published/201902/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md diff --git a/published/20150513 XML vs JSON.md b/published/201902/20150513 XML vs JSON.md similarity index 100% rename from published/20150513 XML vs JSON.md rename to published/201902/20150513 XML vs JSON.md diff --git a/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md b/published/201902/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md similarity index 100% rename from published/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md rename to published/201902/20150616 Computer Laboratory - Raspberry Pi- Lesson 6 Screen01.md diff --git a/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md b/published/201902/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md similarity index 100% rename from published/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md rename to published/201902/20150616 Computer Laboratory - Raspberry Pi- Lesson 7 Screen02.md diff --git a/published/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md b/published/201902/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md similarity index 100% rename from published/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md rename to published/201902/20160922 Annoying Experiences Every Linux Gamer Never Wanted.md diff --git a/published/20171215 Top 5 Linux Music Players.md b/published/201902/20171215 Top 5 Linux Music Players.md similarity index 100% rename from published/20171215 Top 5 Linux Music Players.md rename to published/201902/20171215 Top 5 Linux Music Players.md diff --git a/published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/published/201902/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md similarity index 100% rename from published/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md rename to published/201902/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md diff --git a/published/20180128 Get started with Org mode without Emacs.md b/published/201902/20180128 Get started with Org mode without Emacs.md similarity index 100% rename from published/20180128 Get started with Org mode without Emacs.md rename to published/201902/20180128 Get started with Org mode without Emacs.md diff --git a/published/20180206 Building Slack for the Linux community and adopting snaps.md b/published/201902/20180206 Building Slack for the Linux community and adopting snaps.md similarity index 100% rename from published/20180206 Building Slack for the Linux community and adopting snaps.md rename to published/201902/20180206 Building Slack for the Linux community and adopting snaps.md diff --git a/published/20180530 Introduction to the Pony programming language.md b/published/201902/20180530 Introduction to the Pony programming language.md similarity index 100% rename from published/20180530 Introduction to the Pony programming language.md rename to published/201902/20180530 Introduction to the Pony programming language.md diff --git a/published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md b/published/201902/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md similarity index 100% rename from published/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md rename to published/201902/20180531 Qalculate- - The Best Calculator Application in The Entire Universe.md diff --git a/published/20180614 An introduction to the Tornado Python web app framework.md b/published/201902/20180614 An introduction to the Tornado Python web app framework.md similarity index 100% rename from published/20180614 An introduction to the Tornado Python web app framework.md rename to published/201902/20180614 An introduction to the Tornado Python web app framework.md diff --git a/published/20180621 How to connect to a remote desktop from Linux.md b/published/201902/20180621 How to connect to a remote desktop from Linux.md similarity index 100% rename from published/20180621 How to connect to a remote desktop from Linux.md rename to published/201902/20180621 How to connect to a remote desktop from Linux.md diff --git a/published/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md b/published/201902/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md similarity index 100% rename from published/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md rename to published/201902/20180626 How To Search If A Package Is Available On Your Linux Distribution Or Not.md diff --git a/published/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md b/published/201902/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md similarity index 100% rename from published/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md rename to published/201902/20180724 How To Mount Google Drive Locally As Virtual File System In Linux.md diff --git a/published/20180809 Two Years With Emacs as a CEO (and now CTO).md b/published/201902/20180809 Two Years With Emacs as a CEO (and now CTO).md similarity index 100% rename from published/20180809 Two Years With Emacs as a CEO (and now CTO).md rename to published/201902/20180809 Two Years With Emacs as a CEO (and now CTO).md diff --git a/published/20181123 Three SSH GUI Tools for Linux.md b/published/201902/20181123 Three SSH GUI Tools for Linux.md similarity index 100% rename from published/20181123 Three SSH GUI Tools for Linux.md rename to published/201902/20181123 Three SSH GUI Tools for Linux.md diff --git a/published/20181124 14 Best ASCII Games for Linux That are Insanely Good.md b/published/201902/20181124 14 Best ASCII Games for Linux That are Insanely Good.md similarity index 100% rename from published/20181124 14 Best ASCII Games for Linux That are Insanely Good.md rename to published/201902/20181124 14 Best ASCII Games for Linux That are Insanely Good.md diff --git a/published/20181204 4 Unique Terminal Emulators for Linux.md b/published/201902/20181204 4 Unique Terminal Emulators for Linux.md similarity index 100% rename from published/20181204 4 Unique Terminal Emulators for Linux.md rename to published/201902/20181204 4 Unique Terminal Emulators for Linux.md diff --git a/published/20181212 Top 5 configuration management tools.md b/published/201902/20181212 Top 5 configuration management tools.md similarity index 100% rename from published/20181212 Top 5 configuration management tools.md rename to published/201902/20181212 Top 5 configuration management tools.md diff --git a/published/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md b/published/201902/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md similarity index 100% rename from published/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md rename to published/201902/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md diff --git a/published/20181224 An Introduction to Go.md b/published/201902/20181224 An Introduction to Go.md similarity index 100% rename from published/20181224 An Introduction to Go.md rename to published/201902/20181224 An Introduction to Go.md diff --git a/published/20181224 Go on an adventure in your Linux terminal.md b/published/201902/20181224 Go on an adventure in your Linux terminal.md similarity index 100% rename from published/20181224 Go on an adventure in your Linux terminal.md rename to published/201902/20181224 Go on an adventure in your Linux terminal.md diff --git a/published/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/published/201902/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md similarity index 100% rename from published/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md rename to published/201902/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md diff --git a/published/20190102 How To Display Thumbnail Images In Terminal.md b/published/201902/20190102 How To Display Thumbnail Images In Terminal.md similarity index 100% rename from published/20190102 How To Display Thumbnail Images In Terminal.md rename to published/201902/20190102 How To Display Thumbnail Images In Terminal.md diff --git a/published/20190103 How to use Magit to manage Git projects.md b/published/201902/20190103 How to use Magit to manage Git projects.md similarity index 100% rename from published/20190103 How to use Magit to manage Git projects.md rename to published/201902/20190103 How to use Magit to manage Git projects.md diff --git a/published/20190108 Hacking math education with Python.md b/published/201902/20190108 Hacking math education with Python.md similarity index 100% rename from published/20190108 Hacking math education with Python.md rename to published/201902/20190108 Hacking math education with Python.md diff --git a/published/20190110 5 useful Vim plugins for developers.md b/published/201902/20190110 5 useful Vim plugins for developers.md similarity index 100% rename from published/20190110 5 useful Vim plugins for developers.md rename to published/201902/20190110 5 useful Vim plugins for developers.md diff --git a/published/20190110 Toyota Motors and its Linux Journey.md b/published/201902/20190110 Toyota Motors and its Linux Journey.md similarity index 100% rename from published/20190110 Toyota Motors and its Linux Journey.md rename to published/201902/20190110 Toyota Motors and its Linux Journey.md diff --git a/published/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md b/published/201902/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md similarity index 100% rename from published/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md rename to published/201902/20190114 Hegemon - A Modular System And Hardware Monitoring Tool For Linux.md diff --git a/published/20190114 Remote Working Survival Guide.md b/published/201902/20190114 Remote Working Survival Guide.md similarity index 100% rename from published/20190114 Remote Working Survival Guide.md rename to published/201902/20190114 Remote Working Survival Guide.md diff --git a/published/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md b/published/201902/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md similarity index 100% rename from published/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md rename to published/201902/20190115 Comparing 3 open source databases- PostgreSQL, MariaDB, and SQLite.md diff --git a/published/20190115 Getting started with Sandstorm, an open source web app platform.md b/published/201902/20190115 Getting started with Sandstorm, an open source web app platform.md similarity index 100% rename from published/20190115 Getting started with Sandstorm, an open source web app platform.md rename to published/201902/20190115 Getting started with Sandstorm, an open source web app platform.md diff --git a/published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md b/published/201902/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md similarity index 100% rename from published/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md rename to published/201902/20190116 The Evil-Twin Framework- A tool for improving WiFi security.md diff --git a/published/20190117 How to Update-Change Users Password in Linux Using Different Ways.md b/published/201902/20190117 How to Update-Change Users Password in Linux Using Different Ways.md similarity index 100% rename from published/20190117 How to Update-Change Users Password in Linux Using Different Ways.md rename to published/201902/20190117 How to Update-Change Users Password in Linux Using Different Ways.md diff --git a/published/20190119 Get started with Roland, a random selection tool for the command line.md b/published/201902/20190119 Get started with Roland, a random selection tool for the command line.md similarity index 100% rename from published/20190119 Get started with Roland, a random selection tool for the command line.md rename to published/201902/20190119 Get started with Roland, a random selection tool for the command line.md diff --git a/published/20190120 Get started with HomeBank, an open source personal finance app.md b/published/201902/20190120 Get started with HomeBank, an open source personal finance app.md similarity index 100% rename from published/20190120 Get started with HomeBank, an open source personal finance app.md rename to published/201902/20190120 Get started with HomeBank, an open source personal finance app.md diff --git a/published/20190121 Get started with TaskBoard, a lightweight kanban board.md b/published/201902/20190121 Get started with TaskBoard, a lightweight kanban board.md similarity index 100% rename from published/20190121 Get started with TaskBoard, a lightweight kanban board.md rename to published/201902/20190121 Get started with TaskBoard, a lightweight kanban board.md diff --git a/published/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md b/published/201902/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md similarity index 100% rename from published/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md rename to published/201902/20190122 Dcp (Dat Copy) - Easy And Secure Way To Transfer Files Between Linux Systems.md diff --git a/published/20190122 Get started with Go For It, a flexible to-do list application.md b/published/201902/20190122 Get started with Go For It, a flexible to-do list application.md similarity index 100% rename from published/20190122 Get started with Go For It, a flexible to-do list application.md rename to published/201902/20190122 Get started with Go For It, a flexible to-do list application.md diff --git a/published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md b/published/201902/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md similarity index 100% rename from published/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md rename to published/201902/20190122 How To Copy A File-Folder From A Local System To Remote System In Linux.md diff --git a/published/20190123 Book Review- Fundamentals of Linux.md b/published/201902/20190123 Book Review- Fundamentals of Linux.md similarity index 100% rename from published/20190123 Book Review- Fundamentals of Linux.md rename to published/201902/20190123 Book Review- Fundamentals of Linux.md diff --git a/published/20190123 Commands to help you monitor activity on your Linux server.md b/published/201902/20190123 Commands to help you monitor activity on your Linux server.md similarity index 100% rename from published/20190123 Commands to help you monitor activity on your Linux server.md rename to published/201902/20190123 Commands to help you monitor activity on your Linux server.md diff --git a/published/20190124 Get started with LogicalDOC, an open source document management system.md b/published/201902/20190124 Get started with LogicalDOC, an open source document management system.md similarity index 100% rename from published/20190124 Get started with LogicalDOC, an open source document management system.md rename to published/201902/20190124 Get started with LogicalDOC, an open source document management system.md diff --git a/published/20190124 Understanding Angle Brackets in Bash.md b/published/201902/20190124 Understanding Angle Brackets in Bash.md similarity index 100% rename from published/20190124 Understanding Angle Brackets in Bash.md rename to published/201902/20190124 Understanding Angle Brackets in Bash.md diff --git a/published/20190125 PyGame Zero- Games without boilerplate.md b/published/201902/20190125 PyGame Zero- Games without boilerplate.md similarity index 100% rename from published/20190125 PyGame Zero- Games without boilerplate.md rename to published/201902/20190125 PyGame Zero- Games without boilerplate.md diff --git a/published/20190125 Top 5 Linux Distributions for Development in 2019.md b/published/201902/20190125 Top 5 Linux Distributions for Development in 2019.md similarity index 100% rename from published/20190125 Top 5 Linux Distributions for Development in 2019.md rename to published/201902/20190125 Top 5 Linux Distributions for Development in 2019.md diff --git a/published/20190126 Get started with Tint2, an open source taskbar for Linux.md b/published/201902/20190126 Get started with Tint2, an open source taskbar for Linux.md similarity index 100% rename from published/20190126 Get started with Tint2, an open source taskbar for Linux.md rename to published/201902/20190126 Get started with Tint2, an open source taskbar for Linux.md diff --git a/published/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md b/published/201902/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md similarity index 100% rename from published/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md rename to published/201902/20190127 Get started with eDEX-UI, a Tron-influenced terminal program for tablets and desktops.md diff --git a/published/20190128 3 simple and useful GNOME Shell extensions.md b/published/201902/20190128 3 simple and useful GNOME Shell extensions.md similarity index 100% rename from published/20190128 3 simple and useful GNOME Shell extensions.md rename to published/201902/20190128 3 simple and useful GNOME Shell extensions.md diff --git a/published/20190128 Using more to view text files at the Linux command line.md b/published/201902/20190128 Using more to view text files at the Linux command line.md similarity index 100% rename from published/20190128 Using more to view text files at the Linux command line.md rename to published/201902/20190128 Using more to view text files at the Linux command line.md diff --git a/published/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md b/published/201902/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md similarity index 100% rename from published/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md rename to published/201902/20190128 fdisk - Easy Way To Manage Disk Partitions In Linux.md diff --git a/published/20190129 Get started with gPodder, an open source podcast client.md b/published/201902/20190129 Get started with gPodder, an open source podcast client.md similarity index 100% rename from published/20190129 Get started with gPodder, an open source podcast client.md rename to published/201902/20190129 Get started with gPodder, an open source podcast client.md diff --git a/published/20190129 More About Angle Brackets in Bash.md b/published/201902/20190129 More About Angle Brackets in Bash.md similarity index 100% rename from published/20190129 More About Angle Brackets in Bash.md rename to published/201902/20190129 More About Angle Brackets in Bash.md diff --git a/published/20190130 Get started with Budgie Desktop, a Linux environment.md b/published/201902/20190130 Get started with Budgie Desktop, a Linux environment.md similarity index 100% rename from published/20190130 Get started with Budgie Desktop, a Linux environment.md rename to published/201902/20190130 Get started with Budgie Desktop, a Linux environment.md diff --git a/published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md b/published/201902/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md similarity index 100% rename from published/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md rename to published/201902/20190130 Olive is a new Open Source Video Editor Aiming to Take On Biggies Like Final Cut Pro.md diff --git a/published/20190131 Will quantum computing break security.md b/published/201902/20190131 Will quantum computing break security.md similarity index 100% rename from published/20190131 Will quantum computing break security.md rename to published/201902/20190131 Will quantum computing break security.md diff --git a/published/20190201 Top 5 Linux Distributions for New Users.md b/published/201902/20190201 Top 5 Linux Distributions for New Users.md similarity index 100% rename from published/20190201 Top 5 Linux Distributions for New Users.md rename to published/201902/20190201 Top 5 Linux Distributions for New Users.md diff --git a/published/20190205 DNS and Root Certificates.md b/published/201902/20190205 DNS and Root Certificates.md similarity index 100% rename from published/20190205 DNS and Root Certificates.md rename to published/201902/20190205 DNS and Root Certificates.md diff --git a/published/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/published/201902/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md similarity index 100% rename from published/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md rename to published/201902/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md diff --git a/published/20190206 4 cool new projects to try in COPR for February 2019.md b/published/201902/20190206 4 cool new projects to try in COPR for February 2019.md similarity index 100% rename from published/20190206 4 cool new projects to try in COPR for February 2019.md rename to published/201902/20190206 4 cool new projects to try in COPR for February 2019.md diff --git a/published/20190207 10 Methods To Create A File In Linux.md b/published/201902/20190207 10 Methods To Create A File In Linux.md similarity index 100% rename from published/20190207 10 Methods To Create A File In Linux.md rename to published/201902/20190207 10 Methods To Create A File In Linux.md diff --git a/published/20190207 How to determine how much memory is installed, used on Linux systems.md b/published/201902/20190207 How to determine how much memory is installed, used on Linux systems.md similarity index 100% rename from published/20190207 How to determine how much memory is installed, used on Linux systems.md rename to published/201902/20190207 How to determine how much memory is installed, used on Linux systems.md diff --git a/published/20190208 How To Install And Use PuTTY On Linux.md b/published/201902/20190208 How To Install And Use PuTTY On Linux.md similarity index 100% rename from published/20190208 How To Install And Use PuTTY On Linux.md rename to published/201902/20190208 How To Install And Use PuTTY On Linux.md diff --git a/published/20190214 Drinking coffee with AWK.md b/published/201902/20190214 Drinking coffee with AWK.md similarity index 100% rename from published/20190214 Drinking coffee with AWK.md rename to published/201902/20190214 Drinking coffee with AWK.md diff --git a/published/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md b/published/201902/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md similarity index 100% rename from published/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md rename to published/201902/20190216 How To Grant And Remove Sudo Privileges To Users On Ubuntu.md diff --git a/published/20190219 3 tools for viewing files at the command line.md b/published/201902/20190219 3 tools for viewing files at the command line.md similarity index 100% rename from published/20190219 3 tools for viewing files at the command line.md rename to published/201902/20190219 3 tools for viewing files at the command line.md diff --git a/published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md b/published/201902/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md similarity index 100% rename from published/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md rename to published/201902/20190219 How to List Installed Packages on Ubuntu and Debian -Quick Tip.md From 6ea4e44a514651f3af457db755220ac58fa6c3ca Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Mar 2019 10:24:55 +0800 Subject: [PATCH 388/813] PRF:20181220 7 CI-CD tools for sysadmins.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jdh8383 翻译的很好! --- .../20181220 7 CI-CD tools for sysadmins.md | 72 +++++++++++++------ 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/translated/talk/20181220 7 CI-CD tools for sysadmins.md b/translated/talk/20181220 7 CI-CD tools for sysadmins.md index fe00691a9a..8420cf4a69 100644 --- a/translated/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/translated/talk/20181220 7 CI-CD tools for sysadmins.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (jdh8383) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (7 CI/CD tools for sysadmins) @@ -9,28 +9,30 @@ 系统管理员的 7 个 CI/CD 工具 ====== -本文是一篇简单指南:介绍一些常见的开源 CI/CD 工具。 + +> 本文是一篇简单指南:介绍一些顶级的开源的持续集成、持续交付和持续部署(CI/CD)工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) -虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在运维部门也有实施经验,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 +虽然持续集成、持续交付和持续部署(CI/CD)在开发者社区里已经存在很多年,一些机构在其运维部门也有实施经验,但大多数公司并没有做这样的尝试。对于很多机构来说,让运维团队能够像他们的开发同行一样熟练操作 CI/CD 工具,已经变得十分必要了。 无论是基础设施、第三方应用还是内部开发的应用,都可以开展 CI/CD 实践。尽管你会发现有很多不同的工具,但它们都有着相似的设计模型。而且可能最重要的一点是:通过带领你的公司进行这些实践,会让你在公司内部变得举足轻重,成为他人学习的榜样。 -一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在最终要部署应用的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建[可复用][6]的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 +一些机构在自己的基础设施上已有多年的 CI/CD 实践经验,常用的工具包括 [Ansible][1]、[Chef][2] 或者 [Puppet][3]。另一些工具,比如 [Test Kitchen][4],允许在最终要部署应用的基础设施上运行测试。事实上,如果使用更高级的配置方法,你甚至可以将应用部署到有真实负载的仿真“生产环境”上,来运行应用级别的测试。然而,单单是能够测试基础设施就是一项了不起的成就了。配置管理工具 Terraform 可以通过 Test Kitchen 来快速创建更[短暂][5]和[冥等的][6]的基础设施配置,这比它的前辈要强不少。再加上 Linux 容器和 Kubernetes,在数小时内,你就可以创建一套类似于生产环境的配置参数和系统资源,来测试整个基础设施和其上部署的应用,这在以前可能需要花费几个月的时间。而且,删除和再次创建整个测试环境也非常容易。 -当然,作为初学者,你也可以把网络配置和 DDL(数据定义语言)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法,但实际上大多数用于开发的管道(pipeline)都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种真实的使用场景。 +当然,作为初学者,你也可以把网络配置和 DDL(数据定义语言data definition language)文件加入版本控制,然后开始尝试一些简单的 CI/CD 流程。虽然只能帮你检查一下语义语法或某些最佳实践,但实际上大多数开发的管道都是这样起步的。只要你把脚手架搭起来,建造就容易得多了。而一旦起步,你就会发现各种管道的使用场景。 -举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[管道][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在管道里同时生成。除非有人来检查确认,这些文件不会被直接发布出去。使用 GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求成功或者在某个审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 +举个例子,我经常会在公司内部写新闻简报,我使用 [MJML][7] 制作邮件模板,然后把它加入版本控制。我一般会维护一个 web 版本,但是一些同事喜欢 PDF 版,于是我创建了一个[管道][8]。每当我写好一篇新闻稿,就在 Gitlab 上提交一个合并请求。这样做会自动创建一个 index.html 文件,生成这篇新闻稿的 HTML 和 PDF 版链接。HTML 和 PDF 文件也会在该管道里同时生成。除非有人来检查确认,这些文件不会被直接发布出去。使用 GitLab Pages 发布这个网站后,我就可以下载一份 HTML 版,用来发送新闻简报。未来,我会修改这个流程,当合并请求成功或者在某个审核步骤后,自动发出对应的新闻稿。这些处理逻辑并不复杂,但的确为我节省了不少时间。实际上这些工具最核心的用途就是替你节省时间。 -关键是要在抽象层创建出工具,这样稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成 index 页面的 nodejs 代码][11]。 +关键是要在抽象层创建出工具,这样稍加修改就可以处理不同的问题。值得留意的是,我创建的这套流程几乎不需要任何代码,除了一些[轻量级的 HTML 模板][9],一些[把 HTML 文件转换成 PDF 的 nodejs 代码][10],还有一些[生成索引页面的 nodejs 代码][11]。 -这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也会乐意跟你合作,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](一个地方性DevOps组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 +这其中一些东西可能看起来有点复杂,但其中大部分都源自我使用的不同工具的教学文档。而且很多开发人员也会乐意跟你合作,因为他们在完工时会发现这些东西也挺有用。上面我提供的那些代码链接是给 [DevOps KC][12](LCTT 译注:一个地方性 DevOps 组织) 发送新闻简报用的,其中大部分用来创建网站的代码来自我在内部新闻简报项目上所作的工作。 下面列出的大多数工具都可以提供这种类型的交互,但是有些工具提供的模型略有不同。这一领域新兴的模型是用声明式的方法例如 YAML 来描述一个管道,其中的每个阶段都是短暂而幂等的。许多系统还会创建[有向无环图(DAG)][13],来确保管道上不同的阶段排序的正确性。 -这些阶段一般运行在 Linux 容器里,和普通的容器并没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件,而且提供一些其他工具没有的操作特性。[Jenkins][15] 则通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用[领域专用语言(DSL)][16]如[Groovy][17]。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点上会装一个专门的 Java 程序还有一堆混杂的插件和预装组件。 +这些阶段一般运行在 Linux 容器里,和普通的容器并没有区别。有一些工具,比如 [Spinnaker][14],只关注部署组件,而且提供一些其他工具没有的操作特性。[Jenkins][15] 则通常把管道配置存成 XML 格式,大部分交互都可以在图形界面里完成,但最新的方案是使用[领域专用语言(DSL)][16](如 [Groovy][17])。并且,Jenkins 的任务(job)通常运行在各个节点里,这些节点上会装一个专门的 Java 代理,还有一堆混杂的插件和预装组件。 -Jenkins 在自己的工具里引入了管道的概念,但使用起来却并不轻松,甚至包含一些禁区。最近,Jenkins 的创始人决定带领社区向新的方向前进,希望能为这个项目注入新的活力,把 CI/CD 真正推广开(译者注:详见后面的 Jenkins 章节)。我认为其中最有意思的想法是构建一个云原生 Jenkins,能把 Kubernetes 集群转变成 Jenkins CI/CD 平台。 +Jenkins 在自己的工具里引入了管道的概念,但使用起来却并不轻松,甚至包含一些禁区。最近,Jenkins 的创始人决定带领社区向新的方向前进,希望能为这个项目注入新的活力,把 CI/CD 真正推广开(LCTT 译注:详见后面的 Jenkins 章节)。我认为其中最有意思的想法是构建一个云原生 Jenkins,能把 Kubernetes 集群转变成 Jenkins CI/CD 平台。 当你更多地了解这些工具并把实践带入你的公司和运维部门,你很快就会有追随者,因为你有办法提升自己和别人的工作效率。我们都有多年积累下来的技术债要解决,如果你能给同事们提供足够的时间来处理这些积压的工作,他们该会有多感激呢?不止如此,你的客户也会开始看到应用变得越来越稳定,管理层会把你看作得力干将,你也会在下次谈薪资待遇或参加面试时更有底气。 @@ -38,49 +40,79 @@ Jenkins 在自己的工具里引入了管道的概念,但使用起来却并不 ### GitLab CI -GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在 [Forrester(一个权威调研机构) 的调查报告][20]中位列第一。在一个高水平、竞争充分的领域里,这是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。另有一个功能叫做 Auto DevOps,可以为较简单的项目自动生成管道,并且包含多种内置的测试单元。这套系统使用 [Herokuish buildpacks][21]来判断语言的种类以及如何构建应用。它和 Kubernetes 紧密整合,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 +- [项目主页](https://about.gitlab.com/product/continuous-integration/) +- [源代码](https://gitlab.com/gitlab-org/gitlab-ce/) +- 许可证:MIT -除了它的持续集成功能,GitLab 还提供了许多补充特性,比如:将 Prometheus 和你的应用一同部署,以提供监控功能;通过 GitLab 提供的 Issues、Epics 和 Milestones 功能来实现项目评估和管理;管道中集成了安全检测功能,多个项目的检测结果会聚合显示;你可以通过 GitLab 提供的网页版 IDE 在线编辑代码,还可以快速查看管道的预览或执行状态。 +GitLab 可以说是 CI/CD 领域里新登场的玩家,但它却在权威调研机构 [Forrester 的 CI 集成工具的调查报告][20]中位列第一。在一个高水平、竞争充分的领域里,这是个了不起的成就。是什么让 GitLab CI 这么成功呢?它使用 YAML 文件来描述整个管道。另有一个功能叫做 Auto DevOps,可以为较简单的项目用多种内置的测试单元自动生成管道。这套系统使用 [Herokuish buildpacks][21] 来判断语言的种类以及如何构建应用。有些语言也可以管理数据库,它真正改变了构建新应用程序和从开发的开始将它们部署到生产环境的过程。它原生集成于 Kubernetes,可以根据不同的方案将你的应用自动部署到 Kubernetes 集群,比如灰度发布、蓝绿部署等。 + +除了它的持续集成功能,GitLab 还提供了许多补充特性,比如:将 Prometheus 和你的应用一同部署,以提供操作监控功能;通过 GitLab 提供的 Issues、Epics 和 Milestones 功能来实现项目评估和管理;管道中集成了安全检测功能,多个项目的检测结果会聚合显示;你可以通过 GitLab 提供的网页版 IDE 在线编辑代码,还可以快速查看管道的预览或执行状态。 ### GoCD +- [项目主页](https://www.gocd.org/) +- [源代码](https://github.com/gocd/gocd) +- 许可证:Apache 2.0 + GoCD 是由老牌软件公司 Thoughtworks 出品,这已经足够证明它的能力和效率。对我而言,GoCD 最具亮点的特性是它的[价值流视图(VSM)][22]。实际上,一个管道的输出可以变成下一个管道的输入,从而把管道串联起来。这样做有助于提高不同开发团队在整个开发流程中的独立性。比如在引入 CI/CD 系统时,有些成立较久的机构希望保持他们各个团队相互隔离,这时候 VSM 就很有用了:让每个人都使用相同的工具就很容易在 VSM 中发现工作流程上的瓶颈,然后可以按图索骥调整团队或者想办法提高工作效率。 -为公司的每个产品配置 VSM 是非常有价值的;GoCD 可以使用 [JSON 或 YAML 格式存储配置][23],还能以可视化的方式展示等待时间,这让一个机构能有效减少学习它的成本。刚开始使用 GoCD 创建你自己的流程时,建议使用人工审核的方式。让每个团队也采用人工审核,这样你就可以开始收集数据并且找到可能的瓶颈点。 +为公司的每个产品配置 VSM 是非常有价值的;GoCD 可以使用 [JSON 或 YAML 格式存储配置][23],还能以可视化的方式展示数据等待时间,这让一个机构能有效减少学习它的成本。刚开始使用 GoCD 创建你自己的流程时,建议使用人工审核的方式。让每个团队也采用人工审核,这样你就可以开始收集数据并且找到可能的瓶颈点。 ### Travis CI +- [项目主页](https://docs.travis-ci.com/) +- [源代码](https://github.com/travis-ci/travis-ci) +- 许可证:MIT + 我使用的第一个软件既服务(SaaS)类型的 CI 系统就是 Travis CI,体验很不错。管道配置以源码形式用 YAML 保存,它与 GitHub 等工具无缝整合。我印象中管道从来没有失效过,因为 Travis CI 的在线率很高。除了 SaaS 版之外,你也可以使用自行部署的版本。我还没有自行部署过,它的组件非常多,要全部安装的话,工作量就有点吓人了。我猜更简单的办法是把它部署到 Kubernetes 上,[Travis CI 提供了 Helm charts][26],这些 charts 目前不包含所有要部署的组件,但我相信以后会越来越丰富的。如果你不想处理这些细枝末节的问题,还有一个企业版可以试试。 假如你在开发一个开源项目,你就能免费使用 SaaS 版的 Travis CI,享受顶尖团队提供的优质服务!这样能省去很多麻烦,你可以在一个相对通用的平台上(如 GitHub)研发开源项目,而不用找服务器来运行任何东西。 ### Jenkins -Jenkins在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我强烈建议你读一读这篇文章:"[Jenkins: Shifting Gears][27]",作者 Kohsuke 是 Jenkins 的创始人兼 CloudBees 公司 CTO。这篇文章契合了我在过去十年里对 Jenkins 及其社区的感受。他在文中阐述了一些这几年呼声很高的需求,我很乐意看到 CloudBees 引领这场变革。长期以来,Jenkins 对于非开发人员来说有点难以接受,并且一直是其管理员的重担。还好,这些问题正是他们想要着手解决的。 +- [项目主页](https://jenkins.io/) +- [源代码](https://github.com/jenkinsci/jenkins) +- 许可证:MIT + +Jenkins 在 CI/CD 界绝对是元老级的存在,也是事实上的标准。我强烈建议你读一读这篇文章:“[Jenkins: Shifting Gears][27]”,作者 Kohsuke 是 Jenkins 的创始人兼 CloudBees 公司 CTO。这篇文章契合了我在过去十年里对 Jenkins 及其社区的感受。他在文中阐述了一些这几年呼声很高的需求,我很乐意看到 CloudBees 引领这场变革。长期以来,Jenkins 对于非开发人员来说有点难以接受,并且一直是其管理员的重担。还好,这些问题正是他们想要着手解决的。 [Jenkins 配置既代码][28](JCasC)应该可以帮助管理员解决困扰了他们多年的配置复杂性问题。与其他 CI/CD 系统类似,只需要修改一个简单的 YAML 文件就可以完成 Jenkins 主节点的配置工作。[Jenkins Evergreen][29] 的出现让配置工作变得更加轻松,它提供了很多预设的使用场景,你只管套用就可以了。这些发行版会比官方的标准版本 Jenkins 更容易维护和升级。 -Jenkins 2 引入了两种原生的管道(pipeline)功能,我在 LISA(一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 +Jenkins 2 引入了两种原生的管道功能,我在 LISA(LCTT 译注:一个系统架构和运维大会) 2017 年的研讨会上已经[讨论过了][30]。这两种功能都没有 YAML 简便,但在处理复杂任务时它们很好用。 [Jenkins X][31] 是 Jenkins 的一个全新变种,用来实现云端原生 Jenkins(至少在用户看来是这样)。它会使用 JCasC 及 Evergreen,并且和 Kubernetes 整合的更加紧密。对于 Jenkins 来说这是个令人激动的时刻,我很乐意看到它在这一领域的创新,并且继续发挥领袖作用。 ### Concourse CI +- [项目主页](https://concourse-ci.org/) +- [源代码](https://github.com/concourse/concourse) +- 许可证:Apache 2.0 + 我第一次知道 Concourse 是通过 Pivotal Labs 的伙计们介绍的,当时它处于早期 beta 版本,而且那时候也很少有类似的工具。这套系统是基于微服务构建的,每个任务运行在一个容器里。它独有的一个优良特性是能够在你本地系统上运行任务,体现你本地的改动。这意味着你完全可以在本地开发(假设你已经连接到了 Concourse 的服务器),像在真实的管道构建流程一样从你本地构建项目。而且,你可以在修改过代码后从本地直接重新运行构建,来检验你的改动结果。 -Concourse 还有一个简单的扩展系统,它依赖于资源这一基础概念。基本上,你想给管道添加的每个新功能都可以用一个 Docker 镜像实现,并作为一个新的资源类型包含在你的配置中。这样可以保证每个功能都被封装在一个不易改变的独立工件中,方便对其单独修改和升级,改变其中一个时不会影响其他构建。 +Concourse 还有一个简单的扩展系统,它依赖于“资源”这一基础概念。基本上,你想给管道添加的每个新功能都可以用一个 Docker 镜像实现,并作为一个新的资源类型包含在你的配置中。这样可以保证每个功能都被封装在一个不可变的独立工件中,方便对其单独修改和升级,改变其中一个时不会影响其他构建。 ### Spinnaker -Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在一次金丝雀发布(canary deployment)里,我们可以根据收集到的相关监控指标来做出判断:最近的这次发布是否导致了服务降级,应该立刻回滚;还是说看起来一切OK,应该继续执行部署。 +- [项目主页](https://www.spinnaker.io/) +- [源代码](https://github.com/spinnaker/spinnaker) +- 许可证:Apache 2.0 + +Spinnaker 出自 Netflix,它更关注持续部署而非持续集成。它可以与其他工具整合,比如 Travis 和 Jenkins,来启动测试和部署流程。它也能与 Prometheus、Datadog 这样的监控工具集成,参考它们提供的指标来决定如何部署。例如,在金丝雀发布canary deployment里,我们可以根据收集到的相关监控指标来做出判断:最近的这次发布是否导致了服务降级,应该立刻回滚;还是说看起来一切 OK,应该继续执行部署。 谈到持续部署,一些另类但却至关重要的问题往往被忽略掉了,说出来可能有点让人困惑:Spinnaker 可以帮助持续部署不那么“持续”。在整个应用部署流程期间,如果发生了重大问题,它可以让流程停止执行,以阻止可能发生的部署错误。但它也可以在最关键的时刻让人工审核强制通过,发布新版本上线,使整体收益最大化。实际上,CI/CD 的主要目的就是在商业模式需要调整时,能够让待更新的代码立即得到部署。 ### Screwdriver -Screwdriver 是个简单而又强大的软件。它采用微服务架构,依赖像 Nomad、Kubernetes 和 Docker 这样的工具作为执行引擎。官方有一篇很不错的[部署教学文档][34],介绍了如何将它部署到 AWS 和 Kubernetes 上,但如果相应的 [Helm chart][35] 也完成的话,就更完美了。 +- [项目主页](http://screwdriver.cd/) +- [源代码](https://github.com/screwdriver-cd/screwdriver) +- 许可证:BSD -Screwdriver 也使用 YAML 来描述它的管道,并且有很多合理的默认值,这样可以有效减少各个管道重复的配置项。用配置文件可以组织起高级的工作流,来描述各个 job 间复杂的依赖关系。例如,一项任务可以在另一个任务开始前或结束后运行;各个任务可以并行也可以串行执行;更赞的是你可以预先定义一项任务,只在特定的 pull request 请求时被触发,而且与之有依赖关系的任务并不会被执行,这能让你的管道具有一定的隔离性:什么时候被构造的工件应该被部署到生产环境,什么时候应该被审核。 +Screwdriver 是个简单而又强大的软件。它采用微服务架构,依赖像 Nomad、Kubernetes 和 Docker 这样的工具作为执行引擎。官方有一篇很不错的[部署教学文档][34],介绍了如何将它部署到 AWS 和 Kubernetes 上,但如果正在开发中的 [Helm chart][35] 也完成的话,就更完美了。 + +Screwdriver 也使用 YAML 来描述它的管道,并且有很多合理的默认值,这样可以有效减少各个管道重复的配置项。用配置文件可以组织起高级的工作流,来描述各个任务间复杂的依赖关系。例如,一项任务可以在另一个任务开始前或结束后运行;各个任务可以并行也可以串行执行;更赞的是你可以预先定义一项任务,只在特定的拉取请求时被触发,而且与之有依赖关系的任务并不会被执行,这能让你的管道具有一定的隔离性:什么时候被构造的工件应该被部署到生产环境,什么时候应该被审核。 + +--- 以上只是我对这些 CI/CD 工具的简单介绍,它们还有许多很酷的特性等待你深入探索。而且它们都是开源软件,可以自由使用,去部署一下看看吧,究竟哪个才是最适合你的那个。 @@ -91,7 +123,7 @@ via: https://opensource.com/article/18/12/cicd-tools-sysadmins 作者:[Dan Barker][a] 选题:[lujun9972][b] 译者:[jdh8383](https://github.com/jdh8383) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b66d8ad2451f347cf55121f2e34b87ef9dafed3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Mar 2019 10:25:40 +0800 Subject: [PATCH 389/813] PUB:20181220 7 CI-CD tools for sysadmins.md @jdh8383 https://linux.cn/article-10578-1.html --- .../20181220 7 CI-CD tools for sysadmins.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20181220 7 CI-CD tools for sysadmins.md (99%) diff --git a/translated/talk/20181220 7 CI-CD tools for sysadmins.md b/published/20181220 7 CI-CD tools for sysadmins.md similarity index 99% rename from translated/talk/20181220 7 CI-CD tools for sysadmins.md rename to published/20181220 7 CI-CD tools for sysadmins.md index 8420cf4a69..64933afa4f 100644 --- a/translated/talk/20181220 7 CI-CD tools for sysadmins.md +++ b/published/20181220 7 CI-CD tools for sysadmins.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (jdh8383) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10578-1.html) [#]: subject: (7 CI/CD tools for sysadmins) [#]: via: (https://opensource.com/article/18/12/cicd-tools-sysadmins) [#]: author: (Dan Barker https://opensource.com/users/barkerd427) From ba876925a7ff32e3db04be04983fc562d12b2178 Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Fri, 1 Mar 2019 20:04:57 +0800 Subject: [PATCH 390/813] Update 20160921 lawyer The MIT License, Line by Line.md --- sources/talk/20160921 lawyer The MIT License, Line by Line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index 78abc6b9f1..31a5d3202e 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Amanda0212) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3c012a64775663e19021587a4ca55ff797bfc95e Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Fri, 1 Mar 2019 20:35:38 +0800 Subject: [PATCH 391/813] Update 20160921 lawyer The MIT License, Line by Line.md --- sources/talk/20160921 lawyer The MIT License, Line by Line.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index 31a5d3202e..fa808adaf9 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -1,3 +1,4 @@ +Amanda0212 is translating [#]: collector: (lujun9972) [#]: translator: (Amanda0212) [#]: reviewer: ( ) From 78c2a010a3a2d39ec24156455924e7099ae0d90c Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Fri, 1 Mar 2019 20:42:32 +0800 Subject: [PATCH 392/813] =?UTF-8?q?Amanda0212=20=E7=94=B3=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20160921 lawyer The MIT License, Line by Line.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index fa808adaf9..31a5d3202e 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -1,4 +1,3 @@ -Amanda0212 is translating [#]: collector: (lujun9972) [#]: translator: (Amanda0212) [#]: reviewer: ( ) From 2554b169d04e34f0fcac90fd58a74f292ac82563 Mon Sep 17 00:00:00 2001 From: acyanbird <2534930703@qq.com> Date: Fri, 1 Mar 2019 20:59:36 +0800 Subject: [PATCH 393/813] Update 20180930 A Short History of Chaosnet.md --- sources/talk/20180930 A Short History of Chaosnet.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20180930 A Short History of Chaosnet.md b/sources/talk/20180930 A Short History of Chaosnet.md index acbb10d53d..7ee1db8a37 100644 --- a/sources/talk/20180930 A Short History of Chaosnet.md +++ b/sources/talk/20180930 A Short History of Chaosnet.md @@ -1,3 +1,4 @@ +acyanbird translating A Short History of Chaosnet ====== If you fire up `dig` and run a DNS query for `google.com`, you will get a response somewhat like the following: From bd5488a73655758efe8af07a380cc62064bba2f0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 10:03:22 +0800 Subject: [PATCH 394/813] PRF:20190123 Mind map yourself using FreeMind and Fedora.md @geekpi --- ... map yourself using FreeMind and Fedora.md | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md index 2e2331e698..682fabfb71 100644 --- a/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md +++ b/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md @@ -1,21 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Mind map yourself using FreeMind and Fedora) [#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) [#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) -在 Fedora 中使用 FreeMind 制作自己的思维导图 +在 Fedora 中使用 FreeMind 介绍你自己 ====== + ![](https://fedoramagazine.org/wp-content/uploads/2019/01/freemind-816x345.jpg) -你自己的思维导图一开始听起来有些牵强。它是关于神经通路么?还是心灵感应?完全不是。相反,自己的思维导图是一种在视觉上向他人描述自己的方式。它还展示了你拿来描述的特征之间的联系。这是一种以聪明的同时可控的与他人分享信息的有用方式。你可以使用任何思维导图应用来做到。本文向你展示如何使用 Fedora 中提供的 [FreeMind][1]。 +介绍你自己的思维导图,一开始听起来有些牵强。它是关于神经通路么?还是心灵感应?完全不是。相反,自己的思维导图是一种在视觉上向他人描述自己的方式。它还展示了你拿来描述自己的特征之间的联系。这是一种以聪明又同时可控的与他人分享信息的有用方式。你可以使用任何思维导图应用来做到。本文向你展示如何使用 Fedora 中提供的 [FreeMind][1]。 ### 获取应用 -FreeMind 已经出现有一段时间了。虽然 UI 有点过时,你也可以使用新的,但它是一个功能强大的应用,提供了许多构建思维导图的选项。当然,它是 100% 开源的。还有其他思维导图应用可供 Fedora 和 Linux 用户使用。查看[此前一篇涵盖多个思维导图选择的文章][2]。 +FreeMind 已经出现有一段时间了。虽然 UI 有点过时,应该做一些更新了,但它是一个功能强大的应用,提供了许多构建思维导图的选项。当然,它是 100% 开源的。还有其他思维导图应用可供 Fedora 和 Linux 用户使用。查看[此前一篇涵盖多个思维导图选择的文章][2]。 如果你运行的是 Fedora Workstation,请使用“软件”应用从 Fedora 仓库安装 FreeMind。或者在终端中使用这个 [sudo][3] 命令: @@ -26,31 +27,34 @@ $ sudo dnf install freemind 你可以从 Fedora Workstation 中的 GNOME Shell Overview 启动应用。或者使用桌面环境提供的应用启动服务。默认情况下,FreeMind 会显示一个新的空白脑图: ![][4] -FreeMind 初始(空白)思维导图 + +*FreeMind 初始(空白)思维导图* 脑图由链接的项目或描述(节点)组成。当你想到与节点相关的内容时,只需创建一个与其连接的新节点即可。 -### +### 做你自己的脑图 -单击初始节点。编辑文本并点击**回车**将其替换为你的姓名。你就能开始你的思维导图。 +单击初始节点。编辑文本并按回车将其替换为你的姓名。你就能开始你的思维导图。 如果你必须向某人充分描述自己,你会怎么想?可能会有很多东西。你平时做什么?你喜欢什么?你不喜欢什么?你有什么价值?你有家庭吗?所有这些都可以在节点中体现。 -要添加节点连接,请选择现有节点,然后单击**插入**,或使用“灯泡”图标作为新的子节点。要在与新子级相同的层级添加另一个节点,请使用**回车**。 +要添加节点连接,请选择现有节点,然后单击“Insert”,或使用“灯泡”图标作为新的子节点。要在与新子级相同的层级添加另一个节点,请使用回车。 -如果你弄错了,别担心。你可以使用 **Delete** 键删除不需要的节点。内容上没有规则。但是最好是短节点。它们能让你在创建导图时思维更快。简洁的节点还能让其他浏览者更轻松地查看和理解。 +如果你弄错了,别担心。你可以使用 `Delete` 键删除不需要的节点。内容上没有规则。但是最好是短节点。它们能让你在创建导图时思维更快。简洁的节点还能让其他浏览者更轻松地查看和理解。 该示例使用节点规划了每个主要类别: ![][5] -个人思维导图,第一级 + +*个人思维导图,第一级* 你可以为这些区域中的每个区域另外迭代一次。让你的思想自由地连接想法以生成导图。不要担心“做得正确“。最好将所有内容从头脑中移到显示屏上。这是下一级导图的样子。 ![][6] -个人思维导图,第二级 -你可以以相同的方式扩展任何这些节点。请注意你在示例中可以了解多少有关 John Q. Public 的信息。 +*个人思维导图,第二级* + +你可以以相同的方式扩展任何这些节点。请注意你在示例中可以了解多少有关 “John Q. Public” 的信息。 ### 如何使用你的个人思维导图 @@ -59,7 +63,6 @@ FreeMind 初始(空白)思维导图 祝你在探索个人思维导图上玩得开心! - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ @@ -67,7 +70,7 @@ via: https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/ 作者:[Paul W. Frields][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 15236029c547949577fa1f339166ca1cec9b34f7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 10:05:29 +0800 Subject: [PATCH 395/813] PUB:20190123 Mind map yourself using FreeMind and Fedora.md @geekpi https://linux.cn/article-10579-1.html --- .../20190123 Mind map yourself using FreeMind and Fedora.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190123 Mind map yourself using FreeMind and Fedora.md (98%) diff --git a/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md b/published/20190123 Mind map yourself using FreeMind and Fedora.md similarity index 98% rename from translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md rename to published/20190123 Mind map yourself using FreeMind and Fedora.md index 682fabfb71..b8ee78cf9f 100644 --- a/translated/tech/20190123 Mind map yourself using FreeMind and Fedora.md +++ b/published/20190123 Mind map yourself using FreeMind and Fedora.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10579-1.html) [#]: subject: (Mind map yourself using FreeMind and Fedora) [#]: via: (https://fedoramagazine.org/mind-map-yourself-using-freemind-and-fedora/) [#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) From 6d41920cea52fb7e846699d2377b0b02234f3184 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 10:36:21 +0800 Subject: [PATCH 396/813] PRF:20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @An-DJ 恭喜你完成了第一篇翻译! --- ...Password in Ubuntu -Beginner-s Tutorial.md | 71 +++++++++---------- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md b/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md index a2dfb77515..7a8946acfc 100644 --- a/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md +++ b/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md @@ -1,31 +1,31 @@ [#]: collector: (lujun9972) [#]: translator: (An-DJ) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Change User Password in Ubuntu [Beginner’s Tutorial]) [#]: via: (https://itsfoss.com/change-password-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Ubuntu下如何修改用户密码 [新手教程] +新手教程:Ubuntu 下如何修改用户密码 ====== -**想要在Ubuntu下修改root用户的密码?那我们来学习下如何在Ubuntu Linux下修改任意用户的密码。我们会讨论在终端下修改和在图形界面(GUI)修改两种做法** -那么,在Ubuntu下什么时候会需要修改密码呢?这里我给出如下两种场景。 +> 想要在 Ubuntu 下修改 root 用户的密码?那我们来学习下如何在 Ubuntu Linux 下修改任意用户的密码。我们会讨论在终端下修改和在图形界面(GUI)修改两种做法。 -当你刚安装[Ubuntu][1]系统时,你会创建一个用户并且为之设置一个密码。这个初始密码可能安全性较弱或者太过于复杂,你会想要对它做出修改。 +那么,在 Ubuntu 下什么时候会需要修改密码呢?这里我给出如下两种场景。 -如果你是系统管理员,你可能需要去修改在你管理的系统内其他用户的密码。 +- 当你刚安装 [Ubuntu][1] 系统时,你会创建一个用户并且为之设置一个密码。这个初始密码可能安全性较弱或者太过于复杂,你会想要对它做出修改。 +- 如果你是系统管理员,你可能需要去修改在你管理的系统内其他用户的密码。 -当然,你可能会有其他的一些原因做这样的一件事。不过现在问题来了,我们到底如何在Ubuntu或Linux系统下修改单个用户的密码呢? +当然,你可能会有其他的一些原因做这样的一件事。不过现在问题来了,我们到底如何在 Ubuntu 或其它 Linux 系统下修改单个用户的密码呢? -在这个快速教程中,我将会展示给你在Ubuntu中如何使用命令行和图形界面(GUI)两种方式修改密码。 +在这个快速教程中,我将会展示给你在 Ubuntu 中如何使用命令行和图形界面(GUI)两种方式修改密码。 -### 在Ubuntu中修改用户密码[通过命令行] +### 在 Ubuntu 中修改用户密码 —— 通过命令行 -![如何在Ubuntu Linux下修改用户密码][2] +![如何在 Ubuntu Linux 下修改用户密码][2] -在Ubuntu下修改用户密码其实非常简单。事实上,在任何Linux发行版上修改的方式都是一样的,因为你要使用的是叫做 passwd 的普通Linux命令来达到此目的。 +在 Ubuntu 下修改用户密码其实非常简单。事实上,在任何 Linux 发行版上修改的方式都是一样的,因为你要使用的是叫做 `passwd` 的普通 Linux 命令来达到此目的。 如果你想要修改你的当前密码,只需要简单地在终端执行此命令: @@ -35,27 +35,22 @@ passwd 系统会要求你输入当前密码和两次新的密码。 -在键入密码时,你不会从屏幕上看到任何东西。这在UNIX和Linux系统中是非常正常的表现。 +在键入密码时,你不会从屏幕上看到任何东西。这在 UNIX 和 Linux 系统中是非常正常的表现。 ``` passwd - Changing password for abhishek. - (current) UNIX password: - Enter new UNIX password: - Retype new UNIX password: - passwd: password updated successfully ``` -由于这是你的管理员账户,你刚刚修改了Ubuntu下sudo的密码,但你甚至没有意识到这个操作。 +由于这是你的管理员账户,你刚刚修改了 Ubuntu 下 sudo 密码,但你甚至没有意识到这个操作。(LCTT 译注:执行 sudo 操作时,输入的是的用户自身的密码,此处修改的就是自身的密码。而所说的“管理员账户”指的是该用户处于可以执行 `sudo` 命令的用户组中。本文此处描述易引起误会,特注明。) -![在Linux命令行中修改用户密码][3] +![在 Linux 命令行中修改用户密码][3] -如果你想要修改其他用户的密码,你也可以使用passwd命令来做。但是在这种情况下,你将不得不使用sudo。 +如果你想要修改其他用户的密码,你也可以使用 `passwd` 命令来做。但是在这种情况下,你将不得不使用`sudo`。(LCTT 译注:此处执行 `sudo`,要先输入你的 sudo 密码 —— 如上提示已经修改,再输入给其它用户设置的新密码 —— 两次。) ``` sudo passwd @@ -63,45 +58,45 @@ sudo passwd 如果你对密码已经做出了修改,不过之后忘记了,不要担心。你可以[很容易地在Ubuntu下重置密码][4]. -### 修改Ubuntu下root用户密码 +### 修改 Ubuntu 下 root 用户密码 -默认情况下,Ubuntu中root用户是没有密码的。不必惊讶,你并不是在Ubuntu下一直使用root用户。不太懂?让我快速地给你解释下。 +默认情况下,Ubuntu 中 root 用户是没有密码的。不必惊讶,你并不是在 Ubuntu 下一直使用 root 用户。不太懂?让我快速地给你解释下。 -当[安装Ubuntu][5]时,你会被强制创建一个用户。这个用户拥有管理员访问权限。这个管理员用户可以通过sudo命令获得root访问权限。但是,该用户使用的是自身的密码,而不是root账户的密码(因为就没有)。 +当[安装 Ubuntu][5] 时,你会被强制创建一个用户。这个用户拥有管理员访问权限。这个管理员用户可以通过 `sudo` 命令获得 root 访问权限。但是,该用户使用的是自身的密码,而不是 root 账户的密码(因为就没有)。 -你可以使用**passwd**命令来设置或修改root用户的密码。然而,在大多数情况下,你并不需要它,而且你不应该去做这样的事。 +你可以使用 `passwd` 命令来设置或修改 root 用户的密码。然而,在大多数情况下,你并不需要它,而且你不应该去做这样的事。 -你将不得不使用sudo命令(对于拥有管理员权限的账户)。如果root用户的密码之前没有被设置,它会要求你设置。另外,你可以使用已有的root密码对它进行修改。 +你将必须使用 `sudo` 命令(对于拥有管理员权限的账户)。~~如果 root 用户的密码之前没有被设置,它会要求你设置。另外,你可以使用已有的 root 密码对它进行修改。~~(LCTT 译注:此处描述有误,使用 `sudo` 或直接以 root 用户执行 `passwd` 命令时,不需要输入该被改变密码的用户的当前密码。) ``` sudo password root ``` -### 在Ubuntu下使用图形界面(GUI)修改密码 +### 在 Ubuntu 下使用图形界面(GUI)修改密码 -我这里使用的是GNOME桌面环境,Ubuntu版本为18.04。这些步骤对于其他桌面环境和Ubuntu版本应该差别不大。 +我这里使用的是 GNOME 桌面环境,Ubuntu 版本为 18.04。这些步骤对于其他的桌面环境和 Ubuntu 版本应该差别不大。 -打开菜单(按下Windows/Super键)并搜索Settings。 +打开菜单(按下 `Windows`/`Super` 键)并搜索 “Settings”(设置)。 -在Settings中,向下滚动一段距离打开进入Details。 +在 “Settings” 中,向下滚动一段距离打开进入 “Details”。 -![在Ubuntu GNOME Settings中进入Details][6] +![在 Ubuntu GNOME Settings 中进入 Details][6] -在这里,点击Users获取系统下可见的所有用户。 +在这里,点击 “Users” 获取系统下可见的所有用户。 -![Ubuntu下用户设置][7] +![Ubuntu 下用户设置][7] -你可以选择任一你想要的用户,包括你的主要管理员账户。你需要先解锁用户并点击密码(password)区域。 +你可以选择任一你想要的用户,包括你的主要管理员账户。你需要先解锁用户并点击 “Password” 区域。 -![Ubuntu下修改用户密码][8] +![Ubuntu 下修改用户密码][8] 你会被要求设置密码。如果你正在修改的是你自己的密码,你将必须也输入当前使用的密码。 -![Ubuntu下修改用户密码][9] +![Ubuntu 下修改用户密码][9] -做好这些后,点击上面的Change按钮,这样就完成了。你已经成功地在Ubuntu下修改了用户密码。 +做好这些后,点击上面的 “Change” 按钮,这样就完成了。你已经成功地在 Ubuntu 下修改了用户密码。 -我希望这篇快速精简的小教程能够帮助你在Ubuntu下修改用户密码。如果你对此还有一些问题或建议,请在下方留下评论。 +我希望这篇快速精简的小教程能够帮助你在 Ubuntu 下修改用户密码。如果你对此还有一些问题或建议,请在下方留下评论。 -------------------------------------------------------------------------------- @@ -111,7 +106,7 @@ via: https://itsfoss.com/change-password-ubuntu 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[An-DJ](https://github.com/An-DJ) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8cbcdb661cffd56a3a90897edbcfb5a81fdf1159 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 10:38:33 +0800 Subject: [PATCH 397/813] PUB:20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @An-DJ 本文首发地址: https://linux.cn/article-10580-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/An-DJ 请注册领取 LCCN: https://lctt.linux.cn/ --- ... to Change User Password in Ubuntu -Beginner-s Tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md (98%) diff --git a/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md b/published/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md similarity index 98% rename from translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md rename to published/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md index 7a8946acfc..dbaf1ca52e 100644 --- a/translated/tech/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md +++ b/published/20190217 How to Change User Password in Ubuntu -Beginner-s Tutorial.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (An-DJ) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10580-1.html) [#]: subject: (How to Change User Password in Ubuntu [Beginner’s Tutorial]) [#]: via: (https://itsfoss.com/change-password-ubuntu) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From ec07767fa0a0d31cc1fc7064520cceed64894c81 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 11:06:21 +0800 Subject: [PATCH 398/813] PRF:20180122 Ick- a continuous integration system.md @tomjlw --- ...22 Ick- a continuous integration system.md | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/translated/tech/20180122 Ick- a continuous integration system.md b/translated/tech/20180122 Ick- a continuous integration system.md index eb1f3c6c45..3c240f9545 100644 --- a/translated/tech/20180122 Ick- a continuous integration system.md +++ b/translated/tech/20180122 Ick- a continuous integration system.md @@ -1,60 +1,53 @@ -Ick:一个连续集成系统 +ick:一个持续集成系统 ====== -**TL;DR:** Ick 是一个连续集成或者 CI 系统。访问 获取跟多信息。 +> ick 是一个持续集成(CI)系统。访问 获取更多信息。 -更加详细的版本随后会出 +更加详细的内容如下: ### 首个公开版本发行 -世界可能还不需要另一个连续集成系统(CI)但是我需要。我已对我尝试过或者看过的连续集成系统感到不满意了。更重要的是,几样我感兴趣的东西比我所听说过的连续集成系统要强大得多。因此我开始编写我自己的 CI 系统。 +这个世界可能并不需要又一个持续集成系统(CI),但是我需要。我对我尝试过或者看过的持续集成系统感到不满意。更重要的是,有几样我感兴趣的东西比我所听说过的持续集成系统要强大得多。因此我开始编写我自己的 CI 系统。 -我的新个人业余项目叫做 ick。它是一个 CI 系统,这意味着他可以运行自动化的步骤来搭建、测试软件。它的主页是,[下载][1]页面有导向源码、.deb 包和用来安装的 Ansible 脚本的链接。 +我的新个人业余项目叫做 ick。它是一个 CI 系统,这意味着它可以运行自动化的步骤来构建、测试软件。它的主页是 ,[下载][1]页面有指向源代码、.deb 包和用来安装的 Ansible 脚本的链接。 -我现已发布了首个公开版本,绰号 ALPHA-1,版本号0.23。它现在是 alpha 品质,这意味着它并没拥有所有期望的特性,如果任何一个它已有的特性工作的话,你应该感到庆幸。 +我现已发布了首个公开版本,绰号 ALPHA-1,版本号 0.23。(LCTT 译注:截止至本译文发布,已经更新到 ALPHA-6)它现在是 alpha 品质,这意味着它并没拥有期望的全部特性,如果任何一个它已有的特性工作的话,那真是运气好。 -### 诚邀英才 +### 诚邀贡献 -Ick 目前是我的个人项目。我希望能让它不仅限于此,同时我也诚邀英才。访问[管理][2]页面查看章程,[开始][3]页面查看如何开始贡献的的小贴士,[联系][4]页面查看如何联络。 +ick 目前是我的个人项目。我希望能让它不仅限于此,同时我也诚邀更多贡献。访问[治理][2]页面查看章程,[入门][3]页面查看如何开始贡献的的小建议,[联系][4]页面查看如何联络。 ### 架构 -Ick 拥有一个由几个通过 HTTPS 协议通信使用 RESTful API 和 JSON 处理结构化数据的部分组成的架构。访问[架构][5]页面查看细节。 +ick 拥有一个由几个通过 HTTPS 协议通信使用 RESTful API 和 JSON 处理结构化数据的部分组成的架构。访问[架构][5]页面了解细节。 -### 宣言 +### 宣告 -连续集成(CI)是用于软件开发的强大工具。它不应枯燥、易溃或恼人。它搭建起来应简单快速,除非正在测试、搭建中的码有问题,不然它应在后台安静地工作。 +持续集成(CI)是用于软件开发的强大工具。它不应枯燥、易溃或恼人。它构建起来应简单快速,除非正在测试、构建的代码中有问题,不然它应在后台安静地工作。 -一个连续集成系统应该简单、易用、清楚、干净、可扩展、快速、综合、透明、可靠并推动你的生产力。搭建它不应花大力气、不应需要专门为 CI 而造的硬件、不应需要频繁留意以使其保持工作、开发者永远不必思考为什么某样东西不工作。 +一个持续集成系统应该简单、易用、清楚、干净、可扩展、快速、综合、透明、可靠,并推动你的生产力。构建它不应花大力气、不应需要专门为 CI 而造的硬件、不应需要频繁留意以使其保持工作、开发者永远不必思考为什么某样东西不工作。 -一个连续集成系统应该足够灵活以适应你的搭建、测试需求。只要 CPU 架构和操作系统版本没问题,它应该支持各式操作者。 +一个持续集成系统应该足够灵活以适应你的构建、测试需求。只要 CPU 架构和操作系统版本没问题,它应该支持各种操作者。 同时像所有软件一样,CI 应该彻彻底底的免费,你的 CI 应由你做主。 -(目前的 Ick 仅稍具雏形,但是它会尝试着有朝一日变得完美,在最理想的情况下。) +(目前的 ick 仅稍具雏形,但是它会尝试着有朝一日变得完美 —— 在最理想的情况下。) ### 未来的梦想 长远来看,我希望 ick 拥有像下面所描述的特性。落实全部特性可能需要一些时间。 -* 多种多样的事件都可以触发搭建。时间是一个明显的事件因为项目的源代码仓库改变了。更强大的是不管依赖是来自于 ick 搭建的另一个项目或则包比如说来自 Debian,任何用于搭建的依赖都会改变:ick 应当跟踪所有安装进一个项目搭建环境中的包,如果任何一个包的版本改变,都应再次触发项目搭建和测试。 - -* Ick 应该支持搭建任何合理的目标,包括任何 Linux 发行版,任何免费的操作系统,以及任何一息尚存的收费操作系统。 - -* Ick 应当不需要安装任何专门的代理,就能支持各种它能够通过 ssh 或者串口或者其它这种中性交流管道控制的操作者。Ick 不应默认它可以有比如说一个完整的 Java Runtime,如此一来,操作者就可以是一个微控制器了。 - -* Ick 应当能轻松掌控一大批项目。我觉得不管一个新的 Debian 源包何时上传,Ick 都应该要能够跟得上在 Debian 中搭建所有东西的进度。(明显这可行与否取决于是否有足够的资源确实用在搭建上,但是 Ick 自己不应有瓶颈。) - -* 如果有需要的话 Ick 应当有选择性地补给操作者。如果所有特定种类的操作者处于忙碌中且 Ick 被设置成允许使用更多资源的话,它就应该这么做。这看起来用虚拟机、容器、云提供商等做可能会简单一些。 - -* Ick 应当灵活提醒感兴趣的团体特别是关于其失败的方面。它应允许感兴趣的团体通过 IRC,Matrix,Mastodon, Twitter, email, SMS 甚至电话和语音合成来接受通知。例如“您好,感兴趣的团体。现在是四点钟您想被通知 hello 包什么时候为 RISC-V 搭建好。” - - - +* 各种事件都可以触发构建。时间是一个明显的事件,因为项目的源代码仓库改变了。更强大的是任何依赖的改变,不管依赖是来自于 ick 构建的另一个项目,或者是包(比如说来自 Debian):ick 应当跟踪所有安装进一个项目构建环境中的包,如果任何一个包的版本改变,都应再次触发项目构建和测试。 +* ick 应该支持构建于(或针对)任何合理的目标平台,包括任何 Linux 发行版,任何自由的操作系统,以及任何一息尚存的不自由的操作系统。 +* ick 应该自己管理构建环境,并且能够执行与构建主机或网络隔离的构建。这部分工作:可以要求 ick 构建容器并在容器中运行构建。容器使用 systemd-nspawn 实现。 然而,这可以改进。(如果您认为 Docker 是唯一的出路,请为此提供支持。) +* ick 应当不需要安装任何专门的代理,就能支持各种它能够通过 ssh 或者串口或者其它这种中性的交流管道控制的操作者worker。ick 不应默认它可以有比如说一个完整的 Java Runtime,如此一来,操作者就可以是一个微控制器了。 +* ick 应当能轻松掌控一大批项目。我觉得不管一个新的 Debian 源包何时上传,ick 都应该要能够跟得上在 Debian 中构建所有东西的进度。(明显这可行与否取决于是否有足够的资源确实用在构建上,但是 ick 自己不应有瓶颈。) +* 如果有需要的话 ick 应当有选择性地补给操作者。如果所有特定种类的操作者处于忙碌中,且 ick 被设置成允许使用更多资源的话,它就应该这么做。这看起来用虚拟机、容器、云提供商等做可能会简单一些。 +* ick 应当灵活提醒感兴趣的团体,特别是关于其失败的方面。它应允许感兴趣的团体通过 IRC、Matrix、Mastodon、Twitter、email、SMS 甚至电话和语音合成来接受通知。例如“您好,感兴趣的团体。现在是四点钟您想被通知 hello 包什么时候为 RISC-V 构建好。” ### 请提供反馈 -如果你尝试 ick 或者甚至你仅仅是读到这,请在上面分享你的想法。[联系][4]页面查看如何发送反馈。相比私下反馈我更偏爱公开反馈。但如果你偏爱私下反馈,那也行。 +如果你尝试过 ick 或者甚至你仅仅是读到这,请在上面分享你的想法。在[联系][4]页面查看如何发送反馈。相比私下反馈我更偏爱公开反馈。但如果你偏爱私下反馈,那也行。 -------------------------------------------------------------------------------- @@ -62,7 +55,7 @@ via: https://blog.liw.fi/posts/2018/01/22/ick_a_continuous_integration_system/ 作者:[Lars Wirzenius][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 14cb0814dcd1b3b819b27189922ed50622ce7489 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 11:06:52 +0800 Subject: [PATCH 399/813] PUB:20180122 Ick- a continuous integration system.md @tomjlw https://linux.cn/article-10581-1.html --- .../20180122 Ick- a continuous integration system.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180122 Ick- a continuous integration system.md (100%) diff --git a/translated/tech/20180122 Ick- a continuous integration system.md b/published/20180122 Ick- a continuous integration system.md similarity index 100% rename from translated/tech/20180122 Ick- a continuous integration system.md rename to published/20180122 Ick- a continuous integration system.md From 14a4d2899266bc6e34af7eb1a343531947a4424b Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sat, 2 Mar 2019 16:20:28 +0800 Subject: [PATCH 400/813] Update 20160921 lawyer The MIT License, Line by Line.md --- ...21 lawyer The MIT License, Line by Line.md | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index 31a5d3202e..009acc7961 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -8,27 +8,37 @@ [#]: author: (Kyle E. Mitchell https://kemitchell.com/) lawyer The MIT License, Line by Line +麻省理工学院律师执照,逐行 ====== ### The MIT License, Line by Line +### 麻省理工学院律师执照,逐行 [The MIT License][1] is the most popular open-source software license. Here’s one read of it, line by line. +[MIT许可证][1] 是最流行的开源软件许可证,请逐行阅读下面的内容。 #### Read the License +#### 阅读许可证 If you’re involved in open-source software and haven’t taken the time to read the license from top to bottom—it’s only 171 words—you need to do so now. Especially if licenses aren’t your day-to-day. Make a mental note of anything that seems off or unclear, and keep trucking. I’ll repeat every word again, in chunks and in order, with context and commentary. But it’s important to have the whole in mind. +如果你参与了开源软件的开发,然而你还没有花时间从头开始阅读尽管只有171个单词的许可证,你现在就需要这么做,尤其是如果许可证不是你的日常生活。记住任何看起来不对劲或不清楚的事情,然后继续思考。我将重复上下文和评论的每一个字,按块和顺序。但重要的是你要做到心中有数。 -> The MIT License (MIT) -> +> The MIT License (MIT) MIT 执照 +> > Copyright (c) +> 版权(c)<年份><版权持有人> > > 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. +> 该软件是"原封不动地"提供的,没有任何明示或默示的保证,包括但不限于适销性、适合某一特定目的和不侵权的保证。在任何情况下,作者或版权所有人都不应对因下列原因引起的任何索赔、损害或其他责任负责,与软件或软件中的使用或其他交易有关的。 The license is arranged in five paragraphs, but breaks down logically like this: +许可证由五个部分组成,在逻辑组成上像下面这样: * **Header** * **License Title** : “The MIT License” @@ -39,52 +49,84 @@ The license is arranged in five paragraphs, but breaks down logically like this: * **Attribution and Notice** : “The above … shall be included …” * **Warranty Disclaimer** : “The software is provided ‘as is’ …” * **Limitation of Liability** : “In no event …” + + * **页眉** + * **许可证所有权** : “MIT执照” + * **版权公告** : “版权 (c) …” + * **许可证授予** : “特此批准 …” + * **授予范围** : “… 在软件方面的处理 …” + * **条件** : “… 服从于 …” + * **归属和通知** : “以上...应包含...在内” + * **保修免责声明** : “该软件“原封不动地”提供...” + * **赔偿责任限制** : “在任何情况下....” Here we go: +我们开始了: #### Header +#### 页眉 ##### License Title +##### 许可证所有权 > The MIT License (MIT) +> 麻省理工执照(麻省理工) “The MIT License” is a not a single license, but a family of license forms derived from language prepared for releases from the Massachusetts Institute of Technology. It has seen a lot of changes over the years, both for the original projects that used it, and also as a model for other projects. The Fedora Project maintains a [kind of cabinet of MIT license curiosities][2], with insipid variations preserved in plain text like anatomical specimens in formaldehyde, tracing a wayward kind of evolution. +“麻省理工许可证”并不是一个单一的许可证,而是包含来自于麻省理工学院为发布而准备的语言的一系列许可证表格。这些年来,无论是对于使用它的原始项目都经历了许多变化,还是作为其他项目的模型。fedora项目保持了一种[mit许可证陈列室的种类][2],在简单文本中保留了微小的变化,如甲醛中的解剖标本,追踪着一种没有规律的进化。 Fortunately, the [Open Source Initiative][3] and [Software Package Data eXchange][4] groups have standardized a generic MIT-style license form as “The MIT License”. OSI in turn has adopted SPDX’ standardized [string identifiers][5] for common open-source licenses, with `MIT` pointing unambiguously to the standardized form “MIT License”. If you want MIT-style terms for a new project, use [the standardized form][1]. +幸运的是,[开源计划][3]和[数据交换软件包][4]组已经将通用的MIT式许可证表格标准化为“mit许可证”。而OSI则将SPDX的标准化(字符串标识符)[5]用于普通的开源许可证,“MIT”明确指向标准化的表格“MIT许可证”。 Even if you include “The MIT License” or “SPDX:MIT” in a `LICENSE` file, any responsible reviewer will still run a comparison of the text against the standard form, just to be sure. While various license forms calling themselves “MIT License” vary only in minor details, the looseness of what counts as an “MIT License” has tempted some authors into adding bothersome “customizations”. The canonical horrible, no good, very bad example of this is [the JSON license][6], an MIT-family license plus “The Software shall be used for Good, not Evil.”. This kind of thing might be “very Crockford”. It is definitely a pain in the ass. Maybe the joke was supposed to be on the lawyers. But they laughed all the way to the bank. +即使在“许可证”文件中包含“MIT许可证”或“SPDX:MIT”,负责任的评论者为了确定仍然会对文本和标准表单进行比较。尽管各种自称为“麻省理工许可证”的许可证表格只在细节上有所不同,但所谓的“麻省理工许可证”的宽松已经诱使一些作者添加了令人讨厌的“定制”。典型的可怕的的例子就是[JSON许可证][6],一个MIT-family许可证加上“软件应该用于正途的,而不是邪恶的...”这种事情可能是“非常克罗克福德”。这绝对是一个痛苦的事情。可能是律师们开的一个玩笑,但他们一路笑到最后。 Moral of the story: “MIT License” alone is ambiguous. Folks probably have a good idea what you mean by it, but you’re only going to save everyone—yourself included—time by copying the text of the standard MIT License form into your project. If you use metadata, like the `license` property in package manager metadata files, to designate the `MIT` license, make sure your `LICENSE` file and any header comments use the standard form text. All of this can be [automated][7]. +这个故事的寓意是:“麻省理工许可证”本身是模棱两可的。人们或许对你的意思有清晰的理解,但是你只会通过将标准的mit许可证表格的文本复制到你的项目中来节省所有人的时间,包括你自己。如果您使用元数据,如包管理器元数据文件中的“许可证”属性来指定“MIT”许可证,请确保您的“许可证”文件和任何头注使用标准窗体文本。而这些都可以[自动化][7]。 ##### Copyright Notice +##### 版权公告 > Copyright (c) +> 版权(c)<年份><版权持有人> Until the 1976 Copyright Act, United States copyright law required specific actions, called “formalities”, to secure copyright in creative works. If you didn’t follow those formalities, your rights to sue others for unauthorized use of your work were limited, often completely lost. One of those formalities was “notice”: Putting marks on your work and otherwise making it known to the market that you were claiming copyright. The © is a standard symbol for marking copyrighted works, to give notice of copyright. The ASCII character set doesn’t have the © symbol, but `Copyright (c)` gets the same point across. +直到1976年的版权法,美国版权法要求采取具体行动以确保创作作品的版权,称为“手续”。如果你没有遵循这些手续,你起诉他人未经授权使用你的作品的权利是有限的,但这种权利基本丧失。其中一种形式是“通知”:在你的作品上做标记,或者在声明过后让市场知道你拥有版权。 © 是标记有版权作品的标准符号,以发出版权通知。ascii字符集没有 © 符号,但是“版权(c)”得到了这种权利。 The 1976 Copyright Act, which “implemented” many requirements of the international Berne Convention, eliminated formalities for securing copyright. At least in the United States, copyright holders still need to register their copyrighted works before suing for infringement, with potentially higher damages if they register before infringement begins. In practice, however, many register copyright right before bringing suit against someone in particular. You don’t lose your copyright just by failing to put notices on it, registering, sending a copy to the Library of Congress, and so on. +1976年“执行”了伯尔尼国际公约的许多要求版权法却取消了保护版权的手续。至少在美国,版权拥有者仍然需要在起诉侵权行为之前登记他们的版权作品,但如果他们在侵权行为开始前登记,也许会造成更高的损害。然而,现实中许多人在提起诉讼之前登记了版权。你不会因为只是没有在版权上张贴通知、注册、向国会图书馆发送副本等行为而失去版权。 Even if copyright notices aren’t as absolutely necessary as they used to be, they are still plenty useful. Stating the year a work was authored and who the copyright belonged to give some sense of when copyright in the work might expire, bringing the work into the public domain. The identity of the author or authors is also useful: United States law calculates copyright terms differently for individual and “corporate” authors. Especially in business use, it may also behoove a company to think twice about using software from a known competitor, even if the license terms give very generous permission. If you’re hoping others will see your work and want to license it from you, copyright notices serve nicely for attribution. +即使版权公告不再像过去那样绝对必要,但它们仍然很有用。说明作品创作的年份和版权持有者,使人们对作品的版权何时到期有某种感觉,从而使作品进入公共领域。作者的身份也很有用:美国法律对个人和“公司”两种身份的作者的版权计算方法不同。尤其是在商业上,即使许可条款给予非常慷慨的许可,公司也有必要对使用已知竞争对手的软件三思而后行。如果你希望别人看到你的作品,并希望从你那里获得许可,版权公告就可以很好裁决归属问题。 As for “copyright holder”: Not all standard form licenses have a space to write this out. More recent license forms, like [Apache 2.0][8] and [GPL 3.0][9], publish `LICENSE` texts that are meant to be copied verbatim, with header comments and separate files elsewhere to indicate who owns copyright and is giving the license. Those approaches neatly discourage changes to the “standard” texts, accidental or intentional. They also make automated license identification more reliable. +至于“版权持有人”:并不是所有的标准格式许可证都有地方写出来。近期的许可证表格,如[apache 2.0][8]和[gpl 3.0][9],发布“许可证”文本,这些文本本应逐字复制,与头注和单独的文件其他地方,以表明谁拥有版权,并正在给予许可证。这些做法有意无意地阻止了对"标准"文本的更改,还使自动许可证认证更加可靠。 -The MIT License descends from language written for releases of code by institutions. For institutional releases, there was just one clear “copyright holder”, the institution releasing the code. Other institutions cribbed these licenses, replacing “MIT” with their own names, leading eventually to the generic forms we have now. This process repeated for other short-form institutional licenses of the era, notably the [original four-clause BSD License][10] for the University of California, Berkeley, now used in [three-clause][11] and [two-clause][12] variants, as well as [The ISC License][13] for the Internet Systems Consortium, an MIT variant. +The MIT License descends from language written for releases of code by institutions. For institutional releases, there was just one clear “copyright holder”, the institution releasing the code. Other institutions cribbed these licenses, replacing “MIT” with their own names, leading eventually to the generic forms we have now. This process repeated for other short-form institutional licenses of the era, notably the [original four-clause BSD License][10] for the University of California, Berkeley, now used in [three-clause][11] and [two-clause][12] variants, as well as [The ISC License][13] for the Internet Systems Consortium, an MIT variant. +MIT许可证是机构为发布代码而编写的语言。对于机构发布,只有一个明确的“版权持有人”,即机构发布代码。其他一些机构用他们自己的名字代替了“MIT”,最终形成了我们现在的通用格式。这个过程重复了这个时代的其他短形式的机构许可证,值得注意的是加州大学伯克利分校的[原四条款BSD许可证][10],现在用于[三条款][11]和[二条款][12]的变体,以及互联网系统联盟(MIT的一种变体)的(ISC许可证)。 In each case, the institution listed itself as the copyright holder in reliance on rules of copyright ownership, called “[works made for hire][14]” rules, that give employers and clients ownership of copyright in some work their employees and contractors do on their behalf. These rules don’t usually apply to distributed collaborators submitting code voluntarily. This poses a problem for project-steward foundations, like the Apache Foundation and Eclipse Foundation, that accept contributions from a more diverse group of contributors. The usual foundation approach thus far has been to use a house license that states a single copyright holder—[Apache 2.0][8] and [EPL 1.0][15]—backed up by contributor license agreements—[Apache CLAs][16] and [Eclipse CLAs][17]—to collect rights from contributors. Collecting copyright ownership in one place is even more important under “copyleft” licenses like the GPL, which rely on copyright owners to enforce license conditions to promote software-freedom values. +在所有情况下,机构都将自己列为版权所有人,以依赖版权所有权规则,称为"[受雇作品][14]"规则,这就给了雇主和客户一些版权,他们的雇员和承包商代表他们做的工作。这些规则通常不适用于自愿提交代码的分布式合作者。这给项目管理者基金会带来了一个问题,比如apache基金会和日食基金会,这些基金会接受了来自更多样化的捐助者群体的捐助。到目前为止,通常的基础方法是使用一种房屋许可证,该许可证规定只有一个版权持有人——[Apache 2.0][8]和[EPL 1.0][15]——由出资人许可证协议支持——[apache clas][16]并且[clas][17]——从贡献者那里收集权利。在像GPL这样的“版权许可”下,在一个地方收集版权所有权更加重要,因为它依赖于版权所有人强制执行许可条件以促进软件自由值。 These days, loads of projects without any kind of institutional or business steward use MIT-style license terms. SPDX and OSI have helped these use cases by standardizing forms of licenses like MIT and ISC that don’t refer to a specific entity or institutional copyright holder. Armed with those forms, the prevailing practice of project authors is to fill their own name in the copyright notice of the form very early on … and maybe bump the year here and there. At least under United States copyright law, the resulting copyright notice doesn’t give a full picture. +如今,只有很少的任何机构或企业管理者的项目在使用MIT式的许可证条款。SPDX和OSI通过规范MIT和ISC等不涉及特定实体或机构版权持有人的许可证形式,帮助了这些案例的使用。有了这些表格,项目作者的普遍做法是在很早表格的版权通知时就填写他们自己的名字,也许会在这里或那里增加一年的时间。至少根据美国版权法,由此产生的版权通知并没有给出一个完整的情况。 The original owner of a piece of software retains ownership of their work. But while MIT-style license terms give others rights to build on and change the software, creating what the law calls “derivative works”, they don’t give the original author ownership of copyright in others’ contributions. Rather, each contributor has copyright in any [even marginally creative][18] work they make using the existing code as a starting point. +软件的原拥有者保留对其作品的所有权。但是,尽管MIT式的许可条款赋予了其他人在软件上进行开发和更改的权利,创造了法律所称的“衍生作品”,但它们并没有赋予原始作者在他人贡献中的版权所有权。相反,每个贡献者都拥有以现有代码为起点的作品的版权。 Most of these projects also balk at the idea of taking contributor license agreements, to say nothing of signed copyright assignments. That’s both naive and understandable. Despite the assumption of some newer open-source developers that sending a pull request on GitHub “automatically” licenses the contribution for distribution on the terms of the project’s existing license, United States law doesn’t recognize any such rule. Strong copyright protection, not permissive licensing, is the default. +这些项目中的大多数也对接受贡献者许可协议的想法有所保留,更不用说签署版权转让了。这其实很好理解。尽管假定一些较新的开源开发者对github“自动”发送退出请求,根据项目的现有许可条款授权分配贡献,但美国法律不承认这样的规则。默认的是强有力的版权保护,而不是许可许可。 Update: GitHub later changed its site-wide terms of service to include an attempt to flip this default, at least on GitHub.com. I’ve written up some thoughts on that development, not all of them positive, in [another post][19]. +更新:GitHub后来改变了它在整个网站的服务条款,包括试图翻转这个默认,至少在GitHub.com。我已经写了一些关于这个发展的想法,不是所有的都是积极的,在[另一个帖子][19]。 To fill the gap between legally effective, well-documented grants of rights in contributions and no paper trail at all, some projects have adopted the [Developer Certificate of Origin][20], a standard statement contributors allude to using `Signed-Off-By` metadata tags in their Git commits. The Developer Certificate of Origin was developed for Linux kernel development in the wake of the infamous SCO lawsuits, which alleged that chunks of Linux’ code derived from SCO-owned Unix source. As a means of creating a paper trail showing that each line of Linux came from a contributor, the Developer Certificate of Origin functions nicely. While the Developer Certificate of Origin isn’t a license, it does provide lots of good evidence that those submitting code expected the project to distribute their code, and for others to use it under the kernel’s existing license terms. The kernel also maintains a machine-readable `CREDITS` file listing contributors with name, affiliation, contribution area, and other metadata. I’ve done [some][21] [experiments][22] adapting that approach for projects that don’t use the kernel’s development flow. +为填补具有法律效力的且有充分文件证明的捐款权利授予与完全没有书面记录之间的空白,一些项目采用了[开发商原产地证书][20],一个标准的语句贡献者暗示在他们的Git提交中使用“签名关闭”元数据标签。在臭名昭著的SCO诉讼事件之后,Linux内核开发人员为Linux内核开发了原产地证书,该诉讼指控Linux的代码块来自于SCO拥有的UNIX源代码。作为一种创建文件线索的手段,显示每一行Linux代码的贡献者,开发人员原产地证书的功能很好。虽然开发人员的原产地证书不是许可证,但它确实提供了大量的证据,证明提交代码的人希望项目分发他们的代码,并让其他人在内核的现有许可条款下使用。内核还维护一个机器可读的“信用”文件,列出具有名称、关联、贡献区域和其他元数据的贡献者。我已经做了[一些][实验][22]将这种方法应用于不使用内核开发流程的项目。 #### License Grant +#### 许可授权 > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), From f8b12f319b93e4f37c019025406baa29ad86028f Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sat, 2 Mar 2019 16:22:37 +0800 Subject: [PATCH 401/813] Update 20160921 lawyer The MIT License, Line by Line.md --- sources/talk/20160921 lawyer The MIT License, Line by Line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index 009acc7961..30479986ce 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -78,7 +78,7 @@ Here we go: “麻省理工许可证”并不是一个单一的许可证,而是包含来自于麻省理工学院为发布而准备的语言的一系列许可证表格。这些年来,无论是对于使用它的原始项目都经历了许多变化,还是作为其他项目的模型。fedora项目保持了一种[mit许可证陈列室的种类][2],在简单文本中保留了微小的变化,如甲醛中的解剖标本,追踪着一种没有规律的进化。 Fortunately, the [Open Source Initiative][3] and [Software Package Data eXchange][4] groups have standardized a generic MIT-style license form as “The MIT License”. OSI in turn has adopted SPDX’ standardized [string identifiers][5] for common open-source licenses, with `MIT` pointing unambiguously to the standardized form “MIT License”. If you want MIT-style terms for a new project, use [the standardized form][1]. -幸运的是,[开源计划][3]和[数据交换软件包][4]组已经将通用的MIT式许可证表格标准化为“mit许可证”。而OSI则将SPDX的标准化(字符串标识符)[5]用于普通的开源许可证,“MIT”明确指向标准化的表格“MIT许可证”。 +幸运的是,[开源计划][3]和[数据交换软件包][4]组已经将通用的MIT式许可证表格标准化为“mit许可证”。而OSI则将SPDX的标准化[字符串识别符][5]用于普通的开源许可证,“MIT”明确指向标准化的表格“MIT许可证”。 Even if you include “The MIT License” or “SPDX:MIT” in a `LICENSE` file, any responsible reviewer will still run a comparison of the text against the standard form, just to be sure. While various license forms calling themselves “MIT License” vary only in minor details, the looseness of what counts as an “MIT License” has tempted some authors into adding bothersome “customizations”. The canonical horrible, no good, very bad example of this is [the JSON license][6], an MIT-family license plus “The Software shall be used for Good, not Evil.”. This kind of thing might be “very Crockford”. It is definitely a pain in the ass. Maybe the joke was supposed to be on the lawyers. But they laughed all the way to the bank. 即使在“许可证”文件中包含“MIT许可证”或“SPDX:MIT”,负责任的评论者为了确定仍然会对文本和标准表单进行比较。尽管各种自称为“麻省理工许可证”的许可证表格只在细节上有所不同,但所谓的“麻省理工许可证”的宽松已经诱使一些作者添加了令人讨厌的“定制”。典型的可怕的的例子就是[JSON许可证][6],一个MIT-family许可证加上“软件应该用于正途的,而不是邪恶的...”这种事情可能是“非常克罗克福德”。这绝对是一个痛苦的事情。可能是律师们开的一个玩笑,但他们一路笑到最后。 From 8356cb0f5c07aafb845bbba8656c7f63003d42c2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 2 Mar 2019 21:28:08 +0800 Subject: [PATCH 402/813] PRF:20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @lujun9972 --- ... create OAuth 2.0 UML sequence diagrams.md | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md b/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md index 996c45aaa2..dd514ec985 100644 --- a/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md +++ b/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @@ -1,20 +1,20 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(Use Emacs to create OAuth 2.0 UML sequence diagrams) -[#]:via:(https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) -[#]:author:(Peter Mosmans https://www.onwebsecurity.com) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs to create OAuth 2.0 UML sequence diagrams) +[#]: via: (https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) +[#]: author: (Peter Mosmans https://www.onwebsecurity.com) 使用 Emacs 创建 OAuth 2.0 的 UML 序列图 ====== ![OAuth 2.0 abstract protocol flow][6] -看起来 [OAuth 2.0 框架 ][7] 已经越来越广泛地应用于 web (和 移动) 应用。太棒了! +看起来 [OAuth 2.0 框架][7] 已经越来越广泛地应用于 web (和 移动) 应用。太棒了! -虽然协议本身并不复杂,但有很多的使用场景,流程和实现可供选择。正如生活中的大多数事物一样,魔鬼在于细节之中。 +虽然协议本身并不复杂,但有很多的使用场景、流程和实现可供选择。正如生活中的大多数事物一样,魔鬼在于细节之中。 在审查 OAuth 2.0 实现或编写渗透测试报告时我习惯画出 UML 图。这方便让人理解发生了什么事情,并发现潜在的问题。毕竟,一图抵千言。 @@ -24,17 +24,15 @@ Emacs 是世界上最万能的编辑器。在这种场景中,我们用它来 下载 [预先编译好了的 PlantUML jar 文件 ][11],[Emacs][12] 还可以选择下载并安装 [Graphviz][13]。 -安装并启动 Emacs,然后将下面 Lisp 代码(实际上是配置)写入你的启动文件中(` ~/.emacs.d/init.d` ),这段代码将会 +安装并启动 Emacs,然后将下面 Lisp 代码(实际上是配置)写入你的启动文件中(`~/.emacs.d/init.d`),这段代码将会: - * 配置 ` org-mode` (一种用来组织并编辑文本文件的模式) 来使用 PlantUML - * 将 ` plantuml` 添加到可识别的` org-babel` 语言中 (这让你可以在文本文件中执行源代码) + * 配置 org 模式(一种用来组织并编辑文本文件的模式)来使用 PlantUML + * 将 `plantuml` 添加到可识别的 “org-babel” 语言中(这让你可以在文本文件中执行源代码) * 将 PlantUML 代码标注为安全的,从而允许执行 * 自动显示生成的结果图片 - - ```elisp - ;; tell org-mode where to find the plantuml JAR file (specify the JAR file) +;; tell org-mode where to find the plantuml JAR file (specify the JAR file) (setq org-plantuml-jar-path (expand-file-name "~/plantuml.jar")) ;; use plantuml as org-babel language @@ -54,13 +52,13 @@ Emacs 是世界上最万能的编辑器。在这种场景中,我们用它来 如果你还没有启动文件,那么将该代码加入到 `~/.emacs.d/init.el` 文件中然后重启 Emacs。 -提示:Control-c Control-f 可以让你创建/打开(新)文件。Control-x Control-s 保存文件,而 Control-x Control-c 退出 Emacs。 +提示:`Control-c Control-f` 可以让你创建/打开(新)文件。`Control-x Control-s` 保存文件,而 `Control-x Control-c` 退出 Emacs。 这就结了! -要测试该配置,可以创建/打开( Control-c Control-f )后缀为 `.org` 的文件,例如 `test.org` . 这回让 Emacs 切换到 "org-mode" 并识别 "org-babel" 语法。 +要测试该配置,可以创建/打开(`Control-c Control-f`)后缀为 `.org` 的文件,例如 `test.org`。这会让 Emacs 切换到 org 模式并识别 “org-babel” 语法。 -输入下面代码,然后在代码中输入 Control-c Control-c 来测试是否安装正常: +输入下面代码,然后在代码中输入 `Control-c Control-c` 来测试是否安装正常: ``` #+BEGIN_SRC plantuml :file test.png @@ -72,9 +70,9 @@ version 一切顺利的话,你会在 Emacs 中看到文本下面显示了一张图片。 -注意 +> **注意:** -要快速插入类似 ` #+BEGIN_SRC` 和 ` #+END_SRC` 这样的代码片段,你可以使用内置的 Easy Templates 系统:输入 要快速插入类似 `#+BEGIN_SRC` 和 `#+END_SRC` 这样的代码片段,你可以使用内置的 Easy Templates 系统:输入 ` Date: Sat, 2 Mar 2019 21:29:18 +0800 Subject: [PATCH 403/813] PUB:20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @lujun9972 https://linux.cn/article-10582-1.html --- ...223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md (98%) diff --git a/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md b/published/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md similarity index 98% rename from translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md rename to published/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md index dd514ec985..23b1075f74 100644 --- a/translated/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md +++ b/published/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10582-1.html) [#]: subject: (Use Emacs to create OAuth 2.0 UML sequence diagrams) [#]: via: (https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) [#]: author: (Peter Mosmans https://www.onwebsecurity.com) From 9952d2d1194de21e802d3370856a358d619f5d9e Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Sun, 3 Mar 2019 00:35:42 +0800 Subject: [PATCH 404/813] translating by zero-MK --- .../tech/20190212 Ampersands and File Descriptors in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md index ae0f2ce3f0..f93ec9296c 100644 --- a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md +++ b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zero-MK) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f0dca8ce340afd57df6cf9be6388e4d9656a21b0 Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Sun, 3 Mar 2019 01:01:41 +0800 Subject: [PATCH 405/813] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190212 Ampersands and File Descriptors in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md index f93ec9296c..455b5e3e44 100644 --- a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md +++ b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (zero-MK) +[#]: translator: (zero-mk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 54dadb0aeb4b26cfe9686154f171986bc3627c4e Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Sun, 3 Mar 2019 02:34:39 +0800 Subject: [PATCH 406/813] translated --- ...Ampersands and File Descriptors in Bash.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 translated/tech/20190212 Ampersands and File Descriptors in Bash.md diff --git a/translated/tech/20190212 Ampersands and File Descriptors in Bash.md b/translated/tech/20190212 Ampersands and File Descriptors in Bash.md new file mode 100644 index 0000000000..953a4bcafd --- /dev/null +++ b/translated/tech/20190212 Ampersands and File Descriptors in Bash.md @@ -0,0 +1,162 @@ +[#]: collector: "lujun9972" +[#]: translator: "zero-mk " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Ampersands and File Descriptors in Bash" +[#]: via: "https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash" +[#]: author: "Paul Brown https://www.linux.com/users/bro66" + +Bash中的&符号和文件描述符 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-coffee.png?itok=yChaT-47) + +在我们寻求检查所有的clutter(`&`,`|`,`;`,`>`,`<`,`{`,`[`,`(`,) `]`,`}` 等等)是在大多数链式Bash命令中都会出现,[我们一直在仔细研究(`&`)符号][1]。 + +[上次,我们看到了如何使用`&`把可能需要很长时间运行的进程放到后台运行][1]。但是,`&`与尖括号`<`结合使用,也可用于管道输出或向其他地方的输入。 + +在[前面的][2] [尖括号教程中][3],您看到了如何使用`>`,如下: + +``` +ls > list.txt +``` + +将`ls`输出传递给_list.txt_文件。 + +现在我们看到的是简写 + +``` +ls 1> list.txt +``` + +在这种情况下,`1`是一个文件描述符,指向标准输出(`stdout`)。 + +以类似的方式,`2`指向标准error(`stderr`): + +``` +ls 2> error.log +``` + +所有错误消息都通过管道传递给_error.log_文件。 + +回顾一下:`1>`是标准输出(`stdout`),`2>`标准错误输出(`stderr`)。 + +第三个标准文件描述符,`0<`标准输入(`stdin`)。您可以看到它是一个输入,因为箭头(`<`)指向`0`,而对于 `1`和`2`,箭头(`>`)是指向外部的。 + +### 标准文件描述符有什么用? + +如果您在阅读本系列以后,您已经多次使用标准输出(`1>`)的简写形式:`>`。 + +例如,当(假如)你知道你的命令会抛出一个错误时,像`stderr`(`2`)这样的东西也很方便,但是Bash告诉你的东西是没有用的,你不需要看到它。如果要在_home/_目录中创建目录,例如: + +``` +mkdir newdir +``` + +如果_newdir/_已经存在,`mkdir`将显示错误。但你为什么要关心?(好吧,在某些情况下你可能会关心,但并非总是如此。)在一天结束时,_newdir_会以某种方式让你填写一些东西。您可以通过将错误消息推入void(即_/dev/null_)来抑制错误消息: + +``` +mkdir newdir 2> /dev/null +``` + +这不仅仅是“ _让我们不要看到丑陋和无关的错误消息,因为它们很烦人_ ”,因为在某些情况下,错误消息可能会在其他地方引起一连串错误。比如说,你想找到_/etc_下所有的*.service_文件。你可以这样做: + +``` +find /etc -iname "*.service" +``` + +但事实证明,在大多数系统中,`find`显示错误会导致许多行出现问题,因为普通用户对_/etc_下的某些文件夹没有读取访问权限。它使读取正确的输出变得很麻烦,如果`find`是更大的脚本的一部分,它可能会导致行中的下一个命令排队。 + +相反,你可以这样做: + +``` +find /etc -iname "*.service" 2> /dev/null +``` + +而且你只得到你想要的结果。 + +### 文件描述符入门 + +单独的文件描述符`stdout`和`stderr`还有一些注意事项。如果要将输出存储在文件中,请执行以下操作: + +``` +find /etc -iname "*.service" 1> services.txt +``` + +工作正常,因为`1>`意味着“ _发送标准输出,只有标准输出(非标准错误)_ ”。 + +但这里存在一个问题:如果你想保留命令抛出的错误信息的和非错误信息你该怎么*做*?上面的说明并不会这样做,因为它只写入`find`正确的结果 + +``` +find /etc -iname "*.service" 2> services.txt +``` + +只会写入命令抛出的错误信息。 + +我们如何得到两者?请尝试以下命令: + +``` +find /etc -iname "*.service" &> services.txt +``` + +…… 再次和`&`打招呼! + +我们一直在说`stdin`(`0`),`stdout`(`1`)和`stderr`(`2`)是_文件描述符_。文件描述符是一种特殊构造,指向文件的通道,用于读取或写入,或两者兼而有之。这来自于将所有内容都视为文件的旧UNIX理念。想写一个设备?将其视为文件。想写入套接字并通过网络发送数据?将其视为文件。想要读取和写入文件?嗯,显然,将其视为文件。 + +因此,在管理命令的输出和错误的位置时,将目标视为文件。因此,当您打开它们来读取和写入它们时,它们都会获得文件描述符。 + +这是一个有趣的效果。例如,您可以将内容从一个文件描述符传递到另一个文件描述符: + +``` +find /etc -iname "*.service" 1> services.txt 2>&1 +``` + +该管道`stderr`以`stdout`与`stdout`通过管道被输送到一个文件中,_services.txt的_。 + +它再次出现:`&`发信号通知Bash `1`是目标文件描述符。 + +标准文件描述符的另一个问题是,当你从一个管道传输到另一个时,你执行此操作的顺序有点违反直觉。例如,按照上面的命令。它看起来像是错误的方式。您可能正在阅读它:“ _将输出传输到文件,然后将错误传递给标准输出。_ ”看起来错误输出会很晚,并且在`1`已经完成时发送。 + +但这不是文件描述符的工作方式。文件描述符不是文件的占位符,而是文件的_输入and/or输出通道_。在这种情况下,当你`1> services.txt`这样做时,你会说“ _打开一个写管道到services.txt并保持打开状态_ ”。`1`是您要使用的管道的名称,它将保持打开状态直到该行的结尾。 + +如果你仍然认为这是错误的方法,试试这个: + +``` +find /etc -iname "*.service" 2>&1 1>services.txt +``` + +并注意它是如何工作的; 注意错误是如何通过管道输送到终端的,所以只有非错误的输出(即`stdout`)被推送到`services.txt`。 + +这是因为Bash从左到右处理`find`的每个结果。这样想:当Bash到达`2>&1`时,`stdout` (`1`) 仍然是指向终端的通道。如果`find` Bash的结果包含一个错误,它将被弹出到`2`,转移到`1`,然后离开终端! + +然后在命令结束时,Bash看到您要打开`stdout`作为_services.txt_文件的通道。如果没有发生错误,结果将`1`进入文件。 + +相比之下,在 + +``` +find /etc -iname "*.service" 1>services.txt 2>&1 +``` + +`1`从一开始就指向services.txt,因此任何弹出到`2`的内容都会通过`1`进行管道传输,而`1`已经指向services.txt中的最后一个休息位置,这就是它工作的原因。在任何情况下,如上所述`&>`都是“标准输出和标准错误”的缩写,即`2>&1`。 + +在任何情况下,如上所述`&>`是“_标准输出和标准误差_”的简写,即`2>&1`。 + +这可能有点多,但不用担心。调整文件描述符在Bash命令行和脚本中是司空见惯的事。随着本系列的深入,您将了解更多关于文件描述符的知识。下周见! + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[zero-mk](https://github.com/zero-mk) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash +[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash \ No newline at end of file From 6bff4c78ba452a41d95274c7c6cab13809b636a3 Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Sun, 3 Mar 2019 02:38:14 +0800 Subject: [PATCH 407/813] update --- ...Ampersands and File Descriptors in Bash.md | 162 ------------------ 1 file changed, 162 deletions(-) delete mode 100644 sources/tech/20190212 Ampersands and File Descriptors in Bash.md diff --git a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md b/sources/tech/20190212 Ampersands and File Descriptors in Bash.md deleted file mode 100644 index 455b5e3e44..0000000000 --- a/sources/tech/20190212 Ampersands and File Descriptors in Bash.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-mk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Ampersands and File Descriptors in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -Ampersands and File Descriptors in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-coffee.png?itok=yChaT-47) - -In our quest to examine all the clutter (`&`, `|`, `;`, `>`, `<`, `{`, `[`, `(`, ), `]`, `}`, etc.) that is peppered throughout most chained Bash commands, [we have been taking a closer look at the ampersand symbol (`&`)][1]. - -[Last time, we saw how you can use `&` to push processes that may take a long time to complete into the background][1]. But, the &, in combination with angle brackets, can also be used to pipe output and input elsewhere. - -In the [previous tutorials on][2] [angle brackets][3], you saw how to use `>` like this: - -``` -ls > list.txt -``` - -to pipe the output from `ls` to the _list.txt_ file. - -Now we see that this is really shorthand for - -``` -ls 1> list.txt -``` - -And that `1`, in this context, is a file descriptor that points to the standard output (`stdout`). - -In a similar fashion `2` points to standard error (`stderr`), and in the following command: - -``` -ls 2> error.log -``` - -all error messages are piped to the _error.log_ file. - -To recap: `1>` is the standard output (`stdout`) and `2>` the standard error output (`stderr`). - -There is a third standard file descriptor, `0<`, the standard input (`stdin`). You can see it is an input because the arrow (`<`) is pointing into the `0`, while for `1` and `2`, the arrows (`>`) are pointing outwards. - -### What are the standard file descriptors good for? - -If you are following this series in order, you have already used the standard output (`1>`) several times in its shorthand form: `>`. - -Things like `stderr` (`2`) are also handy when, for example, you know that your command is going to throw an error, but what Bash informs you of is not useful and you don't need to see it. If you want to make a directory in your _home/_ directory, for example: - -``` -mkdir newdir -``` - -and if _newdir/_ already exists, `mkdir` will show an error. But why would you care? (Ok, there some circumstances in which you may care, but not always.) At the end of the day, _newdir_ will be there one way or another for you to fill up with stuff. You can supress the error message by pushing it into the void, which is _/dev/null_ : - -``` -mkdir newdir 2> /dev/null -``` - -This is not just a matter of " _let's not show ugly and irrelevant error messages because they are annoying,_ " as there may be circumstances in which an error message may cause a cascade of errors elsewhere. Say, for example, you want to find all the _.service_ files under _/etc_. You could do this: - -``` -find /etc -iname "*.service" -``` - -But it turns out that on most systems, many of the lines spat out by `find` show errors because a regular user does not have read access rights to some of the folders under _/etc_. It makes reading the correct output cumbersome and, if `find` is part of a larger script, it could cause the next command in line to bork. - -Instead, you can do this: - -``` -find /etc -iname "*.service" 2> /dev/null -``` - -And you get only the results you are looking for. - -### A Primer on File Descriptors - -There are some caveats to having separate file descriptors for `stdout` and `stderr`, though. If you want to store the output in a file, doing this: - -``` -find /etc -iname "*.service" 1> services.txt -``` - -would work fine because `1>` means " _send standard output, and only standard output (NOT standard error) somewhere_ ". - -But herein lies a problem: what if you *do* want to keep a record within the file of the errors along with the non-erroneous results? The instruction above won't do that because it ONLY writes the correct results from `find`, and - -``` -find /etc -iname "*.service" 2> services.txt -``` - -will ONLY write the errors. - -How do we get both? Try the following command: - -``` -find /etc -iname "*.service" &> services.txt -``` - -... and say hello to `&` again! - -We have been saying all along that `stdin` (`0`), `stdout` (`1`), and `stderr` (`2`) are _file descriptors_. A file descriptor is a special construct that points to a channel to a file, either for reading, or writing, or both. This comes from the old UNIX philosophy of treating everything as a file. Want to write to a device? Treat it as a file. Want to write to a socket and send data over a network? Treat it as a file. Want to read from and write to a file? Well, obviously, treat it as a file. - -So, when managing where the output and errors from a command goes, treat the destination as a file. Hence, when you open them to read and write to them, they all get file descriptors. - -This has interesting effects. You can, for example, pipe contents from one file descriptor to another: - -``` -find /etc -iname "*.service" 1> services.txt 2>&1 -``` - -This pipes `stderr` to `stdout` and `stdout` is piped to a file, _services.txt_. - -And there it is again: the `&`, signaling to Bash that `1` is the destination file descriptor. - -Another thing with the standard file descriptors is that, when you pipe from one to another, the order in which you do this is a bit counterintuitive. Take the command above, for example. It looks like it has been written the wrong way around. You may be reading it like this: " _pipe the output to a file and then pipe errors to the standard output._ " It would seem the error output comes to late and is sent when `1` is already done. - -But that is not how file descriptors work. A file descriptor is not a placeholder for the file, but for the _input and/or output channel_ to the file. In this case, when you do `1> services.txt`, you are saying " _open a write channel to services.txt and leave it open_ ". `1` is the name of the channel you are going to use, and it remains open until the end of the line. - -If you still think it is the wrong way around, try this: - -``` -find /etc -iname "*.service" 2>&1 1>services.txt -``` - -And notice how it doesn't work; notice how errors get piped to the terminal and only the non-erroneous output (that is `stdout`) gets pushed to `services.txt`. - -That is because Bash processes every result from `find` from left to right. Think about it like this: when Bash gets to `2>&1`, `stdout` (`1`) is still a channel that points to the terminal. If the result that `find` feeds Bash contains an error, it is popped into `2`, transferred to `1`, and, away it goes, off to the terminal! - -Then at the end of the command, Bash sees you want to open `stdout` as a channel to the _services.txt_ file. If no error has occurred, the result goes through `1` into the file. - -By contrast, in - -``` -find /etc -iname "*.service" 1>services.txt 2>&1 -``` - -`1` is pointing at `services.txt` right from the beginning, so anything that pops into `2` gets piped through `1`, which is already pointing to the final resting place in `services.txt`, and that is why it works. - -In any case, as mentioned above `&>` is shorthand for " _both standard output and standard error_ ", that is, `2>&1`. - -This is probably all a bit much, but don't worry about it. Re-routing file descriptors here and there is commonplace in Bash command lines and scripts. And, you'll be learning more about file descriptors as we progress through this series. See you next week! - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash - -作者:[Paul 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://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash -[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash From 7403900f5d7e9f95758e6f369300599ba0b49e51 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sun, 3 Mar 2019 06:05:47 +0800 Subject: [PATCH 408/813] hankchow translated --- ...20190206 And, Ampersand, and - in Linux.md | 211 ------------------ ...20190206 And, Ampersand, and - in Linux.md | 206 +++++++++++++++++ 2 files changed, 206 insertions(+), 211 deletions(-) delete mode 100644 sources/tech/20190206 And, Ampersand, and - in Linux.md create mode 100644 translated/tech/20190206 And, Ampersand, and - in Linux.md diff --git a/sources/tech/20190206 And, Ampersand, and - in Linux.md b/sources/tech/20190206 And, Ampersand, and - in Linux.md deleted file mode 100644 index 2febc0a2ef..0000000000 --- a/sources/tech/20190206 And, Ampersand, and - in Linux.md +++ /dev/null @@ -1,211 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (And, Ampersand, and & in Linux) -[#]: via: (https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -And, Ampersand, and & in Linux -====== -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand.png?itok=7GdFO36Y) - -Take a look at the tools covered in the [three][1] [previous][2] [articles][3], and you will see that understanding the glue that joins them together is as important as recognizing the tools themselves. Indeed, tools tend to be simple, and understanding what _mkdir_ , _touch_ , and _find_ do (make a new directory, update a file, and find a file in the directory tree, respectively) in isolation is easy. - -But understanding what - -``` -mkdir test_dir 2>/dev/null || touch images.txt && find . -iname "*jpg" > backup/dir/images.txt & -``` - -does, and why we would write a command line like that is a whole different story. - -It pays to look more closely at the sign and symbols that live between the commands. It will not only help you better understand how things work, but will also make you more proficient in chaining commands together to create compound instructions that will help you work more efficiently. - -In this article and the next, we'll be looking at the the ampersand (`&`) and its close friend, the pipe (`|`), and see how they can mean different things in different contexts. - -### Behind the Scenes - -Let's start simple and see how you can use `&` as a way of pushing a command to the background. The instruction: - -``` -cp -R original/dir/ backup/dir/ -``` - -Copies all the files and subdirectories in _original/dir/_ into _backup/dir/_. So far so simple. But if that turns out to be a lot of data, it could tie up your terminal for hours. - -However, using: - -``` -cp -R original/dir/ backup/dir/ & -``` - -pushes the process to the background courtesy of the final `&`. This frees you to continue working on the same terminal or even to close the terminal and still let the process finish up. Do note, however, that if the process is asked to print stuff out to the standard output (like in the case of `echo` or `ls`), it will continue to do so, even though it is being executed in the background. - -When you push a process into the background, Bash will print out a number. This number is the PID or the _Process' ID_. Every process running on your Linux system has a unique process ID and you can use this ID to pause, resume, and terminate the process it refers to. This will become useful later. - -In the meantime, there are a few tools you can use to manage your processes as long as you remain in the terminal from which you launched them: - - * `jobs` shows you the processes running in your current terminal, whether be it in the background or foreground. It also shows you a number associated with each job (different from the PID) that you can use to refer to each process: - -``` - $ jobs -[1]- Running cp -i -R original/dir/* backup/dir/ & -[2]+ Running find . -iname "*jpg" > backup/dir/images.txt & -``` - - * `fg` brings a job from the background to the foreground so you can interact with it. You tell `fg` which process you want to bring to the foreground with a percentage symbol (`%`) followed by the number associated with the job that `jobs` gave you: - -``` - $ fg %1 # brings the cp job to the foreground -cp -i -R original/dir/* backup/dir/ -``` - -If the job was stopped (see below), `fg` will start it again. - - * You can stop a job in the foreground by holding down [Ctrl] and pressing [Z]. This doesn't abort the action, it pauses it. When you start it again with (`fg` or `bg`) it will continue from where it left off... - -...Except for [`sleep`][4]: the time a `sleep` job is paused still counts once `sleep` is resumed. This is because `sleep` takes note of the clock time when it was started, not how long it was running. This means that if you run `sleep 30` and pause it for more than 30 seconds, once you resume, `sleep` will exit immediately. - - * The `bg` command pushes a job to the background and resumes it again if it was paused: - -``` - $ bg %1 -[1]+ cp -i -R original/dir/* backup/dir/ & -``` - - - - -As mentioned above, you won't be able to use any of these commands if you close the terminal from which you launched the process or if you change to another terminal, even though the process will still continue working. - -To manage background processes from another terminal you need another set of tools. For example, you can tell a process to stop from a a different terminal with the [`kill`][5] command: - -``` -kill -s STOP -``` - -And you know the PID because that is the number Bash gave you when you started the process with `&`, remember? Oh! You didn't write it down? No problem. You can get the PID of any running process with the `ps` (short for _processes_ ) command. So, using - -``` -ps | grep cp -``` - -will show you all the processes containing the string " _cp_ ", including the copying job we are using for our example. It will also show you the PID: - -``` -$ ps | grep cp -14444 pts/3 00:00:13 cp -``` - -In this case, the PID is _14444_. and it means you can stop the background copying with: - -``` -kill -s STOP 14444 -``` - -Note that `STOP` here does the same thing as [Ctrl] + [Z] above, that is, it pauses the execution of the process. - -To start the paused process again, you can use the `CONT` signal: - -``` -kill -s CONT 14444 -``` - -There is a good list of many of [the main signals you can send a process here][6]. According to that, if you wanted to terminate the process, not just pause it, you could do this: - -``` -kill -s TERM 14444 -``` - -If the process refuses to exit, you can force it with: - -``` -kill -s KILL 14444 -``` - -This is a bit dangerous, but very useful if a process has gone crazy and is eating up all your resources. - -In any case, if you are not sure you have the correct PID, add the `x` option to `ps`: - -``` -$ ps x| grep cp -14444 pts/3 D 0:14 cp -i -R original/dir/Hols_2014.mp4 -  original/dir/Hols_2015.mp4 original/dir/Hols_2016.mp4 -  original/dir/Hols_2017.mp4 original/dir/Hols_2018.mp4 backup/dir/ -``` - -And you should be able to see what process you need. - -Finally, there is nifty tool that combines `ps` and `grep` all into one: - -``` -$ pgrep cp -8 -18 -19 -26 -33 -40 -47 -54 -61 -72 -88 -96 -136 -339 -6680 -13735 -14444 -``` - -Lists all the PIDs of processes that contain the string " _cp_ ". - -In this case, it isn't very helpful, but this... - -``` -$ pgrep -lx cp -14444 cp -``` - -... is much better. - -In this case, `-l` tells `pgrep` to show you the name of the process and `-x` tells `pgrep` you want an exact match for the name of the command. If you want even more details, try `pgrep -ax command`. - -### Next time - -Putting an `&` at the end of commands has helped us explain the rather useful concept of processes working in the background and foreground and how to manage them. - -One last thing before we leave: processes running in the background are what are known as _daemons_ in UNIX/Linux parlance. So, if you had heard the term before and wondered what they were, there you go. - -As usual, there are more ways to use the ampersand within a command line, many of which have nothing to do with pushing processes into the background. To see what those uses are, we'll be back next week with more on the matter. - -Read more: - -[Linux Tools: The Meaning of Dot][1] - -[Understanding Angle Brackets in Bash][2] - -[More About Angle Brackets in Bash][3] - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux - -作者:[Paul 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://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot -[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash -[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash -[4]: https://ss64.com/bash/sleep.html -[5]: https://bash.cyberciti.biz/guide/Sending_signal_to_Processes -[6]: https://www.computerhope.com/unix/signals.htm diff --git a/translated/tech/20190206 And, Ampersand, and - in Linux.md b/translated/tech/20190206 And, Ampersand, and - in Linux.md new file mode 100644 index 0000000000..4c48348456 --- /dev/null +++ b/translated/tech/20190206 And, Ampersand, and - in Linux.md @@ -0,0 +1,206 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (And, Ampersand, and & in Linux) +[#]: via: (https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +Linux 中的 & +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand.png?itok=7GdFO36Y) + +如果阅读过我之前的[三][1][篇][2][文章][3],你会觉得掌握连接各个命令之间的连接符号用法也是很重要的。实际上,命令的用法并不难,例如 `mkdir`、`touch` 和 `find` 也分别可以简单概括为“建立新目录”、“更新文件”和“在目录树中查找文件”而已。 + +但如果要理解 + +``` +mkdir test_dir 2>/dev/null || touch images.txt && find . -iname "*jpg" > backup/dir/images.txt & +``` + +这一串命令的目的,以及为什么要这样写,就没有这么简单了。 + +关键之处就在于命令之间的连接符号。掌握了这些符号的用法,不仅可以让你更好理解整体的工作原理,还可以让你知道如何将不同的命令有效地结合起来,提高工作效率。 + +在这一篇文章和下一篇文章中,我会介绍如何使用 `&` 号和管道符号(`|`)在不同场景下的使用方法。 + +### 幕后工作 + +我来举一个简单的例子,看看如何使用 `&` 号将下面这个命令放到后台运行: + +``` +cp -R original/dir/ backup/dir/ +``` + +这个命令的目的是将 `original/dir/` 的内容递归地复制到 `backup/dir/` 中。虽然看起来很简单,但是如果原目录里面的文件太大,在执行过程中终端就会一直被卡住。 + +所以,可以在命令的末尾加上一个 `&` 号,将这个任务放到后台去执行: + +``` +cp -R original/dir/ backup/dir/ & +``` + +任务被放到后台执行之后,就可以立即继续在同一个终端上工作了,甚至关闭终端也不影响这个任务的正常执行。需要注意的是,如果要求这个任务输出内容到标准输出中(例如 `echo` 或 `ls`),即使使用了 `&`,也会等待这些输出任务在前台运行完毕。 + +当使用 `&` 将一个进程放置到后台运行的时候,Bash 会提示这个进程的进程 ID。在 Linux 系统中运行的每一个进程都有一个唯一的进程 ID,你可以使用进程 ID 来暂停、恢复或者终止对应的进程,因此进程 ID 是非常重要的。 + +这个时候,只要你还停留在启动进程的终端当中,就可以使用以下几个命令来对管理后台进程: + + * `jobs` 命令可以显示当前终端正在运行的进程,包括前台运行和后台运行的进程。它对每个正在执行中的进程任务分配了一个序号(这个序号不是进程 ID),可以使用这些序号来引用各个进程任务。 + +``` + $ jobs +[1]- Running cp -i -R original/dir/* backup/dir/ & +[2]+ Running find . -iname "*jpg" > backup/dir/images.txt & +``` + + * `fg` 命令可以将后台运行的进程任务放到前台运行,这样可以比较方便地进行交互。根据 `jobs` 命令提供的进程任务序号,再在前面加上 `%` 符号,就可以把相应的进程任务放到前台运行。 + +``` + $ fg %1 # 将上面序号为 1 的 cp 任务放到前台运行 +cp -i -R original/dir/* backup/dir/ +``` + +如果这个进程任务是暂停状态,`fg` 命令会将它启动起来。 + + * 使用 `ctrl+z` 组合键可以将前台运行的任务暂停,仅仅是暂停,而不是将任务终止。当使用 `fg` 或者`bg` 命令将任务重新启动起来的时候,任务会从被暂停的位置开始执行。但 [`sleep`][4] 命令是一个特例,`sleep` 任务被暂停的时间会计算在 `sleep` 时间之内。因为 `sleep` 命令依据的是系统时钟的时间,而不是实际运行的时间。也就是说,如果运行了 `sleep 30`,然后将任务暂停 30 秒以上,那么任务恢复执行的时候会立即终止并退出。 + + * `bg` 命令会将任务放置到后台执行,如果任务是暂停状态,也会被启动起来。 + +``` + $ bg %1 +[1]+ cp -i -R original/dir/* backup/dir/ & +``` + + +如上所述,以上几个命令只能在同一个终端里才能使用。如果启动进程任务的终端被关闭了,或者切换到了另一个终端,以上几个命令就无法使用了。 + +如果要在另一个终端管理后台进程,就需要其它工具了。例如可以使用 [`kill`][5] 命令从另一个终端终止某个进程: + +``` +kill -s STOP +``` + +这里的 PID 就是使用 `&` 将进程放到后台时 Bash 显示的那个进程 ID。如果你当时没有把进程 ID 记录下来,也可以使用 `ps` 命令(代表 process)来获取所有正在运行的进程的进程 ID,就像这样: + +``` +ps | grep cp +``` + +执行以后会显示出包含 `cp` 字符串的所有进程,例如上面例子中的 `cp` 进程。同时还会显示出对应的进程 ID: + +``` +$ ps | grep cp +14444 pts/3 00:00:13 cp +``` + +在这个例子中,进程 ID 是 14444,因此可以使用以下命令来暂停这个后台进程: + +``` +kill -s STOP 14444 +``` + +注意,这里的 `STOP` 等同于前面提到的 `ctrl+z` 组合键的效果,也就是仅仅把进程暂停掉。 + +如果想要把暂停了的进程启动起来,可以对进程发出 `CONT` 信号: + +``` +kill -s CONT 14444 +``` + +这个给出一个[可以向进程发出的常用信号][6]列表。如果想要终止一个进程,可以发送 `TERM` 信号: + +``` +kill -s TERM 14444 +``` + +如果进程不响应 `TERM` 信号并拒绝退出,还可以发送 `KILL` 信号强制终止进程: + +``` +kill -s KILL 14444 +``` + +强制终止进程可能会有一定的风险,但如果遇到进程无节制消耗资源的情况,这样的信号还是能够派上用场的。 + +另外,如果你不确定进程 ID 是否正确,可以在 `ps` 命令中加上 `x` 参数: + +``` +$ ps x| grep cp +14444 pts/3 D 0:14 cp -i -R original/dir/Hols_2014.mp4 + original/dir/Hols_2015.mp4 original/dir/Hols_2016.mp4 + original/dir/Hols_2017.mp4 original/dir/Hols_2018.mp4 backup/dir/ +``` + +这样就可以看到是不是你需要的进程 ID 了。 + +最后介绍一个将 `ps` 和 `grep` 结合到一起的命令: + +``` +$ pgrep cp +8 +18 +19 +26 +33 +40 +47 +54 +61 +72 +88 +96 +136 +339 +6680 +13735 +14444 +``` + +`pgrep` 可以直接将带有字符串 `cp` 的进程的进程 ID 显示出来。 + +可以加上一些参数让它的输出更清晰: + +``` +$ pgrep -lx cp +14444 cp +``` + +在这里,`-l` 参数会让 `pgrep` 将进程的名称显示出来,`-x` 参数则是让 `pgrep` 完全匹配 `cp` 这个命令。如果还想了解这个命令的更多细节,可以尝试运行 `pgrep -ax`。 + +### 总结 + +在命令的末尾加上 `&` 可以让我们理解前台进程和后台进程的概念,以及如何管理这些进程。 + +在 UNIX/Linux 术语中,在后台运行的进程被称为 daemon。如果你曾经听说过这个词,那你现在应该知道它的意义了。 + +和其它符号一样,`&` 在命令行中还有很多别的用法。在下一篇文章中,我会更详细地介绍。 + +阅读更多: + +[Linux Tools: The Meaning of Dot][1] + +[Understanding Angle Brackets in Bash][2] + +[More About Angle Brackets in Bash][3] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux + +作者:[Paul Brown][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://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash +[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash +[4]: https://ss64.com/bash/sleep.html +[5]: https://bash.cyberciti.biz/guide/Sending_signal_to_Processes +[6]: https://www.computerhope.com/unix/signals.htm + From 7c3ed59970c61ea89fe1b61dfe028482c5e84116 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 3 Mar 2019 08:01:09 +0800 Subject: [PATCH 409/813] PRF&PUB:20190213 How to use Linux Cockpit to manage system performance.md @geekpi https://linux.cn/article-10583-1.html --- ...ux Cockpit to manage system performance.md | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) rename {translated/tech => published}/20190213 How to use Linux Cockpit to manage system performance.md (52%) diff --git a/translated/tech/20190213 How to use Linux Cockpit to manage system performance.md b/published/20190213 How to use Linux Cockpit to manage system performance.md similarity index 52% rename from translated/tech/20190213 How to use Linux Cockpit to manage system performance.md rename to published/20190213 How to use Linux Cockpit to manage system performance.md index b2c5136494..2209d07df3 100644 --- a/translated/tech/20190213 How to use Linux Cockpit to manage system performance.md +++ b/published/20190213 How to use Linux Cockpit to manage system performance.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10583-1.html) [#]: subject: (How to use Linux Cockpit to manage system performance) [#]: via: (https://www.networkworld.com/article/3340038/linux/sitting-in-the-linux-cockpit.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) @@ -10,35 +10,33 @@ 如何使用 Linux Cockpit 来管理系统性能 ====== -Linux Cockpit 是一个基于 Web 界面的应用,它提供了对系统的图形化管理。看下它能够控制哪些。 +> Linux Cockpit 是一个基于 Web 界面的应用,它提供了对系统的图形化管理。看下它能够控制哪些。 ![](https://images.idgesg.net/images/article/2019/02/cockpit_airline_airplane_control_pilot-by-southerlycourse-getty-100787904-large.jpg) -如果你还没有尝试过相对较新的 Linux Cockpit,你可能会对它所能做的一切感到惊讶。它是一个用户友好的基于 Web 的控制台,提供了一些非常简单的方法来管理 Linux 系统 —_通过**web**_。你可以通过一个非常简单的 web 来监控系统资源、添加或删除帐户、监控系统使用情况、关闭系统以及执行其他一些其他任务。它的设置和使用也非常简单。 +如果你还没有尝试过相对较新的 Linux Cockpit,你可能会对它所能做的一切感到惊讶。它是一个用户友好的基于 web 的控制台,提供了一些非常简单的方法来管理 Linux 系统 —— 通过 web。你可以通过一个非常简单的 web 来监控系统资源、添加或删除帐户、监控系统使用情况、关闭系统以及执行其他一些其他任务。它的设置和使用也非常简单。 虽然许多 Linux 系统管理员将大部分时间花在命令行上,但使用 PuTTY 等工具访问远程系统并不总能提供最有用的命令输出。Linux Cockpit 提供了图形和易于使用的表单,来查看性能情况并对系统进行更改。 Linux Cockpit 能让你查看系统性能的许多方面并进行配置更改,但任务列表可能取决于你使用的特定 Linux。任务分类包括以下内容: - * 监控系统活动(CPU、内存、磁盘 IO 和网络流量) — **系统** -  * 查看系统日志条目 — **日志** -  * 查看磁盘分区的容量 — **存储** -  * 查看网络活动(发送和接收) — **网络** -  * 查看用户帐户 — **帐户** -  * 检查系统服务的状态 — **服务** -  * 提取已安装应用的信息 — **应用** -  * 查看和安装可用更新(如果以 root 身份登录)并在需要时重新启动系统 — **软件更新** -  * 打开并使用终端窗口 — **终端** +* 监控系统活动(CPU、内存、磁盘 IO 和网络流量) —— **系统** +* 查看系统日志条目 —— **日志** +* 查看磁盘分区的容量 —— **存储** +* 查看网络活动(发送和接收) —— **网络** +* 查看用户帐户 —— **帐户** +* 检查系统服务的状态 —— **服务** +* 提取已安装应用的信息 —— **应用** +* 查看和安装可用更新(如果以 root 身份登录)并在需要时重新启动系统 —— **软件更新** +* 打开并使用终端窗口 —— **终端** - - -某些 Linux Cockpit 安装还允许你运行诊断报告、转储内核、检查 SELinux(安全)设置和列表订阅。 +某些 Linux Cockpit 安装还允许你运行诊断报告、转储内核、检查 SELinux(安全)设置和列出订阅。 以下是 Linux Cockpit 显示的系统活动示例: -![cockpit activity][1] Sandra Henry-Stocker +![cockpit activity][1] -Linux Cockpit 显示系统活动 +*Linux Cockpit 显示系统活动* ### 如何设置 Linux Cockpit @@ -56,17 +54,15 @@ $ sudo systemctl enable --now cockpit.socket $ sudo ufw allow 9090 ``` -启用 Linux Cockpit 后,在浏览器中打开 **https:// :9090**。 +启用 Linux Cockpit 后,在浏览器中打开 `https://:9090` -可以在 [Cockpit Project]][2] 中找到可以使用 Cockpit 的发行版列表以及安装说明。 +可以在 [Cockpit 项目][2] 中找到可以使用 Cockpit 的发行版列表以及安装说明。 -没有额外的配置,Linux Cockpit 将无法识别 **sudo** 权限。如果你被禁止使用 Cockpit 进行更改,你将会在你点击的按钮上看到一个红色的国际禁止标志。 +没有额外的配置,Linux Cockpit 将无法识别 `sudo` 权限。如果你被禁止使用 Cockpit 进行更改,你将会在你点击的按钮上看到一个红色的通用禁止标志。 -要使 sudo 权限有效,你需要确保用户位于 **/etc/group** 文件中的 **wheel**(RHEL)或 **adm** (Debian)组中,即服务器当以 root 用户身份登录 Cockpit 并且用户在登录 Cockpit 时选择“重用我的密码”时,已勾选了 Server Administrator。 +要使 `sudo` 权限有效,你需要确保用户位于 `/etc/group` 文件中的 `wheel`(RHEL)或 `adm` (Debian)组中,即服务器当以 root 用户身份登录 Cockpit 并且用户在登录 Cockpit 时选择“重用我的密码”时,已勾选了 “Server Administrator”。 -在你管理的系统在千里之外或者没有控制台时,能使用图形界面控制也不错。虽然我喜欢在控制台上工作,但我偶然也乐于见到图形或者按钮。Linux Cockpit 为日常管理任务提供了非常有用的界面。 - -在 [Facebook][3] 和 [LinkedIn][4] 中加入 Network World 社区,对你喜欢的文章评论。 +在你管理的系统位在千里之外或者没有控制台时,能使用图形界面控制也不错。虽然我喜欢在控制台上工作,但我偶然也乐于见到图形或者按钮。Linux Cockpit 为日常管理任务提供了非常有用的界面。 -------------------------------------------------------------------------------- @@ -75,7 +71,7 @@ via: https://www.networkworld.com/article/3340038/linux/sitting-in-the-linux-coc 作者:[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 72e3b750ad72aa7fcf2fb3edf66e665605600d01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 3 Mar 2019 08:25:25 +0800 Subject: [PATCH 410/813] PRF&PUB:20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md @geekpi https://linux.cn/article-10584-1.html --- ... manipulating PDFs on the Linux desktop.md | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) rename {translated/tech => published}/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md (60%) diff --git a/translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md b/published/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md similarity index 60% rename from translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md rename to published/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md index adcf6de0d3..77c68dc718 100644 --- a/translated/tech/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md +++ b/published/20190212 Two graphical tools for manipulating PDFs on the Linux desktop.md @@ -1,26 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10584-1.html) [#]: subject: (Two graphical tools for manipulating PDFs on the Linux desktop) [#]: via: (https://opensource.com/article/19/2/manipulating-pdfs-linux) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) 两款 Linux 桌面中的图形化操作 PDF 的工具 ====== -PDF-Shuffler 和 PDF Chain 是在 Linux 中修改 PDF 的绝佳工具。 + +> PDF-Shuffler 和 PDF Chain 是在 Linux 中修改 PDF 的绝佳工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4) -由于我谈论并且写了些工作中使用 PDF 及其工具的文章,有些人认为我喜欢这种格式。其实我并不是,由于各种原因,我不会深入它。 +由于我谈论和写作了些 PDF 及使用它们的工具的文章,有些人认为我喜欢这种格式。其实我并不是,由于各种原因,我不会深入它。 -我不会说 PDF 是我个人和职业生活中的一个躲不开的坏事 - 相反,它们不是那么好。通常即使有更好的替代方案来交付文档,我也必须使用 PDF。 +我不会说 PDF 是我个人和职业生活中的一个躲不开的坏事 - 而实际上它们不是那么好。通常即使有更好的替代方案来交付文档,通常我也必须使用 PDF。 当我使用 PDF 时,通常是在白天工作时在其他的操作系统上使用,我使用 Adobe Acrobat 进行操作。但是当我必须在 Linux 桌面上使用 PDF 时呢?我们来看看我用来操作 PDF 的两个图形工具。 ### PDF-Shuffler -顾名思义,你可以使用 [PDF-Shuffler][1] 在 PDF 文件中移动页面。它可以做得更多,但软件的功能是有限的。这并不意味着 PDF-Shuffler 没用。它有用,很有用。 +顾名思义,你可以使用 [PDF-Shuffler][1] 在 PDF 文件中移动页面。它可以做得更多,但该软件的功能是有限的。这并不意味着 PDF-Shuffler 没用。它有用,很有用。 你可以将 PDF-Shuffler 用来: @@ -28,23 +30,21 @@ PDF-Shuffler 和 PDF Chain 是在 Linux 中修改 PDF 的绝佳工具。 * 将页面添加到文件中 * 重新排列文件中的页面 - - 请注意,PDF-Shuffler 有一些依赖项,如 pyPDF 和 python-gtk。通常,通过包管理器安装它是最快且最不令人沮丧的途径。 -假设你想从 PDF 中提取页面,也许是作为你书中的样本章节。选择**文件>添加**打开 PDF 文件。 +假设你想从 PDF 中提取页面,也许是作为你书中的样本章节。选择 “File > Add”打开 PDF 文件。 ![](https://opensource.com/sites/default/files/uploads/pdfshuffler-book.png) -要提取第 7 页到第 9 页,请按住 Ctrl 并单击选择页面。然后,右键单击并选择**导出选择**。 +要提取第 7 页到第 9 页,请按住 `Ctrl` 并单击选择页面。然后,右键单击并选择 “Export selection”。 ![](https://opensource.com/sites/default/files/uploads/pdfshuffler-export.png) -选择要保存文件的目录,为其命名,然后单击**保存**。 +选择要保存文件的目录,为其命名,然后单击 “Save”。 -要添加文件 - 例如,要添加封面或重新插入已扫描的且已签名的合同或者应用 - 打开 PDF 文件,然后选择**文件>添加**并找到要添加的 PDF 文件。单击**打开**。 +要添加文件 —— 例如,要添加封面或重新插入已扫描的且已签名的合同或者应用 - 打开 PDF 文件,然后选择 “File > Add” 并找到要添加的 PDF 文件。单击 “Open”。 -PDF-Shuffler 有个不好的东西就是在你正在处理的 PDF 文件末尾添加页面。单击并将添加的页面拖动到文件中的所需位置。你一次只能在文件中单击并拖动一个页面。 +PDF-Shuffler 有个不好的地方就是添加页面到你正在处理的 PDF 文件末尾。单击并将添加的页面拖动到文件中的所需位置。你一次只能在文件中单击并拖动一个页面。 ![](https://opensource.com/sites/default/files/uploads/pdfshuffler-move.png) @@ -54,29 +54,27 @@ PDF-Shuffler 有个不好的东西就是在你正在处理的 PDF 文件末尾 [PDF Chain][3] 是 PDFtk 命令行的一个很好的替代品。它可以让你一键使用 PDFtk 最常用的命令。无需使用菜单,你可以: - * 合并 PDF(包括旋转一个或多个文件的页面) -  * 从 PDF 中提取页面并将其保存到单个文件中 -  * 为 PDF 添加背景或水印 -  * 将附件添加到文件 +* 合并 PDF(包括旋转一个或多个文件的页面) +* 从 PDF 中提取页面并将其保存到单个文件中 +* 为 PDF 添加背景或水印 +* 将附件添加到文件 ![](https://opensource.com/sites/default/files/uploads/pdfchain1.png) -你也可以做得更多。点击**工具**菜单,你可以: - - * 从 PDF 中提取附件 -  * 压缩或解压缩文件 -  * 从文件中提取元数据 -  * 用外部[数据][4]填充 PDF 表格 -  * [扁平化][5] PDF -  * 从 PDF 表单中删除 [XML 表格结构][6](XFA)数据 - +你也可以做得更多。点击 “Tools” 菜单,你可以: +* 从 PDF 中提取附件 +* 压缩或解压缩文件 +* 从文件中提取元数据 +* 用外部[数据][4]填充 PDF 表格 +* [扁平化][5] PDF +* 从 PDF 表单中删除 [XML 表格结构][6](XFA)数据 老实说,我只使用 PDF Chain 或 PDFtk 提取附件、压缩或解压缩 PDF。其余的对我来说基本没听说。 ### 总结 -Linux 上用于处理 PDF 的工具数量一直让我感到吃惊。它们的特性和功能的广度和深度也是如此。我通常可以找到一个,无论是命令行还是图形,它都能做我需要的。在大多数情况下,PDF Mod 和 PDF Chain 对我来说效果很好。 +Linux 上用于处理 PDF 的工具数量一直让我感到吃惊。它们的特性和功能的广度和深度也是如此。无论是命令行还是图形,我总能找到一个能做我需要的。在大多数情况下,PDF Mod 和 PDF Chain 对我来说效果很好。 -------------------------------------------------------------------------------- @@ -85,7 +83,7 @@ via: https://opensource.com/article/19/2/manipulating-pdfs-linux 作者:[Scott Nesbitt][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 8f4f188f68ff6804865164d63abe0e01e91ce275 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 2 Mar 2019 21:10:42 +0800 Subject: [PATCH 411/813] =?UTF-8?q?20190206=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...06 Getting started with Vim visual mode.md | 126 ------------------ ...06 Getting started with Vim visual mode.md | 117 ++++++++++++++++ 2 files changed, 117 insertions(+), 126 deletions(-) delete mode 100644 sources/tech/20190206 Getting started with Vim visual mode.md create mode 100644 translated/tech/20190206 Getting started with Vim visual mode.md diff --git a/sources/tech/20190206 Getting started with Vim visual mode.md b/sources/tech/20190206 Getting started with Vim visual mode.md deleted file mode 100644 index eadc031b88..0000000000 --- a/sources/tech/20190206 Getting started with Vim visual mode.md +++ /dev/null @@ -1,126 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Vim visual mode) -[#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode) -[#]: author: (Susan Lauber https://opensource.com/users/susanlauber) - -Getting started with Vim visual mode -====== -Visual mode makes it easier to highlight and manipulate text in Vim. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) - -Ansible playbook files are text files in a YAML format. People who work regularly with them have their favorite editors and plugin extensions to make the formatting easier. - -When I teach Ansible with the default editor available in most Linux distributions, I use Vim's visual mode a lot. It allows me to highlight my actions on the screen—what I am about to edit and the text manipulation task I'm doing—to make it easier for my students to learn. - -### Vim's visual mode - -When editing text with Vim, visual mode can be extremely useful for identifying chunks of text to be manipulated. - -Vim's visual mode has three versions: character, line, and block. The keystrokes to enter each mode are: - - * Character mode: **v** (lower-case) - * Line mode: **V** (upper-case) - * Block mode: **Ctrl+v** - - - -Here are some ways to use each mode to simplify your work. - -### Character mode - -Character mode can highlight a sentence in a paragraph or a phrase in a sentence. Then the visually identified text can be deleted, copied, changed, or modified with any other Vim editing command. - -#### Move a sentence - -To move a sentence from one place to another, start by opening the file and moving the cursor to the first character in the sentence you want to move. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png) - - * Press the **v** key to enter visual character mode. The word **VISUAL** will appear at the bottom of the screen. - * Use the Arrow keys to highlight the desired text. You can use other navigation commands, such as **w** to highlight to the beginning of the next word or **$** to include the rest of the line. - * Once the text is highlighted, press the **d** key to delete the text. - * If you deleted too much or not enough, press **u** to undo and start again. - * Move your cursor to the new location and press **p** to paste the text. - - - -#### Change a phrase - -You can also highlight a chunk of text that you want to replace. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png) - - * Place the cursor at the first character you want to change. - * Press **v** to enter visual character mode. - * Use navigation commands, such as the Arrow keys, to highlight the phrase. - * Press **c** to change the highlighted text. - * The highlighted text will disappear, and you will be in Insert mode where you can add new text. - * After you finish typing the new text, press **Esc** to return to command mode and save your work. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png) - -### Line mode - -When working with Ansible playbooks, the order of tasks can matter. Use visual line mode to move a task to a different location in the playbook. - -#### Manipulate multiple lines of text - -![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png) - - * Place your cursor anywhere on the first or last line of the text you want to manipulate. - * Press **Shift+V** to enter line mode. The words **VISUAL LINE** will appear at the bottom of the screen. - * Use navigation commands, such as the Arrow keys, to highlight multiple lines of text. - * Once the desired text is highlighted, use commands to manipulate it. Press **d** to delete, then move the cursor to the new location, and press **p** to paste the text. - * **y** (yank) can be used instead of **d** (delete) if you want to copy the task. - - - -#### Indent a set of lines - -When working with Ansible playbooks or YAML files, indentation matters. A highlighted block can be shifted right or left with the **>** and **<** keys. - -![]9https://opensource.com/sites/default/files/uploads/vim-visual-line2.png - - * Press **>** to increase the indentation of all the lines. - * Press **<** to decrease the indentation of all the lines. - - - -Try other Vim commands to apply them to the highlighted text. - -### Block mode - -The visual block mode is useful for manipulation of specific tabular data files, but it can also be extremely helpful as a tool to verify indentation of an Ansible playbook. - -Tasks are a list of items and in YAML each list item starts with a dash followed by a space. The dashes must line up in the same column to be at the same indentation level. This can be difficult to see with just the human eye. Indentation of other lines within the task is also important. - -#### Verify tasks lists are indented the same - -![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png) - - * Place your cursor on the first character of the list item. - * Press **Ctrl+v** to enter visual block mode. The words **VISUAL BLOCK** will appear at the bottom of the screen. - * Use the Arrow keys to highlight the single character column. You can verify that each task is indented the same amount. - * Use the Arrow keys to expand the block right or left to check whether the other indentation is correct. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png) - -Even though I am comfortable with other Vim editing shortcuts, I still like to use visual mode to sort out what text I want to manipulate. When I demo other concepts during a presentation, my students see a tool to highlight text and hit delete in this "new to them" text only editor. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/getting-started-vim-visual-mode - -作者:[Susan Lauber][a] -选题:[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/susanlauber -[b]: https://github.com/lujun9972 diff --git a/translated/tech/20190206 Getting started with Vim visual mode.md b/translated/tech/20190206 Getting started with Vim visual mode.md new file mode 100644 index 0000000000..ea1dccaaf4 --- /dev/null +++ b/translated/tech/20190206 Getting started with Vim visual mode.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Vim visual mode) +[#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode) +[#]: author: (Susan Lauber https://opensource.com/users/susanlauber) + +Vim 可视化模式入门 +====== +可视化模式使得在 Vim 中高亮显示和操作文本变得更加容易。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +Ansible playbook 文件是 YAML 格式的文本文件,经常与它们打交道的人有他们最喜欢的编辑器和扩展插件以使格式化更容易。 + +当我使用大多数 Linux 发行版中提供的默认编辑器来教 Ansible 时,我经常使用 Vim 的可视化模式。它允许我在屏幕上高亮显示我的操作 -- 我要编辑什么以及我正在做的文本处理任务,以便使我的学生更容易学习。 + +### Vim 的可视化模式 + +使用 Vim 编辑文本时,可视化模式对于识别要操作的文本块非常有用。 + +Vim 的可视模式有三个模式:字符,行和块。进入每种模式的按键是: + + * 字符模式: **v** (小写) + * 行模式: **V** (大写) + * 块模式: **Ctrl+v** + +下面是使用每种模式简化工作的一些方法。 + +### 字符模式 + +字符模式可以高亮显示段落中的一个句子或句子中的一个短语,然后,可以使用任何 Vim 编辑命令删除、复制、更改或修改可视化模式识别的文本。 + +#### 移动一个句子 + +要将句子从一个地方移动到另一个地方,首先打开文件并将光标移动到要移动的句子的第一个字符。 +![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png) + + * 按下 **v** 键进入可视化字符模式。单词 **VISUAL** 将出现在屏幕底部。 + * 使用箭头来高亮显示所需的文本。你可以使用其他导航命令,例如 **w** 高亮显示至下一个单词的开头,**$** 来包含其余行。 + * 在文本高亮显示后,按下 **d** 删除文本。 + * 如果你删除得太多或不够,按下 **u** 撤销并重新开始。 + * 将光标移动到新位置,然后按 **p** 粘贴文本。 + +#### 改变一个短语 + +你还可以高亮显示要替换的文本块。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png) + + * 将光标放在要更改的第一个字符处。 + * 按下 **v** 进入可视化字符模式。 + * 使用导航命令(如箭头键)高亮显示短语。 + * 按下 **c** 可更改高亮显示的文本。 + * 高亮显示的文本将消失,你将处于插入模式,你可以在其中添加新文本。 + * 输入新文本后,按下 **Esc** 返回命令模式并保存你的工作。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png) + +### 行模式 + +使用 Ansible playbooks 时,任务的顺序很重要。使用可视化行模式将任务移动到 playbooks 中的其他位置。 + +#### 操纵多行文本 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png) + + * 将光标放在要操作的文本的第一行或最后一行的任何位置。 + * 按下 **Shift+V** 进入行模式。单词 **VISUAL LINE** 将出现在屏幕底部。 + * 使用导航命令(如箭头键)高亮显示多行文本。 + * 高亮显示所需文本后,使用命令来操作它。按下 **d** 删除,然后将光标移动到新位置,按下 **p** 粘贴文本。 + * 如果要复制任务,可以使用 **y**(yank) 来代替 **d**(delete)。 + +#### 缩进一组行 + +使用 Ansible playbooks 或 YAML 文件时,缩进很重要。高亮显示的块可以使用 **>** 和 **<** 键向右或向左移动。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-line2.png) + + * 按下 **>** 增加所有行的缩进。 + * 按下 **<** 减少所有行的缩进。 + +尝试其他 Vim 命令将它们应用于高亮显示的文本。 + +### 块模式 + +可视化块模式对于操作特定的表格数据文件非常有用,但它作为验证 Ansible playbook 缩进的工具也很有帮助。 + +任务是项目列表,在 YAML 中,每个列表项都以破折号和空格开头。破折号必须在同一列中对齐,以达到相同的缩进级别。仅凭肉眼很难看出这一点。缩进任务中的其他行也很重要。 + +#### 验证任务列表缩进相同 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png) + + * 将光标放在列表项的第一个字符上。 + * 按下 **Ctrl+v** 进入可视化块模式。单词 **VISUAL BLOCK** 将出现在屏幕底部。 + * 使用箭头键高亮显示单个字符列。你可以验证每个任务的缩进量是否相同。 + * 使用箭头键向右或向左展开块,以检查其它缩进是否正确。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png) + +尽管我对其它 Vim 编辑快捷方式很熟悉,但我仍然喜欢使用可视化模式来整理我想要出来处理的文本。当我在演示过程总演示其它概念时,我的学生会看到一个高亮显示文本的工具,并在这个“仅限他们”的文本编辑器中点击删除。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/getting-started-vim-visual-mode + +作者:[Susan Lauber][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/susanlauber +[b]: https://github.com/lujun9972 From 6ddc8fcf8b0d84173ea14974103adc3c91114df8 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Sun, 3 Mar 2019 14:21:31 +0800 Subject: [PATCH 412/813] Translating 7 steps for hunting down Python code bugs. --- .../20190208 7 steps for hunting down Python code bugs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 5be6735dc7..b63da1ba8d 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -61,9 +61,9 @@ Pdb, 一个 Python 调试器。 #### 一句题外话 -为什么不使用 print 语句呢?我曾经依赖于 print 语句。他们有时候仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。 But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful. +为什么不使用 print 语句呢?我曾经依赖于 print 语句。他们有时候仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。但是主要使用 pdb 还有一个更重要的原因。假设你添加一条 print 语句去发现错误问题,而且 print 语句必须早于错误出现的地方。但是,看看你放 print 语句的函数,你不知道你是怎么调用它的。查看代码是寻找的好方法,但看你以前写的代码是恐怖的。是的,我会用 grep 处理我的代码库以寻找调用函数的地方,但这会变得乏味而且匹配一个通用函数时不能缩小范围。Pdb 就变得非常有用。 -You follow my advice, and put in a pdb break and run your test. And it whooshes on by and fails again, with no break at all. Leave your breakpoint in, and run a test already in your test suite that does something very similar to the broken test. If you have a decent test suite, you should be able to find a test that is hitting the same code you think your failed test should hit. Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. +你遵循我的建议,打上 pdb 断点并运行你的测试。然后测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. ### 4. Change things From 61b8f555fbc9b1379365861e7688f2b770398e31 Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sun, 3 Mar 2019 16:30:51 +0800 Subject: [PATCH 413/813] Update 20160921 lawyer The MIT License, Line by Line.md --- .../talk/20160921 lawyer The MIT License, Line by Line.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index 30479986ce..f5c36f77a3 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -129,14 +129,19 @@ To fill the gap between legally effective, well-documented grants of rights in c #### 许可授权 > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), +> 现免费准许任何人取得本软件及相关文件档案("软件")的副本. The meat of The MIT License is, you guessed it, a license. In general terms, a license is permission that one person or legal entity—the “licensor”—gives another—the “licensee”—to do something the law would otherwise let them sue for. The MIT License is a promise not to sue. +按照猜测,麻省理工执照的重点是执照。一般而言,许可是一个人或一个法律规定的实体----"许可人"----允许另一人----"被许可人"----做法律本来允许他们起诉的事情。MIT执照承诺不起诉。 The law sometimes distinguishes licenses from promises to give licenses. If someone breaks a promise to give a license, you may be able to sue them for breaking their promise, but you may not end up with a license. “Hereby” is one of those hokey, archaic-sounding words lawyers just can’t get rid of. It’s used here to show that the license text itself gives the license, and not just a promise of a license. It’s a legal [IIFE][23]. +法律有时会将许可证与承诺颁发许可证区分开来。如果有人违背了给他发许可证的承诺,你也许可以控告他违反了承诺,但你可能没有得到许可证。"在此"是律师们无法摆脱的时髦的古语之一。它在这里用来显示许可证文本本身给出了许可证,而不仅仅是一个许可证的承诺。这是合法的[IIFE][23]。 While many licenses give permission to a specific, named licensee, The MIT License is a “public license”. Public licenses give everybody—the public at large—permission. This is one of the three great ideas in open-source licensing. The MIT License captures this idea by giving a license “to any person obtaining a copy of … the Software”. As we’ll see later, there is also a condition to receiving this license that ensures others will learn about their permission, too. +虽然许多许可证给予许可的具体命名的许可证,麻省理工学院许可证则是一个“公共许可证”。公共许可证给予广大公众许可。这是开放源码许可的三大理念之一。MIT许可证通过向“获得该软件副本的任何人”颁发许可证来捕捉这一想法。正如我们将在后面看到的,若获得这个许可证也有一个条件,以确保其他人也会知道他们的许可。 The parenthetical with a capitalized term in quotation marks (a “Definition”), is the standard way to give terms specific meanings in American-style legal documents. Courts will reliably look back to the terms of the definition when they see a defined, capitalized term used elsewhere in the document. +在美国式的法律文件中,用大写的引号(一个“定义”)来表示术语的标准方法。当法院在文件的其他地方看到一个定义明确、资本化的术语时,大写的引号将会很可靠地回顾定义的术语。 ##### Grant Scope From 1f9f760e01c2241aabad57ebcc054e82476a0b0f Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 3 Mar 2019 19:03:45 +0800 Subject: [PATCH 414/813] Translating by MjSeven --- sources/tech/20180926 HTTP- Brief History of HTTP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180926 HTTP- Brief History of HTTP.md b/sources/tech/20180926 HTTP- Brief History of HTTP.md index ef6fde90e6..64e2abfd6b 100644 --- a/sources/tech/20180926 HTTP- Brief History of HTTP.md +++ b/sources/tech/20180926 HTTP- Brief History of HTTP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0507d819a22371effe21bbb04197f3597f870c48 Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sun, 3 Mar 2019 20:37:05 +0800 Subject: [PATCH 415/813] Update 20160921 lawyer The MIT License, Line by Line.md --- ...21 lawyer The MIT License, Line by Line.md | 211 +++++++----------- 1 file changed, 83 insertions(+), 128 deletions(-) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/sources/talk/20160921 lawyer The MIT License, Line by Line.md index f5c36f77a3..fbe662dd3f 100644 --- a/sources/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/sources/talk/20160921 lawyer The MIT License, Line by Line.md @@ -7,49 +7,30 @@ [#]: via: (https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html) [#]: author: (Kyle E. Mitchell https://kemitchell.com/) -lawyer The MIT License, Line by Line -麻省理工学院律师执照,逐行 + +MIT许可证的“精华” ====== -### The MIT License, Line by Line -### 麻省理工学院律师执照,逐行 +### MIT许可证的“精华” -[The MIT License][1] is the most popular open-source software license. Here’s one read of it, line by line. [MIT许可证][1] 是最流行的开源软件许可证,请逐行阅读下面的内容。 -#### Read the License #### 阅读许可证 -If you’re involved in open-source software and haven’t taken the time to read the license from top to bottom—it’s only 171 words—you need to do so now. Especially if licenses aren’t your day-to-day. Make a mental note of anything that seems off or unclear, and keep trucking. I’ll repeat every word again, in chunks and in order, with context and commentary. But it’s important to have the whole in mind. 如果你参与了开源软件的开发,然而你还没有花时间从头开始阅读尽管只有171个单词的许可证,你现在就需要这么做,尤其是如果许可证不是你的日常生活。记住任何看起来不对劲或不清楚的事情,然后继续思考。我将重复上下文和评论的每一个字,按块和顺序。但重要的是你要做到心中有数。 -> The MIT License (MIT) MIT 执照 +> MIT 许可证 > -> Copyright (c) > 版权(c)<年份><版权持有人> > -> 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. > 该软件是"原封不动地"提供的,没有任何明示或默示的保证,包括但不限于适销性、适合某一特定目的和不侵权的保证。在任何情况下,作者或版权所有人都不应对因下列原因引起的任何索赔、损害或其他责任负责,与软件或软件中的使用或其他交易有关的。 -The license is arranged in five paragraphs, but breaks down logically like this: 许可证由五个部分组成,在逻辑组成上像下面这样: - * **Header** - * **License Title** : “The MIT License” - * **Copyright Notice** : “Copyright (c) …” - * **License Grant** : “Permission is hereby granted …” - * **Grant Scope** : “… to deal in the Software …” - * **Conditions** : “… subject to …” - * **Attribution and Notice** : “The above … shall be included …” - * **Warranty Disclaimer** : “The software is provided ‘as is’ …” - * **Limitation of Liability** : “In no event …” - * **页眉** * **许可证所有权** : “MIT执照” * **版权公告** : “版权 (c) …” @@ -62,234 +43,208 @@ The license is arranged in five paragraphs, but breaks down logically like this: -Here we go: 我们开始了: -#### Header #### 页眉 -##### License Title ##### 许可证所有权 -> The MIT License (MIT) -> 麻省理工执照(麻省理工) +> 麻省理工许可证(MIT) -“The MIT License” is a not a single license, but a family of license forms derived from language prepared for releases from the Massachusetts Institute of Technology. It has seen a lot of changes over the years, both for the original projects that used it, and also as a model for other projects. The Fedora Project maintains a [kind of cabinet of MIT license curiosities][2], with insipid variations preserved in plain text like anatomical specimens in formaldehyde, tracing a wayward kind of evolution. “麻省理工许可证”并不是一个单一的许可证,而是包含来自于麻省理工学院为发布而准备的语言的一系列许可证表格。这些年来,无论是对于使用它的原始项目都经历了许多变化,还是作为其他项目的模型。fedora项目保持了一种[mit许可证陈列室的种类][2],在简单文本中保留了微小的变化,如甲醛中的解剖标本,追踪着一种没有规律的进化。 -Fortunately, the [Open Source Initiative][3] and [Software Package Data eXchange][4] groups have standardized a generic MIT-style license form as “The MIT License”. OSI in turn has adopted SPDX’ standardized [string identifiers][5] for common open-source licenses, with `MIT` pointing unambiguously to the standardized form “MIT License”. If you want MIT-style terms for a new project, use [the standardized form][1]. 幸运的是,[开源计划][3]和[数据交换软件包][4]组已经将通用的MIT式许可证表格标准化为“mit许可证”。而OSI则将SPDX的标准化[字符串识别符][5]用于普通的开源许可证,“MIT”明确指向标准化的表格“MIT许可证”。 -Even if you include “The MIT License” or “SPDX:MIT” in a `LICENSE` file, any responsible reviewer will still run a comparison of the text against the standard form, just to be sure. While various license forms calling themselves “MIT License” vary only in minor details, the looseness of what counts as an “MIT License” has tempted some authors into adding bothersome “customizations”. The canonical horrible, no good, very bad example of this is [the JSON license][6], an MIT-family license plus “The Software shall be used for Good, not Evil.”. This kind of thing might be “very Crockford”. It is definitely a pain in the ass. Maybe the joke was supposed to be on the lawyers. But they laughed all the way to the bank. 即使在“许可证”文件中包含“MIT许可证”或“SPDX:MIT”,负责任的评论者为了确定仍然会对文本和标准表单进行比较。尽管各种自称为“麻省理工许可证”的许可证表格只在细节上有所不同,但所谓的“麻省理工许可证”的宽松已经诱使一些作者添加了令人讨厌的“定制”。典型的可怕的的例子就是[JSON许可证][6],一个MIT-family许可证加上“软件应该用于正途的,而不是邪恶的...”这种事情可能是“非常克罗克福德”。这绝对是一个痛苦的事情。可能是律师们开的一个玩笑,但他们一路笑到最后。 -Moral of the story: “MIT License” alone is ambiguous. Folks probably have a good idea what you mean by it, but you’re only going to save everyone—yourself included—time by copying the text of the standard MIT License form into your project. If you use metadata, like the `license` property in package manager metadata files, to designate the `MIT` license, make sure your `LICENSE` file and any header comments use the standard form text. All of this can be [automated][7]. -这个故事的寓意是:“麻省理工许可证”本身是模棱两可的。人们或许对你的意思有清晰的理解,但是你只会通过将标准的mit许可证表格的文本复制到你的项目中来节省所有人的时间,包括你自己。如果您使用元数据,如包管理器元数据文件中的“许可证”属性来指定“MIT”许可证,请确保您的“许可证”文件和任何头注使用标准窗体文本。而这些都可以[自动化][7]。 +这个故事的寓意是:“麻省理工许可证”本身是模棱两可的。人们或许对你的意思有清晰的理解,但是你只会通过将标准的MIT许可证表格的文本复制到你的项目中来节省所有人的时间,包括你自己。如果您使用元数据,如包管理器元数据文件中的“许可证”属性来指定“MIT”许可证,请确保您的“许可证”文件和任何头注使用标准窗体文本。而这些都可以[自动化][7]。 -##### Copyright Notice ##### 版权公告 -> Copyright (c) > 版权(c)<年份><版权持有人> -Until the 1976 Copyright Act, United States copyright law required specific actions, called “formalities”, to secure copyright in creative works. If you didn’t follow those formalities, your rights to sue others for unauthorized use of your work were limited, often completely lost. One of those formalities was “notice”: Putting marks on your work and otherwise making it known to the market that you were claiming copyright. The © is a standard symbol for marking copyrighted works, to give notice of copyright. The ASCII character set doesn’t have the © symbol, but `Copyright (c)` gets the same point across. 直到1976年的版权法,美国版权法要求采取具体行动以确保创作作品的版权,称为“手续”。如果你没有遵循这些手续,你起诉他人未经授权使用你的作品的权利是有限的,但这种权利基本丧失。其中一种形式是“通知”:在你的作品上做标记,或者在声明过后让市场知道你拥有版权。 © 是标记有版权作品的标准符号,以发出版权通知。ascii字符集没有 © 符号,但是“版权(c)”得到了这种权利。 -The 1976 Copyright Act, which “implemented” many requirements of the international Berne Convention, eliminated formalities for securing copyright. At least in the United States, copyright holders still need to register their copyrighted works before suing for infringement, with potentially higher damages if they register before infringement begins. In practice, however, many register copyright right before bringing suit against someone in particular. You don’t lose your copyright just by failing to put notices on it, registering, sending a copy to the Library of Congress, and so on. 1976年“执行”了伯尔尼国际公约的许多要求版权法却取消了保护版权的手续。至少在美国,版权拥有者仍然需要在起诉侵权行为之前登记他们的版权作品,但如果他们在侵权行为开始前登记,也许会造成更高的损害。然而,现实中许多人在提起诉讼之前登记了版权。你不会因为只是没有在版权上张贴通知、注册、向国会图书馆发送副本等行为而失去版权。 -Even if copyright notices aren’t as absolutely necessary as they used to be, they are still plenty useful. Stating the year a work was authored and who the copyright belonged to give some sense of when copyright in the work might expire, bringing the work into the public domain. The identity of the author or authors is also useful: United States law calculates copyright terms differently for individual and “corporate” authors. Especially in business use, it may also behoove a company to think twice about using software from a known competitor, even if the license terms give very generous permission. If you’re hoping others will see your work and want to license it from you, copyright notices serve nicely for attribution. 即使版权公告不再像过去那样绝对必要,但它们仍然很有用。说明作品创作的年份和版权持有者,使人们对作品的版权何时到期有某种感觉,从而使作品进入公共领域。作者的身份也很有用:美国法律对个人和“公司”两种身份的作者的版权计算方法不同。尤其是在商业上,即使许可条款给予非常慷慨的许可,公司也有必要对使用已知竞争对手的软件三思而后行。如果你希望别人看到你的作品,并希望从你那里获得许可,版权公告就可以很好裁决归属问题。 -As for “copyright holder”: Not all standard form licenses have a space to write this out. More recent license forms, like [Apache 2.0][8] and [GPL 3.0][9], publish `LICENSE` texts that are meant to be copied verbatim, with header comments and separate files elsewhere to indicate who owns copyright and is giving the license. Those approaches neatly discourage changes to the “standard” texts, accidental or intentional. They also make automated license identification more reliable. 至于“版权持有人”:并不是所有的标准格式许可证都有地方写出来。近期的许可证表格,如[apache 2.0][8]和[gpl 3.0][9],发布“许可证”文本,这些文本本应逐字复制,与头注和单独的文件其他地方,以表明谁拥有版权,并正在给予许可证。这些做法有意无意地阻止了对"标准"文本的更改,还使自动许可证认证更加可靠。 -The MIT License descends from language written for releases of code by institutions. For institutional releases, there was just one clear “copyright holder”, the institution releasing the code. Other institutions cribbed these licenses, replacing “MIT” with their own names, leading eventually to the generic forms we have now. This process repeated for other short-form institutional licenses of the era, notably the [original four-clause BSD License][10] for the University of California, Berkeley, now used in [three-clause][11] and [two-clause][12] variants, as well as [The ISC License][13] for the Internet Systems Consortium, an MIT variant. MIT许可证是机构为发布代码而编写的语言。对于机构发布,只有一个明确的“版权持有人”,即机构发布代码。其他一些机构用他们自己的名字代替了“MIT”,最终形成了我们现在的通用格式。这个过程重复了这个时代的其他短形式的机构许可证,值得注意的是加州大学伯克利分校的[原四条款BSD许可证][10],现在用于[三条款][11]和[二条款][12]的变体,以及互联网系统联盟(MIT的一种变体)的(ISC许可证)。 -In each case, the institution listed itself as the copyright holder in reliance on rules of copyright ownership, called “[works made for hire][14]” rules, that give employers and clients ownership of copyright in some work their employees and contractors do on their behalf. These rules don’t usually apply to distributed collaborators submitting code voluntarily. This poses a problem for project-steward foundations, like the Apache Foundation and Eclipse Foundation, that accept contributions from a more diverse group of contributors. The usual foundation approach thus far has been to use a house license that states a single copyright holder—[Apache 2.0][8] and [EPL 1.0][15]—backed up by contributor license agreements—[Apache CLAs][16] and [Eclipse CLAs][17]—to collect rights from contributors. Collecting copyright ownership in one place is even more important under “copyleft” licenses like the GPL, which rely on copyright owners to enforce license conditions to promote software-freedom values. 在所有情况下,机构都将自己列为版权所有人,以依赖版权所有权规则,称为"[受雇作品][14]"规则,这就给了雇主和客户一些版权,他们的雇员和承包商代表他们做的工作。这些规则通常不适用于自愿提交代码的分布式合作者。这给项目管理者基金会带来了一个问题,比如apache基金会和日食基金会,这些基金会接受了来自更多样化的捐助者群体的捐助。到目前为止,通常的基础方法是使用一种房屋许可证,该许可证规定只有一个版权持有人——[Apache 2.0][8]和[EPL 1.0][15]——由出资人许可证协议支持——[apache clas][16]并且[clas][17]——从贡献者那里收集权利。在像GPL这样的“版权许可”下,在一个地方收集版权所有权更加重要,因为它依赖于版权所有人强制执行许可条件以促进软件自由值。 -These days, loads of projects without any kind of institutional or business steward use MIT-style license terms. SPDX and OSI have helped these use cases by standardizing forms of licenses like MIT and ISC that don’t refer to a specific entity or institutional copyright holder. Armed with those forms, the prevailing practice of project authors is to fill their own name in the copyright notice of the form very early on … and maybe bump the year here and there. At least under United States copyright law, the resulting copyright notice doesn’t give a full picture. 如今,只有很少的任何机构或企业管理者的项目在使用MIT式的许可证条款。SPDX和OSI通过规范MIT和ISC等不涉及特定实体或机构版权持有人的许可证形式,帮助了这些案例的使用。有了这些表格,项目作者的普遍做法是在很早表格的版权通知时就填写他们自己的名字,也许会在这里或那里增加一年的时间。至少根据美国版权法,由此产生的版权通知并没有给出一个完整的情况。 -The original owner of a piece of software retains ownership of their work. But while MIT-style license terms give others rights to build on and change the software, creating what the law calls “derivative works”, they don’t give the original author ownership of copyright in others’ contributions. Rather, each contributor has copyright in any [even marginally creative][18] work they make using the existing code as a starting point. 软件的原拥有者保留对其作品的所有权。但是,尽管MIT式的许可条款赋予了其他人在软件上进行开发和更改的权利,创造了法律所称的“衍生作品”,但它们并没有赋予原始作者在他人贡献中的版权所有权。相反,每个贡献者都拥有以现有代码为起点的作品的版权。 -Most of these projects also balk at the idea of taking contributor license agreements, to say nothing of signed copyright assignments. That’s both naive and understandable. Despite the assumption of some newer open-source developers that sending a pull request on GitHub “automatically” licenses the contribution for distribution on the terms of the project’s existing license, United States law doesn’t recognize any such rule. Strong copyright protection, not permissive licensing, is the default. 这些项目中的大多数也对接受贡献者许可协议的想法有所保留,更不用说签署版权转让了。这其实很好理解。尽管假定一些较新的开源开发者对github“自动”发送退出请求,根据项目的现有许可条款授权分配贡献,但美国法律不承认这样的规则。默认的是强有力的版权保护,而不是许可许可。 -Update: GitHub later changed its site-wide terms of service to include an attempt to flip this default, at least on GitHub.com. I’ve written up some thoughts on that development, not all of them positive, in [another post][19]. 更新:GitHub后来改变了它在整个网站的服务条款,包括试图翻转这个默认,至少在GitHub.com。我已经写了一些关于这个发展的想法,不是所有的都是积极的,在[另一个帖子][19]。 -To fill the gap between legally effective, well-documented grants of rights in contributions and no paper trail at all, some projects have adopted the [Developer Certificate of Origin][20], a standard statement contributors allude to using `Signed-Off-By` metadata tags in their Git commits. The Developer Certificate of Origin was developed for Linux kernel development in the wake of the infamous SCO lawsuits, which alleged that chunks of Linux’ code derived from SCO-owned Unix source. As a means of creating a paper trail showing that each line of Linux came from a contributor, the Developer Certificate of Origin functions nicely. While the Developer Certificate of Origin isn’t a license, it does provide lots of good evidence that those submitting code expected the project to distribute their code, and for others to use it under the kernel’s existing license terms. The kernel also maintains a machine-readable `CREDITS` file listing contributors with name, affiliation, contribution area, and other metadata. I’ve done [some][21] [experiments][22] adapting that approach for projects that don’t use the kernel’s development flow. 为填补具有法律效力的且有充分文件证明的捐款权利授予与完全没有书面记录之间的空白,一些项目采用了[开发商原产地证书][20],一个标准的语句贡献者暗示在他们的Git提交中使用“签名关闭”元数据标签。在臭名昭著的SCO诉讼事件之后,Linux内核开发人员为Linux内核开发了原产地证书,该诉讼指控Linux的代码块来自于SCO拥有的UNIX源代码。作为一种创建文件线索的手段,显示每一行Linux代码的贡献者,开发人员原产地证书的功能很好。虽然开发人员的原产地证书不是许可证,但它确实提供了大量的证据,证明提交代码的人希望项目分发他们的代码,并让其他人在内核的现有许可条款下使用。内核还维护一个机器可读的“信用”文件,列出具有名称、关联、贡献区域和其他元数据的贡献者。我已经做了[一些][实验][22]将这种方法应用于不使用内核开发流程的项目。 -#### License Grant #### 许可授权 -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), > 现免费准许任何人取得本软件及相关文件档案("软件")的副本. -The meat of The MIT License is, you guessed it, a license. In general terms, a license is permission that one person or legal entity—the “licensor”—gives another—the “licensee”—to do something the law would otherwise let them sue for. The MIT License is a promise not to sue. 按照猜测,麻省理工执照的重点是执照。一般而言,许可是一个人或一个法律规定的实体----"许可人"----允许另一人----"被许可人"----做法律本来允许他们起诉的事情。MIT执照承诺不起诉。 -The law sometimes distinguishes licenses from promises to give licenses. If someone breaks a promise to give a license, you may be able to sue them for breaking their promise, but you may not end up with a license. “Hereby” is one of those hokey, archaic-sounding words lawyers just can’t get rid of. It’s used here to show that the license text itself gives the license, and not just a promise of a license. It’s a legal [IIFE][23]. 法律有时会将许可证与承诺颁发许可证区分开来。如果有人违背了给他发许可证的承诺,你也许可以控告他违反了承诺,但你可能没有得到许可证。"在此"是律师们无法摆脱的时髦的古语之一。它在这里用来显示许可证文本本身给出了许可证,而不仅仅是一个许可证的承诺。这是合法的[IIFE][23]。 -While many licenses give permission to a specific, named licensee, The MIT License is a “public license”. Public licenses give everybody—the public at large—permission. This is one of the three great ideas in open-source licensing. The MIT License captures this idea by giving a license “to any person obtaining a copy of … the Software”. As we’ll see later, there is also a condition to receiving this license that ensures others will learn about their permission, too. 虽然许多许可证给予许可的具体命名的许可证,麻省理工学院许可证则是一个“公共许可证”。公共许可证给予广大公众许可。这是开放源码许可的三大理念之一。MIT许可证通过向“获得该软件副本的任何人”颁发许可证来捕捉这一想法。正如我们将在后面看到的,若获得这个许可证也有一个条件,以确保其他人也会知道他们的许可。 -The parenthetical with a capitalized term in quotation marks (a “Definition”), is the standard way to give terms specific meanings in American-style legal documents. Courts will reliably look back to the terms of the definition when they see a defined, capitalized term used elsewhere in the document. 在美国式的法律文件中,用大写的引号(一个“定义”)来表示术语的标准方法。当法院在文件的其他地方看到一个定义明确、资本化的术语时,大写的引号将会很可靠地回顾定义的术语。 -##### Grant Scope +##### 授予范围 -> to deal in the Software without restriction, +> 不受限制的软件处理 -From the licensee’s point of view, these are the seven most important words in The MIT License. The key legal concerns are getting sued for copyright infringement and getting sued for patent infringement. Neither copyright law nor patent law uses “to deal in” as a term of art; it has no specific meaning in court. As a result, any court deciding a dispute between a licensor and a licensee would ask what the parties meant and understood by this language. What the court will see is that the language is intentionally broad and open-ended. It gives licensees a strong argument against any claim by a licensor that they didn’t give permission for the licensee to do that specific thing with the software, even if the thought clearly didn’t occur to either side when the license was given. +麻省理工许可证中最重要的七个词就是从被许可人的观点来看。其关键的法律问题是被起诉侵犯版权和被起诉侵犯专利。版权法和专利法都没有使用“处理”作为术语,它在法庭上没有具体的含义。因此,对许可人与被许可人之间的争议作出裁决的任何法院都会询问该措词所指的当事人的含义和理解。法院将会看到的是,该描述是不详细的和开放式的。这给了被许可人一个强有力的论据——在许可人没有允许被许可人对软件做特定的事情时反对许可人的任何主张,即使在许可的时候,这一想法都没有出现。 -> 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, -No piece of legal writing is perfect, “fully settled in meaning”, or unmistakably clear. Beware anyone who pretends otherwise. This is the least perfect part of The MIT License. There are three main issues: +> 包括在不受限制的情况下使用、复制、修改、合并、公布、分发、转授许可证和/或出售软件副本的权利,以及允许软件给予者这样做的权利。 -First, “including without limitation” is a legal antipattern. It crops up in any number of flavors: +没有哪篇法律文章是完美的,“在根本上完全解决”,或者明确无误的。要小心那些装模作样的人。这是麻省理工执照中最不完美的部分。有三个主要问题: - * “including, without limitation” - * “including, without limiting the generality of the foregoing” - * “including, but not limited to” - * many, many pointless variations +首先,"包括不受限制"是一种法律上的反模式。它产生了各种理解: + + * “包括,不受限制” + * “包括,在不限制上述一般性的情况下” + * “包括,但不局限于” + * 很多很多毫无意义的措辞变化 -All of these share a common purpose, and they all fail to achieve it reliably. Fundamentally, drafters who use them try to have their cake and eat it, too. In The MIT License, that means introducing specific examples of “dealing in the Software”—“use, copy, modify” and so on—without implying that licensee action has to be something like the examples given to count as “dealing in”. The trouble is that, if you end up needing a court to review and interpret the terms of a license, the court will see its job as finding out what those fighting meant by the language. If the court needs to decide what “deal in” means, it cannot “unsee” the examples, even if you tell it to. I’d argue that “deal in the Software without restriction” alone would be better for licensees. Also shorter. +所有这些都有共同的目标,但都没能真正地实现。从根本上说,它们的创始人也在尝试从中得到好处。在MIT许可证中,这意味着引入“软件交易”,其具体示例是“使用、复制、修改”等等,而不是暗示被许可人的行为必须类似于给出的“交易”的示例。问题是,如果你最终需要一个法庭来审查和解释许可证的条款,法庭则看作找出那些争论的语言的含义。法院不能“忽略”示例决定什么是“交易”,,即使你告诉它。也是较短的。 -Second, the verbs given as examples of “deal in” are a hodgepodge. Some have specific meanings under copyright or patent law, others almost do or just plain don’t: +第二,作为“处理”的例子给出的动词是一个大杂烩。有些在版权法或专利法下有特定的含义,有些却没有: - * use appears in [United States Code title 35, section 271(a)][24], the patent law’s list of what patent owners can sue others for doing without permission. + *使用出现在[美国法典第35章,第271(a)条][24],专利法的清单中,列出了专利所有人可以因未经许可而起诉他人的行为。 + + *复制出现在《版权法》(美国法典第17编第106条)[25]中,列出了版权所有人可以因未经许可而起诉他人的行为 - * copy appears in [United States Code title 17, section 106][25], the copyright law’s list of what copyright owners can sue others for doing without permission. - - * modify doesn’t appear in either copyright or patent statute. It is probably closest to “prepare derivative works” under the copyright statute, but may also implicate improving or otherwise derivative inventions. - - * merge doesn’t appear in either copyright or patent statute. “Merger” has a specific meaning in copyright, but that’s clearly not what’s intended here. Rather, a court would probably read “merge” according to its meaning in industry, as in “to merge code”. - - * publish doesn’t appear in either copyright or patent statute. Since “the Software” is what’s being published, it probably hews closest to “distribute” under the [copyright statute][25]. That statute also covers rights to perform and display works “publicly”, but those rights apply only to specific kinds of copyrighted work, like plays, sound recordings, and motion pictures. - - * distribute appears in the [copyright statute][25]. - - * sublicense is a general term of intellectual property law. The right to sublicense means the right to give others licenses of their own, to do some or all of what you have permission to do. The MIT License’s right to sublicense is actually somewhat unusual in open-source licenses generally. The norm is what Heather Meeker calls a “direct licensing” approach, where everyone who gets a copy of the software and its license terms gets a license direct from the owner. Anyone who might get a sublicense under the MIT License will probably end up with a copy of the license telling them they have a direct license, too. - - * sell copies of is a mongrel. It is close to “offer to sell” and “sell” in the [patent statute][24], but refers to “copies”, a copyright concept. On the copyright side, it seems close to “distribute”, but the [copyright statute][25] makes no mention of sales. - - * permit persons to whom the Software is furnished to do so seems redundant of “sublicense”. It’s also unnecessary to the extent folks who get copies also get a direct license. + *修改不出现在版权或专利法规中。它可能最接近版权法规下的“准备衍生作品”,但也可能涉及改进或其他衍生发明。 + + *合并没有出现在版权或专利法规中。“合并”在版权上有特定的含义,但这显然不是这里的本意。相反,法院可能根据其在业界的含义来理解“合并”,如“合并代码”。 + + *出版不出现在版权或专利法规中。由于“软件”是发布的内容,它可能最接近于[版权法规][25]下的“发布”。法律也涵盖了“公开”表演和展示作品的权利,但这些权利只适用于特定类型的有版权的作品,如戏剧、录音和电影。 + + *散布出现在[版权法规][25]中。 + + *次级许可是知识产权法的总称。转牌权是指利用给予他人自己的执照做一些有权利做的事情的权利。MIT许可证的转行权在开源许可证中是不常见的。每个人只要拿到软件及其许可条款的副本,就可以直接从所有者那里得到许可,这就是Heather Meeker所说的“直接授权”方法。任何可能通过麻省理工许可证获得次级许可证的人,很可能最终会得到一份许可证副本,告诉他们自己也有直接许可证。 + + *出售的副本是一个混合物。它接近[专利法规][24]中的"要约销售"和"销售",却指的是版权概念中的"副本"。在版权方面,它似乎接近“发行”,但[版权法规][25]没有提到出售。 + + *允许向软件提供者这样做,"次级许可"似乎是多余的并且也是不必要的,因为人们得到的副本也获得了直接许可证。 -Lastly, as a result of this mishmash of legal, industry, general-intellectual-property, and general-use terms, it isn’t clear whether The MIT License includes a patent license. The general language “deal in” and some of the example verbs, especially “use”, point toward a patent license, albeit a very unclear one. The fact that the license comes from the copyright holder, who may or may not have patent rights in inventions in the software, as well as most of the example verbs and the definition of “the Software” itself, all point strongly toward a copyright license. More recent permissive open-source licenses, like [Apache 2.0][8], address copyright, patent, and even trademark separately and specifically. +最后,由于法律、工业、一般知识产权和一般用途条款的混淆,目前还不清楚麻省理工学院的许可证是否包括专利许可证。一般的语言“处理”和一些例子动词,特别是“使用”,指向专利许可,尽管是一个非常不清楚的。许可证来自版权持有人,他对软件中的发明可能有也可能没有专利权,以及大多数示例动词和"软件"本身的定义,所有这些都强烈指向版权许可证.更近期的许可开放源码许可证,如[apache 2.0][8],涉及单独和具体的版权、专利甚至商标。 ##### Three License Conditions +##### 许可证的三个条件 -> subject to the following conditions: +> 须符合以下条件: -There’s always a catch! MIT has three! +总有人能符合MIT的三个条件! -If you don’t follow The MIT License’s conditions, you don’t get the permission the license offers. So failing to do what the conditions say at least theoretically leaves you open to a lawsuit, probably a copyright lawsuit. +如果你不遵守麻省理工的许可条件,你就得不到许可。因此,如果不按条件所说的做,至少在理论上,你会面临一场诉讼,很可能是一场版权诉讼。 -Using the value of the software to the licensee to motivate compliance with conditions, even though the licensee paid nothing for the license, is the second great idea of open-source licensing. The last, not found in The MIT License, builds off license conditions: “Copyleft” licenses like the [GNU General Public License][9] use license conditions to control how those making changes can license and distribute their changed versions. +利用软件的价值来激励被许可人遵守条件,即使被许可人没有为许可支付任何费用,是开源许可的第二个伟大想法。最后一个,在MIT许可证中没有,建立在许可证条件的基础上:“版权”许可证,像[GNU通用公共许可证][9]使用利益来控制那些进行更改的人去许可和分发他们的更改版本。 ##### Notice Condition +##### 公告条件 -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> 上述版权通知和许可通知应包含在软件的副本的绝大部分内容中。 -If you give someone a copy of the software, you need to include the license text and any copyright notice. This serves a few critical purposes: +如果你给某人软件的副本,你需要包括许可证文本和任何版权通知。这有几个关键目的: - 1. Gives others notice that they have permission for the software under the public license. This is a key part of the direct-licensing model, where each user gets a license direct from the copyright holder. - - 2. Makes known who’s behind the software, so they can be showered in praises, glory, and cold, hard cash donations. - - 3. Ensures the warranty disclaimer and limitation of liability (coming up next) follow the software around. Everyone who gets a copy should get a copy of those licensor protections, too. + 1.通知他人他们有许可使用该软件的公共许可证。这是直接授权模式的一个关键部分,即每个用户直接从版权持有人那里获得许可证。 + + 2.让他们知道谁是软件的参与者,使得他们能够接受检验。 + + 3.确保免责声明和赔偿责任限制(下一步)伴随软件。每个得到副本的人也应该得到一份这些许可人保护的副本。 +没有源代码的情况下,没有什么可以阻止您付费获得副本,甚至是编译形式的副本。但是当你这样做的时候,你不能假装MIT的代码是你自己的专有代码,或者是在其他许可证下提供的代码。领取者得了解他们在"公共许可证"下的权利。 -There’s nothing to stop you charging for providing a copy, or even a copy in compiled form, without source code. But when you do, you can’t pretend that the MIT code is your own proprietary code, or provided under some other license. Those receiving get to know their rights under the “public license”. - -Frankly, compliance with this condition is breaking down. Nearly every open-source license has such an “attribution” condition. Makers of system and installed software often understand they’ll need to compile a notices file or “license information” screen, with copies of license texts for libraries and components, for each release of their own. The project-steward foundations have been instrumental in teaching those practices. But web developers, as a whole, haven’t got the memo. It can’t be explained away by a lack of tooling—there is plenty—or the highly modular nature of packages from npm and other repositories—which uniformly standardize metadata formats for license information. All the good JavaScript minifiers have command-line flags for preserving license header comments. Other tools will concatenate `LICENSE` files from package trees. There’s really no excuse. +坦率地说,这一条件很难去遵守。几乎每个开源许可证都有这样的“归属”条件。系统和已安装软件的制造商通常都明白,他们需要为自己的每个版本编写一个通知文件或“许可证信息”,并为库和组件提供许可证文本的副本。项目管理基金会在传授这些做法方面发挥了重要作用。但总体而言,网络开发者并没有得到这份备忘录。这不能用缺少工具来解释——有大量的工具——或者是来自npm和其他存储库的软件包的高度模块化性质——它们统一地将许可证信息的元数据格式标准化。所有好的JavaScript迷你机都有用于保存许可证标题注释的命令行标记。其他工具将从包装箱树连接“许可证”文件。实在没有理由去遗忘这一条件。 ##### Warranty Disclaimer +##### 保护免责声明 -> 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. +> 该软件是"原封不动地"提供的,没有任何明示或默示的保证,包括但不限于适销性、适合某一特定目的和不侵权的保证。 -Nearly every state in the United States has enacted a version of the Uniform Commercial Code, a model statute of laws governing commercial transactions. Article 2 of the UCC—“Division 2” in California—governs contracts for sales of goods, from used automobiles bought off the lot to large shipments of industrial chemicals to manufacturing plants. +美国几乎每个州都颁布了统一商业法典,这是一个规范商业交易的法律范本。加州大学洛杉矶分校(UCC)的第2条则规定了货物销售合同,从旧汽车的购进到工业化学品的大规模运输,再到制造工厂。 -Some of the UCC’s rules about sales contracts are mandatory. These rules always apply, whether those buying and selling like them or not. Others are just “defaults”. Unless buyers and sellers opt out in writing, the UCC implies that they want the baseline rule found in the UCC’s text for their deal. Among the default rules are implied “warranties”, or promises by sellers to buyers about the quality and usability of the goods being sold. +加州大学洛杉矶分销关于销售合同的某些规则是强制性的。不管那些买卖他们喜欢与否这些规则总是适用的。而其他的只是“默认”。除非买卖双方以书面形式选择不参与,否则UCC暗示他们希望在UCC的文本中找到他们交易的基准规则。在默认规则中,隐含着“保证”,或卖方向买方承诺所售货物的质量和可用性。 -There is a big theoretical debate about whether public licenses like The MIT License are contracts—enforceable agreements between licensors and licensees—or just licenses, which go one way, but may come with strings attached, their conditions. There is less debate about whether software counts as “goods”, triggering the UCC’s rules. There is no debate among licensors on liability: They don’t want to get sued for lots of money if the software they give away for free breaks, causes problems, doesn’t work, or otherwise causes trouble. That’s exactly the opposite of what three default rules for “implied warranties” do: +对于像MIT许可证这样的公共许可证到底是合同(许可人和被许可人之间可执行的协议)还是仅仅只是许可证(只有一种方式,但可能附带条件),存在着很大的争论。而关于软件是否算作“商品”的争论则较少,这触发了UCC的规则。许可证持有者之间没有关于赔偿责任的争论:他们不想因为大量的钱财而被起诉,如果他们赠送的软件是免费、则会引起一些麻烦。这与“默认保证”的三个默认规则正好相反: - 1. The implied warranty of “merchantability” under [UCC section 2-314][26] is a promise that “the goods”—the Software—are of at least average quality, properly packaged and labeled, and fit for the ordinary purposes they are intended to serve. This warranty applies only if the one giving the software is a “merchant” with respect to the software, meaning they deal in software and hold themselves out as skilled in software. + 1.[UCC第2-314][26]条对"适销性"的默认保证是"货物"或者软件应至少具有平均质量,包装和适当的标签,适合他们的用途。这个保证只适用于提供软件的人是软件的“商人”,这意味着他们从事软件交易,并坚持自己在软件方面很熟练。 + + 2.[UCC第2-315][27]条中关于"适合某一特定目的"的默认保证,在卖方知道买方因为某一用途而购买软件时,默认保护是有用的。因此,货物必须"合适"。 - 2. The implied warranty of “fitness for a particular purpose” under [UCC section 2-315][27] kicks in when the seller knows the buyer is relying on them to provide goods for a particular purpose. The goods need to actually be “fit” for that purpose. - - 3. The implied warranty of “noninfringement” is not part of the UCC, but is a common feature of general contract law. This implied promise protects the buyer if it turns out the goods they received infringe somebody else’s intellectual property rights. That would be the case if the software under The MIT License didn’t actually belong to the one trying to license it, or if it fell under a patent owned by someone else. + 3.“不侵权”的默认保证不是合同约定的一部分,而是一般合同法的共同特征。如果买方收到的货物侵犯了他人的知识产权,该默认承诺保护买方。如果MIT许可下的软件实际上不属于试图授权它的软件,或者它属于其他人拥有的专利,就不会去保护买方。 +UCC[章节 2-316(3)][28]条要求选择或"排除"关于适销性和适合某一特定目的的隐含保证的语言非常一目了然。而“显眼”则意味着书写或格式化的目的是为了引起人们对其本身的注意,这与微观的细微印刷相反,其目的是为了避开不谨慎的消费者。州法律可能对不侵权的免责声明规定类似的吸引注意力的要求。 -[Section 2-316(3)][28] of the UCC requires language opting out of, or “excluding”, implied warranties of merchantability and fitness for a particular purpose to be conspicuous. “Conspicuous” in turn means written or formatted to call attention to itself, the opposite of microscopic fine print meant to slip past unwary consumers. State law may impose a similar attention-grabbing requirement for disclaimers of noninfringement. - -Lawyers have long suffered under the delusion that writing anything in `ALL-CAPS` meets the conspicuous requirement. That isn’t true. Courts have criticized the Bar for pretending as much, and most everyone agrees all-caps does more to discourage reading than compel it. All the same, most open-source-license forms set their warranty disclaimers in all-caps, in part because that’s the only obvious way to make it stand out in plain-text `LICENSE` files. I’d prefer to use asterisks or other ASCII art, but that ship sailed long, long ago. +长期以来,律师们一直被一种错觉所困扰,认为用“全盖”写任何东西都符合明显的要求,然而这确实假的。法院已经批判了这一标准,因为它太假了,而且大多数人都同意全上限的做法更多的是为了阻止阅读,而不是强迫阅读。尽管如此,大多数开源许可证的格式都将其保证免责声明设置为全上限,部分原因是这是唯一明显的方法,可以使其在纯文本“许可证”文件中脱颖而出。我宁愿用星号或其他的ASCII艺术,但那已经很久了。 ##### Limitation of Liability +##### 限制 +> 在任何情况下,作者或版权持有人均不对因下列原因而引起的任何索赔、损害或其他责任承担任何责任或是与软件或者软件中的使用或其他交易有关的责任。 -> 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. +MIT许可证允许“免费”使用软件,但法律并不认为获得免费许可证的人会在事情出了差错时放弃起诉的权利,而应归咎于许可人。“赔偿责任限制”,通常与“损害赔偿排除”结合在一起,就像保证不起诉一样,很像许可证。但这些是对许可人免受被许可人诉讼的保护。 -The MIT License gives permission for software “free of charge”, but the law does not assume that folks receiving licenses free of charge give up their rights to sue when things go wrong and the licensor is to blame. “Limitations of liability”, often paired with “damages exclusions”, work a lot like licenses, as promises not to sue. But these are protections for the licensor against lawsuits by licensees. +一般来说,法院谨慎地解读赔偿责任和损害赔偿排除的限制,因为它们可以将巨大的风险从一方转移到另一方。为了保护社区的重大利益,他们“严格解释”限制责任的语言让人们能够纠正在法庭上犯下的错误,在可能的情况下对照受其保护的语言来解读。限制赔偿责任必须是明确的,才能成立。尤其是在“消费者”合同和其他情况下,那些放弃起诉权的人缺乏技巧或议价能力,法院有时拒绝尊重那些言外之意。律师们由于这个原因可能也由于纯粹的习惯而倾向于限制给予赔偿责任。 -In general, courts read limitations of liability and damages exclusions warily, since they can shift an incredible amount of risk from one side to another. To protect the community’s vital interest in giving folks a way to redress wrongs done in court, they “strictly construe” language limiting liability, reading it against the one protected by it where possible. Limitations of liability have to be specific to stand up. Especially in “consumer” contracts and other situations where those giving up the right to sue lack sophistication or bargaining power, courts have sometimes refused to honor language that seemed buried out of sight. Partly for that reason, partly by sheer force of habit, lawyers tend to give limits of liability the all-caps treatment, too. +只要稍微钻低一点,“赔偿责任限额”就是被许可人可以起诉的金额的上限。在开源许可证中,这个限制总是没有钱的——0美元,“不负责任”。相比之下,在商业许可证中,尽管它通常是经过协商的而决定出为过去12个月期间支付的许可证费用的倍数。 -Drilling down a bit, the “limitation of liability” part is a cap on the amount of money a licensee can sue for. In open-source licenses, that limit is always no money at all, $0, “not liable”. By contrast, in commercial licenses, it’s often a multiple of license fees paid in the last 12-month period, though it’s often negotiated. +"排除"部分具体列出了各类法律索赔以及许可人不能使用造成损害赔偿的理由。和许多法律形式一样,MIT执照提到了“合同”行为中的违约行为和“侵权行为”。侵权行为规则是防止不小心或恶意伤害他人的一般规则。如果你发短信的时候在路上撞上了某人,你就犯下了侵权行为。如果你的公司出售的耳机有问题,让人耳朵发麻,那么你的公司就犯下了侵权行为。如果合同没有明确排除侵权索赔,法院有时会在合同中阅读排除语,以防止只发生合同索赔。为了更好地衡量这种排除部分,麻省理工的执照上写着“或者其他”,仅仅是不同寻常的法律主张。 -The “exclusion” part lists, specifically, kinds of legal claims—reasons to sue for damages—the licensor cannot use. Like many, many legal forms, The MIT License mentions actions “of contract”—for breaching a contract—and “of tort”. Tort rules are general rules against carelessly or maliciously harming others. If you run someone down on the road while texting, you have committed a tort. If your company sells faulty headphones that burn peoples’ ears off, your company has committed a tort. If a contract doesn’t specifically exclude tort claims, courts sometimes read exclusion language in a contract to prevent only contract claims. For good measure, The MIT License throws in “or otherwise”, just to catch the odd admiralty law or other, exotic kind of legal claim. - -The phrase “arising from, out of or in connection with” is a recurring tick symptomatic of the legal draftsman’s inherent, anxious insecurity. The point is that any lawsuit having anything to do with the software is covered by the limitation and exclusions. On the off chance something can “arise from”, but not “out of”, or “in connection with”, it feels better to have all three in the form, so pack ‘em in. Never mind that any court forced to split hairs in this part of the form will have to come up with different meanings for each, on the assumption that a professional drafter wouldn’t use different words in a row to mean the same thing. Never mind that in practice, where courts don’t feel good about a limitation that’s disfavored to begin with, they’ll be more than ready to read the scope trigger narrowly. But I digress. The same language appears in literally millions of contracts. +"产生于、或与之有关"这句话是法律起草人固有的、焦虑的不安全感的反复出现的症状。重点是任何与软件有关的诉讼都在限制和排除范围之内。在偶然的机会,一些东西可以"产生",但不是"产生",或"联系",不必介意它在形式上的三种的说法。出现在不同地方的同一个词语或许都是不同意思,假设一个专业起草人不会使用不同的词语在一排的意思相同的事情则不必介意,在实践中,如果法院对一开始就不满意想这个限制,那么他们就会非常愿意仔细地解读范围触发因素。但我离题了。同样的语言出现在数百万份合同中或许理解都不一样。 #### Overall +#### 总结 -All these quibbles are a bit like spitting out gum on the way into church. The MIT License is a legal classic. The MIT License works. It is by no means a panacea for all software IP ills, in particular the software patent scourge, which it predates by decades. But MIT-style licenses have served admirably, fulfilling a narrow purpose—reversing troublesome default rules of copyright, sales, and contract law—with a minimal combination of discreet legal tools. In the greater context of computing, its longevity is astounding. The MIT License has outlasted and will outlast the vast majority of software licensed under it. We can only guess how many decades of faithful legal service it will have given when it finally loses favor. It’s been especially generous to those who couldn’t have afforded their own lawyer. +这些俏皮话虽然有点像碎碎念,但MIT租客正却是法律上的经典。MIT租客正是有用的。虽然MIT式的许可非常出色但它绝不是解决所有软件ip弊病的灵丹妙药,尤其是早于它几十年出现的软件专利的祸害。实现了用最低限度的谨慎的法律工具组合来扭转麻烦的版权、销售和合同法的默认规则这个狭隘的目标。在更大的计算环境中,它的生命周期是惊人的。MIT许可证的有效期已经超过了它所授权的绝大多数软件。我们只能猜测,当它最终对那些自己请不起律师的人失去好感时,它将提供多少几十年忠实的法律服务。 -We’ve seen how the The MIT License we know today is a specific, standardized set of terms, bringing order at long last to a chaos of institution-specific, haphazard variations. +我们已经看到了我们今天所知的MIT许可证是一套具体的、标准化的术语,最终给机构特有的、随意变化的混乱带来了秩序。 -We’ve seen how its approach to attribution and copyright notice informed intellectual property management practices for academic, standards, commercial, and foundation institutions. +我们已经看到了它是如何为学术、标准、商业和基金会机构的知识产权管理实践提供归属和版权通知的依据。 -We’ve seen how The MIT Licenses grants permission for software to all, for free, subject to conditions that protect licensors from warranties and liability. +我们已经看到了MIT许可证是如何向所有人免费授予软件许可的,但我们必须遵守保护许可人免受担保和赔偿责任的条件。 -We’ve seen that despite some crusty verbiage and lawyerly affectation, one hundred and seventy one little words can get a hell of a lot of legal work done, clearing a path for open-source software through a dense underbrush of intellectual property and contract. +我们已经看到,尽管有一些不是很精准的词和修饰,但这一百七十一个词已经足够严谨,能够通过一个密集的知识产权和合同为开源软件开辟新的道路。 -I’m so grateful for all who’ve taken the time to read this rather long post, to let me know they found it useful, and to help improve it. As always, I welcome your comments via [e-mail][29], [Twitter][30], and [GitHub][31]. +我非常感谢所有愿意花时间来阅读这篇长文的人,让我知道他们认为它有用,并帮助改进它。和往常一样,我欢迎您通过[电子邮件][29], [推特][30], 和 [GitHub][31].发表评论。 -A number of folks have asked where they can read more, or find run-downs of other licenses, like the GNU General Public License or the Apache 2.0 license. No matter what your particular continuing interest may be, I heartily recommend the following books: +若是想阅读更多的内容或者找到其他许可证的概要,比如GNU公共许可证或者Apache 2.0许可证。无论你有什么关于这方面的兴趣,我都衷心推荐以下的书: * Andrew M. St. Laurent’s [Understanding Open Source & Free Software Licensing][32], from O’Reilly. -I start with this one because, while it’s somewhat dated, its approach is also closest to the line-by-line approach used above. O’Reilly has made it [available online][33]. +我是这本书开始入门的,虽然它有点过时,但它的方法也最接近上面使用的逐行方法。O’Reilly 已经在网上提供了它。 * Heather Meeker’s [Open (Source) for Business][34] -In my opinion, by far the best writing on the GNU General Public License and copyleft more generally. This book covers the history, the licenses, their development, as well as compatibility and compliance. It’s the book I lend to clients considering or dealing with the GPL. +在我看来,目前为止,关于GNU公共许可证和版权写的比较好的已经有很多了。这本书涵盖了许可证的历史、发展、以及兼容性和合规性。这是我借给客户的书,考虑或处理GPL。 * Larry Rosen’s [Open Source Licensing][35], from Prentice Hall. -A great first book, also available for free [online][36]. This is the best introduction to open-source licensing and related law for programmers starting from scratch. This one is also a bit dated in some specific details, but Larry’s taxonomy of licenses and succinct summary of open-source business models stand the test of time. +这是很棒的一本书,也[在线][36]免费的。这是对程序员关于从零开始的开源许可和相关法律的最好的介绍。虽然这一点也有点过时了,但是在一些具体的细节中拉里对许可证的分类法和对开源商业模式的简洁总结是经得起时间考验的。 +所有的这些教育都对作为开源授权律师的我至关重要。他们的作者是我这行的英雄。强烈推荐阅读!-- K.E.M -All of these were crucial to my own education as an open-source licensing lawyer. Their authors are professional heroes of mine. Have a read! — K.E.M - -I license this article under a [Creative Commons Attribution-ShareAlike 4.0 license][37]. - +我在[创意共享许可4.0版本][37]授权这篇文章. -------------------------------------------------------------------------------- @@ -297,7 +252,7 @@ via: https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html 作者:[Kyle E. Mitchell][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[Amanda0212](https://github.com/Amanda0212) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f64911fad42ed1580fe0f7058f817d063737c1cc Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sun, 3 Mar 2019 20:41:28 +0800 Subject: [PATCH 416/813] Rename sources/talk/20160921 lawyer The MIT License, Line by Line.md to translated/talk/ 20160921 lawyer The MIT License, Line by Line.md --- .../talk/ 20160921 lawyer The MIT License, Line by Line.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/talk/20160921 lawyer The MIT License, Line by Line.md => translated/talk/ 20160921 lawyer The MIT License, Line by Line.md (100%) diff --git a/sources/talk/20160921 lawyer The MIT License, Line by Line.md b/translated/talk/ 20160921 lawyer The MIT License, Line by Line.md similarity index 100% rename from sources/talk/20160921 lawyer The MIT License, Line by Line.md rename to translated/talk/ 20160921 lawyer The MIT License, Line by Line.md From 6e0df531e2b9f6c2505a9b7de9dbe041a2e17cf5 Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sun, 3 Mar 2019 20:44:04 +0800 Subject: [PATCH 417/813] Update and rename 20160921 lawyer The MIT License, Line by Line.md to 20160921 lawyer The MIT License, Line by Line.md --- ...d => 20160921 lawyer The MIT License, Line by Line.md} | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) rename translated/talk/{ 20160921 lawyer The MIT License, Line by Line.md => 20160921 lawyer The MIT License, Line by Line.md} (99%) diff --git a/translated/talk/ 20160921 lawyer The MIT License, Line by Line.md b/translated/talk/20160921 lawyer The MIT License, Line by Line.md similarity index 99% rename from translated/talk/ 20160921 lawyer The MIT License, Line by Line.md rename to translated/talk/20160921 lawyer The MIT License, Line by Line.md index fbe662dd3f..30566443d2 100644 --- a/translated/talk/ 20160921 lawyer The MIT License, Line by Line.md +++ b/translated/talk/20160921 lawyer The MIT License, Line by Line.md @@ -45,7 +45,7 @@ MIT许可证的“精华” 我们开始了: -#### 页眉 +#### 写在前面 ##### 许可证所有权 @@ -141,10 +141,8 @@ MIT许可证是机构为发布代码而编写的语言。对于机构发布, - 最后,由于法律、工业、一般知识产权和一般用途条款的混淆,目前还不清楚麻省理工学院的许可证是否包括专利许可证。一般的语言“处理”和一些例子动词,特别是“使用”,指向专利许可,尽管是一个非常不清楚的。许可证来自版权持有人,他对软件中的发明可能有也可能没有专利权,以及大多数示例动词和"软件"本身的定义,所有这些都强烈指向版权许可证.更近期的许可开放源码许可证,如[apache 2.0][8],涉及单独和具体的版权、专利甚至商标。 -##### Three License Conditions ##### 许可证的三个条件 > 须符合以下条件: @@ -155,7 +153,6 @@ MIT许可证是机构为发布代码而编写的语言。对于机构发布, 利用软件的价值来激励被许可人遵守条件,即使被许可人没有为许可支付任何费用,是开源许可的第二个伟大想法。最后一个,在MIT许可证中没有,建立在许可证条件的基础上:“版权”许可证,像[GNU通用公共许可证][9]使用利益来控制那些进行更改的人去许可和分发他们的更改版本。 -##### Notice Condition ##### 公告条件 > 上述版权通知和许可通知应包含在软件的副本的绝大部分内容中。 @@ -174,7 +171,6 @@ MIT许可证是机构为发布代码而编写的语言。对于机构发布, 坦率地说,这一条件很难去遵守。几乎每个开源许可证都有这样的“归属”条件。系统和已安装软件的制造商通常都明白,他们需要为自己的每个版本编写一个通知文件或“许可证信息”,并为库和组件提供许可证文本的副本。项目管理基金会在传授这些做法方面发挥了重要作用。但总体而言,网络开发者并没有得到这份备忘录。这不能用缺少工具来解释——有大量的工具——或者是来自npm和其他存储库的软件包的高度模块化性质——它们统一地将许可证信息的元数据格式标准化。所有好的JavaScript迷你机都有用于保存许可证标题注释的命令行标记。其他工具将从包装箱树连接“许可证”文件。实在没有理由去遗忘这一条件。 -##### Warranty Disclaimer ##### 保护免责声明 > 该软件是"原封不动地"提供的,没有任何明示或默示的保证,包括但不限于适销性、适合某一特定目的和不侵权的保证。 @@ -197,7 +193,6 @@ UCC[章节 2-316(3)][28]条要求选择或"排除"关于适销性和适合某一 长期以来,律师们一直被一种错觉所困扰,认为用“全盖”写任何东西都符合明显的要求,然而这确实假的。法院已经批判了这一标准,因为它太假了,而且大多数人都同意全上限的做法更多的是为了阻止阅读,而不是强迫阅读。尽管如此,大多数开源许可证的格式都将其保证免责声明设置为全上限,部分原因是这是唯一明显的方法,可以使其在纯文本“许可证”文件中脱颖而出。我宁愿用星号或其他的ASCII艺术,但那已经很久了。 -##### Limitation of Liability ##### 限制 > 在任何情况下,作者或版权持有人均不对因下列原因而引起的任何索赔、损害或其他责任承担任何责任或是与软件或者软件中的使用或其他交易有关的责任。 @@ -211,7 +206,6 @@ MIT许可证允许“免费”使用软件,但法律并不认为获得免费 "产生于、或与之有关"这句话是法律起草人固有的、焦虑的不安全感的反复出现的症状。重点是任何与软件有关的诉讼都在限制和排除范围之内。在偶然的机会,一些东西可以"产生",但不是"产生",或"联系",不必介意它在形式上的三种的说法。出现在不同地方的同一个词语或许都是不同意思,假设一个专业起草人不会使用不同的词语在一排的意思相同的事情则不必介意,在实践中,如果法院对一开始就不满意想这个限制,那么他们就会非常愿意仔细地解读范围触发因素。但我离题了。同样的语言出现在数百万份合同中或许理解都不一样。 -#### Overall #### 总结 这些俏皮话虽然有点像碎碎念,但MIT租客正却是法律上的经典。MIT租客正是有用的。虽然MIT式的许可非常出色但它绝不是解决所有软件ip弊病的灵丹妙药,尤其是早于它几十年出现的软件专利的祸害。实现了用最低限度的谨慎的法律工具组合来扭转麻烦的版权、销售和合同法的默认规则这个狭隘的目标。在更大的计算环境中,它的生命周期是惊人的。MIT许可证的有效期已经超过了它所授权的绝大多数软件。我们只能猜测,当它最终对那些自己请不起律师的人失去好感时,它将提供多少几十年忠实的法律服务。 From 5700bb320755ddab51775d20210b6b7f8a4e2d1b Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sun, 3 Mar 2019 20:46:26 +0800 Subject: [PATCH 418/813] Update 20160921 lawyer The MIT License, Line by Line.md --- .../talk/20160921 lawyer The MIT License, Line by Line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/talk/20160921 lawyer The MIT License, Line by Line.md b/translated/talk/20160921 lawyer The MIT License, Line by Line.md index 30566443d2..cb877210e2 100644 --- a/translated/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/translated/talk/20160921 lawyer The MIT License, Line by Line.md @@ -208,7 +208,7 @@ MIT许可证允许“免费”使用软件,但法律并不认为获得免费 #### 总结 -这些俏皮话虽然有点像碎碎念,但MIT租客正却是法律上的经典。MIT租客正是有用的。虽然MIT式的许可非常出色但它绝不是解决所有软件ip弊病的灵丹妙药,尤其是早于它几十年出现的软件专利的祸害。实现了用最低限度的谨慎的法律工具组合来扭转麻烦的版权、销售和合同法的默认规则这个狭隘的目标。在更大的计算环境中,它的生命周期是惊人的。MIT许可证的有效期已经超过了它所授权的绝大多数软件。我们只能猜测,当它最终对那些自己请不起律师的人失去好感时,它将提供多少几十年忠实的法律服务。 +这些俏皮话虽然有点像碎碎念,但MIT许可证却是法律上的经典。MIT许可证是有用的。虽然MIT式的许可证非常出色但它绝不是解决所有软件ip弊病的灵丹妙药,尤其是早于它几十年出现的软件专利的祸害。实现了用最低限度的谨慎的法律工具组合来扭转麻烦的版权、销售和合同法的默认规则这个狭隘的目标。在更大的计算环境中,它的生命周期是惊人的。MIT许可证的有效期已经超过了它所授权的绝大多数软件。我们只能猜测,当它最终对那些自己请不起律师的人失去好感时,它将提供多少几十年忠实的法律服务。 我们已经看到了我们今天所知的MIT许可证是一套具体的、标准化的术语,最终给机构特有的、随意变化的混乱带来了秩序。 From 0070e3dd7b0c9076372926a4a3ee85e7ee4fcdc3 Mon Sep 17 00:00:00 2001 From: Amanda0212 <39301711+Amanda0212@users.noreply.github.com> Date: Sun, 3 Mar 2019 20:46:53 +0800 Subject: [PATCH 419/813] Update 20160921 lawyer The MIT License, Line by Line.md --- .../talk/20160921 lawyer The MIT License, Line by Line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/talk/20160921 lawyer The MIT License, Line by Line.md b/translated/talk/20160921 lawyer The MIT License, Line by Line.md index cb877210e2..5de277d592 100644 --- a/translated/talk/20160921 lawyer The MIT License, Line by Line.md +++ b/translated/talk/20160921 lawyer The MIT License, Line by Line.md @@ -13,7 +13,7 @@ MIT许可证的“精华” ### MIT许可证的“精华” -[MIT许可证][1] 是最流行的开源软件许可证,请逐行阅读下面的内容。 +[MIT许可证][1] 是最流行的开源软件许可证,请阅读下面的内容。 #### 阅读许可证 From a9ea15394821355ada68bdffd914acc28d3f3770 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 00:53:41 +0800 Subject: [PATCH 420/813] PRF:20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @qhwdw --- ...atory - Raspberry Pi- Lesson 8 Screen03.md | 73 ++++++++----------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md index 7f58f5da24..3b5d89dc3f 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -1,34 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 8 Screen03) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) -计算机实验室 – 树莓派:课程 8 屏幕03 +计算机实验室之树莓派:课程 8 屏幕03 ====== 屏幕03 课程基于屏幕02 课程来构建,它教你如何绘制文本,和一个操作系统命令行参数上的一个小特性。假设你已经有了[课程 7:屏幕02][1] 的操作系统代码,我们将以它为基础来构建。 ### 1、字符串的理论知识 -是的,我们的任务是为这个操作系统绘制文本。我们有几个问题需要去处理,最紧急的那个可能是如何去保存文本。令人难以置信的是,文本是迄今为止在计算机上最大的缺陷之一。原本应该是简单的数据类型却导致了操作系统的崩溃,破坏了完美的加密,并给使用不同字母表的用户带来了许多问题。尽管如此,它仍然是极其重要的数据类型,因为它将计算机和用户很好地连接起来。文本是计算机能够理解的非常好的结构,同时人类使用它时也有足够的可读性。 +是的,我们的任务是为这个操作系统绘制文本。我们有几个问题需要去处理,最紧急的那个可能是如何去保存文本。令人难以置信的是,文本是迄今为止在计算机上最大的缺陷之一。原本应该是简单的数据类型却导致了操作系统的崩溃,从而削弱其他方面的加密效果,并给使用其它字母表的用户带来了许多问题。尽管如此,它仍然是极其重要的数据类型,因为它将计算机和用户很好地连接起来。文本是计算机能够理解的非常好的结构,同时人类使用它时也有足够的可读性。 -``` -可变数据类型,比如文本要求能够进行很复杂的处理。 -``` +那么,文本是如何保存的呢?非常简单,我们使用一种方法,给每个字母分配一个唯一的编号,然后我们保存一系列的这种编号。看起来很容易吧。问题是,那个编号的数量是不固定的。一些文本段可能比其它的长。保存普通数字,我们有一些固有的限制,即:32 位,我们不能超过这个限制,我们要添加方法去使用该长度的数字等等。“文本”这个术语,我们经常也叫它“字符串”,我们希望能够写一个可用于可变长度字符串的函数,否则就需要写很多函数!对于一般的数字来说,这不是个问题,因为只有几种通用的数字格式(字节、字、半字节、双字节)。 -那么,文本是如何保存的呢?非常简单,我们使用一种方法,给每个字母分配一个唯一的编号,然后我们保存一系列的这种编号。看起来很容易吧。问题是,那个编号的数字是不固定的。一些文本片断可能比其它的长。与保存普通数字一样,我们有一些固有的限制,即:3 位,我们不能超过这个限制,我们添加方法去使用那种长数字等等。“文本”这个术语,我们经常也叫它“字符串”,我们希望能够写一个可用于变长字符串的函数,否则就需要写很多函数!对于一般的数字来说,这不是个问题,因为只有几种通用的数字格式(字节、字、半字节、双字节)。 +> 可变数据类型(比如文本)要求能够进行很复杂的处理。 -``` -缓冲区溢出攻击祸害计算机由来已久。最近,Wii、Xbox 和 Playstation 2、以及大型系统如 Microsoft 的 Web 和数据库服务器,都遭受到缓冲区溢出攻击。 -``` +因此,如何判断字符串长度?我想显而易见的答案是存储字符串的长度,然后去存储组成字符串的字符。这称为长度前缀,因为长度位于字符串的前面。不幸的是,计算机科学家的先驱们不同意这么做。他们认为使用一个称为空终止符(`NULL`)的特殊字符(用 `\0` 表示)来表示字符串结束更有意义。这样确定简化了许多字符串算法,因为你只需要持续操作直到遇到空终止符为止。不幸的是,这成为了许多安全问题的根源。如果一个恶意用户给你一个特别长的字符串会发生什么状况?如果没有足够的空间去保存这个特别长的字符串会发生什么状况?你可以使用一个字符串复制函数来做复制,直到遇到空终止符为止,但是因为字符串特别长,而覆写了你的程序,怎么办?这看上去似乎有些较真,但是,缓冲区溢出攻击还是经常发生。长度前缀可以很容易地缓解这种问题,因为它可以很容易地推算出保存这个字符串所需要的缓冲区的长度。作为一个操作系统开发者,我留下这个问题,由你去决定如何才能更好地存储文本。 -因此,如何判断字符串长度?我想显而易见的答案是存储多长的字符串,然后去存储组成字符串的字符。这称为长度前缀,因为长度位于字符串的前面。不幸的是,计算机科学家的先驱们不同意这么做。他们认为使用一个称为空终止符(NULL)的特殊字符(用 \0表示)来表示字符串结束更有意义。这样确定简化了许多字符串算法,因为你只需要持续操作直到遇到空终止符为止。不幸的是,这成为了许多安全问题的根源。如果一个恶意用户给你一个特别长的字符串会发生什么状况?如果没有足够的空间去保存这个特别长的字符串会发生什么状况?你可以使用一个字符串复制函数来做复制,直到遇到空终止符为止,但是因为字符串特别长,而覆写了你的程序,怎么办?这看上去似乎有些较真,但尽管如此,缓冲区溢出攻击还是经常发生。长度前缀可以很容易地缓解这种问题,因为它可以很容易地推算出保存这个字符串所需要的缓冲区的长度。作为一个操作系统开发者,我留下这个问题,由你去决定如何才能更好地存储文本。 +> 缓冲区溢出攻击祸害计算机由来已久。最近,Wii、Xbox 和 Playstation 2、以及大型系统如 Microsoft 的 Web 和数据库服务器,都遭受到缓冲区溢出攻击。 -接下来的事情是,我们需要去维护一个很好的从字符到数字的映射。幸运的是,这是高度标准化的,我们有两个主要的选择,Unicode 和 ASCII。Unicode 几乎将每个单个的有用的符号都映射为数字,作为交换,我们得到的是很多很多的数字,和一个更复杂的编码方法。ASCII 为每个字符使用一个字节,因此它仅保存拉丁字母、数字、少数符号和少数特殊字符。因此,ASCII 是非常易于实现的,与 Unicode 相比,它的每个字符占用的空间并不相同,这使得字符串算法更棘手。一般操作系统上字符使用 ASCII,并不是为了显示给最终用户的(开发者和专家用户除外),给终端用户显示信息使用 Unicode,因为 Unicode 能够支持像日语字符这样的东西,并且因此可以实现本地化。 +接下来的事情是,我们需要确定的是如何最好地将字符映射到数字。幸运的是,这是高度标准化的,我们有两个主要的选择,Unicode 和 ASCII。Unicode 几乎将每个有用的符号都映射为数字,作为代价,我们需要有很多很多的数字,和一个更复杂的编码方法。ASCII 为每个字符使用一个字节,因此它仅保存拉丁字母、数字、少数符号和少数特殊字符。因此,ASCII 是非常易于实现的,与之相比,Unicode 的每个字符占用的空间并不相同,这使得字符串算法更棘手。通常,操作系统上字符使用 ASCII,并不是为了显示给最终用户的(开发者和专家用户除外),给终端用户显示信息使用 Unicode,因为 Unicode 能够支持像日语字符这样的东西,并且因此可以实现本地化。 幸运的是,在这里我们不需要去做选择,因为它们的前 128 个字符是完全相同的,并且编码也是完全一样的。 @@ -45,27 +41,27 @@ | 60 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | | | 70 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL | -这个表显示了前 128 个符号。一个符号的十六进制表示是行的值加上列的值,比如 A 是 41~16~。你可以惊奇地发现前两行和最后的值。这 33 个特殊字符是不可打印字符。事实上,许多人都忽略了它们。它们之所以存在是因为 ASCII 最初设计是基于计算机网络来传输数据的一种方法。因此它要发送的信息不仅仅是符号。你应该学习的重要的特殊字符是 `NUL`,它就是我们前面提到的空终止符。`HT` 水平制表符就是我们经常说的 `tab`,而 `LF` 换行符用于生成一个新行。你可能想研究和使用其它特殊字符在你的操行系统中的意义。 +这个表显示了前 128 个符号。一个符号的十六进制表示是行的值加上列的值,比如 A 是 4116。你可以惊奇地发现前两行和最后的值。这 33 个特殊字符是不可打印字符。事实上,许多人都忽略了它们。它们之所以存在是因为 ASCII 最初设计是基于计算机网络来传输数据的一种方法。因此它要发送的信息不仅仅是符号。你应该学习的重要的特殊字符是 `NUL`,它就是我们前面提到的空终止符。`HT` 水平制表符就是我们经常说的 `tab`,而 `LF` 换行符用于生成一个新行。你可能想研究和使用其它特殊字符在你的操行系统中的意义。 ### 2、字符 到目前为止,我们已经知道了一些关于字符串的知识,我们可以开始想想它们是如何显示的。为了显示一个字符串,我们需要做的最基础的事情是能够显示一个字符。我们的第一个任务是编写一个 `DrawCharacter` 函数,给它一个要绘制的字符和一个位置,然后它将这个字符绘制出来。 -```markdown -在许多操作系统中使用的 `truetype` 字体格式是很强大的,它内置有它自己的汇编语言,以确保在任何分辨率下字母看起来都是正确的。 -``` +这就很自然地引出关于字体的讨论。我们已经知道有许多方式去按照选定的字体去显示任何给定的字母。那么字体又是如何工作的呢?在计算机科学的早期阶段,字体就是所有字母的一系列小图片而已,这种字体称为位图字体,而所有的字符绘制方法就是将图片复制到屏幕上。当人们想去调整字体大小时就出问题了。有时我们需要大的字母,而有时我们需要的是小的字母。尽管我们可以为每个字体、每种大小、每个字符都绘制新图片,但这种作法过于单调乏味。所以,发明了矢量字体。矢量字体不包含字体的图像,它包含的是如何去绘制字符的描述,即:一个 `o` 可能是最大字母高度的一半为半径绘制的圆。现代操作系统都几乎仅使用这种字体,因为这种字体在任何分辨率下都很完美。 -这就很自然地引出关于字体的讨论。我们已经知道有许多方式去按照选定的字体去显示任何给定的字母。那么字体又是如何工作的呢?在计算机科学的早期阶段,一种字体就是所有字母的一系列小图片而已,这种字体称为位图字体,而所有的字符绘制方法就是将图片复制到屏幕上。当人们想去调整字体大小时就出问题了。有时我们需要大的字母,而有时我们需要的是小的字母。尽管我们可以为每个字体、每种大小、每个字符都绘制新图片,但这种作法过于单调乏味。所以,发明了矢量字体。矢量字体不包含字体的图像,它包含的是如何去绘制字符的描述,即:一个 `o` 可能是最大字母高度的一半为半径绘制的圆。现代操作系统都几乎仅使用这种字体,因为这种字体在任何分辨率下都很完美。 +> 在许多操作系统中使用的 TrueType 字体格式是很强大的,它内置有它自己的汇编语言,以确保在任何分辨率下字母看起来都是正确的。 -不幸的是,虽然我很想包含一个矢量字体的格式的实现,但它的内容太多了,将占用这个站点的剩余部分。所以,我们将去实现一个位图字体,可是,如果你想去做一个正宗的图形化的操作系统,那么矢量字体将是很有用的。 +不幸的是,虽然我很想包含一个矢量字体的格式的实现,但它的内容太多了,将占用这个网站的剩余部分。所以,我们将去实现一个位图字体,可是,如果你想去做一个像样的图形操作系统,那么矢量字体将是很有用的。 在下载页面上的字体节中,我们提供了几个 `.bin` 文件。这些只是字体的原始二进制数据文件。为完成本教程,从等宽、单色、8x16 节中挑选你喜欢的字体。然后下载它并保存到 `source` 目录中并命名为 `font.bin` 文件。这些文件只是每个字母的单色图片,它们每个字母刚好是 8 x 16 个像素。所以,每个字母占用 16 字节,第一个字节是第一行,第二个字节是第二行,依此类推。 ![bitmap](https://ws2.sinaimg.cn/large/006tNc79ly1fzzb2064agj305l0apt96.jpg) -这个示意图展示了等宽、单色、8x16 的字符 A 的 `Bitstream Vera Sans Mono`。在这个文件中,我们可以找到,它从第 41~16~ × 10~16~ = 410~16~ 字节开始的十六进制序列: +这个示意图展示了等宽、单色、8x16 的字符 A 的 “Bitstream Vera Sans Mono” 字体。在这个文件中,我们可以找到,它从第 4116 × 1016 = 41016 字节开始的十六进制序列: +``` 00, 00, 00, 10, 28, 28, 28, 44, 44, 7C, C6, 82, 00, 00, 00, 00 +``` 在这里我们将使用等宽字体,因为等宽字体的每个字符大小是相同的。不幸的是,大多数字体的复杂之处就是因为它的宽度不同,从而导致它的显示代码更复杂。在下载页面上还包含有几个其它的字体,并包含了这种字体的存储格式介绍。 @@ -77,9 +73,7 @@ font: .incbin "font.bin" ``` -```assembly -.incbin "file" 插入来自文件 “file” 中的二进制数据。 -``` +> `.incbin "file"` 插入来自文件 “file” 中的二进制数据。 这段代码复制文件中的字体数据到标签为 `font` 的地址。我们在这里使用了一个 `.align 4` 去确保每个字符都是从 16 字节的倍数开始,这是一个以后经常用到的用于加快访问速度的技巧。 @@ -98,8 +92,8 @@ function drawCharacter(r0 is character, r1 is x, r2 is y) next return r0 = 8, r1 = 16 end function - ``` + 如果直接去实现它,这显然不是个高效率的做法。像绘制字符这样的事情,效率是最重要的。因为我们要频繁使用它。我们来探索一些改善的方法,使其成为最优化的汇编代码。首先,因为我们有一个 `× 16`,你应该会马上想到它等价于逻辑左移 4 位。紧接着我们有一个变量 `row`,它只与 `charAddress` 和 `y` 相加。所以,我们可以通过增加替代变量来消除它。现在唯一的问题是如何判断我们何时完成。这时,一个很好用的 `.align 4` 上场了。我们知道,`charAddress` 将从包含 0 的低位半字节开始。这意味着我们可以通过检查低位半字节来看到进入字符数据的程度。 虽然我们可以消除对 `bit` 的需求,但我们必须要引入新的变量才能实现,因此最好还是保留它。剩下唯一的改进就是去除嵌套的 `bits >> bit`。 @@ -189,7 +183,7 @@ pop {r4,r5,r6,r7,r8,pc} ### 3、字符串 -现在,我们可以绘制字符了,我们可以绘制文本了。我们需要去写一个方法,给它一个字符串为输入,它通过递增位置来绘制出每个字符。为了做的更好,我们应该去实现新的行和制表符。是时候决定关于空终止符的问题了,如果你想让你的操作系统使用它们,可以按需来修改下面的代码。为避免这个问题,我将给 `DrawString` 函数传递一个字符串长度,以及字符串的地址,和 x 和 y 的坐标作为参数。 +现在,我们可以绘制字符了,我们可以绘制文本了。我们需要去写一个方法,给它一个字符串为输入,它通过递增位置来绘制出每个字符。为了做的更好,我们应该去实现新的行和制表符。是时候决定关于空终止符的问题了,如果你想让你的操作系统使用它们,可以按需来修改下面的代码。为避免这个问题,我将给 `DrawString` 函数传递一个字符串长度,以及字符串的地址,和 `x` 和 `y` 的坐标作为参数。 ```c function drawString(r0 is string, r1 is length, r2 is x, r3 is y) @@ -215,7 +209,7 @@ end function 同样,这个函数与汇编代码还有很大的差距。你可以随意去尝试实现它,即可以直接实现它,也可以简化它。我在下面给出了简化后的函数和汇编代码。 -很明显,写这个函数的人并不很有效率(感到奇怪吗?它就是我写的)。再说一次,我们有一个 `pos` 变量,它用于递增和与其它东西相加,这是完全没有必要的。我们可以去掉它,而同时进行长度递减,直到减到 0 为止,这样就少用了一个寄存器。除了那个烦人的乘以 5 以外,函数的其余部分还不错。在这里要做的一个重要事情是,将乘法移到循环外面;即便使用位移运算,乘法仍然是很慢的,由于我们总是加一个乘以 5 的相同的常数,因此没有必要重新计算它。实际上,在汇编代码中它可以在一个操作数中通过参数移位来实现,因此我将代码改变为下面这样。 +很明显,写这个函数的人并不很有效率(感到奇怪吗?它就是我写的)。再说一次,我们有一个 `pos` 变量,它用于递增及与其它东西相加,这是完全没有必要的。我们可以去掉它,而同时进行长度递减,直到减到 0 为止,这样就少用了一个寄存器。除了那个烦人的乘以 5 以外,函数的其余部分还不错。在这里要做的一个重要事情是,将乘法移到循环外面;即便使用位移运算,乘法仍然是很慢的,由于我们总是加一个乘以 5 的相同的常数,因此没有必要重新计算它。实际上,在汇编代码中它可以在一个操作数中通过参数移位来实现,因此我将代码改变为下面这样。 ```c function drawString(r0 is string, r1 is length, r2 is x, r3 is y) @@ -307,22 +301,20 @@ pop {r4,r5,r6,r7,r8,r9,pc} .unreq length ``` -```assembly -subs reg,#val 从寄存器 reg 中减去 val,然后将结果与 0 进行比较。 -``` - 这个代码中非常聪明地使用了一个新运算,`subs` 是从一个操作数中减去另一个数,保存结果,然后将结果与 0 进行比较。实现上,所有的比较都可以实现为减法后的结果与 0 进行比较,但是结果通常会丢弃。这意味着这个操作与 `cmp` 一样快。 -### 4、你的愿意是我的命令行 +> `subs reg,#val` 从寄存器 `reg` 中减去 `val`,然后将结果与 `0` 进行比较。 + +### 4、你的意愿是我的命令行 现在,我们可以输出字符串了,而挑战是找到一个有意思的字符串去绘制。一般在这样的教程中,人们都希望去绘制 “Hello World!”,但是到目前为止,虽然我们已经能做到了,我觉得这有点“君临天下”的感觉(如果喜欢这种感觉,请随意!)。因此,作为替代,我们去继续绘制我们的命令行。 有一个限制是我们所做的操作系统是用在 ARM 架构的计算机上。最关键的是,在它们引导时,给它一些信息告诉它有哪些可用资源。几乎所有的处理器都有某些方式来确定这些信息,而在 ARM 上,它是通过位于地址 10016 处的数据来确定的,这个数据的格式如下: 1. 数据是可分解的一系列的标签。 - 2. 这里有九种类型的标签:`core`,`mem`,`videotext`,`ramdisk`,`initrd2`,`serial`,`revision`,`videolfb`,`cmdline`。 - 3. 每个标签只能出现一次,除了 'core’ 标签是必不可少的之外,其它的都是可有可无的。 - 4. 所有标签都依次放置在地址 0x100 处。 + 2. 这里有九种类型的标签:`core`、`mem`、`videotext`、`ramdisk`、`initrd2`、`serial`、`revision`、`videolfb`、`cmdline`。 + 3. 每个标签只能出现一次,除了 `core` 标签是必不可少的之外,其它的都是可有可无的。 + 4. 所有标签都依次放置在地址 `0x100` 处。 5. 标签列表的结束处总是有两个word,它们全为 0。 6. 每个标签的字节数都是 4 的倍数。 7. 每个标签都是以标签中(以字为单位)的标签大小开始(标签包含这个数字)。 @@ -334,11 +326,9 @@ subs reg,#val 从寄存器 reg 中减去 val,然后将结果与 0 进行比较 13. 一个 `cmdline` 标签包含一个 `null` 终止符字符串,它是个内核参数。 -```markdown -几乎所有的操作系统都支持一个`命令行`的程序。它的想法是为选择一个程序所期望的行为而提供一个通用的机制。 -``` +在目前的树莓派版本中,只提供了 `core`、`mem` 和 `cmdline` 标签。你可以在后面找到它们的用法,更全面的参考资料在树莓派的参考页面上。现在,我们感兴趣的是 `cmdline` 标签,因为它包含一个字符串。我们继续写一些搜索这个命令行(`cmdline`)标签的代码,如果找到了,以每个条目一个新行的形式输出它。命令行只是图形处理器或用户认为操作系统应该知道的东西的一个列表。在树莓派上,这包含了 MAC 地址、序列号和屏幕分辨率。字符串本身也是一个由空格隔开的表达式(像 `key.subkey=value` 这样的)的列表。 -在目前的树莓派版本中,只提供了 `core`、`mem` 和 `cmdline` 标签。你可以在后面找到它们的用法,更全面的参考资料在树莓派的参考页面上。现在,我们感兴趣的是 `cmdline` 标签,因为它包含一个字符串。我们继续写一些搜索命令行标签的代码,如果找到了,以每个条目一个新行的形式输出它。命令行只是为了让操作系统理解图形处理器或用户认为的很好的事情的一个列表。在树莓派上,这包含了 MAC 地址,序列号和屏幕分辨率。字符串本身也是一个像 `key.subkey=value` 这样的由空格隔开的表达式列表。 +> 几乎所有的操作系统都支持一个“命令行”的程序。它的想法是为选择一个程序所期望的行为而提供一个通用的机制。 我们从查找 `cmdline` 标签开始。将下列的代码复制到一个名为 `tags.s` 的新文件中。 @@ -355,7 +345,7 @@ tag_videolfb: .int 0 tag_cmdline: .int 0 ``` -通过标签列表来查找是一个很慢的操作,因为这涉及到许多内存访问。因此,我们只是想实现它一次。代码创建一些数据,用于保存每个类型的第一个标签的内存地址。接下来,用下面的伪代码就可以找到一个标签了。 +通过标签列表来查找是一个很慢的操作,因为这涉及到许多内存访问。因此,我们只想做一次。代码创建一些数据,用于保存每个类型的第一个标签的内存地址。接下来,用下面的伪代码就可以找到一个标签了。 ```c function FindTag(r0 is tag) @@ -373,7 +363,8 @@ function FindTag(r0 is tag) end loop end function ``` -这段代码已经是优化过的,并且很接近汇编了。它尝试直接加载标签,第一次这样做是有些乐观的,但是除了第一次之外 的其它所有情况都是可以这样做的。如果失败了,它将去检查 `core` 标签是否有地址。因为 `core` 标签是必不可少的,如果它没有地址,唯一可能的原因就是它不存在。如果它有地址,那就是我们没有找到我们要找的标签。如果没有找到,那我们就需要查找所有标签的地址。这是通过读取标签编号来做的。如果标签编号为 0,意味着已经到了标签列表的结束位置。这意味着我们已经查找了目录中所有的标签。所以,如果我们再次运行我们的函数,现在它应该能够给出一个答案。如果标签编号不为 0,我们检查这个标签类型是否已经有一个地址。如果没有,我们在目录中保存这个标签的地址。然后增加这个标签的长度(以字节为单位)到标签地址中,然后去查找下一个标签。 + +这段代码已经是优化过的,并且很接近汇编了。它尝试直接加载标签,第一次这样做是有些乐观的,但是除了第一次之外的其它所有情况都是可以这样做的。如果失败了,它将去检查 `core` 标签是否有地址。因为 `core` 标签是必不可少的,如果它没有地址,唯一可能的原因就是它不存在。如果它有地址,那就是我们没有找到我们要找的标签。如果没有找到,那我们就需要查找所有标签的地址。这是通过读取标签编号来做的。如果标签编号为 0,意味着已经到了标签列表的结束位置。这意味着我们已经查找了目录中所有的标签。所以,如果我们再次运行我们的函数,现在它应该能够给出一个答案。如果标签编号不为 0,我们检查这个标签类型是否已经有一个地址。如果没有,我们在目录中保存这个标签的地址。然后增加这个标签的长度(以字节为单位)到标签地址中,然后去查找下一个标签。 尝试去用汇编实现这段代码。你将需要简化它。如果被卡住了,下面是我的答案。不要忘了 `.section .text`! @@ -459,11 +450,11 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html 作者:[Alex Chadwick][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.cl.cam.ac.uk [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen02.html +[1]: https://linux.cn/article-10551-1.html [2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html From fa77dbaa3311b6a998a8d36102cb0d29d0ad898e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 00:54:17 +0800 Subject: [PATCH 421/813] PUB:20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @qhwdw https://linux.cn/article-10585-1.html --- ...6 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md (99%) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md similarity index 99% rename from translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md rename to published/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md index 3b5d89dc3f..6ec24f8780 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md +++ b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 8 Screen03.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10585-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 8 Screen03) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) From 2152c1805f26cca12cbace5edb4143325cb7b769 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Sun, 3 Mar 2019 17:00:25 +0000 Subject: [PATCH 422/813] =?UTF-8?q?Revert=20"=E7=BF=BB=E8=AF=91=E7=94=B3?= =?UTF-8?q?=E8=AF=B7"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5bef5c1a9e561db4cf16e774f7a685baa33ec213. --- .../20180611 3 open source alternatives to Adobe Lightroom.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/tech/20180611 3 open source alternatives to Adobe Lightroom.md b/sources/tech/20180611 3 open source alternatives to Adobe Lightroom.md index c489b0f0f1..664c054913 100644 --- a/sources/tech/20180611 3 open source alternatives to Adobe Lightroom.md +++ b/sources/tech/20180611 3 open source alternatives to Adobe Lightroom.md @@ -1,5 +1,3 @@ -scoutydren is translating - 3 open source alternatives to Adobe Lightroom ====== From bf7bb33f851e6cbf309de46080b38dd0ba20f7fa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 01:35:43 +0800 Subject: [PATCH 423/813] PRF:20170721 Firefox and org-protocol URL Capture.md @lujun9972 --- ...21 Firefox and org-protocol URL Capture.md | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/translated/tech/20170721 Firefox and org-protocol URL Capture.md b/translated/tech/20170721 Firefox and org-protocol URL Capture.md index 0682649ed7..eed359cbbd 100644 --- a/translated/tech/20170721 Firefox and org-protocol URL Capture.md +++ b/translated/tech/20170721 Firefox and org-protocol URL Capture.md @@ -1,32 +1,32 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(Firefox and org-protocol URL Capture) -[#]:via:(http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html) -[#]:author:(Andreas Viklund http://andreasviklund.com/) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Firefox and org-protocol URL Capture) +[#]: via: (http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html) +[#]: author: (Andreas Viklund http://andreasviklund.com/) -在 Firefox 上使用 org-protocol 捕获 URL +在 Firefox 上使用 Org 协议捕获 URL ====== ### 介绍 -作为一名 Emacs 人,我尽可能让所有的工作流都在 [org-mode][1] 上进行 – 我比较喜欢文本。 +作为一名 Emacs 人,我尽可能让所有的工作流都在 [Org 模式][1]Org-mode 上进行 —— 我比较喜欢文本。 -我倾向于将书签记录为 [org-mode][1] 代办列表,而 [org-protocol][2] 则允许外部进程利用 [org-mode][1] 的某些功能。然而,要做到这一点配置起来很麻烦。([搜索引擎上 ][3]) 有很多教程,Firefox 也有很多这类 [扩展 ][4],然而我对它们都不太满意。 +我倾向于将书签记录在 [Org 模式][1] 代办列表中,而 [Org 协议][2]Org-protocol 则允许外部进程利用 [Org 模式][1] 的某些功能。然而,要做到这一点配置起来很麻烦。([搜索引擎上][3])有很多教程,Firefox 也有这类 [扩展][4],然而我对它们都不太满意。 因此我决定将我现在的配置记录在这篇博客中,方便其他有需要的人使用。 -### 配置 Emacs Org Mode +### 配置 Emacs Org 模式 -启用 org-protocol: +启用 Org 协议: ``` (require 'org-protocol) ``` -添加一个捕获模板 (capture template) - 我的配置是这样的: +添加一个捕获模板capture template —— 我的配置是这样的: ``` (setq org-capture-templates @@ -36,7 +36,7 @@ ...))) ``` -你可以从 [org-mode][1] 手册中 [capture templates][5] 章节中获取帮助。 +你可以从 [Org 模式][1] 手册中 [捕获模板][5] 章节中获取帮助。 设置默认使用的模板: @@ -56,19 +56,19 @@ emacsclient -n "org-protocol:///capture?url=http%3a%2f%2fduckduckgo%2ecom&title= 基于的配置的模板,可能会弹出一个捕获窗口。请确保正常工作,否则后面的操作没有任何意义。如果工作不正常,检查刚才的配置并且确保你执行了这些代码块。 -如果你的 [org-mode][1] 版本比较老(老于 7 版本),测试的格式会有点不同:这种 URL 编码后的格式需要改成用斜杠来分割 url 和标题。在网上搜一下很容易找出这两者的不同。 +如果你的 [Org 模式][1] 版本比较老(老于 7 版本),测试的格式会有点不同:这种 URL 编码后的格式需要改成用斜杠来分割 url 和标题。在网上搜一下很容易找出这两者的不同。 ### Firefox 协议 -现在开始设置 Firefox。浏览 about:config。右击配置项列表,选择 New -> Boolean,然后输入 network.protocol-handler.expose.org-protocol 作为名字并且将值设置为 true。 +现在开始设置 Firefox。浏览 `about:config`。右击配置项列表,选择 “New -> Boolean”,然后输入 `network.protocol-handler.expose.org-protocol` 作为名字并且将值设置为 `true`。 -有些教程说这一步是可以省略的 – 配不配因人而异。 +有些教程说这一步是可以省略的 —— 配不配因人而异。 ### 添加 Desktop 文件 大多数的教程都有这一步: -增加一个文件 ~/.local/share/applications/org-protocol.desktop: +增加一个文件 `~/.local/share/applications/org-protocol.desktop`: ``` [Desktop Entry] @@ -86,20 +86,19 @@ MimeType=x-scheme-handler/org-protocol; update-desktop-database ~/.local/share/applications/ ``` -KDE 的方法不太一样… 你可以查询其他相关教程。 +KDE 的方法不太一样……你可以查询其他相关教程。 ### 在 FireFox 中设置捕获按钮 -创建一个书签(我是在工具栏上创建这个书签的),地址栏输入下面内容: +创建一个书签(我是在工具栏上创建这个书签的),地址栏输入下面内容: ``` javascript:location.href="org-protocol:///capture?url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title||"[untitled page]") ``` -保存该书签后,再次编辑该书签,你应该会看到其中的所有空格都被替换成了 '%20' – 也就是空格的 URL 编码形式。 - -现在当你点击该书签,你就会在某个 Emacs Frame,可能是任何一个 Frame 中,打开一个窗口,显示你预定的模板。 +保存该书签后,再次编辑该书签,你应该会看到其中的所有空格都被替换成了 `%20` —— 也就是空格的 URL 编码形式。 +现在当你点击该书签,你就会在某个 Emacs 框架中,可能是一个任意的框架中,打开一个窗口,显示你预定的模板。 -------------------------------------------------------------------------------- @@ -109,7 +108,7 @@ via: http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html 作者:[Andreas Viklund][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e6c1fd5de59061c29174affa9943d5c4dbe0bebb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 01:36:17 +0800 Subject: [PATCH 424/813] PUB:20170721 Firefox and org-protocol URL Capture.md @lujun9972 https://linux.cn/article-10586-1.html --- .../20170721 Firefox and org-protocol URL Capture.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20170721 Firefox and org-protocol URL Capture.md (98%) diff --git a/translated/tech/20170721 Firefox and org-protocol URL Capture.md b/published/20170721 Firefox and org-protocol URL Capture.md similarity index 98% rename from translated/tech/20170721 Firefox and org-protocol URL Capture.md rename to published/20170721 Firefox and org-protocol URL Capture.md index eed359cbbd..c9c5bba603 100644 --- a/translated/tech/20170721 Firefox and org-protocol URL Capture.md +++ b/published/20170721 Firefox and org-protocol URL Capture.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10586-1.html) [#]: subject: (Firefox and org-protocol URL Capture) [#]: via: (http://www.mediaonfire.com/blog/2017_07_21_org_protocol_firefox.html) [#]: author: (Andreas Viklund http://andreasviklund.com/) From f24e17390f2cfaf05170aa623f0d80ae27775402 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 01:50:07 +0800 Subject: [PATCH 425/813] PRF:20190206 And, Ampersand, and - in Linux.md @HankChow --- ...20190206 And, Ampersand, and - in Linux.md | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/translated/tech/20190206 And, Ampersand, and - in Linux.md b/translated/tech/20190206 And, Ampersand, and - in Linux.md index 4c48348456..62aa57ae79 100644 --- a/translated/tech/20190206 And, Ampersand, and - in Linux.md +++ b/translated/tech/20190206 And, Ampersand, and - in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (And, Ampersand, and & in Linux) @@ -9,9 +9,12 @@ Linux 中的 & ====== + +> 这篇文章将了解一下 & 符号及它在 Linux 命令行中的各种用法。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand.png?itok=7GdFO36Y) -如果阅读过我之前的[三][1][篇][2][文章][3],你会觉得掌握连接各个命令之间的连接符号用法也是很重要的。实际上,命令的用法并不难,例如 `mkdir`、`touch` 和 `find` 也分别可以简单概括为“建立新目录”、“更新文件”和“在目录树中查找文件”而已。 +如果阅读过我之前的三篇文章([1][1]、[2][2]、[3][3]),你会觉得掌握连接各个命令之间的连接符号用法也是很重要的。实际上,命令的用法并不难,例如 `mkdir`、`touch` 和 `find` 也分别可以简单概括为“建立新目录”、“更新文件”和“在目录树中查找文件”而已。 但如果要理解 @@ -23,7 +26,7 @@ mkdir test_dir 2>/dev/null || touch images.txt && find . -iname "*jpg" > backup/ 关键之处就在于命令之间的连接符号。掌握了这些符号的用法,不仅可以让你更好理解整体的工作原理,还可以让你知道如何将不同的命令有效地结合起来,提高工作效率。 -在这一篇文章和下一篇文章中,我会介绍如何使用 `&` 号和管道符号(`|`)在不同场景下的使用方法。 +在这一篇文章和接下来的文章中,我会介绍如何使用 `&` 号和管道符号(`|`)在不同场景下的使用方法。 ### 幕后工作 @@ -49,34 +52,29 @@ cp -R original/dir/ backup/dir/ & * `jobs` 命令可以显示当前终端正在运行的进程,包括前台运行和后台运行的进程。它对每个正在执行中的进程任务分配了一个序号(这个序号不是进程 ID),可以使用这些序号来引用各个进程任务。 -``` + ``` $ jobs [1]- Running cp -i -R original/dir/* backup/dir/ & [2]+ Running find . -iname "*jpg" > backup/dir/images.txt & ``` - * `fg` 命令可以将后台运行的进程任务放到前台运行,这样可以比较方便地进行交互。根据 `jobs` 命令提供的进程任务序号,再在前面加上 `%` 符号,就可以把相应的进程任务放到前台运行。 -``` + ``` $ fg %1 # 将上面序号为 1 的 cp 任务放到前台运行 cp -i -R original/dir/* backup/dir/ ``` - -如果这个进程任务是暂停状态,`fg` 命令会将它启动起来。 - - * 使用 `ctrl+z` 组合键可以将前台运行的任务暂停,仅仅是暂停,而不是将任务终止。当使用 `fg` 或者`bg` 命令将任务重新启动起来的时候,任务会从被暂停的位置开始执行。但 [`sleep`][4] 命令是一个特例,`sleep` 任务被暂停的时间会计算在 `sleep` 时间之内。因为 `sleep` 命令依据的是系统时钟的时间,而不是实际运行的时间。也就是说,如果运行了 `sleep 30`,然后将任务暂停 30 秒以上,那么任务恢复执行的时候会立即终止并退出。 - + 如果这个进程任务是暂停状态,`fg` 命令会将它启动起来。 + * 使用 `ctrl+z` 组合键可以将前台运行的任务暂停,仅仅是暂停,而不是将任务终止。当使用 `fg` 或者 `bg` 命令将任务重新启动起来的时候,任务会从被暂停的位置开始执行。但 [sleep][4] 命令是一个特例,`sleep` 任务被暂停的时间会计算在 `sleep` 时间之内。因为 `sleep` 命令依据的是系统时钟的时间,而不是实际运行的时间。也就是说,如果运行了 `sleep 30`,然后将任务暂停 30 秒以上,那么任务恢复执行的时候会立即终止并退出。 * `bg` 命令会将任务放置到后台执行,如果任务是暂停状态,也会被启动起来。 -``` + ``` $ bg %1 [1]+ cp -i -R original/dir/* backup/dir/ & ``` - 如上所述,以上几个命令只能在同一个终端里才能使用。如果启动进程任务的终端被关闭了,或者切换到了另一个终端,以上几个命令就无法使用了。 -如果要在另一个终端管理后台进程,就需要其它工具了。例如可以使用 [`kill`][5] 命令从另一个终端终止某个进程: +如果要在另一个终端管理后台进程,就需要其它工具了。例如可以使用 [kill][5] 命令从另一个终端终止某个进程: ``` kill -s STOP @@ -172,18 +170,10 @@ $ pgrep -lx cp 在命令的末尾加上 `&` 可以让我们理解前台进程和后台进程的概念,以及如何管理这些进程。 -在 UNIX/Linux 术语中,在后台运行的进程被称为 daemon。如果你曾经听说过这个词,那你现在应该知道它的意义了。 +在 UNIX/Linux 术语中,在后台运行的进程被称为守护进程daemon。如果你曾经听说过这个词,那你现在应该知道它的意义了。 和其它符号一样,`&` 在命令行中还有很多别的用法。在下一篇文章中,我会更详细地介绍。 -阅读更多: - -[Linux Tools: The Meaning of Dot][1] - -[Understanding Angle Brackets in Bash][2] - -[More About Angle Brackets in Bash][3] - -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux @@ -191,15 +181,15 @@ via: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux 作者:[Paul Brown][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://www.linux.com/users/bro66 [b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot -[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash -[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash +[1]: https://linux.cn/article-10465-1.html +[2]: https://linux.cn/article-10502-1.html +[3]: https://linux.cn/article-10529-1.html [4]: https://ss64.com/bash/sleep.html [5]: https://bash.cyberciti.biz/guide/Sending_signal_to_Processes [6]: https://www.computerhope.com/unix/signals.htm From f4faeacd44c1cb4c11c410c1ac0ec9fa992674f7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 01:50:42 +0800 Subject: [PATCH 426/813] PUB:20190206 And, Ampersand, and - in Linux.md @HankChow https://linux.cn/article-10587-1.html --- .../20190206 And, Ampersand, and - in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190206 And, Ampersand, and - in Linux.md (99%) diff --git a/translated/tech/20190206 And, Ampersand, and - in Linux.md b/published/20190206 And, Ampersand, and - in Linux.md similarity index 99% rename from translated/tech/20190206 And, Ampersand, and - in Linux.md rename to published/20190206 And, Ampersand, and - in Linux.md index 62aa57ae79..5c85abc111 100644 --- a/translated/tech/20190206 And, Ampersand, and - in Linux.md +++ b/published/20190206 And, Ampersand, and - in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10587-1.html) [#]: subject: (And, Ampersand, and & in Linux) [#]: via: (https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From fe546278b97c7c07d95b01fabf3adb8a0ed51d9b Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 4 Mar 2019 08:54:33 +0800 Subject: [PATCH 427/813] translated --- ...Open Source File Encryption Application.md | 117 ------------------ ...Open Source File Encryption Application.md | 117 ++++++++++++++++++ 2 files changed, 117 insertions(+), 117 deletions(-) delete mode 100644 sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md create mode 100644 translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md diff --git a/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md b/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md deleted file mode 100644 index af54453727..0000000000 --- a/sources/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (FinalCrypt – An Open Source File Encryption Application) -[#]: via: (https://itsfoss.com/finalcrypt/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -FinalCrypt – An Open Source File Encryption Application -====== - -I usually don’t encrypt files – but if I am planning to organize my important documents or credentials, an encryption program would come in handy. - -You may be already using a program like [GnuPG][1] that helps you encrypt/decrypt your files on your Linux machine. There is [EncryptPad][2] as well that encrypts your notes. - -However, I have come across a new free and open source encryption tool called FinalCrypt. You can check out their recent releases and the source on its [GitHub page][3]. - -In this article, I will be sharing my experience of using this tool. Do note that I won’t be comparing this with any other program available out there – so if you want a detailed comparison between multiple solutions, let us know in the comments. - -![FinalCrypt][4] - -### Using FinalCrypt to encrypt files - -FinalCrypt uses the [One-Time pad][5] key generation cipher to encrypt files. In other words, it generates an OTP key which you will use for encrypting or decrypting your files. - -The key will be completely random as per the size of the key – which you can specify. So, it is impossible to decrypt the file without the key file. - -While the OTP key method for encryption/decryption is simple and effective, but managing or securing the key file could be an inconvenience for some. - -If you want to use FinalCrypt, you can install the DEB/RPM files from its website. FinalCrypt is also available for Windows and macOS. - -Once downloaded, simply double click to [install it from deb][6] or rpm files. You can also build it from the source code if you want. - -### FileCrypt in Action - -This video shows how to use FinalCrypt: - - - -If you like Linux related videos, please [subscribe to our YouTube channel][7]. - -Once you have installed FinalCrypt, you’ll find it in your list of installed applications. Launch it from there. - -Upon launch, you will observe two sections (split) for the items to encrypt/decrypt and the other to select the OTP file. - -![Using FinalCrypt for encrypting files in Linux][8] - -First, you will have to generate an OTP key. Here’s how to do that: - -![finalcrypt otp][9] - -Do note that your file name can be anything – but you need to make sure that the key file size is greater or equal to the file you want to encrypt. I find it absurd but that’s how it is. - -![][10] - -After you generate the file, select the key on the right-side of the window and then select the files that you want to encrypt on the left-side of the window. - -You will find the checksum value, key file size, and valid status highlighted after generating the OTP: - -![][11] - -After making the selection, you just need to click on “ **Encrypt** ” to encrypt those files and if already encrypted, then “ **Decrypt** ” to decrypt those. - -![][12] - -You can also use FinalCrypt in command line to automate your encryption job. - -#### How do you secure your OTP key? - -It is easy to encrypt/decrypt the files you want to protect. But, where should you keep your OTP key? - -It is literally useless if you fail to keep your OTP key in a safe storage location. - -Well, one of the best ways would be to use a USB stick specifically for the keys you want to store. Just plug it in when you want to decrypt files and its all good. - -In addition to that, you may save your key on a [cloud service][13], if you consider it secure enough. - -More information about FinalCrypt can be found on its website. - -[FinalCrypt](https://sites.google.com/site/ronuitholland/home/finalcrypt) - -**Wrapping Up** - -It might seem a little overwhelming at the beginning but it is actually a simple and user-friendly encryption program available for Linux. There are other programs to [password protect folders][14] as well if you are interested in some additional reading. - -What do you think about FinalCrypt? Do you happen to know about something similar which is potentially better? Let us know in the comments and we shall take a look at them! - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/finalcrypt/ - -作者:[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.gnupg.org/ -[2]: https://itsfoss.com/encryptpad-encrypted-text-editor-linux/ -[3]: https://github.com/ron-from-nl/FinalCrypt -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.png?resize=800%2C450&ssl=1 -[5]: https://en.wikipedia.org/wiki/One-time_pad -[6]: https://itsfoss.com/install-deb-files-ubuntu/ -[7]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.jpg?fit=800%2C439&ssl=1 -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-otp-key.jpg?resize=800%2C443&ssl=1 -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-otp-generate.jpg?ssl=1 -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-key.jpg?fit=800%2C420&ssl=1 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-encrypt.jpg?ssl=1 -[13]: https://itsfoss.com/cloud-services-linux/ -[14]: https://itsfoss.com/password-protect-folder-linux/ -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.png?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md b/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md new file mode 100644 index 0000000000..a61119f478 --- /dev/null +++ b/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FinalCrypt – An Open Source File Encryption Application) +[#]: via: (https://itsfoss.com/finalcrypt/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +FinalCrypt - 一个开源文件加密应用 +====== + +我通常不会加密文件 - 但如果我打算整理我的重要文件或凭证,加密程序就会派上用场。 + +你可能已经在使用像 [GnuPG][1] 这样的程序来帮助你加密/解密 Linux 上的文件。还有 [EncryptPad][2] 也可以加密你的笔记。 + +但是,我看到了一个名为 FinalCrypt 的新的免费开源加密工具。你可以在 [GitHub 页面][3]上查看最新的版本和源码。 + +在本文中,我将分享使用此工具的经验。请注意,我不会将它与其他程序进行比较 - 因此,如果你想要多个程序之间的详细比较,请在评论中告诉我们。 + +![FinalCrypt][4] + +### 使用 FinalCrypt 加密文件 + +FinalCrypt 使用[一次性密码本][5]密钥生成密码来加密文件。换句话说,它会生成一个 OTP 密钥,你将使用该密钥加密或解密你的文件。 + +根据你指定的密钥大小,密钥是完全随机的。因此,没有密钥文件就无法解密文件。 + +虽然 OTP 密钥用于加密/解密简单而有效,但管理或保护密钥文件对某些人来说可能是不方便的。 + +如果要使用 FinalCrypt,可以从它的网站下载 DEB/RPM 文件。FinalCrypt 也可用于 Windows 和 macOS。 + +下载后,只需双击 [deb][6] 或 rpm 文件就能安装。如果需要,你还可以从源码编译。 + +### 使用 FileCrypt + +该视频演示了如何使用FinalCrypt: + + + +如果你喜欢 Linux 相关的视频,请[订阅我们的 YouTube 频道][7]。 + +安装 FinalCrypt 后,你将在已安装的应用列表中找到它。从这里启动它。 + +启动后,你将看到(分割的)两栏,一个进行加密/解密,另一个选择 OTP 文件。 + +![Using FinalCrypt for encrypting files in Linux][8] + +首先,你必须生成 OTP 密钥。下面是做法: + +![finalcrypt otp][9] + +请注意你的文件名可以是任何内容 - 但你需要确保密钥文件大小大于或等于要加密的文件。我觉得这很荒谬,但事实就是如此。 + +![][10] + +生成文件后,选择窗口右侧的密钥,然后选择要在窗口左侧加密的文件。 + +生成 OTP 后,你会看到高亮显示的校验和值,密钥文件大小和有效状态: + +![][11] + +选择之后,你只需要点击“**加密**”来加密这些文件,如果已经加密,那么点击“**解密**”来解密这些文件。 + +![][12] + +你还可以在命令行中使用 FinalCrypt 来自动执行加密作业。 + +#### 如何保护你的 OTP 密钥? + +加密/解密你想要保护的文件很容易。但是,你应该在哪里保存你的 OTP 密钥? + +如果你未能将 OTP 密钥保存在安全的地方,那么它几乎没用。 + +嗯,最好的方法之一是使用专门的 USB 盘保存你的密钥。只需要在解密文件时将它插入即可。 + +除此之外,如果你认为足够安全,你可以将密钥保存在[云服务][13]中。 + +有关 FinalCrypt 的更多信息,请访问它的网站。 + +[FinalCrypt](https://sites.google.com/site/ronuitholland/home/finalcrypt) + +**总结** + +它开始时看上去有点复杂,但它实际上是 Linux 中一个简单且用户友好的加密程序。如果你想看看其他的,还有一些其他的[加密保护文件夹][14]的程序。 + +你如何看待 FinalCrypt?你还知道其他类似可能更好的程序么?请在评论区告诉我们,我们将会查看的! + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/finalcrypt/ + +作者:[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.gnupg.org/ +[2]: https://itsfoss.com/encryptpad-encrypted-text-editor-linux/ +[3]: https://github.com/ron-from-nl/FinalCrypt +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.png?resize=800%2C450&ssl=1 +[5]: https://en.wikipedia.org/wiki/One-time_pad +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.jpg?fit=800%2C439&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-otp-key.jpg?resize=800%2C443&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-otp-generate.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-key.jpg?fit=800%2C420&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt-encrypt.jpg?ssl=1 +[13]: https://itsfoss.com/cloud-services-linux/ +[14]: https://itsfoss.com/password-protect-folder-linux/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/finalcrypt.png?fit=800%2C450&ssl=1 From 6a233ddd35bba134140c42a3af817b81197449b6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 4 Mar 2019 09:03:00 +0800 Subject: [PATCH 428/813] translating --- ...20190121 Akira- The Linux Design Tool We-ve Always Wanted.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md b/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md index bd58eca5bf..ee973a67a4 100644 --- a/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md +++ b/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 84a862dac58480aef37e618be4d041cdbd1782ef Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 4 Mar 2019 13:31:13 +0800 Subject: [PATCH 429/813] Translating 7 steps for hunting down Python code bugs. --- .../20190208 7 steps for hunting down Python code bugs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index b63da1ba8d..9fe0e40a3d 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -63,11 +63,11 @@ Pdb, 一个 Python 调试器。 为什么不使用 print 语句呢?我曾经依赖于 print 语句。他们有时候仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。但是主要使用 pdb 还有一个更重要的原因。假设你添加一条 print 语句去发现错误问题,而且 print 语句必须早于错误出现的地方。但是,看看你放 print 语句的函数,你不知道你是怎么调用它的。查看代码是寻找的好方法,但看你以前写的代码是恐怖的。是的,我会用 grep 处理我的代码库以寻找调用函数的地方,但这会变得乏味而且匹配一个通用函数时不能缩小范围。Pdb 就变得非常有用。 -你遵循我的建议,打上 pdb 断点并运行你的测试。然后测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. +你遵循我的建议,打上 pdb 断点并运行你的测试。然后测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。运行这个测试,然后当它打到你的断点,按下 `w` 并检查调用栈。如果你不知道如何查看因为其他调用而变得混乱的调用栈,那么在调用栈的中间找到属于你的代码,并在其中堆栈中代码的上一行放置一个断点。再试一次新的测试。如果仍然没打到断点,那么继续,向上追踪调用栈并找出你的调用在哪里脱轨了。如果你一直没有打到断点,最后到了追踪的顶部,那么恭喜你,你发现了问题:你的应用程序拼写错了。没有经验,没有经验,一点都没有经验。 ### 4. Change things -If you still feel lost, try making a new test where you vary something slightly. Can you get the new test to work? What is different? What is the same? Try changing something else. Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.) +如果你仍觉得迷惑,在你稍微改变了一些的地方尝试新的测试。你能让新的测试跑起来么?有什么不同的呢?有什么相同的呢?尝试改变别的东西。 Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.) ### 5. Take a break From b9c85b931b4d7125dd694531aaf23b5a15492c30 Mon Sep 17 00:00:00 2001 From: zero-MK <36980619+zero-MK@users.noreply.github.com> Date: Mon, 4 Mar 2019 14:42:10 +0800 Subject: [PATCH 430/813] translating by zero-MK --- ...Script That Insults An User When Typing A Wrong Command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md b/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md index bd81a843ac..5ee389a885 100644 --- a/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md +++ b/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zero-mk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -177,7 +177,7 @@ via: https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-c 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zero-mk](https://github.com/zero-mk) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c2162485b5fb9bdd51528655742eec520beb37bb Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Mon, 4 Mar 2019 15:44:58 +0800 Subject: [PATCH 431/813] translated --- ...lts An User When Typing A Wrong Command.md | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) rename {sources => translated}/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md (71%) diff --git a/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md b/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md similarity index 71% rename from sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md rename to translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md index 5ee389a885..4a3a106a27 100644 --- a/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md +++ b/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @@ -1,74 +1,74 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-mk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bash-Insulter : A Script That Insults An User When Typing A Wrong Command) -[#]: via: (https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) +[#]: collector: "lujun9972" +[#]: translator: "zero-mk" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Bash-Insulter : A Script That Insults An User When Typing A Wrong Command" +[#]: via: "https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -Bash-Insulter : A Script That Insults An User When Typing A Wrong Command +Bash-Insulter : 一个在输入错误命令时侮辱用户的脚本 ====== -This is such a nice and funny script that insult an user whenever they are typing a wrong command in terminal. +这是一个非常有趣的脚本,每当用户在终端输入错误的命令时,它都会侮辱用户。 -It’s make you to feel happy when you are working on some issues. +它让你在处理一些问题时感到快乐。 -But somebody feel bad when the get an insult. However, i really feel happy when i get an insulted on terminal. +有的人在受到终端侮辱的时候感到不愉快。但是,当我受到终端的侮辱时,我真的很开心。 -It’s a funny CLI tool that insults you with random phrases if you do mistake. +这是一个有趣的CLI(译者注:command-line interface) 工具,在你弄错的时候,会用随机短语侮辱你。 -Also, it allows you to update your own phrases. +此外,它允许您添加自己的短语。 -### How To Install Bash-Insulter In Linux? +### 如何在 Linux 上安装 Bash-Insulter? -Make sure, git package were installed on your system before performing Bash-Insulter installation. If no, use the following command to install it. +在安装 Bash-Insulter 之前,请确保您的系统上安装了 git。如果没有,请使用以下命令安装它。 -For **`Fedora`** system, use **[DNF Command][1]** to install git. +对于 **`Fedora`** 系统, 请使用 **[DNF 命令][1]** 安装 git ``` $ sudo dnf install git ``` -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install git. +对于 **`Debian/Ubuntu`** 系统,,请使用 **[APT-GET 命令][2]** 或者 **[APT 命令][3]** 安装 git。 ``` $ sudo apt install git ``` -For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install git. +对于基于 **`Arch Linux`** 的系统, 请使用 **[Pacman 命令][4]** 安装 git。 ``` $ sudo pacman -S git ``` -For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install git. +对于 **`RHEL/CentOS`** systems, 请使用 **[YUM 命令][5]** 安装 git。 ``` $ sudo yum install git ``` -For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install git. +对于 **`openSUSE Leap`** system, 请使用 **[Zypper 命令][6]** 安装 git。 ``` $ sudo zypper install git ``` -We can easily install it by cloning the developer github repository. +我们可以通过克隆(clone)开发人员的github存储库轻松地安装它。 -First clone the Bash-insulter repository. +首先克隆 Bash-insulter 存储库。 ``` $ git clone https://github.com/hkbakke/bash-insulter.git bash-insulter ``` -Move the downloaded file under `/etc` folder. +将下载的文件移动到文件夹 `/etc` 下。 ``` $ sudo cp bash-insulter/src/bash.command-not-found /etc/ ``` -Append the following lines into `/etc/bash.bashrc` file. +将下面的代码添加到 `/etc/bash.bashrc` 文件中。 ``` $ vi /etc/bash.bashrc @@ -79,13 +79,13 @@ if [ -f /etc/bash.command-not-found ]; then fi ``` -Run the following command to take the changes to effect. +运行以下命令使更改生效。 ``` $ sudo source /etc/bash.bashrc ``` -Do you want to test this? if so, type some wrong command in terminal and see how it insult you. +你想测试一下安装是否生效吗?你可以试试在终端上输入一些错误的命令,看看它如何侮辱你。 ``` $ unam -a @@ -95,9 +95,9 @@ $ pin 2daygeek.com ![][8] -If you would like to append your own phrases then navigate to the following file and update it. +如果您想附加您自己的短语,则导航到以下文件并更新它 -You can add your phrases within `messages` section. +您可以在 `messages` 部分中添加短语。 ``` # vi /etc/bash.command-not-found From dca7f76d31752663d645262ef576d546b87391ff Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Mon, 4 Mar 2019 17:19:12 +0800 Subject: [PATCH 432/813] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91=20?= =?UTF-8?q?20190211=20Introducing=20kids=20to=20computational=20thinking?= =?UTF-8?q?=20with=20Python.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20190211 Introducing kids to computational thinking with Python.md --- ...11 Introducing kids to computational thinking with Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190211 Introducing kids to computational thinking with Python.md b/sources/talk/20190211 Introducing kids to computational thinking with Python.md index 542b2291e7..c877d3c212 100644 --- a/sources/talk/20190211 Introducing kids to computational thinking with Python.md +++ b/sources/talk/20190211 Introducing kids to computational thinking with Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (WangYueScream ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 00a5d1de3384f6632a022d8753dcf6d886cca0ff Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 4 Mar 2019 18:11:36 +0800 Subject: [PATCH 433/813] hankchow translating --- ...190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md b/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md index 86b5230d2d..439bd682e5 100644 --- a/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md +++ b/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 53b2730f87a8179795d1c5173ece7611937a1357 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Mar 2019 23:59:20 +0800 Subject: [PATCH 434/813] PRF:20180307 3 open source tools for scientific publishing.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tomjlw  初校 --- ... source tools for scientific publishing.md | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/translated/tech/20180307 3 open source tools for scientific publishing.md b/translated/tech/20180307 3 open source tools for scientific publishing.md index 697b8d50ea..a05680f8e4 100644 --- a/translated/tech/20180307 3 open source tools for scientific publishing.md +++ b/translated/tech/20180307 3 open source tools for scientific publishing.md @@ -1,46 +1,50 @@ -3款用于学术发表的开源工具 +3 款用于学术出版的开源工具 ====== +> 学术出版业每年的价值超过 260 亿美元。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_science.png?itok=WDKARWGV) -有一个行业在采用数字或者开源工具方面已落后其它行业,那就是竞争与利润并存的学术出版业。根据 Stephen Buranyi 去年在 [The Guardian][1] 发表的一份图表,这个估值超过190亿英镑(260亿美元)的行业至今在其选择、发表甚至分享最重要的科学研究的系统方面,仍受限于印刷媒介的诸多限制。全新的数字时代科技展现了一个能够加速探索、推动科学合作性而不是竞争性以及将投入重新从基础建设导向有益社会的研究的巨大的机遇。 -非盈利性的 [eLife 倡议][2] 是由研究的资金赞助方建立,旨在通过使用数字或者开源技术来走出上述僵局。除了为生活中科学和生物医疗方面的重大成就出版开放式获取的杂志,eLife 已将自己变成了一个在研究交流方面的创新实验窗口——而大部分的实验都是基于开源精神的。 +有一个行业在采用数字或者开源工具方面已落后其它行业,那就是竞争与利润并存的学术出版业。根据 Stephen Buranyi 去年在 [The Guardian][1] 发表的一份图表,这个估值超过 190 亿英镑(260 亿美元)的行业至今在其选稿、出版甚至分享是最重要的科学研究的系统方面,仍受限于印刷媒介的诸多限制。全新的数字时代科技展现了一个巨大机遇,可以加速探索、推动科学协作而非竞争,以及将投入从基础建设导向有益于社会的研究。 -参与开源出版项目给予我们加速接触、采用科学技术,提升用户体验的机会。我们认为这种机会对于推动学术出版行业是重要的。大而化之地说,开源产品的用户体验经常是有待开发的,而有时候这种情况会阻止其他人去使用它。作为我们在 OSS 开发中投入的一部分,为了鼓励更多用户使用这些产品,我们十分注重用户体验。 +非盈利性的 [eLife 倡议][2] 是由研究的资金赞助方建立,旨在通过使用数字或者开源技术来走出上述僵局。除了为生活中科学和生物医疗方面的重大成就出版开放式获取的杂志,eLife 已将自己变成了一个在研究交流方面的创新实验窗口 —— 而大部分的实验都是基于开源精神的。 -我们所有的代码都是开源的并且我们也积极鼓励开源社区参与进我们的项目中。这对我们来说意味着更快的迭代、更多的实验、更大的透明度,同时也拓宽了我们工作的外延。 +参与开源出版项目给予我们加速接触、采用科学技术,提升用户体验的机会。我们认为这种机会对于推动学术出版行业是重要的。大而化之地说,开源产品的用户体验经常是有待开发的,而有时候这种情况会阻止其他人去使用它。作为我们在 OSS(开源软件)开发中投入的一部分,为了鼓励更多用户使用这些产品,我们十分注重用户体验。 -我们现在参与的项目,例如 Libero (之前称作 [eLife Continuum][3])和 [可复制文档栈][4] 的开发以及我们最近和 [Hypothesis][5] 的合作,展示了 OSS 是如何在校队、发表以及新发现的沟通方面带来正面影响的。 +我们所有的代码都是开源的,并且我们也积极鼓励开源社区参与进我们的项目中。这对我们来说意味着更快的迭代、更多的实验、更大的透明度,同时也拓宽了我们工作的外延。 + +我们现在参与的项目,例如 Libero (之前称作 [eLife Continuum][3])和 [可复制文档栈][4] 的开发以及我们最近和 [Hypothesis][5] 的合作,展示了 OSS 是如何在评估、发布以及新发现的沟通方面带来正面影响的。 ### Libero -Libero 是面向发布者的服务及应用套餐,它包括一个后生产出版系统、整套前端用户界面、Libero 的棱镜阅读器、一个开放式的API以及一个搜索推荐引擎。 +Libero 是面向出版商的服务及应用套餐,它包括一个后期制作出版系统、整套前端用户界面、Libero 的镜头阅读器、一个 Open API 以及一个搜索及推荐引擎。 -去年我们采取了用户导向的途径重新设计了 Libero 的前端,做出了一个使用户较少地分心并更多地集中注意在研究文章上的站点。我们和 eLife 社区成员测试并迭代了站点所有的核心功能以确保给所有人最好的阅读体验。网站的新 API 也给可供机器阅读的内容提供了更简单的访问途径,其中包括文字挖掘、机器学习以及在线应用开发。我们网站上的内容以及引领新设计的样式都是开源的,以鼓励 eLife 和其它想要使用它的发布者后续的开发。 +去年我们采取了用户导向方式重新设计了 Libero 的前端,可以使用户较少地分心,并更多地集中关注在研究文章上。我们和 eLife 社区成员测试并迭代了站点所有的核心功能,以确保给所有人最好的阅读体验。网站的新 API 也为机器阅读能力提供了更简单的访问途径,其中包括文本挖掘、机器学习以及在线应用开发。 + +我们网站上的内容以及引领新设计的样式都是开源的,以鼓励 eLife 和其它想要使用它的出版商后续的开发。 ### 可复制文档栈 -在与 [Substance][6] 和 [Stencila][7] 的合作下,eLife 也参与了一个项目来创建可复制的文档栈(RDS)——一个开放式的创作、编纂以及在线出版可复制的计算型手稿的工具栈。 +在与 [Substance][6] 和 [Stencila][7] 的合作下,eLife 也参与了一个项目来创建可复制的文档栈(RDS)—— 一个开放式的创作、编纂以及在线出版可复制的计算型手稿的工具栈。 -今天越来越多的研究员能够通过 [R、Markdown][8] 和 [Python][9] 等语言记录他们的计算型实验。这些可以作为实验记录的重要部分,但是尽管它们可以通过最终的研究文章独立地分享,传统出版流程经常将它们视为次级内容。为了发表论文,使用这些语言的研究员除了将他们的计算结果用图片的形式“扁平化”提交外别无他法。但是这导致了许多实验价值和代码和计算数据可重复利用性的流失。诸如 [Jupyter][10] 的电子笔记本解决方案确实可以使研究员以一种可重复利用、可执行的简单形式发布,但是这种方案仍然独立于整个手稿发布过程之外,而不是集成在其中。 +今天越来越多的研究人员能够通过 [R、Markdown][8] 和 [Python][9] 等语言记录他们的计算实验。这些可以作为实验记录的重要部分,但是尽管它们可以独立于最终的研究文章或与之一起分享,传统出版流程经常将它们视为次级内容。为了发表论文,使用这些语言的研究人员除了将他们的计算结果用图片的形式“扁平化”提交外别无他法。但是这导致了许多实验价值和代码和计算数据可重复利用性的流失。诸如 [Jupyter][10] 的电子笔记本解决方案确实可以使研究员以一种可重复利用、可执行的简单形式发布,但是这种方案仍然是出版的手稿的补充,而不是不可或缺的一部分。 -[可复制文档栈][11] 项目着眼于通过开发、发布一个能够把代码和数据集成在文档自身的产品雏形来突出这些挑战并阐述一个端对端的从创作到出版的完整科技。它将最终允许用户以一种包含嵌入代码块和计算结果(统计结果、图表或图片)的形式提交他们的手稿并在出版过程中保留这些可视、可执行的部分。那时发布者就可以将这些作为发布的在线文章的整体所保存。 +[可复制文档栈][11] 项目旨在通过开发、发布一个可重现原稿的产品原型来解决这些挑战,该原型将代码和数据视为文档的组成部分,并展示了从创作到出版的完整端对端技术堆栈。它将最终允许用户以一种包含嵌入代码块和计算结果(统计结果、图表或图片)的形式提交他们的手稿,并在出版过程中保留这些可视、可执行的部分。那时出版商就可以将这些保存为发布的在线文章的组成部分。 ### 用 Hypothesis 进行开放式注解 最近,我们与 [Hypothesis][12] 合作引进了开放式注解,使得我们网站的用户们可以写评语、高亮文章重要部分以及与在线阅读的群体互动。 -通过这样的合作,开源的 Hypothesis 软件被定制得更具有现代化的特性如单次登录验证、用户界面定制选项,给予了发布者在他们自己网站上更多的控制。这些提升正引导着关于发表的学术内容高质量的讨论。 +通过这样的合作,开源的 Hypothesis 软件被定制得更具有现代化的特性,如单次登录验证、用户界面定制选项,给予了出版商在他们自己网站上更多的控制。这些提升正引导着关于发表的学术内容高质量的讨论。 -这个工具可以无缝集成进发布者的网站,学术发表平台 [PubFactory][13] 和内容解决方案供应商 [Ingenta][14] 已经利用了它优化后的特性集。[HighWire][15] 和 [Silverchair][16] 也为他们的发布者提供了实施这套方案的机会。 +这个工具可以无缝集成进出版商的网站,学术发表平台 [PubFactory][13] 和内容解决方案供应商 [Ingenta][14] 已经利用了它优化后的特性集。[HighWire][15] 和 [Silverchair][16] 也为他们的出版商提供了实施这套方案的机会。 - ### 其它产业和开源软件 +### 其它产业和开源软件 -过段时间,我们希望看到更多的发布者采用 Hypothesis、Libero 以及其它开源软件去帮助他们促进重要科学研究的发现以及循环利用。但是 eLife 所能利用的因这些软件和其它 OSS 科技带来的创新机会在其他产业也很普遍。 +睡着时间的推移,我们希望看到更多的出版商采用 Hypothesis、Libero 以及其它开源软件去帮助他们促进重要科学研究的发现以及循环利用。但是 eLife 的创新机会也能被其它行业利用,因为这些软件和其它 OSS 技术带来的在其他行业也很普遍。 -数据科学的世界离不开高质量、强支持的开源软件和围绕它们形成的社区;[TensorFlow][17] 就是这样一个好例子。感谢 OSS 以及其社区,AI 的所有领域和机器学习相比于计算机的其它领域有了迅速的提升和发展。与之类似的是 Linux 云端网页主机、Docker 容器、Github上最流行的开源项目之一的 Kubernetes 使用的爆炸性增长。 +数据科学的世界离不开高质量、强支持的开源软件和围绕它们形成的社区;[TensorFlow][17] 就是这样一个好例子。感谢 OSS 以及其社区,AI 的所有领域和机器学习相比于计算机的其它领域有了迅速的提升和发展。与之类似的是 Linux 云端网页主机的爆炸性增长、接着是 Docker 容器、以及现在 GitHub 上最流行的开源项目之一的 Kubernetes 的增长。 -所有的这些科技使得不同团体能够四两拨千斤并集中在创新而不是造轮子上。最后,那才是 OSS 真正的好处:它使得我们从互相的失败中学习,在互相的成功中成长。 +所有的这些技术使得机构能够用更少的资源做更多的事情,并专注于创新而不是重新发明轮子上。最后,这就是 OSS 真正的好处:它使得我们从互相的失败中学习,在互相的成功中成长。 我们总是在寻找与研究和科技界面方面最好的人才和想法交流的机会。你可以在 [eLife Labs][18] 上或者联系 [innovation@elifesciences.org][19] 找到更多这种交流的信息。 @@ -50,7 +54,7 @@ via: https://opensource.com/article/18/3/scientific-publishing-software 作者:[Paul Shanno][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 03f3318e5a544371f0f49d94fed1857d7670cec8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 00:19:32 +0800 Subject: [PATCH 435/813] PRF:20190216 FinalCrypt - An Open Source File Encryption Application.md @geekpi --- ...Open Source File Encryption Application.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md b/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md index a61119f478..683c5405ec 100644 --- a/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md +++ b/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (FinalCrypt – An Open Source File Encryption Application) [#]: via: (https://itsfoss.com/finalcrypt/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -FinalCrypt - 一个开源文件加密应用 +FinalCrypt:一个开源文件加密应用 ====== -我通常不会加密文件 - 但如果我打算整理我的重要文件或凭证,加密程序就会派上用场。 +我通常不会加密文件,但如果我打算整理我的重要文件或凭证,加密程序就会派上用场。 你可能已经在使用像 [GnuPG][1] 这样的程序来帮助你加密/解密 Linux 上的文件。还有 [EncryptPad][2] 也可以加密你的笔记。 -但是,我看到了一个名为 FinalCrypt 的新的免费开源加密工具。你可以在 [GitHub 页面][3]上查看最新的版本和源码。 +但是,我看到了一个名为 FinalCrypt 的新的免费开源加密工具。你可以在 [GitHub 页面][3]上查看其最新的版本和源码。 -在本文中,我将分享使用此工具的经验。请注意,我不会将它与其他程序进行比较 - 因此,如果你想要多个程序之间的详细比较,请在评论中告诉我们。 +在本文中,我将分享使用此工具的经验。请注意,我不会将它与其他程序进行比较 —— 因此,如果你想要多个程序之间的详细比较,请在评论中告诉我们。 ![FinalCrypt][4] @@ -30,7 +30,9 @@ FinalCrypt 使用[一次性密码本][5]密钥生成密码来加密文件。换 如果要使用 FinalCrypt,可以从它的网站下载 DEB/RPM 文件。FinalCrypt 也可用于 Windows 和 macOS。 -下载后,只需双击 [deb][6] 或 rpm 文件就能安装。如果需要,你还可以从源码编译。 +- [下载 FinalCrypt](https://sites.google.com/site/ronuitholland/home/finalcrypt) + +下载后,只需双击该 [deb][6] 或 rpm 文件就能安装。如果需要,你还可以从源码编译。 ### 使用 FileCrypt @@ -50,17 +52,17 @@ FinalCrypt 使用[一次性密码本][5]密钥生成密码来加密文件。换 ![finalcrypt otp][9] -请注意你的文件名可以是任何内容 - 但你需要确保密钥文件大小大于或等于要加密的文件。我觉得这很荒谬,但事实就是如此。 +请注意你的文件名可以是任何内容 —— 但你需要确保密钥文件的大小大于或等于要加密的文件。我觉得这很荒谬,但事实就是如此。 ![][10] 生成文件后,选择窗口右侧的密钥,然后选择要在窗口左侧加密的文件。 -生成 OTP 后,你会看到高亮显示的校验和值,密钥文件大小和有效状态: +生成 OTP 后,你会看到高亮显示的校验和、密钥文件大小和有效状态: ![][11] -选择之后,你只需要点击“**加密**”来加密这些文件,如果已经加密,那么点击“**解密**”来解密这些文件。 +选择之后,你只需要点击 “Encrypt” 来加密这些文件,如果已经加密,那么点击 “Decrypt” 来解密这些文件。 ![][12] @@ -80,7 +82,7 @@ FinalCrypt 使用[一次性密码本][5]密钥生成密码来加密文件。换 [FinalCrypt](https://sites.google.com/site/ronuitholland/home/finalcrypt) -**总结** +### 总结 它开始时看上去有点复杂,但它实际上是 Linux 中一个简单且用户友好的加密程序。如果你想看看其他的,还有一些其他的[加密保护文件夹][14]的程序。 @@ -94,7 +96,7 @@ via: https://itsfoss.com/finalcrypt/ 作者:[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 0705b27192440d8e8c701f48da98bc3686c95a32 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 00:20:07 +0800 Subject: [PATCH 436/813] PUB:20190216 FinalCrypt - An Open Source File Encryption Application.md @geekpi https://linux.cn/article-10588-1.html --- ...FinalCrypt - An Open Source File Encryption Application.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190216 FinalCrypt - An Open Source File Encryption Application.md (98%) diff --git a/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md b/published/20190216 FinalCrypt - An Open Source File Encryption Application.md similarity index 98% rename from translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md rename to published/20190216 FinalCrypt - An Open Source File Encryption Application.md index 683c5405ec..3619ccacc1 100644 --- a/translated/tech/20190216 FinalCrypt - An Open Source File Encryption Application.md +++ b/published/20190216 FinalCrypt - An Open Source File Encryption Application.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10588-1.html) [#]: subject: (FinalCrypt – An Open Source File Encryption Application) [#]: via: (https://itsfoss.com/finalcrypt/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From f7d40fcd69b1a5e62d406f2abe55514c776b8fad Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Mon, 4 Mar 2019 17:00:22 +0000 Subject: [PATCH 437/813] =?UTF-8?q?Revert=20"=E7=94=B3=E8=AF=B7=E7=BF=BB?= =?UTF-8?q?=E8=AF=91"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a4351268fcfdeebc7d0fa3d895a32dd0958621db. --- .../20181222 How to detect automatically generated emails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 How to detect automatically generated emails.md b/sources/tech/20181222 How to detect automatically generated emails.md index 2ccaeddeee..23b509a77b 100644 --- a/sources/tech/20181222 How to detect automatically generated emails.md +++ b/sources/tech/20181222 How to detect automatically generated emails.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (wyxplus) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e60f8a4d2ced6715d7a44f25d50e99f3930bb8b1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 07:28:51 +0800 Subject: [PATCH 438/813] PRF:20190206 Getting started with Vim visual mode.md @MjSeven --- ...06 Getting started with Vim visual mode.md | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/translated/tech/20190206 Getting started with Vim visual mode.md b/translated/tech/20190206 Getting started with Vim visual mode.md index ea1dccaaf4..c637c65529 100644 --- a/translated/tech/20190206 Getting started with Vim visual mode.md +++ b/translated/tech/20190206 Getting started with Vim visual mode.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with Vim visual mode) @@ -9,98 +9,101 @@ Vim 可视化模式入门 ====== -可视化模式使得在 Vim 中高亮显示和操作文本变得更加容易。 + +> 可视化模式使得在 Vim 中高亮显示和操作文本变得更加容易。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) -Ansible playbook 文件是 YAML 格式的文本文件,经常与它们打交道的人有他们最喜欢的编辑器和扩展插件以使格式化更容易。 +Ansible 剧本文件是 YAML 格式的文本文件,经常与它们打交道的人通过他们偏爱的编辑器和扩展插件以使格式化更容易。 -当我使用大多数 Linux 发行版中提供的默认编辑器来教 Ansible 时,我经常使用 Vim 的可视化模式。它允许我在屏幕上高亮显示我的操作 -- 我要编辑什么以及我正在做的文本处理任务,以便使我的学生更容易学习。 +当我使用大多数 Linux 发行版中提供的默认编辑器来教学 Ansible 时,我经常使用 Vim 的可视化模式。它可以让我在屏幕上高亮显示我的操作 —— 我要编辑什么以及我正在做的文本处理任务,以便使我的学生更容易学习。 ### Vim 的可视化模式 使用 Vim 编辑文本时,可视化模式对于识别要操作的文本块非常有用。 -Vim 的可视模式有三个模式:字符,行和块。进入每种模式的按键是: +Vim 的可视模式有三个模式:字符、行和块。进入每种模式的按键是: - * 字符模式: **v** (小写) - * 行模式: **V** (大写) - * 块模式: **Ctrl+v** + * 字符模式: `v` (小写) + * 行模式: `V` (大写) + * 块模式: `Ctrl+v` 下面是使用每种模式简化工作的一些方法。 ### 字符模式 -字符模式可以高亮显示段落中的一个句子或句子中的一个短语,然后,可以使用任何 Vim 编辑命令删除、复制、更改或修改可视化模式识别的文本。 +字符模式可以高亮显示段落中的一个句子或句子中的一个短语,然后,可以使用任何 Vim 编辑命令删除、复制、更改/修改可视化模式识别的文本。 #### 移动一个句子 要将句子从一个地方移动到另一个地方,首先打开文件并将光标移动到要移动的句子的第一个字符。 + ![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png) - * 按下 **v** 键进入可视化字符模式。单词 **VISUAL** 将出现在屏幕底部。 - * 使用箭头来高亮显示所需的文本。你可以使用其他导航命令,例如 **w** 高亮显示至下一个单词的开头,**$** 来包含其余行。 - * 在文本高亮显示后,按下 **d** 删除文本。 - * 如果你删除得太多或不够,按下 **u** 撤销并重新开始。 - * 将光标移动到新位置,然后按 **p** 粘贴文本。 + * 按下 `v` 键进入可视化字符模式。单词 `VISUAL` 将出现在屏幕底部。 + * 使用箭头来高亮显示所需的文本。你可以使用其他导航命令,例如 `w` 高亮显示至下一个单词的开头,`$` 来包含该行的其余部分。 + * 在文本高亮显示后,按下 `d` 删除文本。 + * 如果你删除得太多或不够,按下 `u` 撤销并重新开始。 + * 将光标移动到新位置,然后按 `p` 粘贴文本。 #### 改变一个短语 -你还可以高亮显示要替换的文本块。 +你还可以高亮显示要替换的一段文本。 ![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png) * 将光标放在要更改的第一个字符处。 - * 按下 **v** 进入可视化字符模式。 - * 使用导航命令(如箭头键)高亮显示短语。 - * 按下 **c** 可更改高亮显示的文本。 + * 按下 `v` 进入可视化字符模式。 + * 使用导航命令(如箭头键)高亮显示该部分。 + * 按下 `c` 可更改高亮显示的文本。 * 高亮显示的文本将消失,你将处于插入模式,你可以在其中添加新文本。 - * 输入新文本后,按下 **Esc** 返回命令模式并保存你的工作。 + * 输入新文本后,按下 `Esc` 返回命令模式并保存你的工作。 ![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png) ### 行模式 -使用 Ansible playbooks 时,任务的顺序很重要。使用可视化行模式将任务移动到 playbooks 中的其他位置。 +使用 Ansible 剧本时,任务的顺序很重要。使用可视化行模式将 Ansible 任务移动到该剧本文件中的其他位置。 #### 操纵多行文本 ![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png) * 将光标放在要操作的文本的第一行或最后一行的任何位置。 - * 按下 **Shift+V** 进入行模式。单词 **VISUAL LINE** 将出现在屏幕底部。 + * 按下 `Shift+V` 进入行模式。单词 `VISUAL LINE` 将出现在屏幕底部。 * 使用导航命令(如箭头键)高亮显示多行文本。 - * 高亮显示所需文本后,使用命令来操作它。按下 **d** 删除,然后将光标移动到新位置,按下 **p** 粘贴文本。 - * 如果要复制任务,可以使用 **y**(yank) 来代替 **d**(delete)。 + * 高亮显示所需文本后,使用命令来操作它。按下 `d` 删除,然后将光标移动到新位置,按下 `p` 粘贴文本。 + * 如果要复制该 Ansible 任务,可以使用 `y`(yank)来代替 `d`(delete)。 #### 缩进一组行 -使用 Ansible playbooks 或 YAML 文件时,缩进很重要。高亮显示的块可以使用 **>** 和 **<** 键向右或向左移动。 +使用 Ansible 剧本或 YAML 文件时,缩进很重要。高亮显示的块可以使用 `>` 和 `<` 键向右或向左移动。 ![](https://opensource.com/sites/default/files/uploads/vim-visual-line2.png) - * 按下 **>** 增加所有行的缩进。 - * 按下 **<** 减少所有行的缩进。 + * 按下 `>` 增加所有行的缩进。 + * 按下 `<` 减少所有行的缩进。 尝试其他 Vim 命令将它们应用于高亮显示的文本。 ### 块模式 -可视化块模式对于操作特定的表格数据文件非常有用,但它作为验证 Ansible playbook 缩进的工具也很有帮助。 +可视化块模式对于操作特定的表格数据文件非常有用,但它作为验证 Ansible 剧本文件缩进的工具也很有帮助。 -任务是项目列表,在 YAML 中,每个列表项都以破折号和空格开头。破折号必须在同一列中对齐,以达到相同的缩进级别。仅凭肉眼很难看出这一点。缩进任务中的其他行也很重要。 +Ansible 任务是个项目列表,在 YAML 中,每个列表项都以一个破折号跟上一个空格开头。破折号必须在同一列中对齐,以达到相同的缩进级别。仅凭肉眼很难看出这一点。缩进 Ansible 任务中的其他行也很重要。 #### 验证任务列表缩进相同 ![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png) * 将光标放在列表项的第一个字符上。 - * 按下 **Ctrl+v** 进入可视化块模式。单词 **VISUAL BLOCK** 将出现在屏幕底部。 + * 按下 `Ctrl+v` 进入可视化块模式。单词 `VISUAL BLOCK` 将出现在屏幕底部。 * 使用箭头键高亮显示单个字符列。你可以验证每个任务的缩进量是否相同。 * 使用箭头键向右或向左展开块,以检查其它缩进是否正确。 ![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png) -尽管我对其它 Vim 编辑快捷方式很熟悉,但我仍然喜欢使用可视化模式来整理我想要出来处理的文本。当我在演示过程总演示其它概念时,我的学生会看到一个高亮显示文本的工具,并在这个“仅限他们”的文本编辑器中点击删除。 +尽管我对其它 Vim 编辑快捷方式很熟悉,但我仍然喜欢使用可视化模式来整理我想要出来处理的文本。当我在讲演过程中演示其它概念时,我的学生将会在这个“对他们而言很新”的文本编辑器中看到一个可以高亮文本并可以点击删除的工具。 -------------------------------------------------------------------------------- @@ -109,7 +112,7 @@ via: https://opensource.com/article/19/2/getting-started-vim-visual-mode 作者:[Susan Lauber][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 93bb99d53e3027e5e04c8a59fa0b0e5ba4db82c9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 07:30:21 +0800 Subject: [PATCH 439/813] PUB:20190206 Getting started with Vim visual mode.md @MjSeven https://linux.cn/article-10589-1.html --- .../20190206 Getting started with Vim visual mode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190206 Getting started with Vim visual mode.md (98%) diff --git a/translated/tech/20190206 Getting started with Vim visual mode.md b/published/20190206 Getting started with Vim visual mode.md similarity index 98% rename from translated/tech/20190206 Getting started with Vim visual mode.md rename to published/20190206 Getting started with Vim visual mode.md index c637c65529..fff2bafe1a 100644 --- a/translated/tech/20190206 Getting started with Vim visual mode.md +++ b/published/20190206 Getting started with Vim visual mode.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10589-1.html) [#]: subject: (Getting started with Vim visual mode) [#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode) [#]: author: (Susan Lauber https://opensource.com/users/susanlauber) From 101ad52f0ceadbf24be3992bf044a2841f51dbd7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 5 Mar 2019 08:51:23 +0800 Subject: [PATCH 440/813] translated --- .../20190223 Regex groups and numerals.md | 60 ------------------- .../20190223 Regex groups and numerals.md | 60 +++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20190223 Regex groups and numerals.md create mode 100644 translated/tech/20190223 Regex groups and numerals.md diff --git a/sources/tech/20190223 Regex groups and numerals.md b/sources/tech/20190223 Regex groups and numerals.md deleted file mode 100644 index c24505ee6b..0000000000 --- a/sources/tech/20190223 Regex groups and numerals.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Regex groups and numerals) -[#]: via: (https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/) -[#]: author: (Dr.Drang https://leancrew.com) - -Regex groups and numerals -====== - -A week or so ago, I was editing a program and decided I should change some variable names. I thought it would be a simple regex find/replace, and it was. Just not as simple as I thought. - -The variables were named `a10`, `v10`, and `x10`, and I wanted to change them to `a30`, `v30`, and `x30`, respectively. I brought up BBEdit’s Find window and entered this: - -![Mistaken BBEdit replacement pattern][2] - -I couldn’t just replace `10` with `30` because there were instances of `10` in the code that weren’t related to the variables. And because I think I’m clever, I didn’t want to do three non-regex replacements, one each for `a10`, `v10`, and `x10`. But I wasn’t clever enough to notice the blue coloring in the replacement pattern. Had I done so, I would have seen that BBEdit was interpreting my replacement pattern as “Captured group 13, followed by `0`” instead of “Captured group 1, followed by `30`,” which was what I intended. Since captured group 13 was blank, all my variable names were replaced with `0`. - -You see, BBEdit can capture up to 99 groups in the search pattern and, strictly speaking, we should use two-digit numbers when referring to them in the replacement pattern. But in most cases, we can use `\1` through `\9` instead of `\01` through `\09` because there’s no ambiguity. In other words, if I had been trying to change `a10`, `v10`, and `x10` to `az`, `vz`, and `xz`, a replacement pattern of `\1z` would have been just fine, because the trailing `z` means there’s no way to misinterpret the intent of the `\1` in that pattern. - -So after undoing the replacement, I changed the pattern to this, - -![Two-digit BBEdit replacement pattern][3] - -and all was right with the world. - -There was another option: a named group. Here’s how that would have looked, using `var` as the pattern name: - -![Named BBEdit replacement pattern][4] - -I don’t think I’ve ever used a named group in any situation, whether the regex was in a text editor or a script. My general feeling is that if the pattern is so complicated I have to use variables to keep track of all the groups, I should stop and break the problem down into smaller parts. - -By the way, you may have heard that BBEdit is celebrating its [25th anniversary][5] of not sucking. When a well-documented app has such a long history, the manual starts to accumulate delightful callbacks to the olden days. As I was looking up the notation for named groups in the BBEdit manual, I ran across this note: - -![BBEdit regex manual excerpt][6] - -BBEdit is currently on Version 12.5; Version 6.5 came out in 2001. But the manual wants to make sure that long-time customers (I believe it was on Version 4 when I first bought it) don’t get confused by changes in behavior, even when those changes occurred nearly two decades ago. - - --------------------------------------------------------------------------------- - -via: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ - -作者:[Dr.Drang][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://leancrew.com -[b]: https://github.com/lujun9972 -[1]: https://leancrew.com/all-this/2019/02/automation-evolution/ -[2]: https://leancrew.com/all-this/images2019/20190223-Mistaken%20BBEdit%20replacement%20pattern.png (Mistaken BBEdit replacement pattern) -[3]: https://leancrew.com/all-this/images2019/20190223-Two-digit%20BBEdit%20replacement%20pattern.png (Two-digit BBEdit replacement pattern) -[4]: https://leancrew.com/all-this/images2019/20190223-Named%20BBEdit%20replacement%20pattern.png (Named BBEdit replacement pattern) -[5]: https://merch.barebones.com/ -[6]: https://leancrew.com/all-this/images2019/20190223-BBEdit%20regex%20manual%20excerpt.png (BBEdit regex manual excerpt) diff --git a/translated/tech/20190223 Regex groups and numerals.md b/translated/tech/20190223 Regex groups and numerals.md new file mode 100644 index 0000000000..f95fd5d4d0 --- /dev/null +++ b/translated/tech/20190223 Regex groups and numerals.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Regex groups and numerals) +[#]: via: (https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/) +[#]: author: (Dr.Drang https://leancrew.com) + +正则组和数字 +====== + +大约一周前,我在编辑一个程序时想要更改一些变量名。我之前认为这将是一个简单的正则表达式查找/替换。只是这没有我想象的那么简单。 + +变量名为 `a10`、`v10` 和 `x10`,我想分别将它们改为 `a30`、`v30` 和 `x30`。我想到使用 BBEdit 的查找窗口并输入: + +![Mistaken BBEdit replacement pattern][2] + +我不能简单地 `30` 替换为 `10`,因为代码中有一些与变量无关的数字 `10`。我认为我很聪明,所以我不想写三个非正则表达式替换,`a10`、`v10` 和 `x10` 每个一个。但是我却没有注意到替换模式中的蓝色。如果我这样做了,我会看到 BBEdit 将我的替换模式解释为“匹配组 13,后面跟着 `0`,而不是”匹配组 1,后面跟着 `30`,后者是我想要的。由于匹配组 13 是空白的,因此所有变量名都会被替换为 `0`。 + +你看,BBEdit 可以在搜索模式中匹配多达 99 个组,严格来说,我们应该在替换模式中引用它们时使用两位数字。但在大多数情况下,我们可以使用 `\1` 到 `\9` 而不是 `\01` 到 `\09`,因为这没有歧义。换句话说,如果我尝试将 `a10`、`v10` 和 `x10` 更改为 `az`、`vz` 和 `xz`,那么使用 `\1z`的替换模式就可以了。因为后面的 `z` 意味着不会误解释该模式中 `\1`。 + +因此,在撤消替换后,我将模式更改为这样: + +![Two-digit BBEdit replacement pattern][3] + +它可以正常工作。 + +还有另一个选择:命名组。这是使用 `var` 作为模式名称: + +![Named BBEdit replacement pattern][4] + +在任何情况下,我从来都没有使用过命名组,无论正则表达式是在文本编辑器还是在脚本中。我的总体感觉是,如果模式复杂到我必须使用变量来跟踪所有组,那么我应该停下来并将问题分解为更小的部分。 + +By the way, you may have heard that BBEdit is celebrating its [25th anniversary][5] of not sucking. When a well-documented app has such a long history, the manual starts to accumulate delightful callbacks to the olden days. As I was looking up the notation for named groups in the BBEdit manual, I ran across this note: +顺便说一下,你可能已经听说 BBEdit 正在庆祝它诞生[25周年][5]。当一个有良好文档的应用有如此历史时,手册的积累能让人愉快地回到过去的日子。当我在 BBEdit 手册中查找命名组的表示法时,我遇到了这个说明: + +![BBEdit regex manual excerpt][6] + +BBEdit 目前的版本是 12.5。第一次出现于 2001 年的 V6.5。但手册希望确保长期客户(我记得是在 V4 的时候第一次购买)不会因行为变化而感到困惑,即使这些变化几乎发生在二十年前。 + +-------------------------------------------------------------------------------- + +via: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ + +作者:[Dr.Drang][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://leancrew.com +[b]: https://github.com/lujun9972 +[1]: https://leancrew.com/all-this/2019/02/automation-evolution/ +[2]: https://leancrew.com/all-this/images2019/20190223-Mistaken%20BBEdit%20replacement%20pattern.png (Mistaken BBEdit replacement pattern) +[3]: https://leancrew.com/all-this/images2019/20190223-Two-digit%20BBEdit%20replacement%20pattern.png (Two-digit BBEdit replacement pattern) +[4]: https://leancrew.com/all-this/images2019/20190223-Named%20BBEdit%20replacement%20pattern.png (Named BBEdit replacement pattern) +[5]: https://merch.barebones.com/ +[6]: https://leancrew.com/all-this/images2019/20190223-BBEdit%20regex%20manual%20excerpt.png (BBEdit regex manual excerpt) From d7383a67ae7bfbbc78b1c074510bf1fc441d30a3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 5 Mar 2019 09:07:51 +0800 Subject: [PATCH 441/813] translating --- ...L To Work With Proprietary Nvidia Graphics Drivers.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md b/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md index a9d540adae..31cc2f155a 100644 --- a/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md +++ b/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers) +[#]: via: (https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-built.html) +[#]: author: (Logix https://plus.google.com/118280394805678839070) + How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers ====== **Some applications and games built with OpenGL support and packaged as Flatpak fail to start with proprietary Nvidia drivers. This article explains how to get such Flatpak applications or games them to start, without installing the open source drivers (Nouveau).** From c86a2d84e2937bf33d6382844c9556b9b7b28fa3 Mon Sep 17 00:00:00 2001 From: cycoe Date: Tue, 5 Mar 2019 10:23:11 +0800 Subject: [PATCH 442/813] translating by cycoe --- ...ero without a villain- How to add one to your Python game.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md index 3ca8fba288..52b46c1adb 100644 --- a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md +++ b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md @@ -1,3 +1,5 @@ +Translating by cycoe +Cycoe 翻译中 What's a hero without a villain? How to add one to your Python game ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z) From 842a5e65738174020be39bdb0762abd59e003424 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 10:52:49 +0800 Subject: [PATCH 443/813] PRF:20180307 3 open source tools for scientific publishing.md @tomjlw --- ... source tools for scientific publishing.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20180307 3 open source tools for scientific publishing.md b/translated/tech/20180307 3 open source tools for scientific publishing.md index a05680f8e4..40deb0ee6c 100644 --- a/translated/tech/20180307 3 open source tools for scientific publishing.md +++ b/translated/tech/20180307 3 open source tools for scientific publishing.md @@ -4,47 +4,47 @@ ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_science.png?itok=WDKARWGV) -有一个行业在采用数字或者开源工具方面已落后其它行业,那就是竞争与利润并存的学术出版业。根据 Stephen Buranyi 去年在 [The Guardian][1] 发表的一份图表,这个估值超过 190 亿英镑(260 亿美元)的行业至今在其选稿、出版甚至分享是最重要的科学研究的系统方面,仍受限于印刷媒介的诸多限制。全新的数字时代科技展现了一个巨大机遇,可以加速探索、推动科学协作而非竞争,以及将投入从基础建设导向有益于社会的研究。 +有一个行业在采用数字化或开源工具方面已落后其它行业,那就是竞争与利润并存的学术出版业。根据 Stephen Buranyi 去年在 [卫报][1] 上发表的一份图表,这个估值超过 190 亿英镑(260 亿美元)的行业,即使是最重要的科学研究方面,至今其系统在选题、出版甚至分享方面仍受限于印刷媒介的诸多限制。全新的数字时代科技展现了一个巨大机遇,可以加速探索、推动科学协作而非竞争,以及将投入从基础建设导向有益于社会的研究。 -非盈利性的 [eLife 倡议][2] 是由研究的资金赞助方建立,旨在通过使用数字或者开源技术来走出上述僵局。除了为生活中科学和生物医疗方面的重大成就出版开放式获取的杂志,eLife 已将自己变成了一个在研究交流方面的创新实验窗口 —— 而大部分的实验都是基于开源精神的。 +非盈利性的 [eLife 倡议][2] 是由研究资金赞助方建立,旨在通过使用数字或者开源技术来走出上述僵局。除了为生命科学和生物医疗方面的重大成就出版开放式获取的期刊,eLife 已将自己变成了一个在研究交流方面的实验和展示创新的平台 —— 而大部分的实验都是基于开源精神的。 -参与开源出版项目给予我们加速接触、采用科学技术,提升用户体验的机会。我们认为这种机会对于推动学术出版行业是重要的。大而化之地说,开源产品的用户体验经常是有待开发的,而有时候这种情况会阻止其他人去使用它。作为我们在 OSS(开源软件)开发中投入的一部分,为了鼓励更多用户使用这些产品,我们十分注重用户体验。 +致力于开放出版基础设施项目给予我们加速接触、采用科学技术、提升用户体验的机会。我们认为这种机会对于推动学术出版行业是重要的。大而化之地说,开源产品的用户体验经常是有待开发的,而有时候这种情况会阻止其他人去使用它。作为我们在 OSS(开源软件)开发中投入的一部分,为了鼓励更多用户使用这些产品,我们十分注重用户体验。 -我们所有的代码都是开源的,并且我们也积极鼓励开源社区参与进我们的项目中。这对我们来说意味着更快的迭代、更多的实验、更大的透明度,同时也拓宽了我们工作的外延。 +我们所有的代码都是开源的,并且我们也积极鼓励社区参与进我们的项目中。这对我们来说意味着更快的迭代、更多的实验、更大的透明度,同时也拓宽了我们工作的外延。 -我们现在参与的项目,例如 Libero (之前称作 [eLife Continuum][3])和 [可复制文档栈][4] 的开发以及我们最近和 [Hypothesis][5] 的合作,展示了 OSS 是如何在评估、发布以及新发现的沟通方面带来正面影响的。 +我们现在参与的项目,例如 Libero (之前称作 [eLife Continuum][3])和 [可重现文档栈][4]Reproducible Document Stack 的开发,以及我们最近和 [Hypothesis][5] 的合作,展示了 OSS 是如何在评估、出版以及新发现的沟通方面带来正面影响的。 ### Libero -Libero 是面向出版商的服务及应用套餐,它包括一个后期制作出版系统、整套前端用户界面、Libero 的镜头阅读器、一个 Open API 以及一个搜索及推荐引擎。 +Libero 是面向出版商的服务及应用套餐,它包括一个后期制作出版系统、整套前端用户界面样式套件、Libero 的镜头阅读器、一个 Open API 以及一个搜索及推荐引擎。 -去年我们采取了用户导向方式重新设计了 Libero 的前端,可以使用户较少地分心,并更多地集中关注在研究文章上。我们和 eLife 社区成员测试并迭代了站点所有的核心功能,以确保给所有人最好的阅读体验。网站的新 API 也为机器阅读能力提供了更简单的访问途径,其中包括文本挖掘、机器学习以及在线应用开发。 +去年我们采取了用户驱动的方式重新设计了 Libero 的前端,可以使用户较少地分心于网站的“陈设”,而是更多地集中关注于研究文章上。我们和 eLife 社区成员测试并迭代了该站点所有的核心功能,以确保给所有人最好的阅读体验。该网站的新 API 也为机器阅读能力提供了更简单的访问途径,其中包括文本挖掘、机器学习以及在线应用开发。 -我们网站上的内容以及引领新设计的样式都是开源的,以鼓励 eLife 和其它想要使用它的出版商后续的开发。 +我们网站上的内容以及引领新设计的样式都是开源的,以鼓励 eLife 和其它想要使用它的出版商后续的产品开发。 -### 可复制文档栈 +### 可重现文档栈 -在与 [Substance][6] 和 [Stencila][7] 的合作下,eLife 也参与了一个项目来创建可复制的文档栈(RDS)—— 一个开放式的创作、编纂以及在线出版可复制的计算型手稿的工具栈。 +在与 [Substance][6] 和 [Stencila][7] 的合作下,eLife 也参与了一个项目来创建可重现文档栈(RDS)—— 一个开放式的创作、编纂以及在线出版可重现的计算型手稿的工具栈。 -今天越来越多的研究人员能够通过 [R、Markdown][8] 和 [Python][9] 等语言记录他们的计算实验。这些可以作为实验记录的重要部分,但是尽管它们可以独立于最终的研究文章或与之一起分享,传统出版流程经常将它们视为次级内容。为了发表论文,使用这些语言的研究人员除了将他们的计算结果用图片的形式“扁平化”提交外别无他法。但是这导致了许多实验价值和代码和计算数据可重复利用性的流失。诸如 [Jupyter][10] 的电子笔记本解决方案确实可以使研究员以一种可重复利用、可执行的简单形式发布,但是这种方案仍然是出版的手稿的补充,而不是不可或缺的一部分。 +今天越来越多的研究人员能够通过 [R Markdown][8] 和 [Python][9] 等语言记录他们的计算实验。这些可以作为实验记录的重要部分,但是尽管它们可以独立于最终的研究文章或与之一同分享,但传统出版流程经常将它们视为次级内容。为了发表论文,使用这些语言的研究人员除了将他们的计算结果用图片的形式“扁平化”提交外别无他法。但是这导致了许多实验价值和代码和计算数据可重复利用性的流失。诸如 [Jupyter][10] 这样的电子笔记本解决方案确实可以使研究员以一种可重复利用、可执行的简单形式发布,但是这种方案仍然是出版的手稿的补充,而不是不可或缺的一部分。 -[可复制文档栈][11] 项目旨在通过开发、发布一个可重现原稿的产品原型来解决这些挑战,该原型将代码和数据视为文档的组成部分,并展示了从创作到出版的完整端对端技术堆栈。它将最终允许用户以一种包含嵌入代码块和计算结果(统计结果、图表或图片)的形式提交他们的手稿,并在出版过程中保留这些可视、可执行的部分。那时出版商就可以将这些保存为发布的在线文章的组成部分。 +[可重现文档栈][11] 项目旨在通过开发、发布一个可重现原稿的产品原型来解决这些挑战,该原型将代码和数据视为文档的组成部分,并展示了从创作到出版的完整端对端技术栈。它将最终允许用户以一种包含嵌入代码块和计算结果(统计结果、图表或图形)的形式提交他们的手稿,并在出版过程中保留这些可视、可执行的部分。那时出版商就可以将这些做为出版的在线文章的组成部分而保存。 ### 用 Hypothesis 进行开放式注解 最近,我们与 [Hypothesis][12] 合作引进了开放式注解,使得我们网站的用户们可以写评语、高亮文章重要部分以及与在线阅读的群体互动。 -通过这样的合作,开源的 Hypothesis 软件被定制得更具有现代化的特性,如单次登录验证、用户界面定制选项,给予了出版商在他们自己网站上更多的控制。这些提升正引导着关于发表的学术内容高质量的讨论。 +通过这样的合作,开源的 Hypothesis 软件被定制得更具有现代化的特性,如单次登录验证、用户界面定制,给予了出版商在他们自己网站上实现更多的控制。这些提升正引导着关于出版学术内容的高质量讨论。 -这个工具可以无缝集成进出版商的网站,学术发表平台 [PubFactory][13] 和内容解决方案供应商 [Ingenta][14] 已经利用了它优化后的特性集。[HighWire][15] 和 [Silverchair][16] 也为他们的出版商提供了实施这套方案的机会。 +这个工具可以无缝集成到出版商的网站,学术出版平台 [PubFactory][13] 和内容解决方案供应商 [Ingenta][14] 已经利用了它优化后的特性集。[HighWire][15] 和 [Silverchair][16] 也为他们的出版商提供了实施这套方案的机会。 ### 其它产业和开源软件 -睡着时间的推移,我们希望看到更多的出版商采用 Hypothesis、Libero 以及其它开源软件去帮助他们促进重要科学研究的发现以及循环利用。但是 eLife 的创新机会也能被其它行业利用,因为这些软件和其它 OSS 技术带来的在其他行业也很普遍。 +随着时间的推移,我们希望看到更多的出版商采用 Hypothesis、Libero 以及其它开源项目去帮助他们促进重要科学研究的发现以及循环利用。但是 eLife 的创新机遇也能被其它行业所利用,因为这些软件和其它 OSS 技术在其他行业也很普遍。 -数据科学的世界离不开高质量、强支持的开源软件和围绕它们形成的社区;[TensorFlow][17] 就是这样一个好例子。感谢 OSS 以及其社区,AI 的所有领域和机器学习相比于计算机的其它领域有了迅速的提升和发展。与之类似的是 Linux 云端网页主机的爆炸性增长、接着是 Docker 容器、以及现在 GitHub 上最流行的开源项目之一的 Kubernetes 的增长。 +数据科学的世界离不开高质量、良好支持的开源软件和围绕它们形成的社区;[TensorFlow][17] 就是这样一个好例子。感谢 OSS 以及其社区,AI 和机器学习的所有领域相比于计算机的其它领域的提升和发展更加迅猛。与之类似的是以 Linux 作为云端 Web 主机的爆炸性增长、接着是 Docker 容器、以及现在 GitHub 上最流行的开源项目之一的 Kubernetes 的增长。 -所有的这些技术使得机构能够用更少的资源做更多的事情,并专注于创新而不是重新发明轮子上。最后,这就是 OSS 真正的好处:它使得我们从互相的失败中学习,在互相的成功中成长。 +所有的这些技术使得机构们能够用更少的资源做更多的事情,并专注于创新而不是重新发明轮子上。最后,这就是 OSS 真正的好处:它使得我们从互相的失败中学习,在互相的成功中成长。 我们总是在寻找与研究和科技界面方面最好的人才和想法交流的机会。你可以在 [eLife Labs][18] 上或者联系 [innovation@elifesciences.org][19] 找到更多这种交流的信息。 From dfcc0256ba574c5b93146d735bf090f201ff4927 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 10:53:32 +0800 Subject: [PATCH 444/813] PUB:20180307 3 open source tools for scientific publishing.md @tomjlw https://linux.cn/article-10590-1.html --- .../20180307 3 open source tools for scientific publishing.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180307 3 open source tools for scientific publishing.md (100%) diff --git a/translated/tech/20180307 3 open source tools for scientific publishing.md b/published/20180307 3 open source tools for scientific publishing.md similarity index 100% rename from translated/tech/20180307 3 open source tools for scientific publishing.md rename to published/20180307 3 open source tools for scientific publishing.md From e736dc9903d856deca1b4ff22143ecca62cdade3 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 5 Mar 2019 13:31:27 +0800 Subject: [PATCH 445/813] Translating 7 steps for hunting down Python code bugs. --- ...steps for hunting down Python code bugs.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 9fe0e40a3d..ab4c13c862 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -65,32 +65,30 @@ Pdb, 一个 Python 调试器。 你遵循我的建议,打上 pdb 断点并运行你的测试。然后测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。运行这个测试,然后当它打到你的断点,按下 `w` 并检查调用栈。如果你不知道如何查看因为其他调用而变得混乱的调用栈,那么在调用栈的中间找到属于你的代码,并在其中堆栈中代码的上一行放置一个断点。再试一次新的测试。如果仍然没打到断点,那么继续,向上追踪调用栈并找出你的调用在哪里脱轨了。如果你一直没有打到断点,最后到了追踪的顶部,那么恭喜你,你发现了问题:你的应用程序拼写错了。没有经验,没有经验,一点都没有经验。 -### 4. Change things +### 4. 修改代码 -如果你仍觉得迷惑,在你稍微改变了一些的地方尝试新的测试。你能让新的测试跑起来么?有什么不同的呢?有什么相同的呢?尝试改变别的东西。 Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.) +如果你仍觉得迷惑,在你稍微改变了一些的地方尝试新的测试。你能让新的测试跑起来么?有什么不同的呢?有什么相同的呢?尝试改变别的东西。当你有了你的测试,可能也还有其他测试,那就可以开始安全地修改代码,确定是否可以缩小问题范围。记得从一个新提交开始解决问题,以便于可以轻松地撤销无效地更改。(这就是版本控制,如果你没有使用版本控制,这将会改变你的生活。好吧,可能它只是让编码更容易。查阅“版本控制可视指南”,以了解更多。) -### 5. Take a break +### 5. 休息一下 -In all seriousness, when it stops feeling like a fun challenge or game and starts becoming really frustrating, your best course of action is to walk away from the problem. Take a break. I highly recommend going for a walk and trying to think about something else. +尽管如此,当它不再感觉起来像一个有趣的挑战或者游戏而开始变得令人沮丧时,你最好的举措是脱离这个问题。休息一下。我强烈建议你去散步并尝试考虑别的事情。 -### 6. Write everything down +### 6. 把一切写下来 -When you come back, if you aren't suddenly inspired to try something, write down any information you have about the problem. This should include: +当你回来了,如果你没有突然受到启发,那就把你关于这个问题所知的每一个点信息写下来。这应该包括: - * Exactly the call that is causing the problem - * Exactly what happened, including any error messages or related log messages - * Exactly what you were expecting to happen - * What you have done so far to find the problem and any clues that you have discovered while troubleshooting + * 真正造成问题的调用 + * 真正发生了什么,包括任何错误信息或者相关的日志信息 + * 你真正期望发生什么 + * 到目前为止,为了找出问题,你做了什么工作;以及解决问题中你发现的任何线索。 +有时这里有很多信息,但相信我,从零碎中挖掘信息是很烦人。所以尽量简洁,但是要完整。 - -Sometimes this is a lot of information, but trust me, it is really annoying trying to pry information out of someone piecemeal. Try to be concise, but complete. - -### 7. Ask for help +### 7. 寻求帮助 I often find that just writing down all the information triggers a thought about something I have not tried yet. Sometimes, of course, I realize what the problem is immediately after hitting the submit button. At any rate, if you still have not thought of anything after writing everything down, try sending an email to someone. First, try colleagues or other people involved in your project, then move on to project email lists. Don't be afraid to ask for help. Most people are kind and helpful, and I have found that to be especially true in the Python community. -Maria McKinley will present [Hunting the Bugs][3] at [PyCascades 2019][4], February 23-24 in Seattle. +Maria McKinley 将在 [PyCascades 2019][4] 发表[代码查错][3],二月 23-24,西雅图。 -------------------------------------------------------------------------------- From 8af7cc6222729125d22895153d6b040c6367dc47 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Tue, 5 Mar 2019 15:29:55 +0800 Subject: [PATCH 446/813] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=EF=BC=9A20180202=20Tips=20for=20success=20when=20getting=20sta?= =?UTF-8?q?rted=20with=20Ansible.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...180202 Tips for success when getting started with Ansible.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180202 Tips for success when getting started with Ansible.md b/sources/tech/20180202 Tips for success when getting started with Ansible.md index 539db2ac86..2b70c04e4d 100644 --- a/sources/tech/20180202 Tips for success when getting started with Ansible.md +++ b/sources/tech/20180202 Tips for success when getting started with Ansible.md @@ -1,3 +1,5 @@ +jdh8383 is translating. + Tips for success when getting started with Ansible ====== From 80d6b508bbf24f767a3a174576a77899e9698453 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 20:37:04 +0800 Subject: [PATCH 447/813] PRF:20190212 Ampersands and File Descriptors in Bash.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zero-MK 恭喜你完成了第一篇翻译! --- ...Ampersands and File Descriptors in Bash.md | 94 ++++++++++--------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/translated/tech/20190212 Ampersands and File Descriptors in Bash.md b/translated/tech/20190212 Ampersands and File Descriptors in Bash.md index 953a4bcafd..05d1ca1acd 100644 --- a/translated/tech/20190212 Ampersands and File Descriptors in Bash.md +++ b/translated/tech/20190212 Ampersands and File Descriptors in Bash.md @@ -1,72 +1,74 @@ -[#]: collector: "lujun9972" -[#]: translator: "zero-mk " -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "Ampersands and File Descriptors in Bash" -[#]: via: "https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash" -[#]: author: "Paul Brown https://www.linux.com/users/bro66" +[#]: collector: (lujun9972) +[#]: translator: (zero-mk) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ampersands and File Descriptors in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) -Bash中的&符号和文件描述符 +Bash 中的 & 符号和文件描述符 ====== +> 了解如何将 “&” 与尖括号结合使用,并从命令行中获得更多信息。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-coffee.png?itok=yChaT-47) -在我们寻求检查所有的clutter(`&`,`|`,`;`,`>`,`<`,`{`,`[`,`(`,) `]`,`}` 等等)是在大多数链式Bash命令中都会出现,[我们一直在仔细研究(`&`)符号][1]。 +在我们探究大多数链式 Bash 命令中出现的所有的杂项符号(`&`、`|`、`;`、`>`、`<`、`{`、`[`、`(`、`)`、`]`、`}` 等等)的任务中,[我们一直在仔细研究 & 符号][1]。 -[上次,我们看到了如何使用`&`把可能需要很长时间运行的进程放到后台运行][1]。但是,`&`与尖括号`<`结合使用,也可用于管道输出或向其他地方的输入。 +[上次,我们看到了如何使用 & 把可能需要很长时间运行的进程放到后台运行][1]。但是,`&` 与尖括号 `<` 结合使用,也可用于将输出或输出通过管道导向其他地方。 -在[前面的][2] [尖括号教程中][3],您看到了如何使用`>`,如下: +在 [前面的][2] [尖括号教程中][3],你看到了如何使用 `>`,如下: ``` ls > list.txt ``` -将`ls`输出传递给_list.txt_文件。 +将 `ls` 输出传递给 `list.txt` 文件。 -现在我们看到的是简写 +现在我们看到的是简写: ``` ls 1> list.txt ``` -在这种情况下,`1`是一个文件描述符,指向标准输出(`stdout`)。 +在这种情况下,`1` 是一个文件描述符,指向标准输出(`stdout`)。 -以类似的方式,`2`指向标准error(`stderr`): +以类似的方式,`2` 指向标准错误输出(`stderr`): ``` ls 2> error.log ``` -所有错误消息都通过管道传递给_error.log_文件。 +所有错误消息都通过管道传递给 `error.log` 文件。 -回顾一下:`1>`是标准输出(`stdout`),`2>`标准错误输出(`stderr`)。 +回顾一下:`1>` 是标准输出(`stdout`),`2>` 是标准错误输出(`stderr`)。 -第三个标准文件描述符,`0<`标准输入(`stdin`)。您可以看到它是一个输入,因为箭头(`<`)指向`0`,而对于 `1`和`2`,箭头(`>`)是指向外部的。 +第三个标准文件描述符,`0<` 是标准输入(`stdin`)。你可以看到它是一个输入,因为箭头(`<`)指向`0`,而对于 `1` 和 `2`,箭头(`>`)是指向外部的。 ### 标准文件描述符有什么用? -如果您在阅读本系列以后,您已经多次使用标准输出(`1>`)的简写形式:`>`。 +如果你在阅读本系列以后,你已经多次使用标准输出(`1>`)的简写形式:`>`。 -例如,当(假如)你知道你的命令会抛出一个错误时,像`stderr`(`2`)这样的东西也很方便,但是Bash告诉你的东西是没有用的,你不需要看到它。如果要在_home/_目录中创建目录,例如: +例如,当(假如)你知道你的命令会抛出一个错误时,像 `stderr`(`2`)这样的东西也很方便,但是 Bash 告诉你的东西是没有用的,你不需要看到它。如果要在 `home/` 目录中创建目录,例如: ``` mkdir newdir ``` -如果_newdir/_已经存在,`mkdir`将显示错误。但你为什么要关心?(好吧,在某些情况下你可能会关心,但并非总是如此。)在一天结束时,_newdir_会以某种方式让你填写一些东西。您可以通过将错误消息推入void(即_/dev/null_)来抑制错误消息: +如果 `newdir/` 已经存在,`mkdir` 将显示错误。但你为什么要关心这些呢?(好吧,在某些情况下你可能会关心,但并非总是如此。)在一天结束时,`newdir` 会以某种方式让你填入一些东西。你可以通过将错误消息推入虚空(即 ``/dev/null`)来抑制错误消息: ``` mkdir newdir 2> /dev/null ``` -这不仅仅是“ _让我们不要看到丑陋和无关的错误消息,因为它们很烦人_ ”,因为在某些情况下,错误消息可能会在其他地方引起一连串错误。比如说,你想找到_/etc_下所有的*.service_文件。你可以这样做: +这不仅仅是 “让我们不要看到丑陋和无关的错误消息,因为它们很烦人”,因为在某些情况下,错误消息可能会在其他地方引起一连串错误。比如说,你想找到 `/etc` 下所有的 `.service` 文件。你可以这样做: ``` find /etc -iname "*.service" ``` -但事实证明,在大多数系统中,`find`显示错误会导致许多行出现问题,因为普通用户对_/etc_下的某些文件夹没有读取访问权限。它使读取正确的输出变得很麻烦,如果`find`是更大的脚本的一部分,它可能会导致行中的下一个命令排队。 +但事实证明,在大多数系统中,`find` 显示的错误会有许多行,因为普通用户对 `/etc` 下的某些文件夹没有读取访问权限。它使读取正确的输出变得很麻烦,如果 `find` 是更大的脚本的一部分,它可能会导致行中的下一个命令排队。 相反,你可以这样做: @@ -78,15 +80,15 @@ find /etc -iname "*.service" 2> /dev/null ### 文件描述符入门 -单独的文件描述符`stdout`和`stderr`还有一些注意事项。如果要将输出存储在文件中,请执行以下操作: +单独的文件描述符 `stdout` 和 `stderr` 还有一些注意事项。如果要将输出存储在文件中,请执行以下操作: ``` find /etc -iname "*.service" 1> services.txt ``` -工作正常,因为`1>`意味着“ _发送标准输出,只有标准输出(非标准错误)_ ”。 +工作正常,因为 `1>` 意味着 “发送标准输出且自身标准输出(非标准错误)到某个地方”。 -但这里存在一个问题:如果你想保留命令抛出的错误信息的和非错误信息你该怎么*做*?上面的说明并不会这样做,因为它只写入`find`正确的结果 +但这里存在一个问题:如果你想把命令抛出的错误信息记录到文件,而结果中没有错误信息你该怎么**做**?上面的命令并不会这样做,因为它只写入 `find` 正确的结果,而: ``` find /etc -iname "*.service" 2> services.txt @@ -100,25 +102,25 @@ find /etc -iname "*.service" 2> services.txt find /etc -iname "*.service" &> services.txt ``` -…… 再次和`&`打招呼! +…… 再次和 `&` 打个招呼! -我们一直在说`stdin`(`0`),`stdout`(`1`)和`stderr`(`2`)是_文件描述符_。文件描述符是一种特殊构造,指向文件的通道,用于读取或写入,或两者兼而有之。这来自于将所有内容都视为文件的旧UNIX理念。想写一个设备?将其视为文件。想写入套接字并通过网络发送数据?将其视为文件。想要读取和写入文件?嗯,显然,将其视为文件。 +我们一直在说 `stdin`(`0`)、`stdout`(`1`)和 `stderr`(`2`)是“文件描述符”。文件描述符是一种特殊构造,是指向文件的通道,用于读取或写入,或两者兼而有之。这来自于将所有内容都视为文件的旧 UNIX 理念。想写一个设备?将其视为文件。想写入套接字并通过网络发送数据?将其视为文件。想要读取和写入文件?嗯,显然,将其视为文件。 -因此,在管理命令的输出和错误的位置时,将目标视为文件。因此,当您打开它们来读取和写入它们时,它们都会获得文件描述符。 +因此,在管理命令的输出和错误的位置时,将目标视为文件。因此,当你打开它们来读取和写入它们时,它们都会获得文件描述符。 -这是一个有趣的效果。例如,您可以将内容从一个文件描述符传递到另一个文件描述符: +这是一个有趣的效果。例如,你可以将内容从一个文件描述符传递到另一个文件描述符: ``` find /etc -iname "*.service" 1> services.txt 2>&1 ``` -该管道`stderr`以`stdout`与`stdout`通过管道被输送到一个文件中,_services.txt的_。 +这会将 `stderr` 导向到 `stdout`,而 `stdout` 通过管道被导向到一个文件中 `services.txt` 中。 -它再次出现:`&`发信号通知Bash `1`是目标文件描述符。 +它再次出现:`&` 发信号通知 Bash `1` 是目标文件描述符。 -标准文件描述符的另一个问题是,当你从一个管道传输到另一个时,你执行此操作的顺序有点违反直觉。例如,按照上面的命令。它看起来像是错误的方式。您可能正在阅读它:“ _将输出传输到文件,然后将错误传递给标准输出。_ ”看起来错误输出会很晚,并且在`1`已经完成时发送。 +标准文件描述符的另一个问题是,当你从一个管道传输到另一个时,你执行此操作的顺序有点违反直觉。例如,按照上面的命令。它看起来像是错误的方式。你也行像这样阅读它:“将输出导向到文件,然后将错误导向到标准输出。” 看起来错误输出会在后面,并且在输出到标准输出(`1`)已经完成时才发送。 -但这不是文件描述符的工作方式。文件描述符不是文件的占位符,而是文件的_输入and/or输出通道_。在这种情况下,当你`1> services.txt`这样做时,你会说“ _打开一个写管道到services.txt并保持打开状态_ ”。`1`是您要使用的管道的名称,它将保持打开状态直到该行的结尾。 +但这不是文件描述符的工作方式。文件描述符不是文件的占位符,而是文件的输入和(或)输出通道。在这种情况下,当你做 `1> services.txt` 时,你的意思是 “打开一个写管道到 `services.txt` 并保持打开状态”。`1` 是你要使用的管道的名称,它将保持打开状态直到该行的结尾。 如果你仍然认为这是错误的方法,试试这个: @@ -126,23 +128,23 @@ find /etc -iname "*.service" 1> services.txt 2>&1 find /etc -iname "*.service" 2>&1 1>services.txt ``` -并注意它是如何工作的; 注意错误是如何通过管道输送到终端的,所以只有非错误的输出(即`stdout`)被推送到`services.txt`。 +并注意它是如何不工作的;注意错误是如何被导向到终端的,而只有非错误的输出(即 `stdout`)被推送到 `services.txt`。 -这是因为Bash从左到右处理`find`的每个结果。这样想:当Bash到达`2>&1`时,`stdout` (`1`) 仍然是指向终端的通道。如果`find` Bash的结果包含一个错误,它将被弹出到`2`,转移到`1`,然后离开终端! +这是因为 Bash 从左到右处理 `find` 的每个结果。这样想:当 Bash 到达 `2>&1` 时,`stdout` (`1`)仍然是指向终端的通道。如果 `find` 给 Bash 的结果包含一个错误,它将被弹出到 `2`,转移到 `1`,然后留在终端! -然后在命令结束时,Bash看到您要打开`stdout`作为_services.txt_文件的通道。如果没有发生错误,结果将`1`进入文件。 +然后在命令结束时,Bash 看到你要打开 `stdout`(`1`) 作为到 `services.txt` 文件的通道。如果没有发生错误,结果将通过通道 `1` 进入文件。 -相比之下,在 +相比之下,在: ``` find /etc -iname "*.service" 1>services.txt 2>&1 ``` -`1`从一开始就指向services.txt,因此任何弹出到`2`的内容都会通过`1`进行管道传输,而`1`已经指向services.txt中的最后一个休息位置,这就是它工作的原因。在任何情况下,如上所述`&>`都是“标准输出和标准错误”的缩写,即`2>&1`。 +`1` 从一开始就指向 `services.txt`,因此任何弹出到 `2` 的内容都会导向到 `1` ,而 `1` 已经指向最终去的位置 `services.txt`,这就是它工作的原因。 -在任何情况下,如上所述`&>`是“_标准输出和标准误差_”的简写,即`2>&1`。 +在任何情况下,如上所述 `&>` 都是“标准输出和标准错误”的缩写,即 `2>&1`。 -这可能有点多,但不用担心。调整文件描述符在Bash命令行和脚本中是司空见惯的事。随着本系列的深入,您将了解更多关于文件描述符的知识。下周见! +这可能有点多,但不用担心。重新导向文件描述符在 Bash 命令行和脚本中是司空见惯的事。随着本系列的深入,你将了解更多关于文件描述符的知识。下周见! -------------------------------------------------------------------------------- @@ -151,12 +153,12 @@ via: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bas 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[zero-mk](https://github.com/zero-mk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.linux.com/users/bro66 [b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[2]: https://www.linux.com/blog/learn/2019/1/understanding-angle-brackets-bash -[3]: https://www.linux.com/blog/learn/2019/1/more-about-angle-brackets-bash \ No newline at end of file +[1]: https://linux.cn/article-10587-1.html +[2]: https://linux.cn/article-10502-1.html +[3]: https://linux.cn/article-10529-1.html From c7b38105fbfb0ac1a4464abf5c2fdfc88910cdb7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 20:41:05 +0800 Subject: [PATCH 448/813] PUB:20190212 Ampersands and File Descriptors in Bash.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zero-MK 本文首发地址: https://linux.cn/article-10591-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/zero-MK 请注册领取 LCCN: https://lctt.linux.cn/ --- .../20190212 Ampersands and File Descriptors in Bash.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190212 Ampersands and File Descriptors in Bash.md (99%) diff --git a/translated/tech/20190212 Ampersands and File Descriptors in Bash.md b/published/20190212 Ampersands and File Descriptors in Bash.md similarity index 99% rename from translated/tech/20190212 Ampersands and File Descriptors in Bash.md rename to published/20190212 Ampersands and File Descriptors in Bash.md index 05d1ca1acd..7aa1a82018 100644 --- a/translated/tech/20190212 Ampersands and File Descriptors in Bash.md +++ b/published/20190212 Ampersands and File Descriptors in Bash.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zero-mk) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10591-1.html) [#]: subject: (Ampersands and File Descriptors in Bash) [#]: via: (https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From 72af22dc0e6c075cb23e43b776aabbd65e3a2417 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 22:40:38 +0800 Subject: [PATCH 449/813] PRF:20190108 How ASLR protects Linux systems from buffer overflow attacks.md @leommxj --- ...ux systems from buffer overflow attacks.md | 85 +++++++++---------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md b/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md index 5d0c059f9b..2007513387 100644 --- a/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md +++ b/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md @@ -1,48 +1,43 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How ASLR protects Linux systems from buffer overflow attacks) [#]: via: (https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -ASLR是如何保护Linux系统免受缓冲区溢出攻击的 +ASLR 是如何保护 Linux 系统免受缓冲区溢出攻击的 ====== +> 地址空间随机化(ASLR)是一种内存攻击缓解技术,可以用于 Linux 和 Windows 系统。了解一下如何运行它、启用/禁用它,以及它是如何工作的。 + ![](https://images.idgesg.net/images/article/2019/01/shuffling-cards-100784640-large.jpg) -地址空间随机化( ASLR )是一种操作系统用来抵御缓冲区溢出攻击的内存保护机制。这种技术使得系统上运行的进程的内存地址无法预测,使得与这些进程有关的漏洞变得更加难以利用。 +地址空间随机化Address Space Layout Randomization(ASLR)是一种操作系统用来抵御缓冲区溢出攻击的内存保护机制。这种技术使得系统上运行的进程的内存地址无法被预测,使得与这些进程有关的漏洞变得更加难以利用。 -ASLR目前在 Linux , Windows 以及 MacOS 系统上都有使用。其最早出现在 2005 的Linux系统上。2007 年,这项技术被 Windows 和 MacOS 部署使用。尽管 ASLR 在各个系统上都提供相同的功能,却有着不同的实现。 +ASLR 目前在 Linux、Windows 以及 MacOS 系统上都有使用。其最早出现在 2005 的 Linux 系统上。2007 年,这项技术被 Windows 和 MacOS 部署使用。尽管 ASLR 在各个系统上都提供相同的功能,却有着不同的实现。 -ASLR的有效性依赖于整个地址空间布局对于攻击者保持未知。此外,只有编译时作为位置无关可执行文件(PIE)的程序才能得到ASLR最大的保护,因为只有这样,可执行文件的所有代码节区才会被加载在随机地址。PIE 代码不管绝对地址是多少都可以正确执行。 - -**[ 参见:[用于排除Linux故障的宝贵提示和技巧][1] ]** +ASLR 的有效性依赖于整个地址空间布局是否对于攻击者保持未知。此外,只有编译时作为位置无关可执行文件Position Independent Executable(PIE)的可执行程序才能得到 ASLR 技术的最大保护,因为只有这样,可执行文件的所有代码节区才会被加载在随机地址。PIE 机器码不管绝对地址是多少都可以正确执行。 ### ASLR 的局限性 尽管 ASLR 使得对系统漏洞的利用更加困难了,但其保护系统的能力是有限的。理解关于 ASLR 的以下几点是很重要的: - * 不能解决漏洞,而是增加利用漏洞的难度 + * 它不能*解决*漏洞,而是增加利用漏洞的难度 * 并不追踪或报告漏洞 * 不能对编译时没有开启 ASLR 支持的二进制文件提供保护 * 不能避免被绕过 - - ### ASLR 是如何工作的 +通过对攻击者在进行缓冲区溢出攻击时所要用到的内存布局中的偏移做了随机化,ASLR 加大了攻击成功的难度,从而增强了系统的控制流完整性。 - -ASLR通过对攻击者在进行缓冲区溢出攻击时所要用到的内存布局中的偏移做随机化来加大攻击成功的难度,从而增强了系统的控制流完整性。 - - -通常认为 ASLR 在64位系统上效果更好,因为64位系统提供了更大的熵(可随机的地址范围)。 +通常认为 ASLR 在 64 位系统上效果更好,因为 64 位系统提供了更大的熵(可随机的地址范围)。 ### ASLR 是否正在你的 Linux 系统上运行? -下面展示的两条命令都可以告诉你你的系统是否启用了 ASLR 功能 +下面展示的两条命令都可以告诉你的系统是否启用了 ASLR 功能: ``` $ cat /proc/sys/kernel/randomize_va_space @@ -51,7 +46,7 @@ $ sysctl -a --pattern randomize kernel.randomize_va_space = 2 ``` -上方指令结果中的数值 (2) 表示 ASLR 工作在全随机化模式。其可能为下面的几个数值之一: +上方指令结果中的数值(`2`)表示 ASLR 工作在全随机化模式。其可能为下面的几个数值之一: ``` 0 = Disabled @@ -59,58 +54,58 @@ kernel.randomize_va_space = 2 2 = Full Randomization ``` -如果你关闭了 ASLR 并且执行下面的指令,你将会注意到前后两条**ldd**的输出是完全一样的。**ldd**命令会加载共享对象并显示他们在内存中的地址。 +如果你关闭了 ASLR 并且执行下面的指令,你将会注意到前后两条 `ldd` 的输出是完全一样的。`ldd` 命令会加载共享对象并显示它们在内存中的地址。 ``` -$ sudo sysctl -w kernel.randomize_va_space=0 <== disable +$ sudo sysctl -w kernel.randomize_va_space=0 <== disable [sudo] password for shs: kernel.randomize_va_space = 0 $ ldd /bin/bash - linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) - /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) + linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) + /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) $ ldd /bin/bash - linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) - /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) + linux-vdso.so.1 (0x00007ffff7fd1000) <== same addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ffff7c69000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffff7c63000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff7a79000) + /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd3000) ``` -如果将其重新设置为**2**来启用 ASLR,你将会看到每次运行**ldd**,得到的内存地址都不相同。 +如果将其重新设置为 `2` 来启用 ASLR,你将会看到每次运行 `ldd`,得到的内存地址都不相同。 ``` -$ sudo sysctl -w kernel.randomize_va_space=2 <== enable +$ sudo sysctl -w kernel.randomize_va_space=2 <== enable [sudo] password for shs: kernel.randomize_va_space = 2 $ ldd /bin/bash - linux-vdso.so.1 (0x00007fff47d0e000) <== first set of addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f1cb7ce0000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1cb7cda000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1cb7af0000) - /lib64/ld-linux-x86-64.so.2 (0x00007f1cb8045000) + linux-vdso.so.1 (0x00007fff47d0e000) <== first set of addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f1cb7ce0000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1cb7cda000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1cb7af0000) + /lib64/ld-linux-x86-64.so.2 (0x00007f1cb8045000) $ ldd /bin/bash - linux-vdso.so.1 (0x00007ffe1cbd7000) <== second set of addresses - libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fed59742000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed5973c000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed59552000) - /lib64/ld-linux-x86-64.so.2 (0x00007fed59aa7000) + linux-vdso.so.1 (0x00007ffe1cbd7000) <== second set of addresses + libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fed59742000) + libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fed5973c000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed59552000) + /lib64/ld-linux-x86-64.so.2 (0x00007fed59aa7000) ``` ### 尝试绕过 ASLR -尽管这项技术有很多优点,绕过ASLR的攻击并不罕见,主要有以下几类: +尽管这项技术有很多优点,但绕过 ASLR 的攻击并不罕见,主要有以下几类: * 利用地址泄露 * 访问与特定地址关联的数据 - * 针对ASLR 实现的缺陷来猜测地址,常见于系统熵过低或 ASLR 实现不完善。 + * 针对 ASLR 实现的缺陷来猜测地址,常见于系统熵过低或 ASLR 实现不完善。 * 利用侧信道攻击 ### 总结 -ASLR 有很大的价值,尤其是在64位系统上运行并被正确实现时。虽然不能避免被绕过,但这项技术的确使得利用系统漏洞变得更加困难了。这份参考资料可以提供更多有关细节 [on the Effectiveness of Full-ASLR on 64-bit Linux][2] ,这篇论文介绍了一种利用分支预测绕过ASLR的技术 [bypass ASLR][3]。 +ASLR 有很大的价值,尤其是在 64 位系统上运行并被正确实现时。虽然不能避免被绕过,但这项技术的确使得利用系统漏洞变得更加困难了。这份参考资料可以提供 [在 64 位 Linux 系统上的完全 ASLR 的有效性][2] 的更多有关细节,这篇论文介绍了一种利用分支预测 [绕过 ASLR][3] 的技术。 -------------------------------------------------------------------------------- @@ -119,7 +114,7 @@ via: https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-li 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[leommxj](https://github.com/leommxj) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bf232f0df7a1ce2604b6930a72d49b691fe3a4c3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 5 Mar 2019 22:41:27 +0800 Subject: [PATCH 450/813] PUB:20190108 How ASLR protects Linux systems from buffer overflow attacks.md @leommxj https://linux.cn/article-10592-1.html --- ...SLR protects Linux systems from buffer overflow attacks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190108 How ASLR protects Linux systems from buffer overflow attacks.md (98%) diff --git a/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md b/published/20190108 How ASLR protects Linux systems from buffer overflow attacks.md similarity index 98% rename from translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md rename to published/20190108 How ASLR protects Linux systems from buffer overflow attacks.md index 2007513387..08e41d60ee 100644 --- a/translated/tech/20190108 How ASLR protects Linux systems from buffer overflow attacks.md +++ b/published/20190108 How ASLR protects Linux systems from buffer overflow attacks.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (leommxj) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10592-1.html) [#]: subject: (How ASLR protects Linux systems from buffer overflow attacks) [#]: via: (https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 9fc6bbd90d847c85fd3ae7ab9afe26267299ac60 Mon Sep 17 00:00:00 2001 From: MK <36980619+zero-MK@users.noreply.github.com> Date: Tue, 5 Mar 2019 22:48:56 +0800 Subject: [PATCH 451/813] translating by zero-MK --- sources/tech/20190128 Top Hex Editors for Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190128 Top Hex Editors for Linux.md b/sources/tech/20190128 Top Hex Editors for Linux.md index 5cd47704b4..2f4c387b24 100644 --- a/sources/tech/20190128 Top Hex Editors for Linux.md +++ b/sources/tech/20190128 Top Hex Editors for Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zero-mk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e503f840fa808547e8f6794f94e57535e8538eb8 Mon Sep 17 00:00:00 2001 From: AnDJ <363787371@qq.com> Date: Wed, 6 Mar 2019 00:23:53 +0800 Subject: [PATCH 452/813] complete the article '20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux' --- ...nd Swap Utilization Percentage In Linux.md | 96 +++++++++---------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index d5a6579e8c..827dda9629 100644 --- a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -7,28 +7,28 @@ [#]: via: (https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) -如何查看Linux下CPU,内存和Swap(交换分区)的利用率? +如何查看Linux下CPU,内存和Swap(交换分区)的占用率? ====== -在Linux下有很多可用的命令和选项来查看内存利用情况,但是我并没有看见关于内存利用率的更多的信息。 +在Linux下有很多可用的命令和选项来查看内存占用情况,但是我并没有看见关于内存利用率的更多的信息。 -在大多数情况下我们只单独查看内存使用情况,没有考虑究竟占用了多少百分比。 +在大多数情况下我们只单独查看内存使用情况,并没有考虑占用的百分比究竟是多少。 如果你想要了解这些信息,那你看这篇文章就对了。 -我们将详细地在这里帮助你摆脱困境。 +我们将会详细地在这里帮助你解决这个问题。 这篇教程将会帮助你在面对Linux服务器下频繁内存高占用情况时,确定内存使用情况。 -但是在同时,如果你使用的是`free -m`或者`free -g`,你将不会得到描述清楚的占用情况。 +但是在同时,如果你使用的是`free -m`或者`free -g`,占用情况描述地并不是十分清楚。 -这些格式命令属于Linux高级命令。它将会对于Linux专家和中等水平Linux使用者非常有用。 +这些格式化命令属于Linux高级命令。它将会对Linux专家和中等水平Linux使用者非常有用。 ### 方法-1:如何查看Linux下内存占用率? -我们可以使用下面命令的组合来达到此目的。在该方法中,我们使用的是free和awk命令的组合来获取内存占用率。 +我们可以使用下面命令的组合来达到此目的。在该方法中,我们使用的是`free`和`awk`命令的组合来获取内存占用率。 -如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 **[free命令][1]** , **[smem 命令][2]** , **[ps_mem 命令][3]** , **[vmstat 命令][4]** and **[多种方式来查看物理内存大小][5]**. +如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 **[free命令][1]** , **[smem命令][2]** , **[ps_mem命令][3]** , **[vmstat命令][4]** and **[多种方式来查看物理内存大小][5]**. 对于获取不包含百分比符号的`内存`占用率: @@ -40,7 +40,7 @@ $ free -t | awk 'FNR == 2 {print "Current Memory Utilization is : " $3/$2*100}' Current Memory Utilization is : 20.4194 ``` -对于获取不包含百分比符号的`Swap(交换空间)`占用率: +对于获取不包含百分比符号的`Swap(交换分区)`占用率: ``` $ free -t | awk 'NR == 3 {print "Current Swap Utilization is : " $3/$2*100}' @@ -60,7 +60,7 @@ $ free -t | awk 'FNR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$ Current Memory Utilization is : 20.42% ``` -对于获取包含百分比符号及保留两位小数的`Swap(交换空间)`占用率: +对于获取包含百分比符号及保留两位小数的`Swap(交换分区)`占用率: ``` $ free -t | awk 'NR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' @@ -72,7 +72,7 @@ Current Swap Utilization is : 0.00% 如果你正在寻找有关于内存的其他文章,你可以导航至如下链接。这些链接有 **[使用LVM(逻辑盘卷管理,Logical Volume Manager)创建和扩展Swap交换分区][6]** , **[多种方式创建或扩展Swap交换分区][7]** 和 **[多种方式创建/删除和挂载交换分区文件][8]**。 -键入free命令输出更好的相关说明: +键入free命令会更好地作出阐释: ``` $ free @@ -82,64 +82,56 @@ Swap: 17454 0 17454 Total: 33322 3730 27322 ``` -下面是一些细节: +如下是一些细节: - * **`free:`** free is a standard command to check memory utilization in Linux. * **`free:`** free是一个标准命令,用于在Linux下查看内存使用情况。 - * **`awk:`** awk is a powerful command which is specialized for textual data manipulation. - * **`awk:`** awk是一个强大的专门用来做文本数据处理的强大命令。 - * **`FNR == 2:`** It gives the total number of records for each input file. Basically it’s used to select the given line (Here, it chooses the line number 2). - * **`FNR == 2:`** 该命令给出了对于每一个输入文件的记录总数。基本上它用于选择给出的行(针对于这里,它选择了行数字为2的行) - * **`NR == 2:`** It gives the total number of records processed. Basically it’s used to filter the given line (Here, it chooses the line number 2).. - * **`NR == 2:`** 该命令给出了处理的记录总数。基本上它用于过滤给出的行(针对于这里,它选择的是行数字为2的行) - * **`$3/$2*100:`** It divides column 2 with column 3 and it’s multiply the results with 100. + * **`awk:`** awk是一个专门用来做文本数据处理的强大命令。 + * **`FNR == 2:`** 该命令给出了对于每一个输入文件的行数。其基本上用于挑选出给定的行(针对于这里,它选择的是行数为2的行) + * **`NR == 2:`** 该命令给出了处理的行总数。其基本上用于过滤给出的行(针对于这里,它选择的是行数为2的行) * **`$3/$2*100:`** 该命令将列3除以列2并将结果乘以100。 - * **`printf:`** It used to format and print data. - * **`printf:`** 该命令用已格式化和打印数据。 - * **`%.2f%:`** By default it prints floating point numbers with 6 decimal places. Use the following format to limit a decimal places. - * **`%.2f%:`** 默认情况下,该命令打印保留6位的浮点数。使用后跟的格式来约束小数位。 + * **`printf:`** 该命令用于格式化和打印数据。 + * **`%.2f%:`** 默认情况下,其打印小数点后保留6位的浮点数。使用后跟的格式来约束小数位。 -### Method-2: How To Check Memory Utilization Percentage In Linux? +### 方法-2:如何查看Linux下内存占用率? -We can use the following combination of commands to get this done. In this method, we are using combination of free, grep and awk command to get the memory utilization percentage. +我们可以使用下面命令的组合来达到此目的。在这种方法中,我们使用`free`,`grep`和`awk`命令的组合来获取内存占用率。 -For `Memory` Utilization Percentage without Percent Symbol: +对于获取不包含百分比符号的`内存`占用率: ``` $ free -t | grep Mem | awk '{print "Current Memory Utilization is : " $3/$2*100}' Current Memory Utilization is : 20.4228 ``` -For `Swap` Utilization Percentage without Percent Symbol: +对于获取不包含百分比符号的`Swap(交换分区)`占用率: ``` $ free -t | grep Swap | awk '{print "Current Swap Utilization is : " $3/$2*100}' Current Swap Utilization is : 0 ``` -For `Memory` Utilization Percentage with Percent Symbol and two decimal places: +对于获取包含百分比符号及保留两位小数的`内存`占用率: ``` $ free -t | grep Mem | awk '{printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' Current Memory Utilization is : 20.43% ``` -For `Swap` Utilization Percentage with Percent Symbol and two decimal places: - +对于获取包含百分比符号及保留两位小数的`Swap(交换空间)`占用率: ``` $ free -t | grep Swap | awk '{printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' Current Swap Utilization is : 0.00% ``` -### Method-1: How To Check CPU Utilization Percentage In Linux? +### 方法-1:如何查看Linux下CPU的占用率? -We can use the following combination of commands to get this done. In this method, we are using combination of top, print and awk command to get the CPU utilization percentage. +我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用`top`,`print`和`awk`命令的组合来获取CPU的占用率。 -If you are looking for other articles which is related to memory then navigate to the following link. Those are **[top Command][9]** , **[htop Command][10]** , **[atop Command][11]** and **[Glances Command][12]**. +如果你正在寻找其他有关于CPU(译者勘误,原文为memory)的文章,你可以导航至如下链接。这些文章有 **[top命令][9]** , **[htop命令][10]** , **[atop命令][11]** and **[Glances命令][12]**. -If it shows multiple CPU in the output then you need to use the following method. +如果在输出中展示的是多个CPU的情况,那么你需要使用下面的方法。 ``` $ top -b -n1 | grep ^%Cpu @@ -153,56 +145,56 @@ $ top -b -n1 | grep ^%Cpu %Cpu7 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st ``` -For `CPU` Utilization Percentage without Percent Symbol: +对于获取不包含百分比符号的`CPU`占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{cpu+=$9}END{print "Current CPU Utilization is : " 100-cpu/NR}' Current CPU Utilization is : 21.05 ``` -For `CPU` Utilization Percentage with Percent Symbol and two decimal places: +对于获取包含百分比符号及保留2位小数的`CPU`占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{cpu+=$9}END{printf("Current CPU Utilization is : %.2f%"), 100-cpu/NR}' Current CPU Utilization is : 14.81% ``` -### Method-2: How To Check CPU Utilization Percentage In Linux? +### 方法-2:如何查看Linux下CPU的占用率? -We can use the following combination of commands to get this done. In this method, we are using combination of top, print/printf and awk command to get the CPU utilization percentage. +我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用的是`top`,`print/printf`和`awk`命令的组合来获取CPU的占用率。 -If it shows all together CPU(s) in the single output then you need to use the following method. +如果在单个输出中一起展示了所有的CPU的情况,那么你需要使用下面的方法。 ``` $ top -b -n1 | grep ^%Cpu %Cpu(s): 15.3 us, 7.2 sy, 0.8 ni, 69.0 id, 6.7 wa, 0.0 hi, 1.0 si, 0.0 st ``` -For `CPU` Utilization Percentage without Percent Symbol: +对于获取不包含百分比符号的`CPU`占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{print "Current CPU Utilization is : " 100-$8}' Current CPU Utilization is : 5.6 ``` -For `CPU` Utilization Percentage with Percent Symbol and two decimal places: +对于获取包含百分比符号及保留2位小数的`CPU`占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{printf("Current CPU Utilization is : %.2f%"), 100-$8}' Current CPU Utilization is : 5.40% ``` -Details are follow: +如下是一些细节: - * **`top:`** top is one of the best command to check currently running process on Linux system. - * **`-b:`** -b option, allow the top command to switch in batch mode. It is useful when you run the top command from local system to remote system. - * **`-n1:`** Number-of-iterations - * **`^%Cpu:`** Filter the lines which starts with %Cpu - * **`awk:`** awk is a powerful command which is specialized for textual data manipulation. - * **`cpu+=$9:`** For each line, add column 9 to a variable ‘cpu’. - * **`printf:`** It used to format and print data. - * **`%.2f%:`** By default it prints floating point numbers with 6 decimal places. Use the following format to limit a decimal places. - * **`100-cpu/NR:`** Finally print the ‘CPU Average’ by subtracting 100, divided by the number of records. + * **`top:`** top命令是一种用于查看当前Linux系统下正在运行的进程的非常好的命令。 + * **`-b:`** -b选项,允许top命令切换至批处理的模式。当你从本地系统运行top命令至远程系统时,它将会非常有用。 + * **`-n1:`** 迭代次数 + * **`^%Cpu:`** 过滤以%CPU开头的行。 + * **`awk:`** awk是一种专门用来做文本数据处理的强大命令。 + * **`cpu+=$9:`** 对于每一行,将第9列添加至变量‘cpu'。 + * **`printf:`** 该命令用于格式化和打印数据。 + * **`%.2f%:`** 默认情况下,它打印小数点后保留6位的浮点数。使用后跟的格式来限制小数位数。 + * **`100-cpu/NR:`** 最终打印出’CPU平均占用‘,即用100减去其并除以行数。 From 7c77a24f4bda6b1c6ccfaa8ceaafb0431db3e3c1 Mon Sep 17 00:00:00 2001 From: AnDJ <363787371@qq.com> Date: Wed, 6 Mar 2019 00:33:46 +0800 Subject: [PATCH 453/813] some fixes on article '20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux' --- ...ck CPU, Memory And Swap Utilization Percentage In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index 827dda9629..743392e522 100644 --- a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -28,7 +28,7 @@ 我们可以使用下面命令的组合来达到此目的。在该方法中,我们使用的是`free`和`awk`命令的组合来获取内存占用率。 -如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 **[free命令][1]** , **[smem命令][2]** , **[ps_mem命令][3]** , **[vmstat命令][4]** and **[多种方式来查看物理内存大小][5]**. +如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 **[free命令][1]** , **[smem命令][2]** , **[ps_mem命令][3]** , **[vmstat命令][4]** 及 **[多种方式来查看物理内存大小][5]**. 对于获取不包含百分比符号的`内存`占用率: @@ -129,7 +129,7 @@ Current Swap Utilization is : 0.00% 我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用`top`,`print`和`awk`命令的组合来获取CPU的占用率。 -如果你正在寻找其他有关于CPU(译者勘误,原文为memory)的文章,你可以导航至如下链接。这些文章有 **[top命令][9]** , **[htop命令][10]** , **[atop命令][11]** and **[Glances命令][12]**. +如果你正在寻找其他有关于CPU(译者勘误,原文为memory)的文章,你可以导航至如下链接。这些文章有 **[top命令][9]** , **[htop命令][10]** , **[atop命令][11]** 及 **[Glances命令][12]**. 如果在输出中展示的是多个CPU的情况,那么你需要使用下面的方法。 From 8f9f3f032e9a8b6a7db080566b8b18ac8a74be59 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 6 Mar 2019 09:07:24 +0800 Subject: [PATCH 454/813] translated --- ...nstall Essential Applications On Ubuntu.md | 135 ------------------ ...nstall Essential Applications On Ubuntu.md | 135 ++++++++++++++++++ 2 files changed, 135 insertions(+), 135 deletions(-) delete mode 100644 sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md create mode 100644 translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md diff --git a/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md deleted file mode 100644 index 719511ce27..0000000000 --- a/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An Automated Way To Install Essential Applications On Ubuntu) -[#]: via: (https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -An Automated Way To Install Essential Applications On Ubuntu -====== -![](https://www.ostechnix.com/wp-content/uploads/2019/02/alfred-720x340.png) - -The default Ubuntu installation doesn’t come with all essential applications pre-installed . You may need to spend few hours on Internet or ask any Linux user’s help to find and install the necessary applications for your Ubuntu box. If you’re newbie, then you certainly need to spend more time to learn how to search and install applications either from command line (using apt-get or dpkg) or from the Ubuntu software center. Some users, especially newbies, might want to easily and quickly install every applications they like. If you’re one of them, no worries. In this guide, we will see how to install essential applications on Ubuntu using a simple command line utility called **“Alfred”**. - -Alfred is a free, open source script written in **Python** programming language. It uses **Zenity** to create a simple graphical interface that allows the users to easily select and install the applications of their choice with a few mouse clicks. You need not to spend hours to search for all essential applications, PPAs, debs, AppImage, snaps or flatpaks. Alfred brings all common applications, tools and utilities under one-roof and automatically installs the selected applications. If you’re a newbie who is recently migrated from Windows to Ubuntu Linux, Alfred helps you to do an unattended software installation on a freshly installed Ubuntu system, without much user intervention. Please be mindful that there is also a Mac OS app with similar name, but both serves different purposes. - -### Installing Alfred On Ubuntu - -Alfred installation is easy! Just download the script and launch it. It is that simple. - -``` -$ wget https://raw.githubusercontent.com/derkomai/alfred/master/alfred.py - -$ python3 alfred.py -``` - -Alternatively, download the script using wget as shown above and just move the **alfred.py** file to your $PATH: - -``` -$ sudo cp alfred.py /usr/local/bin/alfred -``` - -Make it executable: - -``` -$ sudo chmod +x /usr/local/bin/alfred -``` - -And, launch it using command: - -``` -$ alfred -``` - -### Easily And Quickly Install Essential Applications On Ubuntu Using Alfred Script - -Launch Alfred script as described in the installation section above. This is how Alfred default interface looks like. - -![][2] - -As you can see, Alfred lists a lot of most commonly used application types such as, - - * Web browsers, - * Mail clients, - * Messengers, - * Cloud storage clients, - * Hardware drivers, - * Codecs, - * Developer tools, - * Android, - * Text editors, - * Git, - * Kernel update tool, - * Audio/video players, - * Screenshot tools, - * Screen recorders, - * Video encoders, - * Streaming apps, - * 3D modelling and animation tools, - * Image viewers and editors, - * CAD software, - * Pdf tools, - * Gaming emulators, - * Disk management tools, - * Encryption tools, - * Password managers, - * Archive tools, - * Ftp software, - * System resource monitors, - * Application launchers and many. - - - -You can pick any one or multiple applications of your choice and install them at once. Here, I am going to install the ‘Developer bundle’, hence I chose it and click OK button. - -![][3] - -Now, Alfred script will automatically add the necessary repositories, ppas on your Ubuntu system and start installing the selected applications. - -![][4] - -Once the installation is completed, you will see the following message. - -![][5] - -Congratulations! The selected packages have been installed. - -You can [**check recently installed applications**][6] on Ubuntu using the following command: - -``` -$ grep " install " /var/log/dpkg.log -``` - -You may need to reboot your system in-order to use some of the installed applications. Similarly, you can install any applications from the list without much hazzle. - -For your information, there is also a similar script named **post_install.sh** written by different developer. It is exactly same as Alfred, but provides a few different set of applications. Please check the following link for more details. - -These two scripts allows the lazy users, especially newbies, to be able to easily and fastly install most common apps, tools, updates, utilities they want to use in their Ubuntu Linux with few mouse clicks away, and stop depending on the help of official or non-official documentations. - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/ - -作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-1.png -[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-2.png -[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-4.png -[5]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-5-1.png -[6]: https://www.ostechnix.com/list-installed-packages-sorted-installation-date-linux/ diff --git a/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md new file mode 100644 index 0000000000..a8adecc72a --- /dev/null +++ b/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Automated Way To Install Essential Applications On Ubuntu) +[#]: via: (https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +在 Ubuntu 上自动化安装基本应用的方法 +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/02/alfred-720x340.png) + +默认的 Ubuntu 安装并未预先安装所有必需的应用。你可能需要在网上花几个小时或者向其他 Linux 用户寻求帮助寻找和安装 Ubuntu 所需的应用。如果你是新手,那么你肯定需要花更多的时间来学习如何从命令行(使用 apt-get 或 dpkg)或从 Ubuntu 软件中心搜索和安装应用。一些用户,特别是新手,可能希望轻松快速地安装他们喜欢的每个应用。如果你是其中之一,不用担心。在本指南中,我们将了解如何使用名为 **“Alfred”** 的简单命令行程序在 Ubuntu 上安装基本应用。 + +Alfred是用 **Python** 语言编写的免费开源脚本。它使用 **Zenity** 创建了一个简单的图形界面,用户只需点击几下鼠标即可轻松选择和安装他们选择的应用。你不必花费数小时来搜索所有必要的应用程序、PPA、deb、AppImage、snap 或 flatpak。Alfred 将所有常见的应用、工具和小程序集中在一起,并自动安装所选的应用。如果你是最近从 Windows 迁移到 Ubuntu Linux 的新手,Alfred 会帮助你在新安装的 Ubuntu 系统上进行无人值守的软件安装,而无需太多用户干预。请注意,还有一个名称相似的 Mac OS 应用,但两者有不同的用途。 + +### 在 Ubuntu 上安装 Alfred + +Alfred 安装很简单!只需下载脚本并启动它。就这么简单。 + +``` +$ wget https://raw.githubusercontent.com/derkomai/alfred/master/alfred.py + +$ python3 alfred.py +``` + +或者,使用 wget 下载脚本,如上所示,只需将 **alfred.py** 移动到 $PATH 中: + +``` +$ sudo cp alfred.py /usr/local/bin/alfred +``` + +使其可执行: + +``` +$ sudo chmod +x /usr/local/bin/alfred +``` + +并使用命令启动它: + +``` +$ alfred +``` + +### 使用 Alfred 脚本轻松快速地在 Ubuntu 上安装基本应用程序 + +按照上面所说启动 Alfred 脚本。这就是 Alfred 默认界面的样子。 + +![][2] + +如你所见,Alfred 列出了许多最常用的应用类型,例如: + + * 网络浏览器, + * 邮件客户端, + * 短消息, + * 云存储客户端, + * 硬件驱动程序, + * 编解码器, + * 开发者工具, + * Android, + * 文本编辑器, + * Git, + * 内核更新工具, + * 音频/视频播放器, + * 截图工具, + * 录屏工具, + * 视频编码器, + * 流媒体应用, + * 3D建模和动画工具, + * 图像查看器和编辑器, + * CAD 软件, + * Pdf 工具, + * 游戏模拟器, + * 磁盘管理工具, + * 加密工具, + * 密码管理器, + * 存档工具, + * Ftp 软件, + * 系统资源监视器, + * 应用启动器等。 + + + +你可以选择任何一个或多个应用并立即安装它们。在这里,我将安装 “Developer bundle”,因此我选择它并单击 OK 按钮。 + +![][3] + +现在,Alfred 脚本将自动你的 Ubuntu 系统上添加必要仓库、PPA 并开始安装所选的应用。 + +![][4] + +安装完成后,不将看到以下消息。 + +![][5] + +恭喜你!已安装选定的软件包。 + +你可以使用以下命令[**在 Ubuntu 上查看最近安装的应用**][6]: + +``` +$ grep " install " /var/log/dpkg.log +``` + +你可能需要重启系统才能使用某些已安装的应用。类似地,你可以方便地安装列表中的任何程序。 + +提示一下,还有一个由不同的开发人员编写的类似脚本,名为 **post_install.sh**。它与 Alfred 完全相同,但提供了一些不同的应用。请查看以下链接获取更多详细信息。 + +这两个脚本能让懒惰的用户,特别是新手,只需点击几下鼠标就能够轻松快速地安装他们想要在 Ubuntu Linux 中使用的大多数常见应用、工具、更新、小程序,而无需依赖官方或者非官方文档的帮助。 + +就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/ + +作者:[SK][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-1.png +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-2.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-4.png +[5]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-5-1.png +[6]: https://www.ostechnix.com/list-installed-packages-sorted-installation-date-linux/ From 23a08787edfe72e2fbae98ce7a9ea17053c3fab9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 6 Mar 2019 09:12:07 +0800 Subject: [PATCH 455/813] translating --- .../tech/20190131 19 days of productivity in 2019- The fails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190131 19 days of productivity in 2019- The fails.md b/sources/tech/20190131 19 days of productivity in 2019- The fails.md index e03a6f4ce0..aa9a1d62fe 100644 --- a/sources/tech/20190131 19 days of productivity in 2019- The fails.md +++ b/sources/tech/20190131 19 days of productivity in 2019- The fails.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9f9da5a5ef206195bddbaf7e92a8a9e924a831f1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 09:46:57 +0800 Subject: [PATCH 456/813] PRF:20190212 Ampersands and File Descriptors in Bash.md --- published/20190212 Ampersands and File Descriptors in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20190212 Ampersands and File Descriptors in Bash.md b/published/20190212 Ampersands and File Descriptors in Bash.md index 7aa1a82018..1458375ae6 100644 --- a/published/20190212 Ampersands and File Descriptors in Bash.md +++ b/published/20190212 Ampersands and File Descriptors in Bash.md @@ -118,7 +118,7 @@ find /etc -iname "*.service" 1> services.txt 2>&1 它再次出现:`&` 发信号通知 Bash `1` 是目标文件描述符。 -标准文件描述符的另一个问题是,当你从一个管道传输到另一个时,你执行此操作的顺序有点违反直觉。例如,按照上面的命令。它看起来像是错误的方式。你也行像这样阅读它:“将输出导向到文件,然后将错误导向到标准输出。” 看起来错误输出会在后面,并且在输出到标准输出(`1`)已经完成时才发送。 +标准文件描述符的另一个问题是,当你从一个管道传输到另一个时,你执行此操作的顺序有点违反直觉。例如,按照上面的命令。它看起来像是错误的方式。你应该像这样阅读它:“将输出导向到文件,然后将错误导向到标准输出。” 看起来错误输出会在后面,并且在输出到标准输出(`1`)已经完成时才发送。 但这不是文件描述符的工作方式。文件描述符不是文件的占位符,而是文件的输入和(或)输出通道。在这种情况下,当你做 `1> services.txt` 时,你的意思是 “打开一个写管道到 `services.txt` 并保持打开状态”。`1` 是你要使用的管道的名称,它将保持打开状态直到该行的结尾。 From 6334600c282d7e9fc2551e25072b85c05972edb4 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:47:18 +0800 Subject: [PATCH 457/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=205=20wa?= =?UTF-8?q?ys=20to=20teach=20kids=20to=20program=20with=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190305=205=20ways=20to=20teach=20kids=20to=20?= =?UTF-8?q?program=20with=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...teach kids to program with Raspberry Pi.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md diff --git a/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md new file mode 100644 index 0000000000..bfd980e56e --- /dev/null +++ b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to teach kids to program with Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/teach-kids-program-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +5 ways to teach kids to program with Raspberry Pi +====== +The fifth article in our guide to getting started with the Raspberry Pi explores resources for helping kids learn to program. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4) + +As countless schools, libraries, and families have proven, the Raspberry Pi is a great way to expose kids to programming. In the first four articles in this series, you've learned about [purchasing][1], [installing][2], and [configuring][3] a Raspberry Pi. In this fifth article, I'll share some helpful resources to get kids started programming with the Raspberry Pi. + +### Scratch + +[Scratch][4] is a great way to introduce kids to basic programming concepts like variables, boolean logic, loops, and more. It's included in Raspbian, and you can find numerous articles and tutorials about Scratch on the internet, including [Is Scratch today like the Logo of the '80s for teaching kids to code?][5] on Opensource.com. + +![](https://opensource.com/sites/default/files/uploads/scratch2.png) + +### Code.org + +[Code.org][6] is another great online resource for kids learning to program. The organization's mission is to expose more people to coding through courses, tutorials, and the popular Hour of Code event. Many schools—including my fifth-grade son's—use it to expose more kids to programming and computer science concepts. + +### Reading + +Reading books is another great way to learn how to program. You don't necessarily need to speak English to learn how to program, but the more you know, the easier it will be, as most programming languages use English keywords to describe the commands. If your English is good enough to follow this Raspberry Pi series, you are most likely well-equipped to read books, forums, and other publications about programming. One book I recommend is [Python for Kids: A Playful Introduction to Programming][7] by Jason Biggs. + +### Raspberry Jam + +Another way to get your kids into programming is by helping them interact with others at meetups. The Raspberry Pi Foundation sponsors events called [Raspberry Jams][8] around the world where kids and adults can join forces and learn together on the Raspberry Pi. If there isn't a Raspberry Jam in your area, the foundation has a [guidebook][9] and other resources to help you start one. + +### Gaming + +Last, but not least, there's a version of [Minecraft][10] for the Raspberry Pi. Minecraft has grown from a multi-player "digital Lego"-like game into a programming platform where anyone can use Python and other languages to build on Minecraft's virtual world. Check out [Getting Started with Minecraft Pi][11] and [Minecraft Hour of Code Tutorials][12]. + +What are your favorite resources for teaching kids to program with Raspberry Pi? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi + +作者:[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/article/19/2/how-buy-raspberry-pi +[2]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi +[3]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[4]: https://scratch.mit.edu/ +[5]: https://opensource.com/article/17/3/logo-scratch-teach-programming-kids +[6]: https://code.org/ +[7]: https://www.amazon.com/Python-Kids-Playful-Introduction-Programming/dp/1593274076 +[8]: https://www.raspberrypi.org/jam/#map-section +[9]: https://static.raspberrypi.org/files/jam/Raspberry-Jam-Guidebook-2017-04-26.pdf +[10]: https://minecraft.net/en-us/edition/pi/ +[11]: https://projects.raspberrypi.org/en/projects/getting-started-with-minecraft-pi +[12]: https://code.org/minecraft From d911e217eeaf258da527206d5b3c8c7b733bacaa Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:50:17 +0800 Subject: [PATCH 458/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=20Runnin?= =?UTF-8?q?g=20the=20=E2=80=98Real=20Debian=E2=80=99=20on=20Raspberry=20Pi?= =?UTF-8?q?=203+=20[For=20DIY=20Enthusiasts]=20sources/tech/20190305=20Run?= =?UTF-8?q?ning=20the=20=E2=80=98Real=20Debian-=20on=20Raspberry=20Pi=203-?= =?UTF-8?q?=20-For=20DIY=20Enthusiasts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- on Raspberry Pi 3- -For DIY Enthusiasts.md | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md diff --git a/sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md b/sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md new file mode 100644 index 0000000000..785a6eeb5a --- /dev/null +++ b/sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Running the ‘Real Debian’ on Raspberry Pi 3+ [For DIY Enthusiasts]) +[#]: via: (https://itsfoss.com/debian-raspberry-pi) +[#]: author: (Shirish https://itsfoss.com/author/shirish/) + +Running the ‘Real Debian’ on Raspberry Pi 3+ [For DIY Enthusiasts] +====== + +If you have ever used a Raspberry Pi device, you probably already know that it recommends a Linux distribution called [Raspbian][1]. + +Raspbian is a heavily customized form of Debian to run on low-powered ARM processors. It’s not bad. In fact, it’s an excellent OS for Raspberry Pi devices but it’s not the real Debian. + +[Debian purists like me][2] would prefer to run the actual Debian over the Raspberry Pi’s customized Debian version. I trust Debian more than any other distribution to provide me a vast amount of properly vetted free software packages. Moreover, a project like this would help other ARM devices as well. + +Above all, running the official Debian on Raspberry Pi is sort of challenge and I like such challenges. + +![Real Debian on Raspberry Pi][3] + +I am not the only one who thinks like this. There are many other Debian users who share the same feeling and this is why there exists an ongoing project to create a [Debian image for Raspberry Pi][4]. + +About two and a half months back, a Debian Developer (DD) named [Gunnar Wolf][5] took over that unofficial Raspberry Pi image generation project. + +I’ll be quickly showing you how can you install this Raspberry Pi Debian Buster preview image on your Raspberry Pi 3 (or higher) devices. + +### Getting Debian on Raspberry Pi [For Experts] + +``` +Warning + +Be aware this Debian image is very raw and unsupported at the moment. Though it’s very new, I believe experienced Raspberry Pi and Debian users should be able to use it. +``` + +Now as far as [Debian][6] is concerned, here is the Debian image and instructions that you could use to put the Debian stock image on your Raspberry pi 3 Model B+. + +#### Step 1: Download the Debian Raspberry Pi Buster image + +You can download the preview images using wget command: + +``` +wget https://people.debian.org/~gwolf/raspberrypi3/20190206/20190206-raspberry-pi-3-buster-PREVIEW.img.xz +``` + +#### Step 2: Verify checksum (optional) + +It’s optional but you should [verify the checksum][7]. You can do that by downloading the SHA256 hashfile and then comparing it with that of the downloaded Raspberry Pi Debian image. + +At my end I had moved both the .sha256 file as img.xz to a directory to make it easier to check although it’s not necessary. + +``` +wget https://people.debian.org/~gwolf/raspberrypi3/20190206/20190206-raspberry-pi-3-buster-PREVIEW.img.xz.sha256 + +sha256sum -c 20190206-raspberry-pi-3-buster-PREVIEW.img.xz.sha256 +``` + +#### Step 3: Write the image to your SD card + +Once you have verified the image, take a look at it. It is around 400MB in the compressed xzip format. You can extract it to get an image of around 1.5GB in size. + +Insert your SD card. **Before you carry on to the next command please change the sdX to a suitable name that corresponds to your SD card.** + +The command basically extracts the img.xz archive to the SD card. The progress switch/flag enables you to see a progress line with a number as to know how much the archive has extracted. + +``` +xzcat 20190206-raspberry-pi-3-buster-PREVIEW.img.xz | dd of=/dev/sdX bs=64k oflag=dsync status=progress$ xzcat 20190206-raspberry-pi-3-buster-PREVIEW.img.xz | dd of=/dev/sdX bs=64k oflag=dsync status=progress +``` + +Once you have successfully flashed your SD card, you should be able test if the installation went ok by sshing into your Raspberry Pi. The default root password is raspberry. + +``` +ssh root@rpi3 +``` + +If you are curious to know how the Raspberry Pi image was built, you can look at the [build scripts][8]. + +You can find more info on the project homepage. + +[DEBIAN RASPBERRY PI IMAGE][15] + +### How to contribute to the Raspberry Pi Buster effort + +There is a mailing list called [debian-arm][9] where people could contribute their efforts and ask questions. As you can see in the list, there is already a new firmware which was released [few days back][10] which might make booting directly a reality instead of the workaround shared above. + +If you want you could make a new image using the raspi3-image-spec shared above or wait for Gunnar to make a new image which might take time. + +Most of the maintainers also hang out at #vmdb2 at #OFTC. You can either use your IRC client or [Riot client][11], register your name at Nickserv and connect with either Gunnar Wolf, Roman Perier or/and Lars Wirzenius, author of [vmdb2][12]. I might do a follow-up on vmdb2 as it’s a nice little tool by itself. + +### The Road Ahead + +If there are enough interest and contributors, for instance, the lowest-hanging fruit would be to make sure that the ARM64 port [wiki page][13] is as current as possible. The benefits are and can be enormous. + +There are a huge number of projects which could benefit from either having a [Pi farm][14] to making your media server or a SiP phone or whatever you want to play/work with. + +Another low-hanging fruit might be synchronization between devices, say an ARM cluster sharing reports to either a Debian desktop by way of notification or on mobile or both ways. + +While I have shared about Raspberry Pi, there are loads of single-board computers on the market already and lot more coming, both from MIPS as well as OpenRISC-V so there is going to plenty of competition in the days ahead. + +Also, OpenRISC-V is and would be open-sourcing lot of its IP so non-free firmware or binary blobs would not be needed. Even MIPS is rumored to be more open which may challenge ARM if MIPS and OpenRISC-V are able to get their logistics and pricing right, but that is a story for another day. + +There are many more vendors, I am just sharing the ones whom I am most interested to see what they come up with. + +I hope the above sheds some light why it makes sense to have Debian on the Raspberry Pi. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debian-raspberry-pi + +作者:[Shirish][a] +选题:[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/shirish/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/downloads/raspbian/ +[2]: https://itsfoss.com/reasons-why-i-love-debian/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/debian-raspberry-pi.png?resize=800%2C450&ssl=1 +[4]: https://wiki.debian.org/RaspberryPi3 +[5]: https://gwolf.org/node/4139 +[6]: https://www.debian.org/ +[7]: https://itsfoss.com/checksum-tools-guide-linux/ +[8]: https://github.com/Debian/raspi3-image-spec +[9]: https://lists.debian.org/debian-arm/2019/02/threads.html +[10]: https://alioth-lists.debian.net/pipermail/pkg-raspi-maintainers/Week-of-Mon-20190225/000310.html +[11]: https://itsfoss.com/riot-desktop/ +[12]: https://liw.fi/vmdb2/ +[13]: https://wiki.debian.org/Arm64Port +[14]: https://raspi.farm/ +[15]: https://wiki.debian.org/RaspberryPi3 From 92aaee54ad9047e0822b0be038c3ad6c11d82532 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:53:26 +0800 Subject: [PATCH 459/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=205=20Wa?= =?UTF-8?q?ys=20To=20Generate=20A=20Random/Strong=20Password=20In=20Linux?= =?UTF-8?q?=20Terminal=20sources/tech/20190305=205=20Ways=20To=20Generate?= =?UTF-8?q?=20A=20Random-Strong=20Password=20In=20Linux=20Terminal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...andom-Strong Password In Linux Terminal.md | 366 ++++++++++++++++++ 1 file changed, 366 insertions(+) create mode 100644 sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md diff --git a/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md b/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md new file mode 100644 index 0000000000..0f12c53e56 --- /dev/null +++ b/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md @@ -0,0 +1,366 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Ways To Generate A Random/Strong Password In Linux Terminal) +[#]: via: (https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-linux-terminal/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +5 Ways To Generate A Random/Strong Password In Linux Terminal +====== + +Recently we had written an article about **[password strength and password score check][1]** in our website. + +It will help you to validate your password strength and score. + +We can manually create few passwords which we required but if you would like to generate a password for multiple users or servers, what will be the solution. + +Yes, there are many utilities are available in Linux to fulfill this requirements. However, I’m going to include the best five password generators in this article. + +These tools are generates a strong random passwords for you. Navigate to the following article if you would like to update the password on multiple users and servers. + +These tools are easy to use, that’s why i preferred to go with it. By default it will generate a strong password and if you would like to generate a super strong password then use the available options. + +It will help you to generate a super strong password in the following combination. It should have minimum 12-15 characters length, that includes Alphabets (Lower case & Upper case), Numbers and Special Characters. + +These tools are below. + + * `pwgen:` The pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. + * `openssl:` The openssl program is a command line tool for using the various cryptography functions of OpenSSL’s crypto library from the shell. + * `gpg:` OpenPGP encryption and signing tool + * `mkpasswd:` generate new password, optionally apply it to a user + * `makepasswd:` makepasswd generates true random passwords using /dev/urandom, with the emphasis on security over pronounceability. + * `/dev/urandom file:` The character special files /dev/random and /dev/urandom (present since Linux 1.3.30) provide an interface to the kernel’s random number generator. + * `md5sum:` md5sum is a computer program that calculates and verifies 128-bit MD5 hashes. + * `sha256sum:` The program sha256sum is designed to verify data integrity using the SHA-256 (SHA-2 family with a digest length of 256 bits). + * `sha1pass:` sha1pass creates a SHA1 password hash. In the absence of a salt value on the command line, a random salt vector will be generated. + + + +### How To Generate A Random Strong Password In Linux Using pwgen Command? + +The pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. + +Human-memorable passwords are never going to be as secure as completely completely random passwords. + +Use `-s` option to generate completely random, hard-to-memorize passwords. These should only be used for machine passwords as we can’t memorize. + +For **`Fedora`** system, use **[DNF Command][2]** to install pwgen. + +``` +$ sudo dnf install pwgen +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install pwgen. + +``` +$ sudo apt install pwgen +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install pwgen. + +``` +$ sudo pacman -S pwgen +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install pwgen. + +``` +$ sudo yum install pwgen +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install pwgen. + +``` +$ sudo zypper install pwgen +``` + +### How To Use pwgen Command In Linux? + +It’s a simple and straight forward method. Use one of the below preferred examples for you. By default, it generates a human memorable password. + +To do so, simple run the `pwgen` command on your terminal. It generates 160 passwords in a single shot. These 160 passwords are printer with 20 rows and 8 columns. + +``` +$ pwgen +ameiK2oo aibi3Cha EPium0Ie aisoh1Ee Nidee9ae uNga0Bee uPh9ieM1 ahn1ooNg +oc5ooTea tai7eKid tae2yieS hiecaiR8 wohY2Ohk Uab2maed heC4aXoh Ob6Nieso +Shaeriu3 uy9Juk5u hoht7Doo Fah6yah3 faz9Jeew eKiek4ju as0Xuosh Eiwo4epo +oot8teeZ Ui1yoohi Aechae7A Ohdi2ael cae5Thoh Au1aeTei ais0aiC2 Cai2quin +Oox9ohz4 neev0Che ahza8AQu Ahz7eica meiBeeW0 Av3bo7ah quoiTu3f taeNg3ae +Aiko7Aiz SheiGh8E aesaeSh7 haet6Loo AeTel3oN Ath7zeer IeYah4ie UG3ootha +Ohch9Och Phuap6su iel5Xu7s diqui7Bu ieF2dier eeluHa1u Thagei0i Ceeth3oh +OCei1ahj zei2aiYo Jahgh1ia ooqu1Cej eez2aiPo Wahd5soo noo7Mei9 Hie5ashe +Uith4Or2 Xie3uh2b fuF9Eilu eiN2sha9 zae2YaSh oGh5ephi ohvao4Ae aixu6aeM +fo4Ierah iephei6A hae9eeGa eiBeiY3g Aic8Kee9 he8AheCh ohM4bid9 eemae3Zu +eesh2EiM cheiGa4j PooV2vii ahpeeg5E aezauX2c Xe7aethu Ahvaph7a Joh2heec +Ii5EeShi aij7Uo8e ooy2Ahth mieKe2ni eiQuu8fe giedaQu0 eiPhob3E oox1uo2U +eehia4Hu ga9Ahw0a ohxuZei7 eV4OoXio Kid2wu1n ku4Ahf5s uigh8uQu AhWoh0po +vo1Eeb2u Ahth7ve5 ieje4eiL ieci1Ach Meephie9 iephieY8 Eesoom7u eakai2Bo +uo8Ieche Zai3aev5 aGhahf0E Wowoo5th Oraeb0ah Gah3nah0 ieGhah0p aeCh0OhJ +ahQu2feZ ahQu0gah foik7Ush cei1Wai1 Aivi3ooY eephei5U MooZae3O quooRoh7 +aequae5U pae6Ceiv eizahF1k ohmi7ETa ahyaeK1N Mohw2no8 ooc8Oone coo7Ieve +eePhei9h Weequ8eV Vie4iezu neeMiim4 ie6aiZoh Queegh2E shahwi3N Inichie8 +Sid1aeji mohj4Ko7 lieDi0pe Zeemah6a thuevu2E phi4Ohsh paiKeix1 ooz1Ceph +ahV4yore ue2laePh fu1eThui qui7aePh Fahth1nu ohk9puLo aiBeez0b Neengai5 +``` + +To generate a secure random password, use `-s` option with pwgen command. + +``` +$ pwgen -s +CU75lgZd 7HzzKgtA 2ktBJDpR F6XJVhBs UjAm3bNL zO7Dw7JJ pxn8fUvp Ka3lLilG +ywJX7iJl D9ajxb6N 78c1HOg2 g8vtWCra Jp6pBGBw oYuev9Vl gbA6gHV8 G6XQoVO5 +uQN98IU4 50GgQfrX FrTsou2t YQorO4x6 UGer8Yi2 O7DB5nw1 1ax370UR 1xVRPkA1 +RVaGDr2i Nt11ekUd 9Vm3D244 ck8Lnpd0 SjDt8uWn 5ERT4tf8 4EONFzyY Jc6T83jg +WZa6bKPW H4HMo1YU bsDDRik3 gBwV7LOW 9H1QRQ4x 3Ak7RcSe IJu2RBF9 e508xrLC +SzTrW191 AslxDa6E IkWWov2b iOb6EmTy qHt82OwG 5ZFO7B53 97zmjOPu A4KZuhYV +uQpoJR4D 0eKyOiUr Rz96smeO 3HTABu3N 6W0VmEls uPsp5zpw 8UD3VkMG YTct6Rd4 +VKo0cVmq E07ZX7j9 kQSlvA69 Nm3fpv3i xWvF2xMu yEfcw8uA oQGVX3l9 grTzx7Xj +s4GVEYtM uJl5sYMe n3icRPiY ED3Mup4B k3M9KHI7 IkxqoSM0 dt2cxmMU yb2tUkut +2Q9wGZQx 8Rpo11s9 I13siOHu 7GV64Fjv 3VONzD8i SCDfVD3F oiPTx239 6BQakoiJ +XUEokiC4 ybL7VGmL el2RfvWk zKc7CLcE 3FqNBSyA NjDWrvZ5 KI3NSX4h VFyo6VPr +h4q3XeqZ FDYMoX6f uTU5ZzU3 6u4ob4Ep wiYPt05n CZga66qh upzH6Z9y RuVcqbe8 +taQv11hq 1xsY67a8 EVo9GLXA FCaDLGb1 bZyh0YN8 0nTKo0Qy RRVUwn9t DuU8mwwv +x96LWpCb tFLz3fBG dNb4gCKf n6VYcOiH 1ep6QYFZ x8kaJtrY 56PDWuW6 1R0If4kV +2XK0NLQK 4XQqhycl Ip08cn6c Bnx9z2Bz 7gjGlON7 CJxLR1U4 mqMwir3j ovGXWu0z +MfDjk5m8 4KwM9SAN oz0fZ5eo 5m8iRtco oP5BpLh0 Z5kvwr1W f34O2O43 hXao1Sp8 +tKoG5VNI f13fuYvm BQQn8MD3 bmFSf6Mf Z4Y0o17U jT4wO1DG cz2clBES Lr4B3qIY +ArKQRND6 8xnh4oIs nayiK2zG yWvQCV3v AFPlHSB8 zfx5bnaL t5lFbenk F2dIeBr4 +C6RqDQMy gKt28c9O ZCi0tQKE 0Ekdjh3P ox2vWOMI 14XF4gwc nYA0L6tV rRN3lekn +lmwZNjz1 4ovmJAr7 shPl9o5f FFsuNwj0 F2eVkqGi 7gw277RZ nYE7gCLl JDn05S5N +``` + +If you would like to generate a strong five passwords with 14 characters length, use the following format. + +``` +$ pwgen -s 14 5 +7YxUwDyfxGVTYD em2NT6FceXjPfT u8jlrljbrclcTi IruIX3Xu0TFXRr X8M9cB6wKNot1e +``` + +If you really want to generate a super strong random twenty passwords, use the following format. + +``` +$ pwgen -cnys 14 20 +mQ3E=vfGfZ,5[B #zmj{i5|ZS){jg Ht_8i7OqJ%N`~2 443fa5iJ\W-L?] ?Qs$o=vz2vgQBR +^'Ry0Az|J9p2+0 t2oA/n7U_'|QRx EsX*%_(4./QCRJ ACr-,8yF9&eM[* !Xz1C'bw?tv50o +8hfv-fK(VxwQGS q!qj?sD7Xmkb7^ N#Zp\_Y2kr%!)~ 4*pwYs{bq]Hh&Y |4u=-Q1!jS~8=; +]{$N#FPX1L2B{h I|01fcK.z?QTz" l~]JD_,W%5bp.E +i2=D3;BQ}p+$I n.a3,.D3VQ3~&i +``` + +### How To Generate A Random Strong Password In Linux Using openssl Command? + +The openssl program is a command line tool for using the various cryptography functions of OpenSSL’s crypto library from the shell. + +Run the openssl command with the following format to generate a random strong password with 14 characters. + +``` +$ openssl rand -base64 14 +WjzyDqdkWf3e53tJw/c= +``` + +If you would like to generate ten random strong password with 14 characters using openssl command then use the following for loop. + +``` +$ for pw in {1..10}; do openssl rand -base64 14; done +6i0hgHDBi3ohZ9Mil8I= +gtn+y1bVFJFanpJqWaA= +rYu+wy+0nwLf5lk7TBA= +xrdNGykIzxaKDiLF2Bw= +cltejRkDPdFPC/zI0Pg= +G6aroK6d4xVVYFTrZGs= +jJEnFoOk1+UTSx/wJrY= +TFxVjBmLx9aivXB3yxE= +oQtOLPwTuO8df7dIv9I= +ktpBpCSQFOD+5kIIe7Y= +``` + +### How To Generate A Random Strong Password In Linux Using gpg Command? + +gpg is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool to provide digital encryption and signing services using the OpenPGP standard. gpg features complete key management and all the bells and whistles you would expect from a full OpenPGP implementation. + +Run the gpg command with the following format to generate a random strong password with 14 characters. + +``` +$ gpg --gen-random --armor 1 14 +or +$ gpg2 --gen-random --armor 1 14 +jq1mtY4gBa6gIuJrggM= +``` + +If you would like to generate ten random strong password with 14 characters using gpg command then use the following for loop. + +``` +$ for pw in {1..10}; do gpg --gen-random --armor 1 14; done +or +$ for pw in {1..10}; do gpg2 --gen-random --armor 1 14; done +F5ZzLSUMet2kefG6Ssc= +8hh7BFNs8Qu0cnrvHrY= +B+PEt28CosR5xO05/sQ= +m21bfx6UG1cBDzVGKcE= +wALosRXnBgmOC6+++xU= +TGpjT5xRxo/zFq/lNeg= +ggsKxVgpB/3aSOY15W4= +iUlezWxL626CPc9omTI= +pYb7xQwI1NTlM2rxaCg= +eJjhtA6oHhBrUpLY4fM= +``` + +### How To Generate A Random Strong Password In Linux Using mkpasswd Command? + +mkpasswd generates passwords and can apply them automatically to users. With no arguments, mkpasswd returns a new password. It’s part of an expect package so, you have to install expect package to use mkpasswd command. + +For **`Fedora`** system, use **[DNF Command][2]** to install mkpasswd. + +``` +$ sudo dnf install expect +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install mkpasswd. + +``` +$ sudo apt install expect +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install mkpasswd. + +``` +$ sudo pacman -S expect +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install mkpasswd. + +``` +$ sudo yum install expect +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install mkpasswd. + +``` +$ sudo zypper install expect +``` + +Run the `mkpasswd` command in terminal to generate a random password. + +``` +$ mkpasswd +37_slQepD +``` + +Run the mkpasswd command with the following format to generate a random strong password with 14 characters. + +``` +$ mkpasswd -l 14 +W1qP1uv=lhghgh +``` + +Run the mkpasswd command with the following format to generate a random strong password with 14 characters. It combinations of alphabetic (Lower & Upper case), Numeric number and special characters. + +``` +$ mkpasswd -l 14 -d 3 -C 3 -s 3 +3aad!bMWG49"t, +``` + +If you would like to generate ten random strong password with 14 characters (It combination of alphabetic (Lower & Upper case), Numeric number and special characters) using mkpasswd command then use the following for loop. + +``` +$ for pw in {1..10}; do mkpasswd -l 14 -d 3 -C 3 -s 3; done +zmSwP[q9;P1r6[ +E42zcvzM"i3%B\ +8}1#[email protected] +0X:zB(mmU22?nj +0sqqL44M}ko(O^ +43tQ(.6jG;ceRq +-jB6cp3x1GZ$e= +$of?Rj9kb2N(1J +9HCf,nn#gjO79^ +Tu9m56+Ev_Yso( +``` + +### How To Generate A Random Strong Password In Linux Using makepasswd Command? + +makepasswd generates true random passwords using /dev/urandom, with the emphasis on security over pronounceability. It can also encrypt plaintext passwords given on the command line. + +Run the `makepasswd` command in terminal to generate a random password. + +``` +$ makepasswd +HdCJafVaN +``` + +Run the makepasswd command with the following format to generate a random strong password with 14 characters. + +``` +$ makepasswd --chars 14 +HxJDv5quavrqmU +``` + +Run the makepasswd command with the following format to generate ten random strong password with 14 characters. + +``` +$ makepasswd --chars 14 --count 10 +TqmKVWnRGeoVNr +mPV2P98hLRUsai +MhMXPwyzYi2RLo +dxMGgLmoFpYivi +8p0G7JvJjd6qUP +7SmX95MiJcQauV +KWzrh5npAjvNmL +oHPKdq1uA9tU85 +V1su9GjU2oIGiQ +M2TMCEoahzLNYC +``` + +### How To Generate A Random Strong Password In Linux Using Multiple Commands? + +Still if you are looking other options then you can use the following utilities to generate a random password in Linux. + +**Using md5sum:** md5sum is a computer program that calculates and verifies 128-bit MD5 hashes. + +``` +$ date | md5sum +9baf96fb6e8cbd99601d97a5c3acc2c4 - +``` + +**Using /dev/urandom:** The character special files /dev/random and /dev/urandom (present since Linux 1.3.30) provide an interface to the kernel’s random number generator. File /dev/random has major device number 1 and minor device number 8. File /dev/urandom has major device number 1 and minor device number 9. + +``` +$ cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 14 +15LQB9J84Btnzz +``` + +**Using sha256sum:** The program sha256sum is designed to verify data integrity using the SHA-256 (SHA-2 family with a digest length of 256 bits). + +``` +$ date | sha256sum +a114ae5c458ae0d366e1b673d558d921bb937e568d9329b525cf32290478826a - +``` + +**Using sha1pass:** sha1pass creates a SHA1 password hash. In the absence of a salt value on the command line, a random salt vector will be generated. + +``` +$ sha1pass +$4$9+JvykOv$e7U0jMJL2yBOL+RVa2Eke8SETEo$ +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-linux-terminal/ + +作者:[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-check-password-complexity-strength-and-score-in-linux/ +[2]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[3]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From 1ded72a0b5cc165daa2eedc6257a3f15db2f4e7a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:57:43 +0800 Subject: [PATCH 460/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20Learn?= =?UTF-8?q?=20Linux=20with=20the=20Raspberry=20Pi=20sources/tech/20190304?= =?UTF-8?q?=20Learn=20Linux=20with=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90304 Learn Linux with the Raspberry Pi.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sources/tech/20190304 Learn Linux with the Raspberry Pi.md diff --git a/sources/tech/20190304 Learn Linux with the Raspberry Pi.md b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md new file mode 100644 index 0000000000..079e42dbc1 --- /dev/null +++ b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn Linux with the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/learn-linux-raspberry-pi) +[#]: author: (Andersn Silva https://opensource.com/users/ansilva) + +Learn Linux with the Raspberry Pi +====== +The fourth article in our guide to getting started with the Raspberry Pi dives into the Linux command line. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) + +In the [third article][1] in this series on getting started with Raspberry Pi, I shared info on installing Raspbian, the official version of Linux for Raspberry Pi. Now that you've installed Raspbian and booted up your new Pi, you're ready to start learning about Linux. + +It's impossible to tackle a topic as big as "how to use Linux" in a short article like this, so instead I'll give you some ideas about how you can use the Raspberry Pi to learn more about Linux in general. + +Start by spending time on the command line (aka the "terminal"). Linux [window managers][2] and graphical interfaces have come a long way since the mid-'90s. Nowadays you can use Linux by pointing-and-clicking on things, just as easily as you can in other operating systems. In my opinion, there is a difference between just "using Linux" and being "a Linux user," and the latter means at a minimum being able to navigate in the terminal. + +![](https://opensource.com/sites/default/files/uploads/man-terminal.png) + +If you want to become a Linux user, start by trying out the following on the command line: + + * Navigate your home directory with commands like **ls** , **cd** , and **pwd**. + * Create, delete, and rename directories using the **mkdir** , **rm** , **mv** , and **cp** commands. + * Create a text file with a command line editor such as Vi, Vim, Emacs, or Nano. + * Try out some other useful commands, such as **chmod** , **chown** , **w** , **cat** , **more** , **less** , **tail** , **free** , **df** , **ps** , **uname** , and **kill** + * Look around **/bin** and **/usr/bin** for other commands. + + + +The best way to get help with a command is by reading its "man page" (short for manual); type **man ** on the command line to pull it up. And make sure to search the internet for Linux command cheat sheets—you should find a lot of options that will help you learn. + +Raspbian, like most Linux distributions, has many commands and over time you will end up using some commands a lot more than others. I've been using Linux on the command line for over two decades, and there are still some commands that I've never used, even ones that have been around as long as I've been using Linux. + +At the end of the day, you can use your graphical interface environment to get work done faster, but make sure to dive into the Linux command line, for that's where you will get the true power and knowledge of the operating system. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/learn-linux-raspberry-pi + +作者:[Andersn 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/article/19/2/how-boot-new-raspberry-pi +[2]: https://opensource.com/article/18/8/window-manager From 1bf6f5a8e063de670de838f6b4d3096b35d3c3d3 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 13:00:51 +0800 Subject: [PATCH 461/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20What?= =?UTF-8?q?=20you=20need=20to=20know=20about=20Ansible=20modules=20sources?= =?UTF-8?q?/tech/20190304=20What=20you=20need=20to=20know=20about=20Ansibl?= =?UTF-8?q?e=20modules.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... you need to know about Ansible modules.md | 311 ++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 sources/tech/20190304 What you need to know about Ansible modules.md diff --git a/sources/tech/20190304 What you need to know about Ansible modules.md b/sources/tech/20190304 What you need to know about Ansible modules.md new file mode 100644 index 0000000000..8330d4bd59 --- /dev/null +++ b/sources/tech/20190304 What you need to know about Ansible modules.md @@ -0,0 +1,311 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you need to know about Ansible modules) +[#]: via: (https://opensource.com/article/19/3/developing-ansible-modules) +[#]: author: (Jairo da Silva Junior https://opensource.com/users/jairojunior) + +What you need to know about Ansible modules +====== +Learn how and when to develop custom modules for Ansible. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_container_block.png?itok=S8MbXEYw) + +Ansible works by connecting to nodes and sending small programs called modules to be executed remotely. This makes it a push architecture, where configuration is pushed from Ansible to servers without agents, as opposed to the pull model, common in agent-based configuration management systems, where configuration is pulled. + +These modules are mapped to resources and their respective states, which are represented in YAML files. They enable you to manage virtually everything that has an API, CLI, or configuration file you can interact with, including network devices like load balancers, switches, firewalls, container orchestrators, containers themselves, and even virtual machine instances in a hypervisor or in a public (e.g., AWS, GCE, Azure) and/or private (e.g., OpenStack, CloudStack) cloud, as well as storage and security appliances and system configuration. + +With Ansible's batteries-included model, hundreds of modules are included and any task in a playbook has a module behind it. + +The contract for building modules is simple: JSON in the stdout. The configurations declared in YAML files are delivered over the network via SSH/WinRM—or any other connection plugin—as small scripts to be executed in the target server(s). Modules can be written in any language capable of returning JSON, although most Ansible modules (except for Windows PowerShell) are written in Python using the Ansible API (this eases the development of new modules). + +Modules are one way of expanding Ansible capabilities. Other alternatives, like dynamic inventories and plugins, can also increase Ansible's power. It's important to know about them so you know when to use one instead of the other. + +Plugins are divided into several categories with distinct goals, like Action, Cache, Callback, Connection, Filters, Lookup, and Vars. The most popular plugins are: + + * **Connection plugins:** These implement a way to communicate with servers in your inventory (e.g., SSH, WinRM, Telnet); in other words, how automation code is transported over the network to be executed. + * **Filters plugins:** These allow you to manipulate data inside your playbook. This is a Jinja2 feature that is harnessed by Ansible to solve infrastructure-as-code problems. + * **Lookup plugins:** These fetch data from an external source (e.g., env, file, Hiera, database, HashiCorp Vault). + + + +Ansible's official docs are a good resource on [developing plugins][1]. + +### When should you develop a module? + +Although many modules are delivered with Ansible, there is a chance that your problem is not yet covered or it's something too specific—for example, a solution that might make sense only in your organization. Fortunately, the official docs provide excellent guidelines on [developing modules][2]. + +**IMPORTANT:** Before you start working on something new, always check for open pull requests, ask developers at #ansible-devel (IRC/Freenode), or search the [development list][3] and/or existing [working groups][4] to see if a module exists or is in development. + +Signs that you need a new module instead of using an existing one include: + + * Conventional configuration management methods (e.g., templates, file, get_url, lineinfile) do not solve your problem properly. + * You have to use a complex combination of commands, shells, filters, text processing with magic regexes, and API calls using curl to achieve your goals. + * Your playbooks are complex, imperative, non-idempotent, and even non-deterministic. + + + +In the ideal scenario, the tool or service already has an API or CLI for management, and it returns some sort of structured data (JSON, XML, YAML). + +### Identifying good and bad playbooks + +> "Make love, but don't make a shell script in YAML." + +So, what makes a bad playbook? + +``` +- name: Read a remote resource +   command: "curl -v http://xpto/resource/abc" + register: resource + changed_when: False + + - name: Create a resource in case it does not exist +   command: "curl -X POST http://xpto/resource/abc -d '{ config:{ client: xyz, url: http://beta, pattern: core.md Dict.md lctt2014.md lctt2016.md lctt2018.md README.md } }'" +   when: "resource.stdout | 404" + + # Leave it here in case I need to remove it hehehe + #- name: Remove resource + #  command: "curl -X DELETE http://xpto/resource/abc" + #  when: resource.stdout == 1 +``` + +Aside from being very fragile—what if the resource state includes a 404 somewhere?—and demanding extra code to be idempotent, this playbook can't update the resource when its state changes. + +Playbooks written this way disrespect many infrastructure-as-code principles. They're not readable by human beings, are hard to reuse and parameterize, and don't follow the declarative model encouraged by most configuration management tools. They also fail to be idempotent and to converge to the declared state. + +Bad playbooks can jeopardize your automation adoption. Instead of harnessing configuration management tools to increase your speed, they have the same problems as an imperative automation approach based on scripts and command execution. This creates a scenario where you're using Ansible just as a means to deliver your old scripts, copying what you already have into YAML files. + +Here's how to rewrite this example to follow infrastructure-as-code principles. + +``` +- name: XPTO +  xpto: +    name: abc +    state: present +    config: +      client: xyz +      url: http://beta +      pattern: "*.*" +``` + +The benefits of this approach, based on custom modules, include: + + * It's declarative—resources are properly represented in YAML. + * It's idempotent. + * It converges from the declared state to the current state. + * It's readable by human beings. + * It's easily parameterized or reused. + + + +### Implementing a custom module + +Let's use [WildFly][5], an open source Java application server, as an example to introduce a custom module for our not-so-good playbook: + +``` + - name: Read datasource +   command: "jboss-cli.sh -c '/subsystem=datasources/data-source=DemoDS:read-resource()'" +   register: datasource + + - name: Create datasource +   command: "jboss-cli.sh -c '/subsystem=datasources/data-source=DemoDS:add(driver-name=h2, user-name=sa, password=sa, min-pool-size=20, max-pool-size=40, connection-url=.jdbc:h2:mem:demo;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE..)'" +   when: 'datasource.stdout | outcome => failed' +``` + +Problems: + + * It's not declarative. + * JBoss-CLI returns plaintext in a JSON-like syntax; therefore, this approach is very fragile, since we need a type of parser for this notation. Even a seemingly simple parser can be too complex to treat many [exceptions][6]. + * JBoss-CLI is just an interface to send requests to the management API (port 9990). + * Sending an HTTP request is more efficient than opening a new JBoss-CLI session, connecting, and sending a command. + * It does not converge to the desired state; it only creates the resource when it doesn't exist. + + + +A custom module for this would look like: + +``` +- name: Configure datasource +      jboss_resource: +        name: "/subsystem=datasources/data-source=DemoDS" +        state: present +        attributes: +          driver-name: h2 +          connection-url: "jdbc:h2:mem:demo;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE" +          jndi-name: "java:jboss/datasources/DemoDS" +          user-name: sa +          password: sa +          min-pool-size: 20 +          max-pool-size: 40 +``` + +This playbook is declarative, idempotent, more readable, and converges to the desired state regardless of the current state. + +### Why learn to build custom modules? + +Good reasons to learn how to build custom modules include: + + * Improving existing modules + * You have bad playbooks and want to improve them, or … + * You don't, but want to avoid having bad playbooks. + * Knowing how to build a module considerably improves your ability to debug problems in playbooks, thereby increasing your productivity. + + + +> "…abstractions save us time working, but they don't save us time learning." —Joel Spolsky, [The Law of Leaky Abstractions][7] + +#### Custom Ansible modules 101 + + * JSON (JavaScript Object Notation) in stdout: that's the contract! + * They can be written in any language, but … + * Python is usually the best option (or the second best) + * Most modules delivered with Ansible ( **lib/ansible/modules** ) are written in Python and should support compatible versions. + + + +#### The Ansible way + + * First step: + +``` +git clone https://github.com/ansible/ansible.git +``` + + * Navigate in **lib/ansible/modules/** and read the existing modules code. + + * Your tools are: Git, Python, virtualenv, pdb (Python debugger) + + * For comprehensive instructions, consult the [official docs][8]. + + + + +#### An alternative: drop it in the library directory + +``` +library/                  # if any custom modules, put them here (optional) +module_utils/             # if any custom module_utils to support modules, put them here (optional) +filter_plugins/           # if any custom filter plugins, put them here (optional) + +site.yml                  # master playbook +webservers.yml            # playbook for webserver tier +dbservers.yml             # playbook for dbserver tier + +roles/ +    common/               # this hierarchy represents a "role" +        library/          # roles can also include custom modules +        module_utils/     # roles can also include custom module_utils +        lookup_plugins/   # or other types of plugins, like lookup in this case +``` + + * It's easier to start. + * Doesn't require anything besides Ansible and your favorite IDE/text editor. + * This is your best option if it's something that will be used internally. + + + +**TIP:** You can use this directory layout to overwrite existing modules if, for example, you need to patch a module. + +#### First steps + +You could do it in your own—including using another language—or you could use the AnsibleModule class, as it is easier to put JSON in the stdout ( **exit_json()** , **fail_json()** ) in the way Ansible expects ( **msg** , **meta** , **has_changed** , **result** ), and it's also easier to process the input ( **params[]** ) and log its execution ( **log()** , **debug()** ). + +``` +def main(): + +  arguments = dict(name=dict(required=True, type='str'), +                  state=dict(choices=['present', 'absent'], default='present'), +                  config=dict(required=False, type='dict')) + +  module = AnsibleModule(argument_spec=arguments, supports_check_mode=True) +  try: +      if module.check_mode: +          # Do not do anything, only verifies current state and report it +          module.exit_json(changed=has_changed, meta=result, msg='Fez alguma coisa ou não...') + +      if module.params['state'] == 'present': +          # Verify the presence of a resource +          # Desired state `module.params['param_name'] is equal to the current state? +          module.exit_json(changed=has_changed, meta=result) + +      if module.params['state'] == 'absent': +          # Remove the resource in case it exists +          module.exit_json(changed=has_changed, meta=result) + +  except Error as err: +      module.fail_json(msg=str(err)) +``` + +**NOTES:** The **check_mode** ("dry run") allows a playbook to be executed or just verifies if changes are required, but doesn't perform them. **** Also, the **module_utils** directory can be used for shared code among different modules. + +For the full Wildfly example, check [this pull request][9]. + +### Running tests + +#### The Ansible way + +The Ansible codebase is heavily tested, and every commit triggers a build in its continuous integration (CI) server, [Shippable][10], which includes linting, unit tests, and integration tests. + +For integration tests, it uses containers and Ansible itself to perform the setup and verify phase. Here is a test case (written in Ansible) for our custom module's sample code: + +``` +- name: Configure datasource + jboss_resource: +   name: "/subsystem=datasources/data-source=DemoDS" +   state: present +   attributes: +     connection-url: "jdbc:h2:mem:demo;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE" +     ... + register: result + +- name: assert output message that datasource was created + assert: +   that: +      - "result.changed == true" +      - "'Added /subsystem=datasources/data-source=DemoDS' in result.msg" +``` + +#### An alternative: bundling a module with your role + +Here is a [full example][11] inside a simple role: + +``` +[*Molecule*]() + [*Vagrant*]() + [*pytest*](): `molecule init` (inside roles/) +``` + +It offers greater flexibility to choose: + + * Simplified setup + * How to spin up your infrastructure: e.g., Vagrant, Docker, OpenStack, EC2 + * How to verify your infrastructure tests: Testinfra and Goss + + + +But your tests would have to be written using pytest with Testinfra or Goss, instead of plain Ansible. If you'd like to learn more about testing Ansible roles, see my article about [using Molecule][12]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/developing-ansible-modules + +作者:[Jairo da Silva Junior][a] +选题:[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/jairojunior +[b]: https://github.com/lujun9972 +[1]: https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html#developing-plugins +[2]: https://docs.ansible.com/ansible/latest/dev_guide/developing_modules.html +[3]: https://groups.google.com/forum/#!forum/ansible-devel +[4]: https://github.com/ansible/community/ +[5]: http://www.wildfly.org/ +[6]: https://tools.ietf.org/html/rfc7159 +[7]: https://en.wikipedia.org/wiki/Leaky_abstraction#The_Law_of_Leaky_Abstractions +[8]: https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#developing-modules-general +[9]: https://github.com/ansible/ansible/pull/43682/files +[10]: https://app.shippable.com/github/ansible/ansible/dashboard +[11]: https://github.com/jairojunior/ansible-role-jboss/tree/with_modules +[12]: https://opensource.com/article/18/12/testing-ansible-roles-molecule From 7a185f1040618c7636c33f597c8da2c10e957f15 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 13:04:45 +0800 Subject: [PATCH 462/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20How=20?= =?UTF-8?q?to=20use=20sudo=20access=20in=20winSCP=20sources/tech/20190301?= =?UTF-8?q?=20How=20to=20use=20sudo=20access=20in=20winSCP.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190301 How to use sudo access in winSCP.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190301 How to use sudo access in winSCP.md diff --git a/sources/tech/20190301 How to use sudo access in winSCP.md b/sources/tech/20190301 How to use sudo access in winSCP.md new file mode 100644 index 0000000000..750c37e318 --- /dev/null +++ b/sources/tech/20190301 How to use sudo access in winSCP.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use sudo access in winSCP) +[#]: via: (https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/) +[#]: author: (kerneltalks https://kerneltalks.com) + +How to use sudo access in winSCP +====== + +Learn how to use sudo access in winSCP with screenshots. + +![How to use sudo access in winSCP][1]sudo access in winSCP + +First of all you need to check where is your SFTP server binary located on server you are trying to connect with winSCP. + +You can check SFTP server binary location with below command – + +``` +[root@kerneltalks ~]# cat /etc/ssh/sshd_config |grep -i sftp-server +Subsystem sftp /usr/libexec/openssh/sftp-server +``` + +Here you can see sftp server binary is located at `/usr/libexec/openssh/sftp-server` + +Now open winSCP and click `Advanced` button to open up advanced settings. + +![winSCP advance settings][2] +winSCP advance settings + +It will open up advanced setting window like one below. Here select `SFTP `under `Environment` on left hand side panel. You will be presented with option on right hand side. + +Now, add SFTP server value here with command `sudo su -c` here as displayed in screenshot below – + +![SFTP server setting in winSCP][3] +SFTP server setting in winSCP + +So we added `sudo su -c /usr/libexec/openssh/sftp-server` in settings here. Now click Ok and connect to server as you normally do. + +After connection you will be able to transfer files from directory where you normally need sudo permission to access. + +That’s it! You logged to server using winSCP and sudo access. + +-------------------------------------------------------------------------------- + +via: https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/ + +作者:[kerneltalks][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://kerneltalks.com +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/kerneltalks.com/wp-content/uploads/2019/03/How-to-use-sudo-access-in-winSCP.png?ssl=1 +[2]: https://i0.wp.com/kerneltalks.com/wp-content/uploads/2019/03/winscp-advanced-settings.jpg?ssl=1 +[3]: https://i1.wp.com/kerneltalks.com/wp-content/uploads/2019/03/SFTP-server-setting-in-winSCP.jpg?ssl=1 From c20d2b40c0e64ea77b2d805a83b12d82af73614d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 6 Mar 2019 13:30:03 +0800 Subject: [PATCH 463/813] Translating 7 steps for hunting down Python code bugs. --- ...steps for hunting down Python code bugs.md | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index ab4c13c862..04d302964c 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -9,37 +9,38 @@ 7 步检查 Python 代码错误 ====== -了解一些技巧来减少你花费在寻找代码失败原因的时间。 +了解一些技巧助你减少代码查错时间。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) 在周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经移动了的通知。 -结果这些日志被转移到你获取不到的地方,但他们正在转移到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。它应该会在几天内完成。我知道,这完全不符合实际情况,对吧?然而不,日志或者日志消息似乎经常在错误的时间出现缺少。在我们追踪错误前,一个忠告:经常检查你的日志保证他们在你认为它们该在的地方并记录你认为它们该记的东西。当你不看的时候,这些东西会发生令人惊讶的变化。 +结果这些日志被转移到了你获取不到的地方,但他们正在导到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。这个应用预计会在几天内完成。我知道,这完全不符合实际情况,对吧?然而并不是,日志或者日志消息似乎经常在错误的时间出现缺失。在我们开始查错前,一个忠告:经常检查你的日志以确保他们在你认为它们应该在的地方并记录你认为它们应该记的东西。当你不检查的时候,这些东西往往会发生令人惊讶的变化。 -好的,所以你寻找了日志或者尝试了呼叫运维,而客户确实发现了一个错误。可能你甚至认为你知道错误在哪儿。 +好的,你找到了日志或者尝试了呼叫运维人员,而客户确实发现了一个错误。甚至你可能认为你知道错误在哪儿。 -你立即打开你认为可能有问题的文件并开始寻找。 +你立即打开你认为可能有问题的文件并开始查错。 ### 1. 不要碰你的代码 -阅读代码,你甚至可能会想出一个假设。但是在开始修改你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有疑问,目前你还没能准确地知道问题在哪儿。 +阅读代码,你甚至可能会想到一个假设。但是在开始修改你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有其他疑问,目前你还没能准确地知道问题在哪儿。 -确保这个测试是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。当我尝试着重现这个失败的调用时,我不准备说我创建了一个测试,但是,对的,我已经创建了,但我不认为这是特别不寻常的。从自己的错误中吸取教训。 +确保这个测试是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。当我尝试着重现这个失败的调用时,我不准备说我创建了一个新测试,但是,对的,我确实已经创建了新的一个测试,但我不认为这是特别不寻常的。从自己的错误中吸取教训。 ### 2. 编写错误的测试 现在,你有了一个失败的测试或者可能是一个带有错误的测试,那么是时候解决问题了。但是在你开干之前,让我们先检查下调用栈,因为这样可以更轻松地解决问题。 -调用栈包括你已经启动但尚未完成地所有任务。所以,比如你正在烤蛋糕并准备往面糊里加面粉,那你的调用栈将是: +调用栈包括你已经启动但尚未完成地所有任务。因此,比如你正在烤蛋糕并准备往面糊里加面粉,那你的调用栈将是: + * 做蛋糕 * 打面糊 * 加面粉 -你已经开始做蛋糕,你已经开始打面糊,而你现在正在加面粉。锅底抹油不在这个列表中因为你已经做完了,而做糖霜不在这个列表上因为你还没开始做。 +你已经开始做蛋糕,开始打面糊,而你现在正在加面粉。往锅底抹油不在这个列表中因为你已经完成了,而做糖霜不在这个列表上因为你还没开始做。 如果你对调用栈不清楚,我强烈建议你使用 [Python Tutor][1],它能帮你在执行代码时观察调用栈。 -现在,如果你的 Python 程序出现了错误,接收器会帮你打印出当前调用栈。这意味着无论那一时刻程序在做什么,很明显调用栈的底部发生了错误。 +现在,如果你的 Python 程序出现了错误,接收器会帮你打印出当前调用栈。这意味着无论那一时刻程序在做什么,很明显错误发生在调用栈的底部。 ### 3. 始终先检查 stack 的底部 @@ -86,9 +87,9 @@ Pdb, 一个 Python 调试器。 ### 7. 寻求帮助 -I often find that just writing down all the information triggers a thought about something I have not tried yet. Sometimes, of course, I realize what the problem is immediately after hitting the submit button. At any rate, if you still have not thought of anything after writing everything down, try sending an email to someone. First, try colleagues or other people involved in your project, then move on to project email lists. Don't be afraid to ask for help. Most people are kind and helpful, and I have found that to be especially true in the Python community. +我经常发现写下所以信息会引发我对还没尝试过的东西的思考。当然,有时候我在点击提交按钮后立刻意识到问题是是什么。无论如何,当你在写下所有东西仍一无所获,那就试着向他人发邮件。首先是你的同事或者其他参与你的项目的人,然后是项目的邮件列表。不要害怕向人求助。大多数人都是友善和乐于助人的,我发现在 Python 社区里尤其如此。 -Maria McKinley 将在 [PyCascades 2019][4] 发表[代码查错][3],二月 23-24,西雅图。 +Maria McKinley 将在 [PyCascades 2019][4] 发表[代码查错][3],二月 23-24,于西雅图。 -------------------------------------------------------------------------------- @@ -96,7 +97,7 @@ via: https://opensource.com/article/19/2/steps-hunting-code-python-bugs 作者:[Maria Mckinley][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[LazyWolfLin](https://github.com/LazyWolfLin) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3d0ec9a712ea319d477a826783e039687698cbdb Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:39:40 +0800 Subject: [PATCH 464/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20How=20?= =?UTF-8?q?to=20Install=20MongoDB=20on=20Ubuntu=20sources/tech/20190304=20?= =?UTF-8?q?How=20to=20Install=20MongoDB=20on=20Ubuntu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190304 How to Install MongoDB on Ubuntu.md | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 sources/tech/20190304 How to Install MongoDB on Ubuntu.md diff --git a/sources/tech/20190304 How to Install MongoDB on Ubuntu.md b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md new file mode 100644 index 0000000000..5dad6b0b54 --- /dev/null +++ b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install MongoDB on Ubuntu) +[#]: via: (https://itsfoss.com/install-mongodb-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Install MongoDB on Ubuntu +====== + +**This tutorial presents two ways to install MongoDB on Ubuntu and Ubuntu-based Linux distributions.** + +[MongoDB][1] is an increasingly popular free and open-source NoSQL database that stores data in collections of JSON-like, flexible documents, in contrast to the usual table approach you’ll find in SQL databases. + +You are most likely to find MongoDB used in modern web applications. Its document model makes it very intuitive to access and handle with various programming languages. + +![mongodb Ubuntu][2] + +In this article, I’ll cover two ways you can install MongoDB on your Ubuntu system. + +### Installing MongoDB on Ubuntu based Distributions + + 1. Install MongoDB using Ubuntu’s repository. Easy but not the latest version of MongoDB + 2. Install MongoDB using its official repository. Slightly complicated but you get the latest version of MongoDB. + + + +The first installation method is easier, but I recommend the second method if you plan on using the latest release with official support. + +Some people might prefer using snap packages. There are snaps available in the Ubuntu Software Center, but I wouldn’t recommend using them; they’re outdated at the moment and I won’t be covering that. + +#### Method 1. Install MongoDB from Ubuntu Repository + +This is the easy way to install MongoDB on your system, you only need to type in a simple command. + +##### Installing MongoDB + +First, make sure your packages are up-to-date. Open up a terminal and type: + +``` +sudo apt update && sudo apt upgrade -y +``` + +Go ahead and install MongoDB with: + +``` +sudo apt install mongodb +``` + +That’s it! MongoDB is now installed on your machine. + +The MongoDB service should automatically be started on install, but to check the status type + +``` +sudo systemctl status mongodb +``` + +![Check if the MongoDB service is running.][3] + +You can see that the service is **active**. + +##### Running MongoDB + +MongoDB is currently a systemd service, so we’ll use **systemctl** to check and modify it’s state, using the following commands: + +``` +sudo systemctl status mongodb +sudo systemctl stop mongodb +sudo systemctl start mongodb +sudo systemctl restart mongodb +``` + +You can also change if MongoDB automatically starts when the system starts up ( **default** : enabled): + +``` +sudo systemctl disable mongodb +sudo systemctl enable mongodb +``` + +To start working with (creating and editing) databases, type: + +``` +mongo +``` + +This will start up the **mongo shell**. Please check out the [manual][4] for detailed information on the available queries and options. + +**Note:** Depending on how you plan to use MongoDB, you might need to adjust your Firewall. That’s unfortunately more involved than what I can cover here and depends on your configuration. + +##### Uninstall MongoDB + +If you installed MongoDB from the Ubuntu Repository and want to uninstall it (maybe to install using the officially supported way), type: + +``` +sudo systemctl stop mongodb +sudo apt purge mongodb +sudo apt autoremove +``` + +This should completely get rid of your MongoDB install. Make sure to **backup** any collections or documents you might want to keep since they will be wiped out! + +#### Method 2. Install MongoDB Community Edition on Ubuntu + +This is the way the recommended way to install MongoDB, using the package manager. You’ll have to type a few more commands and it might be intimidating if you are newer to the Linux world. + +But there’s nothing to be afraid of! We’ll go through the installation process step by step. + +##### Installing MongoDB + +The package maintained by MongoDB Inc. is called **mongodb-org** , not **mongodb** (this is the name of the package in the Ubuntu Repository). Make sure **mongodb** is not installed on your system before applying this steps. The packages will conflict. Let’s get to it! + +First, we’ll have to import the public key: + +``` +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 +``` + +Now, you need to add a new repository in your sources list so that you can install MongoDB Community Edition and also get automatic updates: + +``` +echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list +``` + +To be able to install **mongodb-org** , we’ll have to update our package database so that your system is aware of the new packages available: + +``` +sudo apt update +``` + +Now you can ether install the **latest stable version** of MongoDB: + +``` +sudo apt install -y mongodb-org +``` + +or a **specific version** (change the version number after **equal** sign) + +``` +sudo apt install -y mongodb-org=4.0.6 mongodb-org-server=4.0.6 mongodb-org-shell=4.0.6 mongodb-org-mongos=4.0.6 mongodb-org-tools=4.0.6 +``` + +If you choose to install a specific version, make sure you change the version number everywhere. If you only change it in the **mongodb-org=4.0.6** part, the latest version will be installed. + +By default, when updating using the package manager ( **apt-get** ), MongoDB will be updated to the newest updated version. To stop that from happening (and freezing to the installed version), use: + +``` +echo "mongodb-org hold" | sudo dpkg --set-selections +echo "mongodb-org-server hold" | sudo dpkg --set-selections +echo "mongodb-org-shell hold" | sudo dpkg --set-selections +echo "mongodb-org-mongos hold" | sudo dpkg --set-selections +echo "mongodb-org-tools hold" | sudo dpkg --set-selections +``` + +You have now successfully installed MongoDB! + +##### Configuring MongoDB + +By default, the package manager will create **/var/lib/mongodb** and **/var/log/mongodb** and MongoDB will run using the **mongodb** user account. + +I won’t go into changing these default settings since that is beyond the scope of this guide. You can check out the [manual][5] for detailed information. + +The settings in **/etc/mongod.conf** are applied when starting/restarting the **mongodb** service instance. + +##### Running MongoDB + +To start the mongodb daemon **mongod** , type: + +``` +sudo service mongod start +``` + +Now you should verify that the **mongod** process started successfully. This information is stored (by default) at **/var/log/mongodb/mongod.log**. Let’s check the contents of that file: + +``` +sudo cat /var/log/mongodb/mongod.log +``` + +![Check MongoDB logs to see if the process is running properly.][6] + +As long as you get this: **[initandlisten] waiting for connections on port 27017** somewhere in there, the process is running properly. + +**Note: 27017** is the default port of **mongod.** + +To stop/restart **mongod** enter: + +``` +sudo service mongod stop +sudo service mongod restart +``` + +Now, you can use MongoDB by opening the **mongo shell** : + +``` +mongo +``` + +##### Uninstall MongoDB + +Run the following commands + +``` +sudo service mongod stop +sudo apt purge mongodb-org* +``` + +To remove the **databases** and **log files** (make sure to **backup** what you want to keep!): + +``` +sudo rm -r /var/log/mongodb +sudo rm -r /var/lib/mongodb +``` + +**Wrapping Up** + +MongoDB is a great NoSQL database, easy to integrate into modern projects. I hope this tutorial helped you to set it up on your Ubuntu machine! Let us know how you plan on using MongoDB in the comments below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-mongodb-ubuntu + +作者:[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://www.mongodb.com/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/mongodb-ubuntu.jpeg?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_check_status.jpg?fit=800%2C574&ssl=1 +[4]: https://docs.mongodb.com/manual/tutorial/getting-started/ +[5]: https://docs.mongodb.com/manual/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_org_check_logs.jpg?fit=800%2C467&ssl=1 From c38904c25bf786e21934e25b65afdd8d9097e563 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:47:43 +0800 Subject: [PATCH 465/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190302=20How=20?= =?UTF-8?q?to=20buy=20a=20Raspberry=20Pi=20sources/tech/20190302=20How=20t?= =?UTF-8?q?o=20buy=20a=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190302 How to buy a Raspberry Pi.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/tech/20190302 How to buy a Raspberry Pi.md diff --git a/sources/tech/20190302 How to buy a Raspberry Pi.md b/sources/tech/20190302 How to buy a Raspberry Pi.md new file mode 100644 index 0000000000..974a6b75fb --- /dev/null +++ b/sources/tech/20190302 How to buy a Raspberry Pi.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to buy a Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/how-buy-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to buy a Raspberry Pi +====== +Find out the best ways to get a Raspberry Pi in the second article in our getting started guide + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) + +The first article in this series on getting started with Raspberry Pi offered some advice on [which model you should buy][1]. Now that you have an idea of which version you want, let's find out how to get one. + +The most obvious—and probably the safest and simplest—way is through the [official Raspberry Pi website][2]. If you click on "Buy a Raspberry Pi" from the homepage, you'll be taken to the organization's [online store][3], where you can find authorized Raspberry Pi sellers in your country where you can place an order. If your country isn't listed, there is a "Rest of the World" option, which should let you put in an international order. + +Second, check Amazon.com or another major online technology retailer in your country that allows smaller shops to sell new and used items. Given the relatively low cost and size of the Raspberry Pi, it should be fairly easy for smaller shop owners to import and export the boards for reselling purposes. Before you place an order, keep an eye on the sellers' reviews though. + +Third, ask your geek friends! You never know if someone has an unused Raspberry Pi gathering dust. I have given at least three Raspberry Pis away to family, not as planned gifts, but because they were just so curious about this mini-computer. I had so many lying around that I just told them to keep one! + +### Don't forget the extras + +One final thought: don't forget that you'll need some peripherals to set up and operate your Raspberry Pi. At a minimum, you'll need a keyboard, an HDMI cable to connect to a display (and a display), a Micro SD card to install the operating system, a power cord, and a mouse will be handy, too. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_2a_pi0w-kit.jpg) + +If you don't already have these items, try borrowing them from friends or order them at the same time you buy your Raspberry Pi. You may want to consider one of the starter kits available from the authorized Raspberry Pi vendors—that will avoid the hassle of searching for parts one at a time. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_2b_pi3b.jpg) + +Now that you have a Raspberry Pi, in the next article in this series, we'll install the operating system and start using it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-buy-raspberry-pi + +作者:[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/article/19/2/which-raspberry-pi-should-you-get +[2]: https://www.raspberrypi.org/ +[3]: https://www.raspberrypi.org/products/ From a65967215f5f7a6c726e45d61242905607ea1a72 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:51:23 +0800 Subject: [PATCH 466/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190303=20Manage?= =?UTF-8?q?=20Your=20Mirrors=20with=20ArchLinux=20Mirrorlist=20Manager=20s?= =?UTF-8?q?ources/tech/20190303=20Manage=20Your=20Mirrors=20with=20ArchLin?= =?UTF-8?q?ux=20Mirrorlist=20Manager.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rrors with ArchLinux Mirrorlist Manager.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md diff --git a/sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md b/sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md new file mode 100644 index 0000000000..7618d3f711 --- /dev/null +++ b/sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage Your Mirrors with ArchLinux Mirrorlist Manager) +[#]: via: (https://itsfoss.com/archlinux-mirrorlist-manager) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Manage Your Mirrors with ArchLinux Mirrorlist Manager +====== + +**ArchLinux Mirrorlist Manager is a simple GUI program that allows you to easily manage mirrors in your Arch Linux system.** + +For Linux users, it is important to make sure that you keep your mirror list in good shape. Today we will take a quick look at an application designed to help manage your Arch mirror list. + +![ArchLinux Mirrorlist Manager][1]ArchLinux Mirrorlist Manager + +### What is a Mirror? + +For those new to the world of Linux, Linux operating systems depend on a series of servers placed around the world. These servers contain identical copies of all of the packages and software available for a particular distro. This is why they are called “mirrors”. + +The ultimate goal is to have multiple mirrors in each country. This allows local users to quickly update their systems. However, this is not always true. Sometimes mirrors from another country can be faster. + +### ArchLinux Mirrorlist Manager makes managing mirrors simpler in Arch Linux + +![ArchLinux Mirrorlist Manager][2]Main Screen + +[Managing and sorting][3] the available mirrors in Arch is not easy. It involves fairly lengthy commands. Thankfully, someone came up with a solution. + +Last year, [Rizwan Hasan][4] created a little Python and Qt application entitled [ArchLinux Mirrorlist Manager][5]. You might recognize Rizwan’s name because it is not the first time that we featured something he created on this site. Over a year ago, I wrote about a new Arch-based distro that Rizwan created named [MagpieOS][6]. I imagine that Rizwan’s experience with MagpieOS inspired him to create this application. + +There really isn’t much to ArchLinux Mirrorlist Manager. It allows you to rank mirrors by response speed and limit the results by number and country of origin. + +In other words, if you are located in Germany, you can restrict your mirrors to the 3 fastest in Germany. + +### Install ArchLinux Mirrorlist Manager + +``` +It is only for Arch Linux users + +Pay attention! ArchLinux Mirrorlist Manager is for Arch Linux distribution only. Don’t try to use it on other Arch-based distributions unless you make sure that the distro uses Arch mirrors. Otherwise, you might face issues that I encountered with Manjaro (explained in the section below). +``` + +``` +Mirrorlist Manager alternative for Manjaro + +When it comes to using something Archy, my go-to system is Manjaro. In preparation for this article, I decided to install ArchLinux Mirrorlist Manager on my Manjaro machine. It quickly sorted the available mirror and saved them to my mirror list. + +I then proceeded to try to update my system and immediately ran into problems. When ArchLinux Mirrorlist Manager sorted the mirrors my system was using, it replaced all of my Manjaro mirrors with vanilla Arch mirrors. (Manjaro is based on Arch, but has its own mirrors because the dev team tests all package updates before pushing them to the users to ensure there are no system-breaking bugs.) Thankfully, the Manjaro forum helped me fix my mistake. + +If you are a Manjaro user, please do not make the same mistake that I did. ArchLinux Mirrorlist Manager is only for Arch and Arch-based distros that use Arch’s mirrors. + +Luckily, there is an easy to use terminal application that Manjaro users can use to manage their mirror lists. It is called [Pacman-mirrors][7]. Just like ArchLinux Mirrorlist Manager, you can sort by response speed. Just type `sudo pacman-mirrors --fasttrack`. If you want to limit the results to the five fastest mirrors, you can type `sudo pacman-mirrors --fasttrack 5`. To restrict the results to one or more countries, type `sudo pacman-mirrors --country Germany,Spain,Austria`. You can limit the results to your country by typing `sudo pacman-mirrors --geoip`. You can visit the [Manjaro wiki][7] for more information about Pacman-mirrors. + +After you run Pacman-mirrors, you have to synchronize your package database and update your system by typing `sudo pacman -Syyu`. + +Note: Pacman-mirrors is for **Manjaro only**. +``` + +ArchLinux Mirrorlist Manager is available in the [Arch User Repository][8]. More advanced Arch users can download the PKGBUILD directly from [the GitHub page][9]. + +### Final Thoughts on ArchLinux Mirrorlist Manager + +Even though [ArchLinux Mirrorlist Manager][5] isn’t very useful for me, I’m glad it exists. It shows that Linux users are actively trying to make Linux easier to use. As I said earlier, managing a mirror list on Arch is not easy. Rizwan’s little tool will help make Arch more usable by the beginning user. + +Have you ever used ArchLinux Mirrorlist Manager? What is your method to manage your Arch mirrors? 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][10]. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/archlinux-mirrorlist-manager + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/mirrorlist-manager2.png?ssl=1 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/mirrorlist-manager4.jpg?ssl=1 +[3]: https://wiki.archlinux.org/index.php/Mirrors +[4]: https://github.com/Rizwan-Hasan +[5]: https://github.com/Rizwan-Hasan/ArchLinux-Mirrorlist-Manager +[6]: https://itsfoss.com/magpieos/ +[7]: https://wiki.manjaro.org/index.php?title=Pacman-mirrors +[8]: https://aur.archlinux.org/packages/mirrorlist-manager +[9]: https://github.com/Rizwan-Hasan/MagpieOS-Packages/tree/master/ArchLinux-Mirrorlist-Manager +[10]: http://reddit.com/r/linuxusersgroup From 56d704d9279070cdbc92169c0a6aad7ece0c5e7d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:53:06 +0800 Subject: [PATCH 467/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20MiyoLi?= =?UTF-8?q?nux:=20A=20Lightweight=20Distro=20with=20an=20Old-School=20Appr?= =?UTF-8?q?oach=20sources/tech/20190228=20MiyoLinux-=20A=20Lightweight=20D?= =?UTF-8?q?istro=20with=20an=20Old-School=20Approach.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ight Distro with an Old-School Approach.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md diff --git a/sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md b/sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md new file mode 100644 index 0000000000..3217e304cd --- /dev/null +++ b/sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MiyoLinux: A Lightweight Distro with an Old-School Approach) +[#]: via: (https://www.linux.com/blog/learn/2019/2/miyolinux-lightweight-distro-old-school-approach) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +MiyoLinux: A Lightweight Distro with an Old-School Approach +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_main.jpg?itok=ErLiqGwp) + +I must confess, although I often wax poetic about the old ways of the Linux desktop, I much prefer my distributions to help make my daily workflow as efficient as possible. Because of that, my taste in Linux desktop distributions veers very far toward the modern side of things. I want a distribution that integrates apps seamlessly, gives me notifications, looks great, and makes it easy to work with certain services that I use. + +However, every so often it’s nice to dip my toes back into those old-school waters and remind myself why I fell in love with Linux in the first place. That’s precisely what [MiyoLinux][1] did for me recently. This lightweight distribution is based on [Devuan][2] and makes use of the [i3 Tiling Window Manager][3]. + +Why is it important that MiyoLinux is based on Devuan? Because that means it doesn’t use systemd. There are many within the Linux community who’d be happy to make the switch to an old-school Linux distribution that opts out of systemd. If that’s you, MiyoLinux might just charm you into submission. + +But don’t think MiyoLinux is going to be as easy to get up and running as, say, Ubuntu Linux, Elementary OS, or Linux Mint. Although it’s not nearly as challenging as Arch or Gentoo, MiyoLinux does approach installation and basic usage a bit differently. Let’s take a look at how this particular distro handles things. + +### Installation + +The installation GUI of MiyoLinux is pretty basic. The first thing you’ll notice is that you are presented with a good amount of notes, regarding the usage of the MiyoLinux desktop. If you happen to be testing MiyoLinux via VirtualBox, you’ll wind up having to deal with the frustration of not being able to resize the window (Figure 1), as the Guest Additions cannot be installed. This also means mouse integration cannot be enabled during the installation, so you’ll have to tab through the windows and use your keyboard cursor keys and Enter key to make selections. + +![MiyoLinux][5] + +Figure 1: The first step in the MiyoLinux installation. + +[Used with permission][6] + +Once you click the Install MiyoLinux button, you’ll be prompted to continue using either ‘su” or sudo. Click the use sudo button to continue with the installation. + +The next screen of importance is the Installation Options window (Figure 2), where you can select various options for MiyoLinux (such as encryption, file system labels, disable automatic login, etc.). + +![Configuration][8] + +Figure 2: Configuration Installation options for MiyoLinux. + +[Used with permission][6] + +The MiyoLinux installation does not include an automatic partition tool. Instead, you’ll be prompted to run either cfdisk or GParted (Figure 3). If you don’t know your way around cfdisk, select GParted and make use of the GUI tool. + +![partitioning ][10] + +Figure 3: Select your partitioning tool for MiyoLinux. + +[Used with permission][6] + +With your disk partitioned (Figure 4), you’ll be required to take care of the following steps: + + * Configure the GRUB bootloader. + + * Select the filesystem for the bootloader. + + * Configure time zone and locales. + + * Configure keyboard, keyboard language, and keyboard layout. + + * Okay the installation. + + + + +Once, you’ve okay’d the installation, all packages will be installed and you will then be prompted to install the bootloader. Following that, you’ll be prompted to configure the following: + + * Hostname. + + * User (Figure 5). + + * Root password. + + + + +With the above completed, reboot and log into your new MiyoLinux installation. + +![hostname][12] + +Figure 5: Configuring hostname and username. + +[Creative Commons Zero][13] + +### Usage + +Once you’ve logged into the MiyoLinux desktop, you’ll find things get a bit less-than-user-friendly. This is by design. You won’t find any sort of mouse menu available anywhere on the desktop. Instead you use keyboard shortcuts to open the different types of menus. The Alt+m key combination will open the PMenu, which is what one would consider a fairly standard desktop mouse menu (Figure 6). + +The Alt+d key combination will open the dmenu, a search tool at the top of the desktop, where you can scroll through (using the cursor keys) or search for an app you want to launch (Figure 7). + +![dmenu][15] + +Figure 7: The dmenu in action. + +[Used with permission][6] + +### Installing Apps + +If you open the PMenu, click System > Synaptic Package Manager. From within that tool you can search for any app you want to install. However, if you find Synaptic doesn’t want to start from the PMenu, open the dmenu, search for terminal, and (once the terminal opens), issue the command sudo synaptic. That will get the package manager open, where you can start installing any applications you want (Figure 8). + +![Synaptic][17] + +Figure 8: The Synaptic Package Manager on MiyoLinux. + +[Used with permission][6] + +Of course, you can always install applications from the command line. MiyoLinux depends upon the Apt package manager, so installing applications is as easy as: + +``` +sudo apt-get install libreoffice -y +``` + +Once installed, you can start the new package from either the PMenu or dmenu tools. + +### MiyoLinux Accessories + +If you find you need a bit more from the MiyoLinux desktop, type the keyboard combination Alt+Ctrl+a to open the MiyoLinux Accessories tool (Figure 9). From this tool you can configure a number of options for the desktop. + +![Accessories][19] + +Figure 9: Configure i3, Conky, Compton, your touchpad, and more with the Accessories tool. + +[Used with permission][6] + +All other necessary keyboard shortcuts are listed on the default desktop wallpaper. Make sure to put those shortcuts to memory, as you won’t get very far in the i3 desktop without them. + +### A Nice Nod to Old-School Linux + +If you’re itching to throw it back to a time when Linux offered you a bit of challenge to your daily grind, MiyoLinux might be just the operating system for you. It’s a lightweight operating system that makes good use of a minimal set of tools. Anyone who likes their distributions to be less modern and more streamlined will love this take on the Linux desktop. However, if you prefer your desktop with the standard bells and whistles, found on modern distributions, you’ll probably find MiyoLinux nothing more than a fun distraction from the standard fare. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/miyolinux-lightweight-distro-old-school-approach + +作者:[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://sourceforge.net/p/miyolinux/wiki/Home/ +[2]: https://devuan.org/ +[3]: https://i3wm.org/ +[4]: /files/images/miyo1jpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_1.jpg?itok=5PxRDYRE (MiyoLinux) +[6]: /licenses/category/used-permission +[7]: /files/images/miyo2jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_2.jpg?itok=svlVr7VI (Configuration) +[9]: /files/images/miyo3jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_3.jpg?itok=lpNzZBPz (partitioning) +[11]: /files/images/miyo5jpg +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_5.jpg?itok=lijIsgZ2 (hostname) +[13]: /licenses/category/creative-commons-zero +[14]: /files/images/miyo7jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_7.jpg?itok=I8Ow3PX6 (dmenu) +[16]: /files/images/miyo8jpg +[17]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_8.jpg?itok=oa502KfM (Synaptic) +[18]: /files/images/miyo9jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_9.jpg?itok=gUM4mxEv (Accessories) From 3bad4583b106f65b12207a77a3ec93d6ac6f1e0d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 16:01:07 +0800 Subject: [PATCH 468/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190302=20Create?= =?UTF-8?q?=20a=20Custom=20System=20Tray=20Indicator=20For=20Your=20Tasks?= =?UTF-8?q?=20on=20Linux=20sources/tech/20190302=20Create=20a=20Custom=20S?= =?UTF-8?q?ystem=20Tray=20Indicator=20For=20Your=20Tasks=20on=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Tray Indicator For Your Tasks on Linux.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md diff --git a/sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md b/sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md new file mode 100644 index 0000000000..d9d42b7a2f --- /dev/null +++ b/sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create a Custom System Tray Indicator For Your Tasks on Linux) +[#]: via: (https://fosspost.org/tutorials/custom-system-tray-icon-indicator-linux) +[#]: author: (M.Hanny Sabbagh https://fosspost.org/author/mhsabbagh) + +Create a Custom System Tray Indicator For Your Tasks on Linux +====== + +System Tray icons are still considered to be an amazing functionality today. By just right-clicking on the icon, and then selecting which actions you would like to take, you may ease your life a lot and save many unnecessary clicks on daily basis. + +When talking about useful system tray icons, examples like Skype, Dropbox and VLC do come to mind: + +![Create a Custom System Tray Indicator For Your Tasks on Linux 11][1] + +However, system tray icons can actually be quite a lot more useful; By simply building one yourself for your own needs. In this tutorial, we’ll explain how to do that for you in very simple steps. + +### Prerequisites + +We are going to build a custom system tray indicator using Python. Python is probably installed by default on all the major Linux distributions, so just check it’s there (version 2.7). Additionally, we’ll need the gir1.2-appindicator3 package installed. It’s the library allowing us to easily create system tray indicators. + +To install it on Ubuntu/Mint/Debian: + +``` +sudo apt-get install gir1.2-appindicator3 +``` + +On Fedora: + +``` +sudo dnf install libappindicator-gtk3 +``` + +For other distributions, just search for any packages containing appindicator. + +On GNOME Shell, system tray icons are removed starting from 3.26. You’ll need to install the [following extension][2] (Or possibly other extensions) to re-enable the feature on your desktop. Otherwise, you won’t be able to see the indicator we are going to create here. + +### Basic Code + +Here’s the basic code of the indicator: + +``` +#!/usr/bin/python +import os +from gi.repository import Gtk as gtk, AppIndicator3 as appindicator + +def main(): + indicator = appindicator.Indicator.new("customtray", "semi-starred-symbolic", appindicator.IndicatorCategory.APPLICATION_STATUS) + indicator.set_status(appindicator.IndicatorStatus.ACTIVE) + indicator.set_menu(menu()) + gtk.main() + +def menu(): + menu = gtk.Menu() + + command_one = gtk.MenuItem('My Notes') + command_one.connect('activate', note) + menu.append(command_one) + + exittray = gtk.MenuItem('Exit Tray') + exittray.connect('activate', quit) + menu.append(exittray) + + menu.show_all() + return menu + +def note(_): + os.system("gedit $HOME/Documents/notes.txt") + +def quit(_): + gtk.main_quit() + +if __name__ == "__main__": + main() +``` + +We’ll explain how the code works later. But for know, just save it in a text file under the name tray.py, and run it using Python: + +``` +python tray.py +``` + +You’ll see the indicator working as follows: + +![Create a Custom System Tray Indicator For Your Tasks on Linux 13][3] + +Now, to explain how we did the magic: + + * The first 3 lines of the code are nothing more than just specifying the Python path and importing the libraries we are going to use in our indicator. + + * def main() : This is the main function of the indicator. Under it we write the code to initialize and build the indicator. + + * indicator = appindicator.Indicator.new(“customtray”, “semi-starred-symbolic”, appindicator.IndicatorCategory.APPLICATION_STATUS) : Here we are specially creating a new indicator and calling it `customtray` . This is the special name of the indicator so that the system doesn’t mix it with other indicators that may be running. Also, we used the `semi-starred-symbolic` icon name as the default icon for our indicator. You could possibly change thing to any other things; Say `firefox` (if you want to see Firefox icon being used for the indicator), or any other icon name you would like. The last part regarding the `APPLICATION_STATUS` is just ordinary code for the categorization/scope of that indicator. + + * `indicator.set_status(appindicator.IndicatorStatus.ACTIVE)` : This line just turns the indicator on. + + * `indicator.set_menu(menu())` : Here, we are saying that we want to use the `menu()` function (which we’ll define later) for creating the menu items of our indicator. This is important so that when you click on the indicator, you can see a list of possible actions to take. + + * `gtk.main()` : Just run the main GTK loop. + + * Under `menu()` you’ll see that we are creating the actions/items we want to provide using our indicator. `command_one = gtk.MenuItem(‘My Notes’)` simply initializes the first menu item with the text “My notes”, and then `command_one.connect(‘activate’, note)` connects the `activate` signal of that menu item to the `note()` function defined later; In other words, we are telling our system here: “When this menu item is clicked, run the note() function”. Finally, `menu.append(command_one)` adds that menu item to the list. + + * The lines regarding `exittray` are just for creating an exit menu item to close the indicator any time you want. + + * `menu.show_all()` and `return menu` are just ordinary codes for returning the menu list to the indicator. + + * Under `note(_)` you’ll see the code that must be executed when the “My Notes” menu item is clicked. Here, we just wrote `os.system(“gedit $HOME/Documents/notes.txt”)` ; The `os.system` function is a function that allows us to run shell commands from inside Python, so here we wrote a command to open a file called `notes.txt` under the `Documents` folder in our home directory using the `gedit` editor. This for example can be your daily notes taking program from now on! + +### Adding your Needed Tasks + +There are only 2 things you need to touch in the code: + + 1. Define a new menu item under `menu()` for your desired task. + + 2. Create a new function to run a specific action when that menu item is clicked. + + +So, let’s say that you want to create a new menu item, which when clicked, plays a specific video/audio file on your hard disk using VLC? To do it, simply add the following 3 lines in line 17: + +``` +command_two = gtk.MenuItem('Play video/audio') +command_two.connect('activate', play) +menu.append(command_two) +``` + +And the following lines in line 30: + +``` +def play(_): + os.system("vlc /home//Videos/somevideo.mp4") +``` + +Replace /home//Videos/somevideo.mp4 with the path to the video/audio file you want. Now save the file and run the indicator again: + +``` +python tray.py +``` + +This is how you’ll see it now: + +![Create a Custom System Tray Indicator For Your Tasks on Linux 15][4] + +And when you click on the newly-created menu item, VLC will start playing! + +To create other items/tasks, simply redo the steps again. Just be careful to replace command_two with another name, like command_three, so that no clash between variables happen. And then define new separate functions like what we did with the play(_) function. + +The possibilities are endless from here; I am using this way for example to fetch some data from the web (using the urllib2 library) and display them for me any time. I am also using it for playing an mp3 file in the background using the mpg123 command, and I am defining another menu item to killall mpg123 to stop playing that audio whenever I want. CS:GO on Steam for example takes a huge time to exit (the window doesn’t close automatically), so as a workaround for this, I simply minimize the window and click on a menu item that I created which will execute killall -9 csgo_linux64. + +You can use this indicator for anything: Updating your system packages, possibly running some other scripts any time you want.. Literally anything. + +### Autostart on Boot + +We want our system tray indicator to start automatically on boot, we don’t want to run it manually each time. To do that, simply add the following command to your startup applications (after you replace the path to the tray.py file with yours): + +``` +nohup python /home//tray.py & +``` + +The very next time you reboot your system, the indicator will start working automatically after boot! + +### Conclusion + +You now know how to create your own system tray indicator for any task that you may want. This method should save you a lot of time depending on the nature and number of tasks you need to run on daily basis. Some users may prefer creating aliases from the command line, but this will require you to always open the terminal window or have a drop-down terminal emulator available, while here, the system tray indicator is always working and available for you. + +Have you used this method to run your tasks before? Would love to hear your thoughts. + + +-------------------------------------------------------------------------------- + +via: https://fosspost.org/tutorials/custom-system-tray-icon-indicator-linux + +作者:[M.Hanny Sabbagh][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://fosspost.org/author/mhsabbagh +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/Screenshot-at-2019-02-28-0808.png?resize=407%2C345&ssl=1 (Create a Custom System Tray Indicator For Your Tasks on Linux 12) +[2]: https://extensions.gnome.org/extension/1031/topicons/ +[3]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/03/Screenshot-at-2019-03-02-1041.png?resize=434%2C140&ssl=1 (Create a Custom System Tray Indicator For Your Tasks on Linux 14) +[4]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/03/Screenshot-at-2019-03-02-1141.png?resize=440%2C149&ssl=1 (Create a Custom System Tray Indicator For Your Tasks on Linux 16) From b23423b1df54ff0ba9101987c5634a3e6d85b6fe Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 16:11:42 +0800 Subject: [PATCH 469/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20What's?= =?UTF-8?q?=20happening=20in=20the=20OpenStack=20community=3F=20sources/ta?= =?UTF-8?q?lk/20190301=20What-s=20happening=20in=20the=20OpenStack=20commu?= =?UTF-8?q?nity.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-s happening in the OpenStack community.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/talk/20190301 What-s happening in the OpenStack community.md diff --git a/sources/talk/20190301 What-s happening in the OpenStack community.md b/sources/talk/20190301 What-s happening in the OpenStack community.md new file mode 100644 index 0000000000..28e3bf2fd3 --- /dev/null +++ b/sources/talk/20190301 What-s happening in the OpenStack community.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's happening in the OpenStack community?) +[#]: via: (https://opensource.com/article/19/3/whats-happening-openstack) +[#]: author: (Jonathan Bryce https://opensource.com/users/jonathan-bryce) + +What's happening in the OpenStack community? +====== + +In many ways, 2018 was a transformative year for the OpenStack Foundation. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/travel-mountain-cloud.png?itok=ZKsJD_vb) + +Since 2010, the OpenStack community has been building open source software to run cloud computing infrastructure. Initially, the focus was public and private clouds, but open infrastructure has been pulled into many new important use cases like telecoms, 5G, and manufacturing IoT. + +As OpenStack software matured and grew in scope to support new technologies like bare metal provisioning and container infrastructure, the community widened its thinking to embrace users who deploy and run the software in addition to the developers who build the software. Questions like, "What problems are users trying to solve?" "Which technologies are users trying to integrate?" and "What are the gaps?" began to drive the community's thinking and decision making. + +In response to those questions, the OSF reorganized its approach and created a new "open infrastructure" framework focused on use cases, including edge, container infrastructure, CI/CD, and private and hybrid cloud. And, for the first time, the OSF is hosting open source projects outside of the OpenStack project. + +Following are three highlights from the [OSF 2018 Annual Report][1]; I encourage you to read the entire report for more detailed information about what's new. + +### Pilot projects + +On the heels of launching [Kata Containers][2] in December 2017, the OSF launched three pilot projects in 2018—[Zuul][3], [StarlingX][4], and [Airship][5]—that help further our goals of taking our technology into additional relevant markets. Each project follows the tenets we consider key to the success of true open source, [the Four Opens][6]: open design, open collaboration, open development, and open source. While these efforts are still new, they have been extremely valuable in helping us learn how we should expand the scope of the OSF, as well as showing others the kind of approach we will take. + +While the OpenStack project remained at the core of the team's focus, pilot projects are helping expand usage of open infrastructure across markets and already benefiting the OpenStack community. This has attracted dozens of new developers to the open infrastructure community, which will ultimately benefit the OpenStack community and users. + +There is direct benefit from these contributors working upstream in OpenStack, such as through StarlingX, as well as indirect benefit from the relationships we've built with the Kubernetes community through the Kata Containers project. Airship is similarly bridging the gaps between the Kubernetes and OpenStack ecosystems. This shows users how the technologies work together. A rise in contributions to Zuul has provided the engine for OpenStack CI and keeps our development running smoothly. + +### Containers collaboration + +In addition to investing in new pilot projects, we continued efforts to work with key adjacent projects in 2018, and we made particularly good progress with Kubernetes. OSF staffer Chris Hoge helps lead the cloud provider special interest group, where he has helped standardize how Kubernetes deployments expect to run on top of various infrastructure. This has clarified OpenStack's place in the Kubernetes ecosystem and led to valuable integration points, like having OpenStack as part of the Kubernetes release testing process. + +Additionally, OpenStack Magnum was certified as a Kubernetes installer by the CNCF. Through the Kata Containers community, we have deepened these relationships into additional areas within the container ecosystem resulting in a number of companies getting involved for the first time. + +### Evolving events + +We knew heading into 2018 that the environment around our events was changing and we needed to respond. During the year, we held two successful project team gatherings (PTGs) in Dublin and Denver, reaching capacity for both events while also including new projects and OpenStack operators. We held OpenStack Summits in Vancouver and Berlin, both experiencing increases in attendance and project diversity since Sydney in 2017, with each Summit including more than 30 open source projects. Recognizing this broader audience and the OSF's evolving strategy, the OpenStack Summit was renamed the [Open Infrastructure Summit][7], beginning with the Denver event coming up in April. + +In 2018, we boosted investment in China, onboarding a China Community Manager based in Shanghai and hosting a strategy day in Beijing with 30+ attendees from Gold and Platinum Members in China. This effort will continue in 2019 as we host our first Summit in China: the [Open Infrastructure Summit Shanghai][8] in November. + +We also worked with the community in 2018 to define a new model for events to maximize participation while saving on travel and expenses for the individuals and companies who are increasingly stretched across multiple open source communities. We arrived at a plan that we will implement and iterate on in 2019 where we will collocate PTGs as standalone events adjacent to our Open Infrastructure Summits. + +### Looking ahead + +We've seen impressive progress, but the biggest accomplishment might be in establishing a framework for the future of the foundation itself. In 2018, we advanced the open infrastructure mission by establishing OSF as an effective place to collaborate for CI/CD, container infrastructure, and edge computing, in addition to the traditional public and private cloud use cases. The open infrastructure approach opened a lot of doors in 2018, from the initial release of software from each pilot project, to live 5G demos, to engagement with hyperscale public cloud providers. + +Ultimately, our value comes from the effectiveness of our communities and the software they produce. As 2019 unfolds, our community is excited to apply learnings from 2018 to the benefit of developers, users, and the commercial ecosystem across all our projects. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/whats-happening-openstack + +作者:[Jonathan Bryce][a] +选题:[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/jonathan-bryce +[b]: https://github.com/lujun9972 +[1]: https://www.openstack.org/foundation/2018-openstack-foundation-annual-report +[2]: https://katacontainers.io/ +[3]: https://zuul-ci.org/ +[4]: https://www.starlingx.io/ +[5]: https://www.airshipit.org/ +[6]: https://www.openstack.org/four-opens/ +[7]: https://www.openstack.org/summit/denver-2019/ +[8]: https://www.openstack.org/summit/shanghai-2019 From c7c857c95e45236f6f7f2cf026c57763c0730d09 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 16:19:42 +0800 Subject: [PATCH 470/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=203=20op?= =?UTF-8?q?en=20source=20behavior-driven=20development=20tools=20sources/t?= =?UTF-8?q?ech/20190228=203=20open=20source=20behavior-driven=20developmen?= =?UTF-8?q?t=20tools.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ource behavior-driven development tools.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/tech/20190228 3 open source behavior-driven development tools.md diff --git a/sources/tech/20190228 3 open source behavior-driven development tools.md b/sources/tech/20190228 3 open source behavior-driven development tools.md new file mode 100644 index 0000000000..9c004a14c2 --- /dev/null +++ b/sources/tech/20190228 3 open source behavior-driven development tools.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 open source behavior-driven development tools) +[#]: via: (https://opensource.com/article/19/2/behavior-driven-development-tools) +[#]: author: (Christine Ketterlin Fisher https://opensource.com/users/cketterlin) + +3 open source behavior-driven development tools +====== +Having the right motivation is as important as choosing the right tool when implementing BDD. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +[Behavior-driven development][1] (BDD) seems very easy. Tests are written in an easily readable format that allows for feedback from product owners, business sponsors, and developers. Those tests are living documentation for your team, so you don't need requirements. The tools are easy to use and allow you to automate your test suite. Reports are generated with each test run to document every step and show you where tests are failing. + +Quick recap: Easily readable! Living documentation! Automation! Reports! What could go wrong, and why isn't everybody doing this? + +### Getting started with BDD + +So, you're ready to jump in and can't wait to pick the right open source tool for your team. You want it to be easy to use, automate all your tests, and provide easily understandable reports for each test run. Great, let's get started! + +Except, not so fast … First, what is your motivation for trying to implement BDD on your team? If the answer is simply to automate tests, go ahead and choose any of the tools listed below because chances are you're going to see minimal success in the long run. + +### My first effort + +I manage a team of business analysts (BA) and quality assurance (QA) engineers, but my background is on the business analysis side. About a year ago, I attended a talk where a developer talked about the benefits of BDD. He said that he and his team had given it a try during their last project. That should have been the first red flag, but I didn't realize it at the time. You cannot simply choose to "give BDD a try." It takes planning, preparation, and forethought into what you want your team to accomplish. + +However, you can try various parts of BDD without a large investment, and I eventually realized he and his team had written feature files and automated those tests using Cucumber. I also learned it was an experiment done solely by the team's developers, not the BA or QA staff, which defeats the purpose of understanding the end user's behavior. + +During the talk we were encouraged to try BDD, so my test analyst and I went to our boss and said we were willing to give it a shot. And then, we didn't know what to do. We had no guidance, no plan in place, and a leadership team who just wanted to automate testing. I don't think I need to tell you how this story ended. Actually, there wasn't even an end, just a slow fizzle after a few initial attempts at writing behavioral scenarios. + +### A fresh start + +Fast-forward a year, and I'm at a different company with a team of my own and BDD on the brain. I knew there was value there, but I also knew it went deeper than what I had initially been sold. I spent a lot of time thinking about how BDD could make a positive impact, not only on my team, but on our entire development team. Then I read [Discovery: Explore Behaviour Using Examples][2] by Gaspar Nagy and Seb Rose, and one of the first things I learned was that automation of tests is a benefit of BDD, but it should not be the main goal. No wonder we failed! + +This book changed how I viewed BDD and helped me start to fill in the pieces I had been missing. We are now on the (hopefully correct!) path to implementing BDD on our team. It involves active involvement from our product owners, business analysts, and manual and automated testers and buy-in and support from our executive leadership. We have a plan in place for our approach and our measures of success. + +We are still writing requirements (don't ever let anyone tell you that these scenarios can completely replace requirements!), but we are doing so with a more critical eye and evaluating where requirements and test scenarios overlap and how we can streamline the two. + +I have told the team we cannot even try to automate these tests for at least two quarters, at which point we'll evaluate and determine whether we're ready to move forward or not. Our current priorities are defining our team's standard language, practicing writing given/when/then scenarios, learning the Gherkin syntax, determining where to store these tests, and investigating how to integrate these tests into our pipeline. + +### 3 BDD tools to choose + +At its core, BDD is a way to help the entire team understand the end user's actions and behaviors, which will lead to more clear requirements, tests, and ultimately higher-quality applications. Before you pick your tool, do your pre-work. Think about your motivation, and understand that while the different parts and pieces of BDD are fairly simple, integrating them into your team is more challenging and needs careful thought and planning. Also, think about where your people fit in. + +Every organization has different roles, and BDD should not belong solely to developers nor test automation engineers. If you don't involve the business side, you're never going to gain the full benefit of this methodology. Once you have a strategy defined and are ready to move forward with automating your BDD scenarios, there are several open source tools for you to choose from. + +#### Cucumber + +[Cucumber][3] is probably the most recognized tool available that supports BDD. It is widely seen as a straightforward tool to learn and is easy to get started with. Cucumber relies on test scenarios that are written in plain text and follow the given/when/then format. Each scenario is an individual test. Scenarios are grouped into features, which is comparable to a test suite. Scenarios must be written in the Gherkin syntax for Cucumber to understand and execute the scenario's steps. The human-readable steps in the scenarios are tied to the step definitions in your code through the Cucumber framework. To successfully write and automate the scenarios, you need the right mix of business knowledge and technical ability. Identify the skill sets on your team to determine who will write and maintain the scenarios and who will automate them; most likely these should be managed by different roles. Because these tests are executed from the step definitions, reporting is very robust and can show you at which exact step your test failed. Cucumber works well with a variety of browser and API automation tools. + +#### JBehave + +[JBehave][4] is very similar to Cucumber. Scenarios are still written in the given/when/then format and are easily understandable by the entire team. JBehave supports Gherkin but also has its own JBehave syntax that can be used. Gherkin is more universal, but either option will work as long as you are consistent in your choice. JBehave has more configuration options than Cucumber, and its reports, although very detailed, need more configuration to get feedback from each step. JBehave is a powerful tool, but because it can be more customized, it is not quite as easy to get started with. Teams need to ask themselves exactly what features they need and whether or not learning the tool's various configurations is worth the time investment. + +#### Gauge + +Where Cucumber and JBehave are specifically designed to work with BDD, [Gauge][5] is not. If automation is your main goal (and not the entire BDD process), it is worth a look. Gauge tests are written in Markdown, which makes them easily readable. However, without a more standard format, such as the given/when/then BDD scenarios, tests can vary widely and, depending on the author, some tests will be much more digestible for business owners than others. Gauge works with multiple languages, so the automation team can leverage what they already use. Gauge also offers reporting with screenshots to show where the tests failed. + +### What are your needs? + +Implementing BDD allows the team to test the users' behaviors. This can be done without automating any tests at all, but when done correctly, can result in a powerful, reusable test suite. As a team, you will need to identify exactly what your automation needs are and whether or not you are truly going to use BDD or if you would rather focus on automating tests that are written in plain text. Either way, open source tools are available for you to use and to help support your testing evolution. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/behavior-driven-development-tools + +作者:[Christine Ketterlin Fisher][a] +选题:[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/cketterlin +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Behavior-driven_development +[2]: https://www.amazon.com/gp/product/1983591254/ref=dbs_a_def_rwt_bibl_vppi_i0 +[3]: https://cucumber.io/ +[4]: https://jbehave.org/ +[5]: https://www.gauge.org/ From bc89e28cd3818b02d003f8ceaa10931d4fd372f8 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:00:09 +0800 Subject: [PATCH 471/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Connec?= =?UTF-8?q?ting=20a=20VoIP=20phone=20directly=20to=20an=20Asterisk=20serve?= =?UTF-8?q?r=20sources/tech/20190228=20Connecting=20a=20VoIP=20phone=20dir?= =?UTF-8?q?ectly=20to=20an=20Asterisk=20server.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...IP phone directly to an Asterisk server.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md diff --git a/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md new file mode 100644 index 0000000000..16b9d442e2 --- /dev/null +++ b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Connecting a VoIP phone directly to an Asterisk server) +[#]: via: (https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/) +[#]: author: (François Marier https://fmarier.org/) + +Connecting a VoIP phone directly to an Asterisk server +====== + +On my [Asterisk][1] server, I happen to have two on-board ethernet boards. Since I only used one of these, I decided to move my VoIP phone from the local network switch to being connected directly to the Asterisk server. + +The main advantage is that this phone, running proprietary software of unknown quality, is no longer available on my general home network. Most importantly though, it no longer has access to the Internet, without my having to firewall it manually. + +Here's how I configured everything. + +### Private network configuration + +On the server, I started by giving the second network interface a static IP address in `/etc/network/interfaces`: + +``` +auto eth1 +iface eth1 inet static + address 192.168.2.2 + netmask 255.255.255.0 +``` + +On the VoIP phone itself, I set the static IP address to `192.168.2.3` and the DNS server to `192.168.2.2`. I then updated the SIP registrar IP address to `192.168.2.2`. + +The DNS server actually refers to an [unbound daemon][2] running on the Asterisk server. The only configuration change I had to make was to listen on the second interface and allow the VoIP phone in: + +``` +server: + interface: 127.0.0.1 + interface: 192.168.2.2 + access-control: 0.0.0.0/0 refuse + access-control: 127.0.0.1/32 allow + access-control: 192.168.2.3/32 allow +``` + +Finally, I opened the right ports on the server's firewall in `/etc/network/iptables.up.rules`: + +``` +-A INPUT -s 192.168.2.3/32 -p udp --dport 5060 -j ACCEPT +-A INPUT -s 192.168.2.3/32 -p udp --dport 10000:20000 -j ACCEPT +``` + +### Accessing the admin page + +Now that the VoIP phone is no longer available on the local network, it's not possible to access its admin page. That's a good thing from a security point of view, but it's somewhat inconvenient. + +Therefore I put the following in my `~/.ssh/config` to make the admin page available on `http://localhost:8081` after I connect to the Asterisk server via ssh: + +``` +Host asterisk + LocalForward 8081 192.168.2.3:80 +``` + +-------------------------------------------------------------------------------- + +via: https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/ + +作者:[François Marier][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fmarier.org/ +[b]: https://github.com/lujun9972 +[1]: https://www.asterisk.org/ +[2]: https://feeding.cloud.geek.nz/posts/setting-up-your-own-dnssec-aware/ From 9cc8fe51127ba072798a29330a59963b70afb58b Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:10:49 +0800 Subject: [PATCH 472/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Guide?= =?UTF-8?q?=20to=20Install=20VMware=20Tools=20on=20Linux=20sources/tech/20?= =?UTF-8?q?190301=20Guide=20to=20Install=20VMware=20Tools=20on=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Guide to Install VMware Tools on Linux.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20190301 Guide to Install VMware Tools on Linux.md diff --git a/sources/tech/20190301 Guide to Install VMware Tools on Linux.md b/sources/tech/20190301 Guide to Install VMware Tools on Linux.md new file mode 100644 index 0000000000..e6a43bcde1 --- /dev/null +++ b/sources/tech/20190301 Guide to Install VMware Tools on Linux.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Guide to Install VMware Tools on Linux) +[#]: via: (https://itsfoss.com/install-vmware-tools-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Guide to Install VMware Tools on Linux +====== + +**VMware Tools enhances your VM experience by allowing you to share clipboard and folder among other things. Learn how to install VMware tools on Ubuntu and other Linux distributions.** + +In an earlier tutorial, you learned to [install VMware Workstation on Ubuntu][1]. You can further enhance the functionality of your virtual machines by installing VMware Tools. + +If you have already installed a guest OS on VMware, you must have noticed the requirement for [VMware tools][2] – even though not completely aware of what it is needed for. + +In this article, we will highlight the importance of VMware tools, the features it offers, and the method to install VMware tools on Ubuntu or any other Linux distribution. + +### VMware Tools: Overview & Features + +![Installing VMware Tools on Ubuntu][3]Installing VMware Tools on Ubuntu + +For obvious reasons, the virtual machine (your Guest OS) will not behave exactly like the host. There will be certain limitations in terms of its performance and operationg. And, that is why a set of utilities (VMware Tools) was introduced. + +VMware tools help in managing the guest OS in an efficient manner while also improving its performance. + +#### What exactly is VMware tool responsible for? + +![How to Install VMware tools on Linux][4] + +You have got a vague idea of what it does – but let us talk about the details: + + * Synchronize the time between the guest OS and the host to make things easier. + * Unlocks the ability to pass messages from host OS to guest OS. For example, you copy a text on the host to your clipboard and you can easily paste it to your guest OS. + * Enables sound in guest OS. + * Improves video resolution. + * Improves the cursor movement. + * Fixes incorrect network speed data. + * Eliminates inadequate color depth. + + + +These are the major changes that happen when you install VMware tools on Guest OS. But, what exactly does it contain / feature in order to unlock/enhance these functionalities? Let’s see.. + +#### VMware tools: Core Feature Details + +![Sharing clipboard between guest and host OS with VMware Tools][5]Sharing clipboard between guest and host OS with VMware Tools + +If you do not want to know what it includes to enable the functionalities, you can skip this part. But, for the curious readers, let us briefly discuss about it: + +**VMware device drivers:** It really depends on the OS. Most of the major operating systems do include device drivers by default. So, you do not have to install it separately. This generally involves – memory control driver, mouse driver, audio driver, NIC driver, VGA driver and so on. + +**VMware user process:** This is where things get really interesting. With this, you get the ability to copy-paste and drag-drop between the host and the guest OS. You can basically copy and paste the text from the host to the virtual machine or vice versa. + +You get to drag and drop files as well. In addition, it enables the pointer release/lock when you do not have an SVGA driver installed. + +**VMware tools lifecycle management** : Well, we will take a look at how to install VMware tools below – but this feature helps you easily install/upgrade VMware tools in the virtual machine. + +**Shared Folders** : In addition to these, VMware tools also allow you to have shared folders between the guest OS and the host. + +![Sharing folder between guest and host OS using VMware Tools in Linux][6]Sharing folder between guest and host OS using VMware Tools in Linux + +Of course, what it does and facilitates also depends on the host OS. For example, on Windows, you get a Unity mode on VMware to run programs on virtual machine and operate it from the host OS. + +### How to install VMware Tools on Ubuntu & other Linux distributions + +**Note:** For Linux guest operating systems, you should already have “Open VM Tools” suite installed, eliminating the need of installing VMware tools separately, most of the time. + +Most of the time, when you install a guest OS, you will get a prompt as a software update or a popup telling you to install VMware tools if the operating system supports [Easy Install][7]. + +Windows and Ubuntu does support Easy Install. So, even if you are using Windows as your host OS or trying to install VMware tools on Ubuntu, you should first get an option to install the VMware tools easily as popup message. Here’s how it should look like: + +![Pop-up to install VMware Tools][8]Pop-up to install VMware Tools + +This is the easiest way to get it done. So, make sure you have an active network connection when you setup the virtual machine. + +If you do not get any of these pop ups – or options to easily install VMware tools. You have to manually install it. Here’s how to do that: + +1\. Launch VMware Workstation Player. + +2\. From the menu, navigate through **Virtual Machine - > Install VMware tools**. If you already have it installed, and want to repair the installation, you will observe the same option to appear as “ **Re-install VMware tools** “. + +3\. Once you click on that, you will observe a virtual CD/DVD mounted in the guest OS. + +4\. Open that and copy/paste the **tar.gz** file to any location of your choice and extract it, here we choose the **Desktop**. + +![][9] + +5\. After extraction, launch the terminal and navigate to the folder inside by typing in the following command: + +``` +cd Desktop/VMwareTools-10.3.2-9925305/vmware-tools-distrib +``` + +You need to check the name of the folder and path in your case – depending on the version and where you extracted – it might vary. + +![][10] + +Replace **Desktop** with your storage location (such as cd Downloads) and the rest should remain the same if you are installing **10.3.2 version**. + +6\. Now, simply type in the following command to start the installation: + +``` +sudo ./vmware-install.pl -d +``` + +![][11] + +You will be asked the password for permission to install, type it in and you should be good to go. + +That’s it. You are done. These set of steps should be applicable to almost any Ubuntu-based guest operating system. If you want to install VMware tools on Ubuntu Server, or any other OS. + +**Wrapping Up** + +Installing VMware tools on Ubuntu Linux is pretty easy. In addition to the easy method, we have also explained the manual method to do it. If you still need help, or have a suggestion regarding the installation, let us know in the comments down below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-vmware-tools-linux + +作者:[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-vmware-player-ubuntu-1310/ +[2]: https://kb.vmware.com/s/article/340 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-downloading.jpg?fit=800%2C531&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/install-vmware-tools-linux.png?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-features.gif?resize=800%2C500&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-shared-folder.jpg?fit=800%2C660&ssl=1 +[7]: https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/15.0/com.vmware.player.linux.using.doc/GUID-3F6B9D0E-6CFC-4627-B80B-9A68A5960F60.html +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools.jpg?fit=800%2C481&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-extraction.jpg?fit=800%2C564&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-folder.jpg?fit=800%2C487&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-installation-ubuntu.jpg?fit=800%2C492&ssl=1 From 1b589c74d545fd75b4737d070dad665eb22d3ad2 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:12:47 +0800 Subject: [PATCH 473/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Why=20?= =?UTF-8?q?CLAs=20aren't=20good=20for=20open=20source=20sources/talk/20190?= =?UTF-8?q?228=20Why=20CLAs=20aren-t=20good=20for=20open=20source.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...28 Why CLAs aren-t good for open source.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20190228 Why CLAs aren-t good for open source.md diff --git a/sources/talk/20190228 Why CLAs aren-t good for open source.md b/sources/talk/20190228 Why CLAs aren-t good for open source.md new file mode 100644 index 0000000000..ca39619762 --- /dev/null +++ b/sources/talk/20190228 Why CLAs aren-t good for open source.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why CLAs aren't good for open source) +[#]: via: (https://opensource.com/article/19/2/cla-problems) +[#]: author: (Richard Fontana https://opensource.com/users/fontana) + +Why CLAs aren't good for open source +====== +Few legal topics in open source are as controversial as contributor license agreements. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/write-hand_0.jpg?itok=Uw5RJD03) + +Few legal topics in open source are as controversial as [contributor license agreements][1] (CLAs). Unless you count the special historical case of the [Fedora Project Contributor Agreement][2] (which I've always seen as an un-CLA), or, like [Karl Fogel][3], you classify the [DCO][4] as a [type of CLA][5], today Red Hat makes no use of CLAs for the projects it maintains. + +It wasn't always so. Red Hat's earliest projects followed the traditional practice I've called "inbound=outbound," in which contributions to a project are simply provided under the project's open source license with no execution of an external, non-FOSS contract required. But in the early 2000s, Red Hat began experimenting with the use of contributor agreements. Fedora started requiring contributors to sign a CLA based on the widely adapted [Apache ICLA][6], while a Free Software Foundation-derived copyright assignment agreement and a pair of bespoke CLAs were inherited from the Cygnus and JBoss acquisitions, respectively. We even took [a few steps][7] towards adopting an Apache-style CLA across the rapidly growing set of Red Hat-led projects. + +This came to an end, in large part because those of us on the Red Hat legal team heard and understood the concerns and objections raised by Red Hat engineers and the wider technical community. We went on to become de facto leaders of what some have called the anti-CLA movement, marked notably by our [opposition to Project Harmony][8] and our [efforts][9] to get OpenStack to replace its CLA with the DCO. (We [reluctantly][10] sign tolerable upstream project CLAs out of practical necessity.) + +### Why CLAs are problematic + +Our choice not to use CLAs is a reflection of our values as an authentic open source company with deep roots in the free software movement. Over the years, many in the open source community have explained why CLAs, and the very similar mechanism of copyright assignment, are a bad policy for open source. + +One reason is the red tape problem. Normally, open source development is characterized by frictionless contribution, which is enabled by inbound=outbound without imposition of further legal ceremony or process. This makes it relatively easy for new contributors to get involved in a project, allowing more effective growth of contributor communities and driving technical innovation upstream. Frictionless contribution is a key part of the advantage open source development holds over proprietary alternatives. But frictionless contribution is negated by CLAs. Having to sign an unusual legal agreement before a contribution can be accepted creates a bureaucratic hurdle that slows down development and discourages participation. This cost persists despite the growing use of automation by CLA-using projects. + +CLAs also give rise to an asymmetry of legal power among a project's participants, which also discourages the growth of strong contributor and user communities around a project. With Apache-style CLAs, the company or organization leading the project gets special rights that other contributors do not receive, while those other contributors must shoulder certain legal obligations (in addition to the red tape burden) from which the project leader is exempt. The problem of asymmetry is most severe in copyleft projects, but it is present even when the outbound license is permissive. + +When assessing the arguments for and against CLAs, bear in mind that today, as in the past, the vast majority of the open source code in any product originates in projects that follow the inbound=outbound practice. The use of CLAs by a relatively small number of projects causes collateral harm to all the others by signaling that, for some reason, open source licensing is insufficient to handle contributions flowing into a project. + +### The case for CLAs + +Since CLAs continue to be a minority practice and originate from outside open source community culture, I believe that CLA proponents should bear the burden of explaining why they are necessary or beneficial relative to their costs. I suspect that most companies using CLAs are merely emulating peer company behavior without critical examination. CLAs have an understandable, if superficial, appeal to risk-averse lawyers who are predisposed to favor greater formality, paper, and process regardless of the business costs. Still, some arguments in favor of CLAs are often advanced and deserve consideration. + +**Easy relicensing:** If administered appropriately, Apache-style CLAs give the project steward effectively unlimited power to sublicense contributions under terms of the steward's choice. This is sometimes seen as desirable because of the potential need to relicense a project under some other open source license. But the value of easy relicensing has been greatly exaggerated by pointing to a few historical cases involving major relicensing campaigns undertaken by projects with an unusually large number of past contributors (all of which were successful without the use of a CLA). There are benefits in relicensing being hard because it results in stable legal expectations around a project and encourages projects to consult their contributor communities before undertaking significant legal policy changes. In any case, most inbound=outbound open source projects never attempt to relicense during their lifetime, and for the small number that do, relicensing will be relatively painless because typically the number of past contributors to contact will not be large. + +**Provenance tracking:** It is sometimes claimed that CLAs enable a project to rigorously track the provenance of contributions, which purportedly has some legal benefit. It is unclear what is achieved by the use of CLAs in this regard that is not better handled through such non-CLA means as preserving Git commit history. And the DCO would seem to be much better suited to tracking contributions, given that it is normally used on a per-commit basis, while CLAs are signed once per contributor and are administratively separate from code contributions. Moreover, provenance tracking is often described as though it were a benefit for the public, yet I know of no case where a project provides transparent, ready public access to CLA acceptance records. + +**License revocation:** Some CLA advocates warn of the prospect that a contributor may someday attempt to revoke a past license grant. To the extent that the concern is about largely judgment-proof individual contributors with no corporate affiliation, it is not clear why an Apache-style CLA provides more meaningful protection against this outcome compared to the use of an open source license. And, as with so many of the legal risks raised in discussions of open source legal policy, this appears to be a phantom risk. I have heard of only a few purported attempts at license revocation over the years, all of which were resolved quickly when the contributor backed down in the face of community pressure. + +**Unauthorized employee contribution:** This is a special case of the license revocation issue and has recently become a point commonly raised by CLA advocates. When an employee contributes to an upstream project, normally the employer owns the copyrights and patents for which the project needs licenses, and only certain executives are authorized to grant such licenses. Suppose an employee contributed proprietary code to a project without approval from the employer, and the employer later discovers this and demands removal of the contribution or sues the project's users. This risk of unauthorized contributions is thought to be minimized by use of something like the [Apache CCLA][11] with its representations and signature requirement, coupled with some adequate review process to ascertain that the CCLA signer likely was authorized to sign (a step which I suspect is not meaningfully undertaken by most CLA-using companies). + +Based on common sense and common experience, I contend that in nearly all cases today, employee contributions are done with the actual or constructive knowledge and consent of the employer. If there were an atmosphere of high litigation risk surrounding open source software, perhaps this risk should be taken more seriously, but litigation arising out of open source projects remains remarkably uncommon. + +More to the point, I know of no case where an allegation of copyright or patent infringement against an inbound=outbound project, not stemming from an alleged open source license violation, would have been prevented by use of a CLA. Patent risk, in particular, is often cited by CLA proponents when pointing to the risk of unauthorized contributions, but the patent license grants in Apache-style CLAs are, by design, quite narrow in scope. Moreover, corporate contributions to an open source project will typically be few in number, small in size (and thus easily replaceable), and likely to be discarded as time goes on. + +### Alternatives + +If your company does not buy into the anti-CLA case and cannot get comfortable with the simple use of inbound=outbound, there are alternatives to resorting to an asymmetric and administratively burdensome Apache-style CLA requirement. The use of the DCO as a complement to inbound=outbound addresses at least some of the concerns of risk-averse CLA advocates. If you must use a true CLA, there is no need to use the Apache model (let alone a [monstrous derivative][10] of it). Consider the non-specification core of the [Eclipse Contributor Agreement][12]—essentially the DCO wrapped inside a CLA—or the Software Freedom Conservancy's [Selenium CLA][13], which merely ceremonializes an inbound=outbound contribution policy. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/cla-problems + +作者:[Richard Fontana][a] +选题:[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/fontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/3/cla-vs-dco-whats-difference +[2]: https://opensource.com/law/10/6/new-contributor-agreement-fedora +[3]: https://www.red-bean.com/kfogel/ +[4]: https://developercertificate.org +[5]: https://producingoss.com/en/contributor-agreements.html#developer-certificate-of-origin +[6]: https://www.apache.org/licenses/icla.pdf +[7]: https://www.freeipa.org/page/Why_CLA%3F +[8]: https://opensource.com/law/11/7/trouble-harmony-part-1 +[9]: https://wiki.openstack.org/wiki/OpenStackAndItsCLA +[10]: https://opensource.com/article/19/1/cla-proliferation +[11]: https://www.apache.org/licenses/cla-corporate.txt +[12]: https://www.eclipse.org/legal/ECA.php +[13]: https://docs.google.com/forms/d/e/1FAIpQLSd2FsN12NzjCs450ZmJzkJNulmRC8r8l8NYwVW5KWNX7XDiUw/viewform?hl=en_US&formkey=dFFjXzBzM1VwekFlOWFWMjFFRjJMRFE6MQ#gid=0 From 100fa31fdec177f8a935e45a92ca76d5c1acfe14 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:14:21 +0800 Subject: [PATCH 474/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Which?= =?UTF-8?q?=20Raspberry=20Pi=20should=20you=20choose=3F=20sources/tech/201?= =?UTF-8?q?90301=20Which=20Raspberry=20Pi=20should=20you=20choose.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...01 Which Raspberry Pi should you choose.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20190301 Which Raspberry Pi should you choose.md diff --git a/sources/tech/20190301 Which Raspberry Pi should you choose.md b/sources/tech/20190301 Which Raspberry Pi should you choose.md new file mode 100644 index 0000000000..b7c5009051 --- /dev/null +++ b/sources/tech/20190301 Which Raspberry Pi should you choose.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Which Raspberry Pi should you choose?) +[#]: via: (https://opensource.com/article/19/3/which-raspberry-pi-choose) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Which Raspberry Pi should you choose? +====== +In the first article in our series on getting started with Raspberry Pi, learn the three criteria for choosing the right model for you. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) + +This is the first article in a 14-day series on getting started with the [Raspberry Pi][1]. Although the series is geared towards people who have never used a Raspberry Pi or Linux or programming, there will definitely be things for more experienced readers—and I encourage those readers to leave comments and tips that build on what I write. If everyone contributes, we can make this series even more useful for beginners, other experienced readers, and even me! + +So, you want to give the Raspberry Pi a shot, but you don't know which model to buy. Maybe you want one for your classroom or your kid, but there are so many options, and you aren't sure which one is right for you. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_1_boards.png) + +My three main criteria for choosing a new Raspberry Pi are: + + * **Cost:** Don't just consider the cost of the Raspberry Pi board, but also factor the peripherals you will need in order to use it. In the US, the Raspberry Pi's cost varies from $5 (for the Raspberry Pi Zero) to $35 (for the Raspberry Pi 3 B and 3 B+). However, if you pick the Zero you will probably also need a USB hub for your mouse and keyboard, possibly a wireless adapter, and some sort of display adapter. Unless you have most (if not all) of the peripherals needed for whatever you want to do with your Raspberry Pi, make sure to add those to your Pi budget. Also, in some countries, a Raspberry Pi on its own (even without any peripherals) may be a cost burden for many students and teachers. + + * **Availability:** Finding the Raspberry Pi you want can vary depending on your location, as it may be easier (or harder) to get certain versions in some countries. Availability is an even bigger issue after new models are released, and it can take a few days or even weeks for new versions to become available in your market. + + * **Purpose:** Location and cost may not affect everyone, but every buyer must consider why they want a Raspberry Pi. The eight different models vary in RAM, CPU core, CPU speed, physical size, network connectivity, peripheral expansion, etc. For example, if you want the most robust solution with more "horsepower," you probably will want the Raspberry Pi 3 B+, which has the most RAM, fastest CPU, and largest number of cores. If you want something that won't require network connectivity, won't be used for CPU-intensive work, and can be hidden in a small space, you could go with a Raspberry Pi Zero. + + +[Wikipedia's Raspberry Pi specs chart][2] is an easy way to compare the eight Raspberry Pis models. + +Now that you know what to look for in a Raspberry Pi, in the next article, I will explain how to buy one. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/which-raspberry-pi-choose + +作者:[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://www.raspberrypi.org/ +[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications From 39480dbf3d6d536a37a0ba29ef03ba9da1f7b88a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 18:46:31 +0800 Subject: [PATCH 475/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20IRC=20?= =?UTF-8?q?vs=20IRL:=20How=20to=20run=20a=20good=20IRC=20meeting=20sources?= =?UTF-8?q?/talk/20190228=20IRC=20vs=20IRL-=20How=20to=20run=20a=20good=20?= =?UTF-8?q?IRC=20meeting.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...C vs IRL- How to run a good IRC meeting.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md diff --git a/sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md b/sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md new file mode 100644 index 0000000000..99f0c5c465 --- /dev/null +++ b/sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IRC vs IRL: How to run a good IRC meeting) +[#]: via: (https://opensource.com/article/19/2/irc-vs-irl-meetings) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +IRC vs IRL: How to run a good IRC meeting +====== +Internet Relay Chat meetings can be a great way to move a project forward if you follow these best practices. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community_1.png?itok=rT7EdN2m) + +There's an art to running a meeting in any format. Many people have learned to run in-person or telephone meetings, but [Internet Relay Chat][1] (IRC) meetings have unique characteristics that differ from "in real life" (IRL) meetings. This article will share the advantages and disadvantages of the IRC format as well as tips that will help you lead IRC meetings more effectively. + +Why IRC? Despite the wealth of real-time chat options available today, [IRC remains a cornerstone of open source projects][2]. If your project uses another communication method, don't worry. Most of this advice works for any synchronous text chat mechanism, perhaps with a few tweaks here and there. + +### Challenges of IRC meetings + +IRC meetings pose certain challenges compared to in-person meetings. You know that lag between when one person finishes talking and the next one begins? It's worse in IRC because people have to type what they're thinking. This is slower than talking and—unlike with talking—you can't tell when someone else is trying to compose a message. Moderators must remember to insert long pauses when asking for responses or moving to the next topic. And someone who wants to speak up should insert a brief message (e.g., a period) to let the moderator know. + +IRC meetings also lack the metadata you get from other methods. You can't read facial expressions or tone of voice in text. This means you have to be careful with your word choice and phrasing. + +And IRC meetings make it really easy to get distracted. At least when someone is looking at funny cat GIFs during an in-person meeting, you'll see them smile and hear them laugh at inopportune times. In IRC, unless they accidentally paste the wrong text, there's no peer pressure even to pretend to pay attention. With IRC, you can even be in multiple meetings at once. I've done this, but it's dangerous if you need to be an active participant. + +### Benefits of IRC meetings + +IRC meetings have some unique advantages, too. IRC is a very resource-light medium. It doesn't tax bandwidth or CPU. This lowers the barrier for participation, which is advantageous for both the underprivileged and people who are on the road. For volunteer contributors, it means they may be able to participate during their workday. And it means participants don't need to find a quiet space where they can talk without bothering those around them. + +With a meeting bot, IRC can produce meeting minutes instantly. In Fedora, we use Zodbot, an instance of Debian's [Meetbot][3], to log meetings and provide interaction. When a meeting ends, the minutes and full logs are immediately available to the community. This can reduce the administrative overhead of running the meeting. + +### It's like a normal meeting, but different + +Conducting a meeting via IRC or other text-based medium means thinking about the meeting in a slightly different way. Although it lacks some of the benefits of higher-bandwidth modes of communication, it has advantages, too. Running an IRC meeting provides the opportunity to develop discipline that can help you run any type of meeting. + +Like any meeting, IRC meetings are best when there's a defined agenda and purpose. A good meeting moderator knows when to let the conversation follow twists and turns and when it's time to reel it back in. There's no hard and fast rule here—it's very much an art. But IRC offers an advantage in this regard. By setting the channel topic to the meeting's current topic, people have a visible reminder of what they should be talking about. + +If your project doesn't already conduct synchronous meetings, you should give it some thought. For projects with a diverse set of time zones, finding a mutually agreeable time to hold a meeting is hard. You can't rely on meetings as your only source of coordination. But they can be a valuable part of how your project works. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/irc-vs-irl-meetings + +作者:[Ben Cotton][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://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[2]: https://opensource.com/article/16/6/getting-started-irc +[3]: https://wiki.debian.org/MeetBot From 8c8bfcf91233101430ba4670eb652d9de03ae34e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 18:52:55 +0800 Subject: [PATCH 476/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How=20?= =?UTF-8?q?To=20Find=20Available=20Network=20Interfaces=20On=20Linux=20sou?= =?UTF-8?q?rces/tech/20190227=20How=20To=20Find=20Available=20Network=20In?= =?UTF-8?q?terfaces=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...d Available Network Interfaces On Linux.md | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 sources/tech/20190227 How To Find Available Network Interfaces On Linux.md diff --git a/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md new file mode 100644 index 0000000000..e71aa15459 --- /dev/null +++ b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Find Available Network Interfaces On Linux) +[#]: via: (https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Find Available Network Interfaces On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/network-interface-720x340.jpeg) + +One of the common task we do after installing a Linux system is network configuration. Of course, you can configure network interfaces during the installation time. But, some of you might prefer to do it after installation or change the existing settings. As you know already, you must first know how many interfaces are available on the system in-order to configure network settings from command line. This brief tutorial addresses all the possible ways to find available network interfaces on Linux and Unix operating systems. + +### Find Available Network Interfaces On Linux + +We can find the available network cards in couple ways. + +**Method 1 – Using ‘ifconfig’ Command:** + +The most commonly used method to find the network interface details is using **‘ifconfig’** command. I believe some of Linux users might still use this. + +``` +$ ifconfig -a +``` + +Sample output: + +``` +enp5s0: flags=4098 mtu 1500 +ether 24:b6:fd:37:8b:29 txqueuelen 1000 (Ethernet) +RX packets 0 bytes 0 (0.0 B) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 0 bytes 0 (0.0 B) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 +inet 127.0.0.1 netmask 255.0.0.0 +inet6 ::1 prefixlen 128 scopeid 0x10 +loop txqueuelen 1000 (Local Loopback) +RX packets 171420 bytes 303980988 (289.8 MiB) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 171420 bytes 303980988 (289.8 MiB) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +wlp9s0: flags=4163 mtu 1500 +inet 192.168.225.37 netmask 255.255.255.0 broadcast 192.168.225.255 +inet6 2409:4072:6183:c604:c218:85ff:fe50:474f prefixlen 64 scopeid 0x0 +inet6 fe80::c218:85ff:fe50:474f prefixlen 64 scopeid 0x20 +ether c0:18:85:50:47:4f txqueuelen 1000 (Ethernet) +RX packets 564574 bytes 628671925 (599.5 MiB) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 299706 bytes 60535732 (57.7 MiB) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + +As you see in the above output, I have two network interfaces namely **enp5s0** (on board wired ethernet adapter) and **wlp9s0** (wireless network adapter) on my Linux box. Here, **lo** is loopback interface, which is used to access all network services locally. It has an ip address of 127.0.0.1. + +We can also use the same ‘ifconfig’ command in many UNIX variants, for example **FreeBSD** , to list available network cards. + +**Method 2 – Using ‘ip’ Command:** + +The ‘ifconfig’ command is deprecated in the latest Linux versions. So you can use **‘ip’** command to display the network interfaces as shown below. + +``` +$ ip link show +``` + +Sample output: + +``` +1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: enp5s0: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 + link/ether 24:b6:fd:37:8b:29 brd ff:ff:ff:ff:ff:ff +3: wlp9s0: mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000 + link/ether c0:18:85:50:47:4f brd ff:ff:ff:ff:ff:ff +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/ip-command.png) + +You can also use the following commands as well. + +``` +$ ip addr + +$ ip -s link +``` + +Did you notice that these command also shows the connected state of the network interfaces? If you closely look at the above output, you will notice that my Ethernet card is not connected with network cable (see the word **“DOWN”** in the above output). And wireless network card is connected (See the word **“UP”** ). For more details, check our previous guide to [**find the connected state of network interfaces on Linux**][1]. + +These two commands (ifconfig and ip) are just enough to find the available network cards on your Linux systems. + +However, there are few other methods available to list network interfaces on Linux. Here you go. + +**Method 3:** + +The Linux Kernel saves the network interface details inside **/sys/class/net** directory. You can verify the list of available interfaces by looking into this directory. + +``` +$ ls /sys/class/net +``` + +Output: + +``` +enp5s0 lo wlp9s0 +``` + +**Method 4:** + +In Linux operating systems, **/proc/net/dev** file contains statistics about network interfaces. + +To view the available network cards, just view its contents using command: + +``` +$ cat /proc/net/dev +``` + +Output: + +``` +Inter-| Receive | Transmit +face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed +wlp9s0: 629189631 566078 0 0 0 0 0 0 60822472 300922 0 0 0 0 0 0 +enp5s0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +lo: 303980988 171420 0 0 0 0 0 0 303980988 171420 0 0 0 0 0 0 +``` + +**Method 5: Using ‘netstat’ command** + +The **netstat** command displays various details such as network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. + +``` +$ netstat -i +``` + +**Sample output:** + +``` +Kernel Interface table +Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg +lo 65536 171420 0 0 0 171420 0 0 0 LRU +wlp9s0 1500 565625 0 0 0 300543 0 0 0 BMRU +``` + +Please be mindful that netstat is obsolete. The Replacement for “netstat -i” is “ip -s link”. Also note that this method will list only the active interfaces, not all available interfaces. + +**Method 6: Using ‘nmcli’ command** + +The nmcli is nmcli is a command-line tool for controlling NetworkManager and reporting network status. It is used to create, display, edit, delete, activate, and deactivate network connections and display network status. + +If you have Linux system with Network Manager installed, you can list the available network interfaces using nmcli tool using the following commands: + +``` +$ nmcli device status +``` + +Or, + +``` +$ nmcli connection show +``` + +You know now how to find the available network interfaces on Linux. Next, check the following guides to know how to configure IP address on Linux. + +[How To Configure Static IP Address In Linux And Unix][2] + +[How To Configure IP Address In Ubuntu 18.04 LTS][3] + +[How To Configure Static And Dynamic IP Address In Arch Linux][4] + +[How To Assign Multiple IP Addresses To Single Network Card In Linux][5] + +If you know any other quick ways to do it, please share them in the comment section below. I will check and update the guide with your inputs. + +And, that’s all. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/ + +作者:[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]: https://www.ostechnix.com/how-to-find-out-the-connected-state-of-a-network-cable-in-linux/ +[2]: https://www.ostechnix.com/configure-static-ip-address-linux-unix/ +[3]: https://www.ostechnix.com/how-to-configure-ip-address-in-ubuntu-18-04-lts/ +[4]: https://www.ostechnix.com/configure-static-dynamic-ip-address-arch-linux/ +[5]: https://www.ostechnix.com/how-to-assign-multiple-ip-addresses-to-single-network-card-in-linux/ From 3e2039c3b98178d0bb64beb7ef7285b06ef5b28d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:02:52 +0800 Subject: [PATCH 477/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20A=20Br?= =?UTF-8?q?ief=20History=20of=20FOSS=20Practices=20sources/talk/20190228?= =?UTF-8?q?=20A=20Brief=20History=20of=20FOSS=20Practices.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90228 A Brief History of FOSS Practices.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/talk/20190228 A Brief History of FOSS Practices.md diff --git a/sources/talk/20190228 A Brief History of FOSS Practices.md b/sources/talk/20190228 A Brief History of FOSS Practices.md new file mode 100644 index 0000000000..58e90a8efa --- /dev/null +++ b/sources/talk/20190228 A Brief History of FOSS Practices.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Brief History of FOSS Practices) +[#]: via: (https://itsfoss.com/history-of-foss) +[#]: author: (Avimanyu Bandyopadhyay https://itsfoss.com/author/avimanyu/) + +A Brief History of FOSS Practices +====== + +We focus a great deal about Linux and Free & Open Source Software at It’s FOSS. Ever wondered how old such FOSS Practices are? How did this Practice come by? What is the History behind this revolutionary concept? + +In this history and trivia article, let’s take a look back in time through this brief write-up and note some interesting initiatives in the past that have grown so huge today. + +### Origins of FOSS + +![History of FOSS][1] + +The origins of FOSS goes back to the 1950s. When hardware was purchased, there used to be no additional charges for bundled software and the source code would also be available in order to fix possible bugs in the software. + +It was actually a common Practice back then for users with the freedom to customize the code. + +At that time, mostly academicians and researchers in the industry were the collaborators to develop such software. + +The term Open Source was not there yet. Instead, the term that was popular at that time was “Public Domain Software”. As of today, ideologically, both are very much [different][2] in nature even though they may sound similar. + + + +Back in 1955, some users of the [IBM 701][3] computer system from Los Angeles, voluntarily founded a group called SHARE. The “SHARE Program Library Agency” (SPLA) distributed information and software through magnetic tapes. + +Technical information shared, was about programming languages, operating systems, database systems, and user experiences for enterprise users of small, medium, and large-scale IBM computers. + +The initiative that is now more than 60 years old, continues to follow its goals quite actively. SHARE has its upcoming event coming up as [SHARE Phoenix 2019][4]. You can download and check out their complete timeline [here][5]. + +### The GNU Project + +Announced at MIT on September 27, 1983, by Richard Stallman, the GNU Project is what immensely empowers and supports the Free Software Community today. + +### Free Software Foundation + +The “Free Software Movement” by Richard Stallman established a new norm for developing Free Software. + +He founded The Free Software Foundation (FSF) on 4th October 1985 to support the free software movement. Software that ensures that the end users have freedom in using, studying, sharing and modifying that software came to be called as Free Software. + +**Free as in Free Speech, Not Free Beer** + + + +The Free Software Movement laid the following rules to establish the distinctiveness of the idea: + + * The freedom to run the program as you wish, for any purpose (freedom 0). + * The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this. + * The freedom to redistribute copies so you can help your neighbor (freedom 2). + * The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this. + +### The Linux Kernel + + + +How can we miss this section at It’s FOSS! The Linux kernel was released as freely modifiable source code in 1991 by Linus Torvalds. At first, it was neither Free Software nor used an Open-source software license. In February 1992, Linux was relicensed under the GPL. + +### The Linux Foundation + +The Linux Foundation has a goal to empower open source projects to accelerate technology development and commercial adoption. It is an initiative that was taken in 2000 via the [Open Source Development Labs][6] (OSDL) which later merged with the [Free Standards Group][7]. + +Linus Torvalds works at The Linux Foundation who provide complete support to him so that he can work full-time on improving Linux. + +### Open Source + +When the source code of [Netscape][8] Communicator was released in 1998, the label “Open Source” was adopted by a group of individuals at a strategy session held on February 3rd, 1998 in Palo Alto, California. The idea grew from a visionary realization that the [Netscape announcement][9] had changed the way people looked at commercial software. + +This opened up a whole new world, creating a new perspective that revealed the superiority and advantage of an open development process that could be powered by collaboration. + +[Christine Peterson][10] was the one among that group of individuals who originally suggested the term “Open Source” as we perceive today (mentioned [earlier][11]). + +### Evolution of Business Models + +The concept of Open Source is a huge phenomenon right now and there are several companies that continue to adopt the Open Source Approach to this day. [As of April 2015, 78% of companies used Open Source Software][12] with different [Open Source Licenses][13]. + +Several organisations have adopted [different business models][14] for Open Source. Red Hat and Mozilla are two good examples. + +So this was a brief recap of some interesting facts from FOSS History. Do let us know your thoughts if you want to share in the comments below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/history-of-foss + +作者:[Avimanyu Bandyopadhyay][a] +选题:[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/avimanyu/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/history-of-foss.png?resize=800%2C450&ssl=1 +[2]: https://opensource.org/node/878 +[3]: https://en.wikipedia.org/wiki/IBM_701 +[4]: https://event.share.org/home +[5]: https://www.share.org/d/do/11532 +[6]: https://en.wikipedia.org/wiki/Open_Source_Development_Labs +[7]: https://en.wikipedia.org/wiki/Free_Standards_Group +[8]: https://en.wikipedia.org/wiki/Netscape +[9]: https://web.archive.org/web/20021001071727/http://wp.netscape.com:80/newsref/pr/newsrelease558.html +[10]: https://en.wikipedia.org/wiki/Christine_Peterson +[11]: https://itsfoss.com/nanotechnology-open-science-ai/ +[12]: https://www.zdnet.com/article/its-an-open-source-world-78-percent-of-companies-run-open-source-software/ +[13]: https://itsfoss.com/open-source-licenses-explained/ +[14]: https://opensource.com/article/17/12/open-source-business-models From b354f9e00c3a132067f6603c2e29930ccae647d9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:05:24 +0800 Subject: [PATCH 478/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20All=20?= =?UTF-8?q?about=20{Curly=20Braces}=20in=20Bash=20sources/tech/20190226=20?= =?UTF-8?q?All=20about=20-Curly=20Braces-=20in=20Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190226 All about -Curly Braces- in Bash.md | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 sources/tech/20190226 All about -Curly Braces- in Bash.md diff --git a/sources/tech/20190226 All about -Curly Braces- in Bash.md b/sources/tech/20190226 All about -Curly Braces- in Bash.md new file mode 100644 index 0000000000..42d37abdec --- /dev/null +++ b/sources/tech/20190226 All about -Curly Braces- in Bash.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (All about {Curly Braces} in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +All about {Curly Braces} in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/curly-braces-1920.jpg?itok=cScRhWrX) + +At this stage of our Bash basics series, it would be hard not to see some crossover between topics. For example, you have already seen a lot of brackets in the examples we have shown over the past several weeks, but the focus has been elsewhere. + +For the next phase of the series, we’ll take a closer look at brackets, curly, curvy, or straight, how to use them, and what they do depending on where you use them. We will also tackle other ways of enclosing things, like when to use quotes, double-quotes, and backquotes. + +This week, we're looking at curly brackets or _braces_ : `{}`. + +### Array Builder + +You have already encountered curly brackets before in [The Meaning of Dot][1]. There, the focus was on the use of the dot/period (`.`), but using braces to build a sequence was equally important. + +As we saw then: + +``` +echo {0..10} +``` + +prints out the numbers from 0 to 10. Using: + +``` +echo {10..0} +``` + +prints out the same numbers, but in reverse order. And, + +``` +echo {10..0..2} +``` + +prints every second number, starting with 10 and making its way backwards to 0. + +Then, + +``` +echo {z..a..2} +``` + +prints every second letter, starting with _z_ and working its way backwards until _a_. + +And so on and so forth. + +Another thing you can do is combine two or more sequences: + +``` +echo {a..z}{a..z} +``` + +This prints out all the two letter combinations of the alphabet, from _aa_ to _zz_. + +Is this useful? Well, actually it is. You see, arrays in Bash are defined by putting elements between parenthesis `()` and separating each element using a space, like this: + +``` +month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") +``` + +To access an element within the array, you use its index within brackets `[]`: + +``` +$ echo ${month[3]} # Array indexes start at [0], so [3] points to the fourth item + +Apr +``` + +You can accept all those brackets, parentheses, and braces on faith for a moment. We'll talk about them presently. + +Notice that, all things being equal, you can create an array with something like this: + +``` +letter_combos=({a..z}{a..z}) +``` + +and `letter_combos` points to an array that contains all the 2-letter combinations of the entire alphabet. + +You can also do this: + +``` +dec2bin=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}) +``` + +This last one is particularly interesting because `dec2bin` now contains all the binary numbers for an 8-bit register, in ascending order, starting with 00000000, 00000001, 00000010, etc., until reaching 11111111. You can use this to build yourself an 8-bit decimal-to-binary converter. Say you want to know what 25 is in binary. You can do this: + +``` +$ echo ${dec2bin[25]} + +00011001 +``` + +Yes, there are better ways of converting decimal to binary as we saw in [the article where we discussed & as a logical operator][2], but it is still interesting, right? + +### Parameter expansion + +Getting back to + +``` +echo ${month[3]} +``` + +Here the braces `{}` are not being used as apart of a sequence builder, but as a way of generating _parameter expansion_. Parameter expansion involves what it says on the box: it takes the variable or expression within the braces and expands it to whatever it represents. + +In this case, `month` is the array we defined earlier, that is: + +``` +month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") +``` + +And, item 3 within the array points to `"Apr"` (remember: the first index in an array in Bash is `[0]`). That means that `echo ${month[3]}`, after the expansion, translates to `echo "Apr"`. + +Interpreting a variable as its value is one way of expanding it, but there are a few more you can leverage. You can use parameter expansion to manipulate what you read from variable, say, by cutting a chunk off the end. + +Suppose you have a variable like: + +``` +a="Too longgg" +``` + +The command: + +``` +echo ${a%gg} +``` + +chops off the last two gs and prints " _Too long_ ". + +Breaking this down, + + * `${...}` tells the shell to expand whatever is inside it + * `a` is the variable you are working with + * `%` tells the shell you want to chop something off the end of the expanded variable ("Too longgg") + * and `gg` is what you want to chop off. + + + +This can be useful for converting files from one format to another. Allow me to explain with a slight digression: + +[ImageMagick][3] is a set of command line tools that lets you manipulate and modify images. One of its most useful tools ImageMagick comes with is `convert`. In its simplest form `convert` allows you to, given an image in a certain format, make a copy of it in another format. + +The following command takes a JPEG image called _image.jpg_ and creates a PNG copy called _image.png_ : + +``` +convert image.jpg image.png +``` + +ImageMagick is often pre-installed on most Linux distros. If you can't find it, look for it in your distro's software manager. + +Okay, end of digression. On to the example: + +With variable expansion, you can do the same as shown above like this: + +``` +i=image.jpg + +convert $i ${i%jpg}png +``` + +What you are doing here is chopping off the extension `jpg` from `i` and then adding `png`, making the command `convert image.jpg image.png`. + +You may be wondering how this is more useful than just writing in the name of the file. Well, when you have a directory containing hundreds of JPEG images, you need to convert to PNG, run the following in it: + +``` +for i in *.jpg; do convert $i ${i%jpg}png; done +``` + +... and, hey presto! All the pictures get converted automatically. + +If you need to chop off a chunk from the beginning of a variable, instead of `%`, use `#`: + +``` +$ a="Hello World!" + +$ echo Goodbye${a#Hello} + +Goodbye World! +``` + +There's quite a bit more to parameter expansion, but a lot of it makes sense only when you are writing scripts. We'll explore more on that topic later in this series. + +### Output Grouping + +Meanwhile, let's finish up with something simple: you can also use `{ ... }` to group the output from several commands into one big blob. The command: + +``` +echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls > PNGs.txt +``` + +will execute all the commands but will only copy into the _PNGs.txt_ file the output from the last `ls` command in the list. However, doing + +``` +{ echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls; } > PNGs.txt +``` + +creates the file _PNGs.txt_ with everything, starting with the line " _I found all these PNGs:_ ", then the list of PNG files returned by `find`, then the line "Within this bunch of files:" and finishing up with the complete list of files and directories within the current directory. + +Notice that there is space between the braces and the commands enclosed within them. That’s because `{` and `}` are _reserved words_ here, commands built into the shell. They would roughly translate to " _group the outputs of all these commands together_ " in plain English. + +Also notice that the list of commands has to end with a semicolon (`;`) or the whole thing will bork. + +### Next Time + +In our next installment, we'll be looking at more things that enclose other things, but of different shapes. Until then, have fun! + +Read more: + +[And, Ampersand, and & in Linux][4] + +[Ampersands and File Descriptors in Bash][5] + +[Logical & in Bash][2] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash + +作者:[Paul 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://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[2]: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash +[3]: http://www.imagemagick.org/ +[4]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[5]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash From 9bc188ba498fa327cb5bc7affe36dfc3582161a9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:07:24 +0800 Subject: [PATCH 479/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20Let=20?= =?UTF-8?q?your=20engineers=20choose=20the=20license:=20A=20guide=20source?= =?UTF-8?q?s/talk/20190227=20Let=20your=20engineers=20choose=20the=20licen?= =?UTF-8?q?se-=20A=20guide.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...r engineers choose the license- A guide.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20190227 Let your engineers choose the license- A guide.md diff --git a/sources/talk/20190227 Let your engineers choose the license- A guide.md b/sources/talk/20190227 Let your engineers choose the license- A guide.md new file mode 100644 index 0000000000..81a8dd8ee2 --- /dev/null +++ b/sources/talk/20190227 Let your engineers choose the license- A guide.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let your engineers choose the license: A guide) +[#]: via: (https://opensource.com/article/19/2/choose-open-source-license-engineers) +[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman) + +Let your engineers choose the license: A guide +====== +Enabling engineers to make licensing decisions is wise and efficient. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) + +Imagine you are working for a company that will be starting a new open source community project. Great! You have taken a positive first step to give back and enable a virtuous cycle of innovation that the open source community-based development model provides. + +But what about choosing an open source license for your project? You ask your manager for guidance, and she provides some perspective but quickly realizes that there is no formal company policy or guidelines. As any wise manager would do, she asks you to develop formal corporate guidelines for choosing an open source license for such projects. + +Simple, right? You may be surprised to learn some unexpected challenges. This article will describe some of the complexities you may encounter and some perspective based on my recent experience with a similar project at Red Hat. + +It may be useful to quickly review some of the more common forms of open source licensing. Open source licenses may be generally placed into two main buckets, copyleft and permissive. + +> Copyleft licenses, such as the GPL, allow access to source code, modifications to the source, and distribution of the source or binary versions in their original or modified forms. Copyleft additionally provides that essential software freedoms (run, study, change, and distribution) will be allowed and ensured for any recipients of that code. A copyleft license prohibits restrictions or limitations on these essential software freedoms. +> +> Permissive licenses, similar to copyleft, also generally allow access to source code, modifications to the source, and distribution of the source or binary versions in their original or modified forms. However, unlike copyleft licenses, additional restrictions may be included with these forms of licenses, including proprietary limitations such as prohibiting the creation of modified works or further distribution. + +Red Hat is one of the leading open source development companies, with thousands of open source developers continuously working upstream and contributing to an assortment of open source projects. When I joined Red Hat, I was very familiar with its flagship Red Hat Enterprise Linux offering, often referred to as RHEL. Although I fully expected that the company contributes under a wide assortment of licenses based on project requirements, I thought our preference and top recommendation for our engineers would be GPLv2 due to our significant involvement with Linux. In addition, GPL is a copyleft license, and copyleft ensures that the essential software freedoms (run, study, change, distribute) will be extended to any recipients of that code. What could be better for sustaining the open source ecosystem than a copyleft license? + +Fast forwarding on my journey to craft internal license choice guidelines for Red Hat, the end result was to not have any license preference at all. Instead, we delegate that responsibility, to the maximum extent possible, to our engineers. Why? Because each open source project and community is unique and there are social aspects to these communities that may have preferences towards various licensing philosophies (e.g., copyleft or permissive). Engineers working in those communities understand all these issues and are best equipped to choose the proper license on this knowledge. Mandating certain licenses for code contributions often will conflict with these community norms and result in reduction or prohibition in contributed content. + +For example, perhaps your organization believes that the latest GPL license (GPLv3) is the best for your company due to its updated provisions. If you mandated GPLv3 for all future contributions vs. GPLv2, you would be prohibited from contributing code to the Linux kernel, since that is a GPLv2 project and will likely remain that way for a very long time. Your engineers, being part of that open source community project, would know that and would automatically choose GPLv2 in the absence of such a mandate. + +Bottom line: Enabling engineers to make these decisions is wise and efficient. + +To the extent your organization may have to restrict the use of certain licenses (e.g., due to certain intellectual property concerns), this should naturally be part of your guidelines or policy. I believe it is much better to delegate to the maximum extent possible to those that understand all the nuances, politics, and licensing philosophies of these varied communities and restrict license choice only when absolutely necessary. Even having a preference for a certain license over another can be problematic. Open source engineers may have deeply rooted feelings about copyleft (either for or against), and forcing one license over the other (unless absolutely necessary for business reasons) may result in creating ill-will and ostracizing an engineer or engineering department within your organization + +In summary, Red Hat's guidelines are very simple and are summarized below: + + 1. We suggest choosing an open source license from a set of 10 different licenses that are very common and meet the needs of most new open source projects. + + 2. We allow the use of other licenses but we ask that a reason is provided to the open source legal team so we can collect and better understand some of the new and perhaps evolving needs of the open source communities that we serve. (As stated above, our engineers are on the front lines and are best equipped to deliver this type of information.) + + 3. The open source legal team always has the right to override a decision, but this would be very rare and only would occur if we were aware of some community or legal concern regarding a specific license or project. + + 4. Publishing source code without a license is never permitted. + +In summary, the advantages of these guidelines are enormous. They are very efficient and lead to a very low-friction development and approval system within our organization. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/choose-open-source-license-engineers + +作者:[Jeffrey Robert Kaufman][a] +选题:[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/jkaufman +[b]: https://github.com/lujun9972 From 01f18c190cf11afc256e8deff8089fb48597536a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:11:06 +0800 Subject: [PATCH 480/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How=20?= =?UTF-8?q?To=20Check=20Password=20Complexity/Strength=20And=20Score=20In?= =?UTF-8?q?=20Linux=3F=20sources/tech/20190227=20How=20To=20Check=20Passwo?= =?UTF-8?q?rd=20Complexity-Strength=20And=20Score=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Complexity-Strength And Score In Linux.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md diff --git a/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md new file mode 100644 index 0000000000..59b18f8a87 --- /dev/null +++ b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Check Password Complexity/Strength And Score In Linux?) +[#]: via: (https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Check Password Complexity/Strength And Score In Linux? +====== + +We all know the password importance. It’s a best practices to use hard and guess password. + +Also, i advise you to use the different password for each services such as email, ftp, ssh, etc., + +In top of that i suggest you guys to change the password frequently to avoid an unnecessary hacking attempt. + +By default RHEL and it’s clone uses `cracklib` module to check password strength. + +We are going to teach you, how to check the password strength using cracklib module. + +If you would like to check the password score which you have created then use the `pwscore` package. + +If you would like to create a good password, basically it should have minimum 12-15 characters length. + +It should be created in the following combinations like, Alphabets (Lower case & Upper case), Numbers and Special Characters. + +There are many utilities are available in Linux to check a password complexity and we are going to discuss about `cracklib` module today. + +### How To Install cracklib module In Linux? + +The cracklib module is available in most of the distribution repository so, use the distribution official package manager to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install cracklib. + +``` +$ sudo dnf install cracklib +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install libcrack2. + +``` +$ sudo apt install libcrack2 +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install cracklib. + +``` +$ sudo pacman -S cracklib +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install cracklib. + +``` +$ sudo yum install cracklib +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install cracklib. + +``` +$ sudo zypper install cracklib +``` + +### How To Use The cracklib module In Linux To Check Password Complexity? + +I have added few example in this article to make you understand better about this module. + +If you are given any words like, person name or place name or common word then you will be getting an message “it is based on a dictionary word”. + +``` +$ echo "password" | cracklib-check +password: it is based on a dictionary word +``` + +The default password length in Linux is `Seven` characters. If you give any password less than seven characters then you will be getting an message “it is WAY too short”. + +``` +$ echo "123" | cracklib-check +123: it is WAY too short +``` + +You will be getting `OK` When you give good password like us. + +``` +$ echo "ME$2w!@fgty6723" | cracklib-check +ME!@fgty6723: OK +``` + +### How To Install pwscore In Linux? + +The pwscore package is available in most of the distribution official repository so, use the distribution package manager to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install libpwquality. + +``` +$ sudo dnf install libpwquality +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install libpwquality. + +``` +$ sudo apt install libpwquality +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install libpwquality. + +``` +$ sudo pacman -S libpwquality +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install libpwquality. + +``` +$ sudo yum install libpwquality +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install libpwquality. + +``` +$ sudo zypper install libpwquality +``` + +If you are given any words like, person name or place name or common word then you will be getting a message “it is based on a dictionary word”. + +``` +$ echo "password" | pwscore +Password quality check failed: + The password fails the dictionary check - it is based on a dictionary word +``` + +The default password length in Linux is `Seven` characters. If you give any password less than seven characters then you will be getting an message “it is WAY too short”. + +``` +$ echo "123" | pwscore +Password quality check failed: + The password is shorter than 8 characters +``` + +You will be getting `password score` When you give good password like us. + +``` +$ echo "ME!@fgty6723" | pwscore +90 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-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/dnf-command-examples-manage-packages-fedora-system/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From 2d7af94ac168215b253164f5d52d8847a08c1959 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 19:12:25 +0800 Subject: [PATCH 481/813] PRF:20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @zero-MK --- ...lts An User When Typing A Wrong Command.md | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md b/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md index 4a3a106a27..9e5e51a032 100644 --- a/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md +++ b/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @@ -1,60 +1,56 @@ [#]: collector: "lujun9972" [#]: translator: "zero-mk" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Bash-Insulter : A Script That Insults An User When Typing A Wrong Command" [#]: via: "https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -Bash-Insulter : 一个在输入错误命令时侮辱用户的脚本 +Bash-Insulter:一个在输入错误命令时嘲讽用户的脚本 ====== -这是一个非常有趣的脚本,每当用户在终端输入错误的命令时,它都会侮辱用户。 +这是一个非常有趣的脚本,每当用户在终端输入错误的命令时,它都会嘲讽用户。 -它让你在处理一些问题时感到快乐。 +它让你在解决一些问题时会感到快乐。有的人在受到终端嘲讽的时候感到不愉快。但是,当我受到终端的批评时,我真的很开心。 -有的人在受到终端侮辱的时候感到不愉快。但是,当我受到终端的侮辱时,我真的很开心。 - -这是一个有趣的CLI(译者注:command-line interface) 工具,在你弄错的时候,会用随机短语侮辱你。 - -此外,它允许您添加自己的短语。 +这是一个有趣的 CLI 工具,在你弄错的时候,会用随机短语嘲讽你。此外,它允许你添加自己的短语。 ### 如何在 Linux 上安装 Bash-Insulter? -在安装 Bash-Insulter 之前,请确保您的系统上安装了 git。如果没有,请使用以下命令安装它。 +在安装 Bash-Insulter 之前,请确保你的系统上安装了 git。如果没有,请使用以下命令安装它。 -对于 **`Fedora`** 系统, 请使用 **[DNF 命令][1]** 安装 git +对于 Fedora 系统, 请使用 [DNF 命令][1] 安装 git。 ``` $ sudo dnf install git ``` -对于 **`Debian/Ubuntu`** 系统,,请使用 **[APT-GET 命令][2]** 或者 **[APT 命令][3]** 安装 git。 +对于 Debian/Ubuntu 系统,请使用 [APT-GET 命令][2] 或者 [APT 命令][3] 安装 git。 ``` $ sudo apt install git ``` -对于基于 **`Arch Linux`** 的系统, 请使用 **[Pacman 命令][4]** 安装 git。 +对于基于 Arch Linux 的系统,请使用 [Pacman 命令][4] 安装 git。 ``` $ sudo pacman -S git ``` -对于 **`RHEL/CentOS`** systems, 请使用 **[YUM 命令][5]** 安装 git。 +对于 RHEL/CentOS 系统,请使用 [YUM 命令][5] 安装 git。 ``` $ sudo yum install git ``` -对于 **`openSUSE Leap`** system, 请使用 **[Zypper 命令][6]** 安装 git。 +对于 openSUSE Leap 系统,请使用 [Zypper 命令][6] 安装 git。 ``` $ sudo zypper install git ``` -我们可以通过克隆(clone)开发人员的github存储库轻松地安装它。 +我们可以通过克隆clone开发人员的 GitHub 存储库轻松地安装它。 首先克隆 Bash-insulter 存储库。 @@ -85,7 +81,7 @@ fi $ sudo source /etc/bash.bashrc ``` -你想测试一下安装是否生效吗?你可以试试在终端上输入一些错误的命令,看看它如何侮辱你。 +你想测试一下安装是否生效吗?你可以试试在终端上输入一些错误的命令,看看它如何嘲讽你。 ``` $ unam -a @@ -95,9 +91,7 @@ $ pin 2daygeek.com ![][8] -如果您想附加您自己的短语,则导航到以下文件并更新它 - -您可以在 `messages` 部分中添加短语。 +如果你想附加你自己的短语,则导航到以下文件并更新它。你可以在 `messages` 部分中添加短语。 ``` # vi /etc/bash.command-not-found @@ -178,7 +172,7 @@ via: https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-c 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[zero-mk](https://github.com/zero-mk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 00ece5ce852fd62f2b1b938284953f228c315d0d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 19:14:37 +0800 Subject: [PATCH 482/813] PUB:20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @zero-MK https://linux.cn/article-10593-1.html --- ...Script That Insults An User When Typing A Wrong Command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md (98%) diff --git a/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md b/published/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md similarity index 98% rename from translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md rename to published/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md index 9e5e51a032..d2844f8a05 100644 --- a/translated/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md +++ b/published/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "zero-mk" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10593-1.html" [#]: subject: "Bash-Insulter : A Script That Insults An User When Typing A Wrong Command" [#]: via: "https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" From 88d4f3b207ce450546c33c250ec5441b64d87fc7 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:22:02 +0800 Subject: [PATCH 483/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20Linux?= =?UTF-8?q?=20security:=20Cmd=20provides=20visibility,=20control=20over=20?= =?UTF-8?q?user=20activity=20sources/tech/20190226=20Linux=20security-=20C?= =?UTF-8?q?md=20provides=20visibility,=20control=20over=20user=20activity.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... visibility, control over user activity.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md diff --git a/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md new file mode 100644 index 0000000000..952e76f1f3 --- /dev/null +++ b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux security: Cmd provides visibility, control over user activity) +[#]: via: (https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux security: Cmd provides visibility, control over user activity +====== + +![](https://images.techhive.com/images/article/2017/01/background-1900329_1920-100705659-large.jpg) + +There's a new Linux security tool you should be aware of — Cmd (pronounced "see em dee") dramatically modifies the kind of control that can be exercised over Linux users. It reaches way beyond the traditional configuration of user privileges and takes an active role in monitoring and controlling the commands that users are able to run on Linux systems. + +Provided by a company of the same name, Cmd focuses on cloud usage. Given the increasing number of applications being migrated into cloud environments that rely on Linux, gaps in the available tools make it difficult to adequately enforce required security. However, Cmd can also be used to manage and protect on-premises systems. + +### How Cmd differs from traditional Linux security controls + +The leaders at Cmd — Milun Tesovic and Jake King — say organizations cannot confidently predict or control user behavior until they understand how users work routinely and what is considered “normal.” They seek to provide a tool that will granularly control, monitor, and authenticate user activity. + +Cmd monitors user activity by forming user activity profiles (characterizing the activities these users generally perform), noticing abnormalities in their online behavior (login times, commands used, user locations, etc.), and preventing and reporting certain activities (e.g., downloading or modifying files and running privileged commands) that suggest some kind of system compromise might be underway. The product's behaviors are configurable and changes can be made rapidly. + +The kind of tools most of us are using today to detect threats, identify vulnerabilities, and control user privileges have taken us a long way, but we are still fighting the battle to keep our systems and data safe. Cmd brings us a lot closer to identifying the intentions of hostile users whether those users are people who have managed to break into accounts or represent insider threats. + +![1 sources live sessions][1] + +View live Linux sessions + +### How does Cmd work? + +In monitoring and managing user activity, Cmd: + + * Collects information that profiles user activity + * Uses the baseline to determine what is considered normal + * Detects and proactively prevents threats using specific indicators + * Sends alerts to responsible people + + + +![2 triggers][3] + +Building custom policies in Cmd + +Cmd goes beyond defining what sysadmins can control through traditional methods, such as configuring sudo privileges, providing much more granular and situation-specific controls. + +Administrators can select escalation policies that can be managed separately from the user privilege controls managed by Linux sysadmins. + +The Cmd agent provides real-time visibility (not after-the-fact log analysis) and can block actions, require additional authentication, or negotiate authorization as needed. + +Also, Cmd supports custom rules based on geolocation if user locations are available. And new policies can be pushed to agents deployed on hosts within minutes. + +![3 command blocked][4] + +Building a trigger query in Cmd + +### Funding news for Cmd + +[Cmd][2] recently got a financial boost, having [completed of a $15 million round of funding][5] led by [GV][6] (formerly Google Ventures) with participation from Expa, Amplify Partners, and additional strategic investors. This brings the company's raised funding to $21.6 million and will help it continue to add new defensive capabilities to the product and grow its engineering teams. + +In addition, the company appointed Karim Faris, general partner at GV, to its board of directors. + +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/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.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://images.idgesg.net/images/article/2019/02/1-sources-live-sessions-100789431-large.jpg +[2]: https://cmd.com +[3]: https://images.idgesg.net/images/article/2019/02/2-triggers-100789432-large.jpg +[4]: https://images.idgesg.net/images/article/2019/02/3-command-blocked-100789433-large.jpg +[5]: https://www.linkedin.com/pulse/changing-cybersecurity-announcing-cmds-15-million-funding-jake-king/ +[6]: https://www.gv.com/ +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 9c9f2b80e1c76ce33aea2667854f3b5cd416deda Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:24:34 +0800 Subject: [PATCH 484/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How=20?= =?UTF-8?q?to=20Display=20Weather=20Information=20in=20Ubuntu=2018.04=20so?= =?UTF-8?q?urces/tech/20190227=20How=20to=20Display=20Weather=20Informatio?= =?UTF-8?q?n=20in=20Ubuntu=2018.04.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lay Weather Information in Ubuntu 18.04.md | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md diff --git a/sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md b/sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md new file mode 100644 index 0000000000..da0c0df203 --- /dev/null +++ b/sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md @@ -0,0 +1,290 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Display Weather Information in Ubuntu 18.04) +[#]: via: (https://itsfoss.com/display-weather-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Display Weather Information in Ubuntu 18.04 +====== + +You’ve got a fresh Ubuntu install and you’re [customizing Ubuntu][1] to your liking. You want the best experience and the best apps for your needs. + +The only thing missing is a weather app. Luckily for you, we got you covered. Just make sure you have the Universe repository enabled. + +![Tools to Display Weather Information in Ubuntu Linux][2] + +### 8 Ways to Display Weather Information in Ubuntu 18.04 + +Back in the Unity days, there were a few popular options like My Weather Indicator to display weather on your system. Those options are either discontinued or not available in Ubuntu 18.04 and higher versions anymore. + +Fortunately, there are many other options to choose from. Some are minimalist and plain simple to use, some offer detailed information (or even present you with news headlines) and some are made for terminal gurus. Whatever your needs may be, the right app is waiting for you. + +**Note:** The presented apps are in no particular order of ranking. + +**Top Panel Apps** + +These applications usually sit on the top panel of your screen. Good for quick look at the temperature. + +#### 1\. OpenWeather Shell Extension + +![Open Weather Gnome Shell Extesnsion][3] + +**Key features:** + + * Simple to install and customize + * Uses OpenWeatherMap (by default) + * Many Units and Layout options + * Can save multiple locations (that can easily be changed) + + + +This is a great extension presenting you information in a simple manner. There are multiple ways to install this. It is the weather app that I find myself using the most, because it’s just a simple, no-hassle integrated weather display for the top panel. + +**How to Install:** + +I recommend reading this [detailed tutorial about using GNOME extensions][4]. The easiest way to install this extension is to open up a terminal and run: + +``` +sudo apt install gnome-shell-extension-weather +``` + +Then all you have to restart the gnome shell by executing: + +``` +Alt+F2 +``` + +Enter **r** and press **Enter**. + +Now open up **Tweaks** (gnome tweak tool) and enable **Openweather** in the **Extensions** tab. + +#### 2\. gnome-weather + +![Gnome Weather App UI][5] +![Gnome Weather App Top Panel][6] + +**Key features:** + + * Pleasant Design + * Integrated into Calendar (Top Panel) + * Simple Install + * Flatpak install available + + + +This app is great for new users. The installation is only one command and the app is easy to use. Although it doesn’t have as many features as other apps, it is still great if you don’t want to bother with multiple settings and a complex install procedure. + +**How to Install:** + +All you have to do is run: + +``` +sudo apt install gnome-weather +``` + +Now search for **Weather** and the app should pop up. After logging out (and logging back in), the Calendar extension will be displayed. + +If you prefer, you can get a [flatpak][7] version. + +#### 3\. Meteo + +![Meteo Weather App UI][8] +![Meteo Weather System Tray][9] + +**Key features:** + + * Great UI + * Integrated into System Tray (Top Panel) + * Simple Install + * Great features (Maps) + + + +Meteo is a snap app on the heavier side. Most of that weight comes from the great Maps features, with maps presenting temperatures, clouds, precipitations, pressure and wind speed. It’s a distinct feature that I haven’t encountered in any other weather app. + +**Note** : After changing location, you might have to quit and restart the app for the changes to be applied in the system tray. + +**How to Install:** + +Open up the **Ubuntu Software Center** and search for **Meteo**. Install and launch. + +**Desktop Apps** + +These are basically desktop widgets. They look good and provide more information at a glance. + +#### 4\. Temps + +![Temps Weather App UI][10] + +**Key features:** + + * Beautiful Design + * Useful Hotkeys + * Hourly Temperature Graph + + + +Temps is an electron app with a beautiful UI (though not exactly “light”). The most unique features are the temperature graphs. The hotkeys might feel unintuitive at first, but they prove to be useful in the long run. The app will minimize when you click somewhere else. Just press Ctrl+Shift+W to bring it back. + +This app is **Open-Source** , and the developer can’t afford the cost of a faster API key, so you might want to create your own API at [OpenWeatherMap][11]. + +**How to Install:** + +Go to the website and download the version you need (probably 64-bit). Extract the archive. Open the extracted directory and double-click on **Temps**. Press Ctrl+Shift+W if the window minimizes. + +#### 5\. Cumulus + +![Cumulus Weather App UI][12] + +**Key features:** + + * Color Selector for background and text + + * Re-sizable window + + * Tray Icon (temperature only) + + * Allows multiple instances with different locations etc. + + + + +Cumulus is a greatly customizable weather app, with a backend supporting Yahoo! Weather and OpenWeatherMap. The UI is great and the installer is simple to use. This app has amazing features. It’s one of the few weather apps that allow for multiple instances. You should definitely try it you are looking for an experience tailored to your preferences. + +**How to Install:** + +Go to the website and download the (online) installer. Open up a terminal and **cd** (change directory) to the directory where you downloaded the file. + +Then run + +``` +chmod +x Cumulus-online-installer-x64 +./Cumulus-online-installer-x64 +``` + +Search for **Cumulus** and enjoy the app! + +**Terminal Apps** + +You are a terminal dweller? You can check the weather right in your terminal. + +#### 7\. WeGo + +![WeGo Weather App Terminal][13] + +**Key features:** + + * Supports different APIs + * Pretty detailed + * Customizable config + * Multi-language support + * 1 to 7 day forecast + + + +WeGo is a Go app for displaying weather info in the terminal. It’s install can be a little tricky, but it’s easy to set up. You’ll need to register an API Key [here][14] (if using **forecast.io** , which is default). Once you set it up, it’s fairly practical for someone who mostly works in the terminal. + +**How to Install:** + +I recommend you to check out the GitHub page for complete information on installation, setup and features. + +#### 8\. Wttr.in + +![Wttr.in Weather App Terminal][15] + +**Key features:** + + * Simple install + * Easy to use + * Lightweight + * 3 day forecast + * Moon phase + + + +If you really live in the terminal, this is the weather app for you. This is as lightweight as it gets. You can specify location (by default the app tries to detect your current location) and a few other parameters (eg. units). + +**How to Install:** + +Open up a terminal and install Curl: + +``` +sudo apt install curl +``` + +Then: + +``` +curl wttr.in +``` + +That’s it. You can specify location and parameters like so: + +``` +curl wttr.in/london?m +``` + +To check out other options type: + +``` +curl wttr.in/:help +``` + +If you found some settings you enjoy and you find yourself using them frequently, you might want to add an **alias**. To do so, open **~/.bashrc** with your favorite editor (that’s **vim** , terminal wizard). Go to the end and paste in + +``` +alias wttr='curl wttr.in/CITY_NAME?YOUR_PARAMS' +``` + +For example: + +``` +alias wttr='curl wttr.in/london?m' +``` + +Save and close **~/.bashrc** and run the command below to source the new file. + +``` +source ~/.bashrc +``` + +Now, typing **wttr** in the terminal and pressing Enter should execute your custom command. + +**Wrapping Up** + +These are a handful of the weather apps available for Ubuntu. We hope our list helped you discover an app fitting your needs, be that something with pleasant aesthetics or just a quick tool. + +What is your favorite weather app? Tell us about what you enjoy and why in the comments section. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/display-weather-ubuntu + +作者:[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/gnome-tricks-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/display-weather-ubuntu.png?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/open_weather_gnome_shell-1-1.jpg?fit=800%2C383&ssl=1 +[4]: https://itsfoss.com/gnome-shell-extensions/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/gnome_weather_ui.jpg?fit=800%2C599&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/gnome_weather_top_panel.png?fit=800%2C587&ssl=1 +[7]: https://flatpak.org/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/meteo_ui.jpg?fit=800%2C547&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/meteo_system_tray.png?fit=800%2C653&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/temps_ui.png?fit=800%2C623&ssl=1 +[11]: https://openweathermap.org/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/cumulus_ui.png?fit=800%2C651&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/wego_terminal.jpg?fit=800%2C531&ssl=1 +[14]: https://developer.forecast.io/register +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/wttr_in_terminal.jpg?fit=800%2C526&ssl=1 From bcb410f91816972b7b593632c8742389fff51e69 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:25:57 +0800 Subject: [PATCH 485/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190223=20No!=20?= =?UTF-8?q?Ubuntu=20is=20NOT=20Replacing=20Apt=20with=20Snap=20sources/tal?= =?UTF-8?q?k/20190223=20No-=20Ubuntu=20is=20NOT=20Replacing=20Apt=20with?= =?UTF-8?q?=20Snap.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- Ubuntu is NOT Replacing Apt with Snap.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md diff --git a/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md b/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md new file mode 100644 index 0000000000..bb7dd14943 --- /dev/null +++ b/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (No! Ubuntu is NOT Replacing Apt with Snap) +[#]: via: (https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +No! Ubuntu is NOT Replacing Apt with Snap +====== + +Stop believing the rumors that Ubuntu is planning to replace Apt with Snap in the [Ubuntu 19.04 release][1]. These are only rumors. + +![Snap replacing apt rumors][2] + +Don’t get what I am talking about? Let me give you some context. + +There is a ‘blueprint’ on Ubuntu’s launchpad website, titled ‘Replace APT with snap as default package manager’. It talks about replacing Apt (package manager at the heart of Debian) with Snap ( a new packaging system by Ubuntu). + +> Thanks to Snap, the need for APT is disappearing, fast… why don’t we use snap at the system level? + +The post further says “Imagine, for example, being able to run “sudo snap install cosmic” to upgrade to the current release, “sudo snap install –beta disco” (in March) to upgrade to a beta release, or, for that matter, “sudo snap install –edge disco” to upgrade to a pre-beta release. It would make the whole process much easier, and updates could simply be delivered as updates to the corresponding snap, which could then just be pushed to the repositories and there it is. This way, instead of having a separate release updater, it would be possible to A, run all system updates completely and silently in the background to avoid nagging the user (a la Chrome OS), and B, offer release upgrades in the GNOME software store, Mac-style, as banners, so the user can install them easily. It would make the user experience both more consistent and even more user-friendly than it currently is.” + +It might sound good and promising and if you take a look at [this link][3], even you might start believing the rumor. Why? Because at the bottom of the blueprint information, it lists Ubuntu-founder Mark Shuttleworth as the approver. + +![Apt being replaced with Snap blueprint rumor][4]Mark Shuttleworth’s name adds to the confusion + +The rumor got fanned when the Switch to Linux YouTube channel covered it. You can watch the video from around 11:30. + + + +When this ‘news’ was brought to my attention, I reached out to Alan Pope of Canonical and asked him if he or his colleagues at Canonical (Ubuntu’s parent company) could confirm it. + +Alan clarified that the so called blueprint was not associated with official Ubuntu team. It was created as a proposal by some community member not affiliated with Ubuntu. + +> That’s not anything official. Some random community person made it. Anyone can write a blueprint. +> +> Alan Pope, Canonical + +Alan further elaborated that anyone can create such blueprints and tag Mark Shuttleworth or other Ubuntu members in it. Just because Mark’s name was listed as the approver, it doesn’t mean he already approved the idea. + +Canonical has no such plans to replace Apt with Snap. It’s not as simple as the blueprint in question suggests. + +After talking with Alan, I decided to not write about this topic because I don’t want to fan baseless rumors and confuse people. + +Unfortunately, the ‘replace Apt with Snap’ blueprint is still being shared on various Ubuntu and Linux related groups and forums. Alan had to publicly dismiss these rumors in a series of tweets: + +> Seen this [#Ubuntu][5] blueprint being shared around the internet. It's not official, not a thing we're doing. Just because someone made a blueprint, doesn't make it fact. +> +> — Alan Pope 🇪🇺🇬🇧 (@popey) [February 23, 2019][6] + +I don’t want you, the It’s FOSS reader, to fell for such silly rumors so I quickly penned this article. + +If you come across ‘apt being replaced with snap’ discussion, you may tell people that it’s not true and provide them this link as a reference. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/ + +作者:[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/ubuntu-19-04-release-features/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/snap-replacing-apt.png?resize=800%2C450&ssl=1 +[3]: https://blueprints.launchpad.net/ubuntu/+spec/package-management-default-snap +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-snap-blueprint.jpg?ssl=1 +[5]: https://twitter.com/hashtag/Ubuntu?src=hash&ref_src=twsrc%5Etfw +[6]: https://twitter.com/popey/status/1099238146393468931?ref_src=twsrc%5Etfw From 132b18ec04c155c3c55ce4ad7e8118d268d12742 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:31:26 +0800 Subject: [PATCH 486/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20Reduci?= =?UTF-8?q?ng=20security=20risks=20with=20centralized=20logging=20sources/?= =?UTF-8?q?talk/20190226=20Reducing=20security=20risks=20with=20centralize?= =?UTF-8?q?d=20logging.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...security risks with centralized logging.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/talk/20190226 Reducing security risks with centralized logging.md diff --git a/sources/talk/20190226 Reducing security risks with centralized logging.md b/sources/talk/20190226 Reducing security risks with centralized logging.md new file mode 100644 index 0000000000..60bbd7a80b --- /dev/null +++ b/sources/talk/20190226 Reducing security risks with centralized logging.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reducing security risks with centralized logging) +[#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) +[#]: author: (Hannah Suarez https://opensource.com/users/hcs) + +Reducing security risks with centralized logging +====== +Centralizing logs and structuring log data for processing can mitigate risks related to insufficient logging. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +Logging and log analysis are essential to securing infrastructure, particularly when we consider common vulnerabilities. This article, based on my lightning talk [Let's use centralized log collection to make incident response teams happy][1] at FOSDEM'19, aims to raise awareness about the security concerns around insufficient logging, offer a way to avoid the risk, and advocate for more secure practices _(disclaimer: I work for NXLog)._ + +### Why log collection and why centralized logging? + +Logging is, to be specific, an append-only sequence of records written to disk. In practice, logs help you investigate an infrastructure issue as you try to find a cause for misbehavior. A challenge comes up when you have heterogeneous systems with their own standards and formats, and you want to be able to handle and process these in a dependable way. This often comes at the cost of metadata. Centralized logging solutions require commonality, and that commonality often removes the rich metadata many open source logging tools provide. + +### The security risk of insufficient logging and monitoring + +The Open Web Application Security Project ([OWASP][2]) is a nonprofit organization that contributes to the industry with incredible projects (including many [tools][3] focusing on software security). The organization regularly reports on the riskiest security challenges for application developers and maintainers. In its most recent report on the [top 10 most critical web application security risks][4], OWASP added Insufficient Logging and Monitoring to its list. OWASP warns of risks due to insufficient logging, detection, monitoring, and active response in the following types of scenarios. + + * Important auditable events, such as logins, failed logins, and high-value transactions are not logged. + * Warnings and errors generate none, inadequate, or unclear log messages. + * Logs are only being stored locally. + * The application is unable to detect, escalate, or alert for active attacks in real time or near real time. + + + +These instances can be mitigated by centralizing logs (i.e., not storing logs locally) and structuring log data for processing (i.e., in alerting dashboards and security suites). + +For example, imagine a DNS query leads to a malicious site named **hacked.badsite.net**. With DNS monitoring, administrators monitor and proactively analyze DNS queries and responses. The efficiency of DNS monitoring relies on both sufficient logging and log collection in order to catch potential issues as well as structuring the resulting DNS log for further processing: + +``` +2019-01-29 +Time (GMT)      Source                  Destination             Protocol-Info +12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net +``` + +You can try this yourself and run through other examples and snippets with the [NXLog Community Edition][5] _(disclaimer again: I work for NXLog)._ + +### Important aside: unstructured vs. structured data + +It's important to take a moment and consider the log data format. For example, let's consider this log message: + +``` +debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 +``` + +This log contains a predefined structure, such as a metadata keyword before the colon ( **debug1** ). However, the rest of the log field is an unstructured string ( **Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2** ). So, while the message is easily available in a human-readable format, it is not a format a computer can easily parse. + +Unstructured event data poses limitations including difficulty of parsing, searching, and analyzing the logs. The important metadata is too often set in an unstructured data field in the form of a freeform string like the example above. Logging administrators will come across this problem at some point as they attempt to standardize/normalize log data and centralize their log sources. + +### Where to go next + +Alongside centralizing and structuring your logs, make sure you're collecting the right log data—Sysmon, PowerShell, Windows EventLog, DNS debug, NetFlow, ETW, kernel monitoring, file integrity monitoring, database logs, external cloud logs, and so on. Also have the right tools and processes in place to collect, aggregate, and help make sense of the data. + +Hopefully, this gives you a starting point to centralize log collection across diverse sources; send them to outside sources like dashboards, monitoring software, analytics software, specialized software like security information and event management (SEIM) suites; and more. + +What does your centralized logging strategy look like? Share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging + +作者:[Hannah Suarez][a] +选题:[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/hcs +[b]: https://github.com/lujun9972 +[1]: https://fosdem.org/2019/schedule/event/lets_use_centralized_log_collection_to_make_incident_response_teams_happy/ +[2]: https://www.owasp.org/index.php/Main_Page +[3]: https://github.com/OWASP +[4]: https://www.owasp.org/index.php/Top_10-2017_Top_10 +[5]: https://nxlog.co/products/nxlog-community-edition/download From 8bd61abae61a973b82659578d68dd7f5a2f4b349 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:34:30 +0800 Subject: [PATCH 487/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20How=20?= =?UTF-8?q?To=20SSH=20Into=20A=20Particular=20Directory=20On=20Linux=20sou?= =?UTF-8?q?rces/tech/20190226=20How=20To=20SSH=20Into=20A=20Particular=20D?= =?UTF-8?q?irectory=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SH Into A Particular Directory On Linux.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md diff --git a/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md new file mode 100644 index 0000000000..37d52656a8 --- /dev/null +++ b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To SSH Into A Particular Directory On Linux) +[#]: via: (https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To SSH Into A Particular Directory On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/SSH-Into-A-Particular-Directory-720x340.png) + +Have you ever been in a situation where you want to SSH to a remote server and immediately cd into a directory and continue work interactively? You’re on the right track! This brief tutorial describes how to directly SSH into a particular directory of a remote Linux system. Not just SSH into a specific directory, you can run any command immediately right after connecting to an SSH server as described in this guide. It is not that difficult as you might think. Read on. + +### SSH Into A Particular Directory Of A Remote System + +Before I knew this method, I would usually first SSH to the remote remote system using command: + +``` +$ ssh user@remote-system +``` + +And then cd into a directory like below: + +``` +$ cd +``` + +However, you need not to use two separate commands. You can combine these commands and simplify the task with one command. + +Have a look at the following example. + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; bash' +``` + +The above command will SSH into a remote system (192.168.225.22) and immediately cd into a directory named **‘/home/sk/ostechnix/’** directory and leave yourself at the prompt. + +Here, the **-t** flag is used to force pseudo-terminal allocation, which is necessary or an interactive shell. + +Here is the sample output of the above command: + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/ssh-1.gif) + +You can also use this command as well. + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; exec bash' +``` + +Or, + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec bash -l' +``` + +Here, the **-l** flag sets the bash as login shell. + +In the above example, I have used **bash** in the last argument. It is the default shell in my remote system. If you don’t know the shell type on the remote system, use the following command: + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec $SHELL' +``` + +Like I already said, this is not just for cd into directory after connecting to an remote system. You can use this trick to run other commands as well. For example, the following command will land you inside ‘/home/sk/ostechnix/’ directory and then execute ‘uname -a’ command. + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && uname -a && exec $SHELL' +``` + +Alternatively, you can add the command(s) you wanted to run after connecting to an SSH server on the remote system’s **.bash_profile** file. + +Edit **.bash_profile** file: + +``` +$ nano ~/.bash_profile +``` + +Add the command(s) one by one. In my case, I am adding the following line: + +``` +cd /home/sk/ostechnix >& /dev/null +``` + +Save and close the file. Finally, run the following command to update the changes. + +``` +$ source ~/.bash_profile +``` + +Please note that you should add this line on the remote system’s **.bash_profile** or **.bashrc** file, not in your local system’s. From now on, whenever you login (whether by SSH or direct), the cd command will execute and you will be automatically landed inside “/home/sk/ostechnix/” directory. + + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ + +作者:[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 From db0e2d9aee47189b82ce475b5ebabda56e148b5e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:38:02 +0800 Subject: [PATCH 488/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20How=20?= =?UTF-8?q?To=20Identify=20That=20The=20Linux=20Server=20Is=20Integrated?= =?UTF-8?q?=20With=20Active=20Directory=20(AD)=3F=20sources/tech/20190225?= =?UTF-8?q?=20How=20To=20Identify=20That=20The=20Linux=20Server=20Is=20Int?= =?UTF-8?q?egrated=20With=20Active=20Directory=20(AD).md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s Integrated With Active Directory (AD).md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md diff --git a/sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md b/sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md new file mode 100644 index 0000000000..55d30a7910 --- /dev/null +++ b/sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Identify That The Linux Server Is Integrated With Active Directory (AD)?) +[#]: via: (https://www.2daygeek.com/how-to-identify-that-the-linux-server-is-integrated-with-active-directory-ad/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +How To Identify That The Linux Server Is Integrated With Active Directory (AD)? +====== + +Single Sign On (SSO) Authentication is an implemented in most of the organizations due to multiple applications access. + +It allows a user to logs in with a single ID and password to all the applications which is available in the organization. + +It uses a centralized authentication system for all the applications. + +A while ago we had written an article, **[how to integrate Linux system with AD][1]**. + +Today we are going to show you, how to check that the Linux system is integrated with AD using multiple ways. + +It can be done in four ways and we will explain one by one. + + * **`ps Command:`** It report a snapshot of the current processes. + * **`id Command:`** It prints user identity. + * **`/etc/nsswitch.conf file:`** It is Name Service Switch configuration file. + * **`/etc/pam.d/system-auth file:`** It is Common configuration file for PAMified services. + + + +### How To Identify That The Linux Server Is Integrated With AD Using PS Command? + +ps command displays information about a selection of the active processes. + +To integrate the Linux server with AD, we need to use either `winbind` or `sssd` or `ldap` service. + +So, use the ps command to filter these services. + +If you found any of these services is running on system then we can decide that the system is currently integrate with AD using “winbind” or “sssd” or “ldap” service. + +You might get the output similar to below if the system is integrated with AD using `SSSD` service. + +``` +# ps -ef | grep -i "winbind\|sssd" + +root 29912 1 0 2017 ? 00:19:09 /usr/sbin/sssd -f -D +root 29913 29912 0 2017 ? 04:36:59 /usr/libexec/sssd/sssd_be --domain 2daygeek.com --uid 0 --gid 0 --debug-to-files +root 29914 29912 0 2017 ? 00:29:28 /usr/libexec/sssd/sssd_nss --uid 0 --gid 0 --debug-to-files +root 29915 29912 0 2017 ? 00:09:19 /usr/libexec/sssd/sssd_pam --uid 0 --gid 0 --debug-to-files +root 31584 26666 0 13:41 pts/3 00:00:00 grep sssd +``` + +You might get the output similer to below if the system is integrated with AD using `winbind` service. + +``` +# ps -ef | grep -i "winbind\|sssd" + +root 676 21055 0 2017 ? 00:00:22 winbindd +root 958 21055 0 2017 ? 00:00:35 winbindd +root 21055 1 0 2017 ? 00:59:07 winbindd +root 21061 21055 0 2017 ? 11:48:49 winbindd +root 21062 21055 0 2017 ? 00:01:28 winbindd +root 21959 4570 0 13:50 pts/2 00:00:00 grep -i winbind\|sssd +root 27780 21055 0 2017 ? 00:00:21 winbindd +``` + +### How To Identify That The Linux Server Is Integrated With AD Using id Command? + +It Prints information for given user name, or the current user. It displays the UID, GUID, User Name, Primary Group Name and Secondary Group Name, etc., + +If the Linux system is integrated with AD then you might get the output like below. The GID clearly shows that the user is coming from AD “domain users”. + +``` +# id daygeek + +uid=1918901106(daygeek) gid=1918900513(domain users) groups=1918900513(domain users) +``` + +### How To Identify That The Linux Server Is Integrated With AD Using nsswitch.conf file? + +The Name Service Switch (NSS) configuration file, `/etc/nsswitch.conf`, is used by the GNU C Library and certain other applications to determine the sources from which to obtain name-service information in a range of categories, and in what order. Each category of information is identified by a database name. + +You might get the output similar to below if the system is integrated with AD using `SSSD` service. + +``` +# cat /etc/nsswitch.conf | grep -i "sss\|winbind\|ldap" + +passwd: files sss +shadow: files sss +group: files sss +services: files sss +netgroup: files sss +automount: files sss +``` + +You might get the output similar to below if the system is integrated with AD using `winbind` service. + +``` +# cat /etc/nsswitch.conf | grep -i "sss\|winbind\|ldap" + +passwd: files [SUCCESS=return] winbind +shadow: files [SUCCESS=return] winbind +group: files [SUCCESS=return] winbind +``` + +You might get the output similer to below if the system is integrated with AD using `ldap` service. + +``` +# cat /etc/nsswitch.conf | grep -i "sss\|winbind\|ldap" + +passwd: files ldap +shadow: files ldap +group: files ldap +``` + +### How To Identify That The Linux Server Is Integrated With AD Using system-auth file? + +It is Common configuration file for PAMified services. + +PAM stands for Pluggable Authentication Module that provides dynamic authentication support for applications and services in Linux. + +system-auth configuration file is provide a common interface for all applications and service daemons calling into the PAM library. + +The system-auth configuration file is included from nearly all individual service configuration files with the help of the include directive. + +You might get the output similar to below if the system is integrated with AD using `SSSD` service. + +``` +# cat /etc/pam.d/system-auth | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" +or +# cat /etc/pam.d/system-auth-ac | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" + +auth sufficient pam_sss.so use_first_pass +account [default=bad success=ok user_unknown=ignore] pam_sss.so +password sufficient pam_sss.so use_authtok +session optional pam_sss.so +``` + +You might get the output similar to below if the system is integrated with AD using `winbind` service. + +``` +# cat /etc/pam.d/system-auth | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" +or +# cat /etc/pam.d/system-auth-ac | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" + +auth sufficient pam_winbind.so cached_login use_first_pass +account [default=bad success=ok user_unknown=ignore] pam_winbind.so cached_login +password sufficient pam_winbind.so cached_login use_authtok +``` + +You might get the output similar to below if the system is integrated with AD using `ldap` service. + +``` +# cat /etc/pam.d/system-auth | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" +or +# cat /etc/pam.d/system-auth-ac | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" + +auth sufficient pam_ldap.so cached_login use_first_pass +account [default=bad success=ok user_unknown=ignore] pam_ldap.so cached_login +password sufficient pam_ldap.so cached_login use_authtok +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-identify-that-the-linux-server-is-integrated-with-active-directory-ad/ + +作者:[Vinoth 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.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/join-integrate-rhel-centos-linux-system-to-windows-active-directory-ad-domain/ From f14d756e72062fe367019bc859939788a80c99ee Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:39:23 +0800 Subject: [PATCH 489/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190222=20Develo?= =?UTF-8?q?per=20happiness:=20What=20you=20need=20to=20know=20sources/talk?= =?UTF-8?q?/20190222=20Developer=20happiness-=20What=20you=20need=20to=20k?= =?UTF-8?q?now.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eloper happiness- What you need to know.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/talk/20190222 Developer happiness- What you need to know.md diff --git a/sources/talk/20190222 Developer happiness- What you need to know.md b/sources/talk/20190222 Developer happiness- What you need to know.md new file mode 100644 index 0000000000..8ef7772193 --- /dev/null +++ b/sources/talk/20190222 Developer happiness- What you need to know.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Developer happiness: What you need to know) +[#]: via: (https://opensource.com/article/19/2/developer-happiness) +[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) + +Developer happiness: What you need to know +====== +Developers need the tools and the freedom to code quickly, without getting bogged down by compliance and security. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_happy_sad_developer_programming.png?itok=72nkfSQ_) + +A person needs the right tools for the job. There's nothing as frustrating as getting halfway through a car repair, for instance, only to discover you don't have the specialized tool you need to complete the job. The same concept applies to developers: you need the tools to do what you are best at, without disrupting your workflow with compliance and security needs, so you can produce code faster. + +Over half—51%, to be specific—of developers spend only one to four hours each day programming, according to ActiveState's recent [Developer Survey 2018: Open Source Runtime Pains][1]. In other words, the majority of developers spend less than half of their time coding. According to the survey, 50% of developers say security is one of their biggest concerns, but 67% of developers choose not to add a new language when coding because of the difficulties related to corporate policies. + +The result is developers have to devote time to non-coding activities like retrofitting software for security and compliance criteria checked after software and languages have been built. And they won't choose the best tool or language for the job because of corporate policies. Their satisfaction goes down and risk goes up. + +So, developers aren't able to devote time to high-value work. This creates additional business risk because their time-to-market is slowed, and the organization increases tech debt by not empowering developers to decide on "the best" tech, unencumbered by corporate policy drag. + +### Baking in security and compliance workflows + +How can we solve this issue? One way is to integrate security and compliance workflows into the software development process in four easy steps: + +#### 1\. Gather your forces + +Get support from everyone involved. This is an often-forgotten but critical first step. Make sure to consider a wide range of stakeholders, including: + + * DevOps + * Developers + * InfoSec + * Legal/compliance + * IT security + + + +Stakeholders want to understand the business benefits, so make a solid case for eliminating the security and compliance checkpoints after software builds. You can consider any (or all) of the following in building your business case: time savings, opportunity cost, and developer productivity. By integrating security and compliance workflows into the development process, you also avoid retrofitting of languages. + +#### 2\. Find trustworthy sources + +Next, choose the trusted sources that can be used, along with their license and security requirements. Consider including information such as: + + * Restrictions on usage based on environment or application type and version controls per language + * Which open source components are allowable, e.g., specific packages + * Which licenses can be used in which types of environments (e.g., research vs. production) + * The definition of security levels, acceptable vulnerability risk levels, what risk levels trigger an action, what that action would be, and who would be responsible for its implementation + + + +#### 3\. Incorporate security and compliance from day one + +The upshot of incorporating security and compliance workflows is that it ultimately bakes security and compliance into the first line of code. It eliminates the drag of corporate policy because you're coding to spec versus having to fix things after the fact. But to do this, consider mechanisms for automatically scanning code as it's being built, along with using agentless monitoring of your runtime code. You're freeing up your time, and you'll also be able to programmatically enforce policies to ensure compliance across your entire organization. + +New vulnerabilities arise, and new patches and versions become available. Consequently, security and compliance need to be considered when deploying code into production and also when running code. You need to know what, if any, code is at risk and where that code is running. So, the process for deploying and running code should include monitoring, reporting, and updating code in production. + +By integrating security and compliance into your software development process from the start, you can also benefit by tracking where your code is running once deployed and be alerted of new threats as they arise. You will be able to track when your applications were vulnerable and respond with automatic enforcement of your software policies. + +If your software development process has security and compliance workflows baked in, you will improve your productivity. And you'll be able to measure value through increased time spent coding; gains in security and stability; and cost- and time-savings in maintenance and discovery of security and compliance threats. + +### Happiness through integration + +If you don't develop and update software, your organization can't go forward. Developers are a linchpin in the success of your company, which means they need the tools and the freedom to code quickly. You can't let compliance and security needs—though they are critical—bog you down. Developers clearly worry about security, so the happy medium is to "shift left" and integrate security and compliance workflows from the start. You'll get more done, get it right the first time, and spend far less time retrofitting code. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/developer-happiness + +作者:[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://www.activestate.com/company/press/press-releases/activestate-developer-survey-examines-open-source-challenges/ From bf484d4c877535713329ba0b34cdd799fba27584 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:40:40 +0800 Subject: [PATCH 490/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20Netboo?= =?UTF-8?q?t=20a=20Fedora=20Live=20CD=20sources/tech/20190225=20Netboot=20?= =?UTF-8?q?a=20Fedora=20Live=20CD.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190225 Netboot a Fedora Live CD.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20190225 Netboot a Fedora Live CD.md diff --git a/sources/tech/20190225 Netboot a Fedora Live CD.md b/sources/tech/20190225 Netboot a Fedora Live CD.md new file mode 100644 index 0000000000..2767719b8c --- /dev/null +++ b/sources/tech/20190225 Netboot a Fedora Live CD.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Netboot a Fedora Live CD) +[#]: via: (https://fedoramagazine.org/netboot-a-fedora-live-cd/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +Netboot a 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: + + * 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]. + + + +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. + +### Download a Live CD Image + +``` +$ 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 +$ 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. + +### Convert the Live CD Image + +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: + +``` +$ 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 +$ sudo losetup -d $MY_LOOP +``` + +### Upload the Live Image to your Server + +Create a directory on your iSCSI server to store your live images and then upload your modified image to it. + +**For releases 21 and greater:** + +``` +$ MY_FLDR=/images +$ scp $MY_NAME.img $MY_SRVR:$MY_FLDR/ +``` + +**For releases prior to 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" +$ sudo losetup -d $MY_LOOP +``` + +### Define the iSCSI Target + +Run the following commands on your iSCSI server: + +``` +$ 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 +# tgt-admin --update ALL +``` + +### Create a Bootable USB Drive + +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. + +First, download iPXE and build it in its lkrn format. This should be done as a normal user on a workstation: + +``` +$ 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 +$ 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!** + +``` +$ 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 +# mkfs -t vfat -F 32 ${MY_USB}1 +``` + +Finally, install syslinux on the USB drive and configure it to chain load 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}) +# 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 +# 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. + +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. + +### 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. + + + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/netboot-a-fedora-live-cd/ + +作者:[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://en.wikipedia.org/wiki/Live_CD +[2]: https://en.wikipedia.org/wiki/Live_CD#Uses +[3]: https://en.wikipedia.org/wiki/ISCSI +[4]: https://ipxe.org/ +[5]: https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/ +[6]: http://ipxe.org/cmd/sanboot/ +[7]: https://ipxe.org/appnote/buildtargets#boot_type +[8]: https://en.wikipedia.org/wiki/Chain_loading +[9]: https://www.syslinux.org/wiki/index.php?title=SYSLINUX +[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 3abd57f36de62d4c5b2b2a737d1daa45c3ef0b7a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:42:56 +0800 Subject: [PATCH 491/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20How=20?= =?UTF-8?q?to=20Install=20VirtualBox=20on=20Ubuntu=20[Beginner=E2=80=99s?= =?UTF-8?q?=20Tutorial]=20sources/tech/20190225=20How=20to=20Install=20Vir?= =?UTF-8?q?tualBox=20on=20Ubuntu=20-Beginner-s=20Tutorial.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rtualBox on Ubuntu -Beginner-s Tutorial.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md diff --git a/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..4ba0580ece --- /dev/null +++ b/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-virtualbox-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Install VirtualBox on Ubuntu [Beginner’s Tutorial] +====== + +**This beginner’s tutorial explains various ways to install VirtualBox on Ubuntu and other Debian-based Linux distributions.** + +Oracle’s free and open source offering [VirtualBox][1] is an excellent virtualization tool, specially for desktop operating systems. I prefer using it over [VMWare Workstation in Linux][2], another virtualization tool. + +You can use virtualization software like VirtualBox for installing and using another operating system within a virtual machine. + +For example, you can [install Linux on VirtualBox inside Windows][3]. Similarly, you can also [install Windows inside Linux using VirtualBox][4]. + +You can also use VirtualBox for installing another Linux distribution in your current Linux system. Actually, this is what I use it for. If I hear about a nice Linux distribution, instead of installing it on a real system, I test it on a virtual machine. It’s more convenient when you just want to try out a distribution before making a decision about installing it on your actual machine. + +![Linux installed inside Linux using VirtualBox][5]Ubuntu 18.10 installed inside Ubuntu 18.04 + +In this beginner’s tutorial, I’ll show you various ways of installing Oracle VirtualBox on Ubuntu and other Debian-based distributions. + +### Installing VirtualBox on Ubuntu and Debian based Linux distributions + +The installation methods mentioned here should also work for other Debian and Ubuntu-based Linux distributions such as Linux Mint, elementary OS etc. + +#### Method 1: Install VirtualBox from Ubuntu Repository + +**Pros** : Easy installation + +**Cons** : Installs older version + +The easiest way to install VirtualBox on Ubuntu would be to search for it in the Software Center and install it from there. + +![VirtualBox in Ubuntu Software Center][6]VirtualBox is available in Ubuntu Software Center + +You can also install it from the command line using the command: + +``` +sudo apt install virtualbox +``` + +However, if you [check the package version before installing it][7], you’ll see that the VirtualBox provided by Ubuntu’s repository is quite old. + +For example, the current VirtualBox version at the time of writing this tutorial is 6.0 but the one in Software Center is 5.2. This means you won’t get the newer features introduced in the [latest version of VirtualBox][8]. + +#### Method 2: Install VirtualBox using Deb file from Oracle’s website + +**Pros** : Easily install the latest version + +**Cons** : Can’t upgrade to newer version + +If you want to use the latest version of VirtualBox on Ubuntu, the easiest way would be to [use the deb file][9]. + +Oracle provides read to use binary files for VirtualBox releases. If you look at its download page, you’ll see the option to download the deb installer files for Ubuntu and other distributions. + +![VirtualBox Linux Download][10] + +You just have to download this deb file and double click on it to install it. It’s as simple as that. + +However, the problem with this method is that you won’t get automatically updated to the newer VirtualBox releases. The only way is to remove the existing version, download the newer version and install it again. That’s not very convenient, is it? + +#### Method 3: Install VirualBox using Oracle’s repository + +**Pros** : Automatically updates with system updates + +**Cons** : Slightly complicated installation + +Now this is the command line method and it may seem complicated to you but it has advantages over the previous two methods. You’ll get the latest version of VirtualBox and it will be automatically updated to the future releases. That’s what you would want, I presume. + +To install VirtualBox using command line, you add the Oracle VirtualBox’s repository in your list of repositories. You add its GPG key so that your system trusts this repository. Now when you install VirtualBox, it will be installed from Oracle’s repository instead of Ubuntu’s repository. If there is a new version released, VirtualBox install will be updated along with the system updates. Let’s see how to do that. + +First, add the key for the repository. You can download and add the key using this single command. + +``` +wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - +``` + +``` +Important for Mint users + +The next step will work for Ubuntu only. If you are using Linux Mint or some other distribution based on Ubuntu, replace $(lsb_release -cs) in the command with the Ubuntu version your current version is based on. For example, Linux Mint 19 series users should use bionic and Mint 18 series users should use xenial. Something like this + +sudo add-apt-repository “deb [arch=amd64] **bionic** contrib“ +``` + +Now add the Oracle VirtualBox repository in the list of repositories using this command: + +``` +sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" +``` + +If you have read my article on [checking Ubuntu version][11], you probably know that ‘lsb_release -cs’ will print the codename of your Ubuntu system. + +**Note** : If you see [add-apt-repository command not found][12] error, you’ll have to install software-properties-common package. + +Now that you have the correct repository added, refresh the list of available packages through these repositories and install VirtualBox. + +``` +sudo apt update && sudo apt install virtualbox-6.0 +``` + +**Tip** : A good idea would be to type sudo apt install **virtualbox–** and hit tab to see the various VirtualBox versions available for installation and then select one of them by typing it completely. + +![Install VirtualBox via terminal][13] + +### How to remove VirtualBox from Ubuntu + +Now that you have learned to install VirtualBox, I would also mention the steps to remove it. + +If you installed it from the Software Center, the easiest way to remove the application is from the Software Center itself. You just have to find it in the [list of installed applications][14] and click the Remove button. + +Another ways is to use the command line. + +``` +sudo apt remove virtualbox virtualbox-* +``` + +Note that this will not remove the virtual machines and the files associated with the operating systems you installed using VirtualBox. That’s not entirely a bad thing because you may want to keep them safe to use it later or in some other system. + +**In the end…** + +I hope you were able to pick one of the methods to install VirtualBox. I’ll also write about using it effectively in another article. For the moment, if you have and tips or suggestions or any questions, feel free to leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-virtualbox-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://www.virtualbox.org +[2]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[3]: https://itsfoss.com/install-linux-in-virtualbox/ +[4]: https://itsfoss.com/install-windows-10-virtualbox-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/linux-inside-linux-virtualbox.png?resize=800%2C450&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-ubuntu-software-center.jpg?ssl=1 +[7]: https://itsfoss.com/know-program-version-before-install-ubuntu/ +[8]: https://itsfoss.com/oracle-virtualbox-release/ +[9]: https://itsfoss.com/install-deb-files-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-download.jpg?resize=800%2C433&ssl=1 +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://itsfoss.com/add-apt-repository-command-not-found/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-virtualbox-ubuntu-terminal.png?resize=800%2C165&ssl=1 +[14]: https://itsfoss.com/list-installed-packages-ubuntu/ From 1475813bda920ca419bb42ed0a8f47d892c5f8d6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:48:48 +0800 Subject: [PATCH 492/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20Teachi?= =?UTF-8?q?ng=20scientists=20how=20to=20share=20code=20sources/talk/201902?= =?UTF-8?q?25=20Teaching=20scientists=20how=20to=20share=20code.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...5 Teaching scientists how to share code.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/talk/20190225 Teaching scientists how to share code.md diff --git a/sources/talk/20190225 Teaching scientists how to share code.md b/sources/talk/20190225 Teaching scientists how to share code.md new file mode 100644 index 0000000000..074da27476 --- /dev/null +++ b/sources/talk/20190225 Teaching scientists how to share code.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teaching scientists how to share code) +[#]: via: (https://opensource.com/article/19/2/open-science-git) +[#]: author: (Jon Tennant https://opensource.com/users/jon-tennant) + +Teaching scientists how to share code +====== +This course teaches them how to set up a GitHub project, index their project in Zenodo, and integrate Git into an RStudio workflow. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolserieshe_rh_051x_0.png?itok=gIzbmxuI) + +Would it surprise you to learn that most of the world's scholarly research is not owned by the people who funded it or who created it? Rather it's owned by private corporations and locked up in proprietary systems, leading to [problems][1] around sharing, reuse, and reproducibility. + +The open science movement is challenging this system, aiming to give researchers control, ownership, and freedom over their work. The [Open Science MOOC][2] (massively open online community) is a mission-driven project launched in 2018 to kick-start an open scientific revolution and foster more partnerships between open source software and open science. + +The Open Science MOOC is a peer-to-peer community of practice, based around sharing knowledge and ideas, learning new skills, and using these things to develop as individuals so research communities can grow as part of a wider cultural shift towards openness. + +### The curriculum + +The Open Science MOOC is divided into 10 core modules, from the principles of open science to becoming an open science advocate. + +The first module, [Open Research Software and Open Source][3], was released in late 2018. It includes three main tasks, all designed to help make research workflows more efficient and more open for collaboration: + +#### 1\. Setting up your first GitHub project + +GitHub is a powerful project management tool, both for coders and non-coders. This task teaches how to create a community around the platform, select an appropriate license, and write good documentation (including README files, contributing guidelines, and codes of conduct) to foster open collaboration and a welcoming community. + +#### 2\. Indexing your project in Zenodo + +[Zenodo][4] is an open science platform that seamlessly integrates with GitHub to help make projects more permanent, reusable, and citable. This task explains how webhooks between Zenodo and GitHub allow new versions of projects to become permanently archived as they progress. This is critical for helping researchers get a [DOI][5] for their work so they can receive full credit for all aspects of a project. As citations are still a primary form of "academic capital," this is essential for researchers. + +#### 3\. Integrating Git into an RStudio workflow + +This task is about giving research a mega-boost through greater collaborative efficiency and reproducibility. Git enables version control in all forms of text-based content, including data analysis and writing papers. Each time you save your work during the development process, Git saves time-stamped copies. This saves the hassle of trying to "roll back" projects if you delete a file or text by mistake, and eliminates horrific file-naming conventions. (For example, does FINAL_Revised_2.2_supervisor_edits_ver1.7_scream.txt look familiar?) Getting Git to interface with RStudio is the painful part, but this task goes through it, step by step, to ease the stress. + +The third task also gives students the ability to interact directly with the MOOC by submitting pull requests to demonstrate their skills. This also adds their name to an online list of open source champions (aka "open sourcerers"). + +The MOOC's inherently interactive style is much more valuable than listening to someone talk at you, either on or off screen, like with many traditional online courses or educational programs. Each task is backed up by expert-gathered knowledge, so students get a rigorous, dual-learning experience. + +### Empowering researchers + +The Open Science MOOC strives to be as open as possible—this means we walk the walk and talk the talk. We are built upon a solid values-based foundation of freedom and equitable access to research. We see this route towards widespread adoption of best scientific practices as an essential part of the research process. + +Everything we produce is openly developed and openly licensed for maximum engagement, sharing, and reuse. An open source workflow underpins our development. All of this happens openly around channels such as [Slack][6] and [GitHub][7] and helps to make the community much more coherent. + +If we can instill the value of open source into modern research, this would empower current and future generations of researchers to think more about fundamental freedoms around knowledge production. We think that is something worth working towards as a community. + +The Open Science MOOC combines the best elements of the open education, open science, and open source worlds. If you're ready to join, [sign up for the full course][3], which is, of course, free. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/open-science-git + +作者:[Jon Tennant][a] +选题:[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/jon-tennant +[b]: https://github.com/lujun9972 +[1]: https://www.theguardian.com/science/political-science/2018/jun/29/elsevier-are-corrupting-open-science-in-europe +[2]: https://opensciencemooc.eu/ +[3]: https://eliademy.com/catalog/oer/module-5-open-research-software-and-open-source.html +[4]: https://zenodo.org/ +[5]: https://en.wikipedia.org/wiki/Digital_object_identifier +[6]: https://osmooc.herokuapp.com/ +[7]: https://open-science-mooc-invite.herokuapp.com/ From 338c29dfa1736eda1680480ef9354c288bf01bd1 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:55:50 +0800 Subject: [PATCH 493/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=205=20Li?= =?UTF-8?q?nux=20GUI=20Cloud=20Backup=20Tools=20sources/tech/20190205=205?= =?UTF-8?q?=20Linux=20GUI=20Cloud=20Backup=20Tools.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190205 5 Linux GUI Cloud Backup Tools.md | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md diff --git a/sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md b/sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md new file mode 100644 index 0000000000..45e0bf1342 --- /dev/null +++ b/sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Linux GUI Cloud Backup Tools) +[#]: via: (https://www.linux.com/blog/learn/2019/2/5-linux-gui-cloud-backup-tools) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +5 Linux GUI Cloud Backup Tools +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/cloud-m-wong-unsplash.jpg?itok=aW0mpzio) + +We have reached a point in time where most every computer user depends upon the cloud … even if only as a storage solution. What makes the cloud really important to users, is when it’s employed as a backup. Why is that such a game changer? By backing up to the cloud, you have access to those files, from any computer you have associated with your cloud account. And because Linux powers the cloud, many services offer Linux tools. + +Let’s take a look at five such tools. I will focus on GUI tools, because they offer a much lower barrier to entry to many of the CLI tools. I’ll also be focusing on various, consumer-grade cloud services (e.g., [Google Drive][1], [Dropbox][2], [Wasabi][3], and [pCloud][4]). And, I will be demonstrating on the Elementary OS platform, but all of the tools listed will function on most Linux desktop distributions. + +Note: Of the following backup solutions, only Duplicati is licensed as open source. With that said, let’s see what’s available. + +### Insync + +I must confess, [Insync][5] has been my cloud backup of choice for a very long time. Since Google refuses to release a Linux desktop client for Google Drive (and I depend upon Google Drive daily), I had to turn to a third-party solution. Said solution is Insync. This particular take on syncing the desktop to Drive has not only been seamless, but faultless since I began using the tool. + +The cost of Insync is a one-time $29.99 fee (per Google account). Trust me when I say this tool is worth the price of entry. With Insync you not only get an easy-to-use GUI for managing your Google Drive backup and sync, you get a tool (Figure 1) that gives you complete control over what is backed up and how it is backed up. Not only that, but you can also install Nautilus integration (which also allows you to easy add folders outside of the configured Drive sync destination). + +![Insync app][7] + +Figure 1: The Insync app window on Elementary OS. + +[Used with permission][8] + +You can download Insync for Ubuntu (or its derivatives), Linux Mint, Debian, and Fedora from the [Insync download page][9]. Once you’ve installed Insync (and associated it with your account), you can then install Nautilus integration with these steps (demonstrating on Elementary OS): + + 1. Open a terminal window and issue the command sudo nano /etc/apt/sources.list.d/insync.list. + + 2. Paste the following into the new file: deb precise non-free contrib. + + 3. Save and close the file. + + 4. Update apt with the command sudo apt-get update. + + 5. Install the necessary package with the command sudo apt-get install insync-nautilus. + + + + +Allow the installation to complete. Once finished, restart Nautilus with the command nautilus -q (or log out and back into the desktop). You should now see an Insync entry in the Nautilus right-click context menu (Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/insync_2.jpg?itok=-kA0epiH) + +Figure 2: Insync/Nautilus integration in action. + +[Used with permission][8] + +### Dropbox + +Although [Dropbox][2] drew the ire of many in the Linux community (by dropping support for all filesystems but unencrypted ext4), it still supports a great deal of Linux desktop deployments. In other words, if your distribution still uses the ext4 file system (and you do not opt to encrypt your full drive), you’re good to go. + +The good news is the Dropbox Linux desktop client is quite good. The tool offers a system tray icon that allows you to easily interact with your cloud syncing. Dropbox also includes CLI tools and a Nautilus integration (by way of an additional addon found [here][10]). + +The Linux Dropbox desktop sync tool works exactly as you’d expect. From the Dropbox system tray drop-down (Figure 3) you can open the Dropbox folder, launch the Dropbox website, view recently changed files, get more space, pause syncing, open the preferences window, find help, and quite Dropbox. + +![Dropbox][12] + +Figure 3: The Dropbox system tray drop-down on Elementary OS. + +[Used with permission][8] + +The Dropbox/Nautilus integration is an important component, as it makes quickly adding to your cloud backup seamless and fast. From the Nautilus file manager, locate and right-click the folder to bad added, and select Dropbox > Move to Dropbox (Figure 4). + +The only caveat to the Dropbox/Nautilus integration is that the only option is to move a folder to Dropbox. To some this might not be an option. The developers of this package would be wise to instead have the action create a link (instead of actually moving the folder). + +Outside of that one issue, the Dropbox cloud sync/backup solution for Linux is a great route to go. + +### pCloud + +pCloud might well be one of the finest cloud backup solutions you’ve never heard of. This take on cloud storage/backup includes features like: + + * Encryption (subscription service required for this feature); + + * Mobile apps for Android and iOS; + + * Linux, Mac, and Windows desktop clients; + + * Easy file/folder sharing; + + * Built-in audio/video players; + + * No file size limitation; + + * Sync any folder from the desktop; + + * Panel integration for most desktops; and + + * Automatic file manager integration. + + + + +pCloud offers both Linux desktop and CLI tools that function quite well. pCloud offers both a free plan (with 10GB of storage), a Premium Plan (with 500GB of storage for a one-time fee of $175.00), and a Premium Plus Plan (with 2TB of storage for a one-time fee of $350.00). Both non-free plans can also be paid on a yearly basis (instead of the one-time fee). + +The pCloud desktop client is quite user-friendly. Once installed, you have access to your account information (Figure 5), the ability to create sync pairs, create shares, enable crypto (which requires an added subscription), and general settings. + +![pCloud][14] + +Figure 5: The pCloud desktop client is incredibly easy to use. + +[Used with permission][8] + +The one caveat to pCloud is there’s no file manager integration for Linux. That’s overcome by the Sync folder in the pCloud client. + +### CloudBerry + +The primary focus for [CloudBerry][15] is for Managed Service Providers. The business side of CloudBerry does have an associated cost (one that is probably well out of the price range for the average user looking for a simple cloud backup solution). However, for home usage, CloudBerry is free. + +What makes CloudBerry different than the other tools is that it’s not a backup/storage solution in and of itself. Instead, CloudBerry serves as a link between your desktop and the likes of: + + * AWS + + * Microsoft Azure + + * Google Cloud + + * BackBlaze + + * OpenStack + + * Wasabi + + * Local storage + + * External drives + + * Network Attached Storage + + * Network Shares + + * And more + + + + +In other words, you use CloudBerry as the interface between the files/folders you want to share and the destination with which you want send them. This also means you must have an account with one of the many supported solutions. +Once you’ve installed CloudBerry, you create a new Backup plan for the target storage solution. For that configuration, you’ll need such information as: + + * Access Key + + * Secret Key + + * Bucket + + + + +What you’ll need for the configuration will depend on the account you’re connecting to (Figure 6). + +![CloudBerry][17] + +Figure 6: Setting up a CloudBerry backup for Wasabi. + +[Used with permission][8] + +The one caveat to CloudBerry is that it does not integrate with any file manager, nor does it include a system tray icon for interaction with the service. + +### Duplicati + +[Duplicati][18] is another option that allows you to sync your local directories with either locally attached drives, network attached storage, or a number of cloud services. The options supported include: + + * Local folders + + * Attached drives + + * FTP/SFTP + + * OpenStack + + * WebDAV + + * Amazon Cloud Drive + + * Amazon S3 + + * Azure Blob + + * Box.com + + * Dropbox + + * Google Cloud Storage + + * Google Drive + + * Microsoft OneDrive + + * And many more + + + + +Once you install Duplicati (download the installer for Debian, Ubuntu, Fedora, or RedHat from the [Duplicati downloads page][19]), click on the entry in your desktop menu, which will open a web page to the tool (Figure 7), where you can configure the app settings, create a new backup, restore from a backup, and more. + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/duplicati_1.jpg?itok=SVf06tnv) + +To create a backup, click Add backup and walk through the easy-to-use wizard (Figure 8). The backup service you choose will dictate what you need for a successful configuration. + +![Duplicati backup][21] + +Figure 8: Creating a new Duplicati backup for Google Drive. + +[Used with permission][8] + +For example, in order to create a backup to Google Drive, you’ll need an AuthID. For that, click the AuthID link in the Destination section of the setup, where you’ll be directed to select the Google Account to associate with the backup. Once you’ve allowed Duplicati access to the account, the AuthID will fill in and you’re ready to continue. Click Test connection and you’ll be asked to okay the creation of a new folder (if necessary). Click Next to complete the setup of the backup. + +### More Where That Came From + +These five cloud backup tools aren’t the end of this particular rainbow. There are plenty more options where these came from (including CLI-only tools). But any of these backup clients will do a great job of serving your Linux desktop-to-cloud backup needs. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/5-linux-gui-cloud-backup-tools + +作者:[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.google.com/drive/ +[2]: https://www.dropbox.com/ +[3]: https://wasabi.com/ +[4]: https://www.pcloud.com/ +[5]: https://www.insynchq.com/ +[6]: /files/images/insync1jpg +[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/insync_1.jpg?itok=_SDP77uE (Insync app) +[8]: /licenses/category/used-permission +[9]: https://www.insynchq.com/downloads +[10]: https://www.dropbox.com/install-linux +[11]: /files/images/dropbox1jpg +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dropbox_1.jpg?itok=BYbg-sKB (Dropbox) +[13]: /files/images/pcloud1jpg +[14]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pcloud_1.jpg?itok=cAUz8pya (pCloud) +[15]: https://www.cloudberrylab.com +[16]: /files/images/cloudberry1jpg +[17]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/cloudberry_1.jpg?itok=s0aP5xuN (CloudBerry) +[18]: https://www.duplicati.com/ +[19]: https://www.duplicati.com/download +[20]: /files/images/duplicati2jpg +[21]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/duplicati_2.jpg?itok=Xkn8s3jg (Duplicati backup) From e04e4a529d6f3417082d7eb98cee0c61b3253d0f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 20:24:08 +0800 Subject: [PATCH 494/813] PRF:20190223 Regex groups and numerals.md @geekpi --- .../tech/20190223 Regex groups and numerals.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190223 Regex groups and numerals.md b/translated/tech/20190223 Regex groups and numerals.md index f95fd5d4d0..309a176ed2 100644 --- a/translated/tech/20190223 Regex groups and numerals.md +++ b/translated/tech/20190223 Regex groups and numerals.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Regex groups and numerals) [#]: via: (https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/) [#]: author: (Dr.Drang https://leancrew.com) -正则组和数字 +正则表达式的分组和数字 ====== 大约一周前,我在编辑一个程序时想要更改一些变量名。我之前认为这将是一个简单的正则表达式查找/替换。只是这没有我想象的那么简单。 @@ -16,9 +16,9 @@ ![Mistaken BBEdit replacement pattern][2] -我不能简单地 `30` 替换为 `10`,因为代码中有一些与变量无关的数字 `10`。我认为我很聪明,所以我不想写三个非正则表达式替换,`a10`、`v10` 和 `x10` 每个一个。但是我却没有注意到替换模式中的蓝色。如果我这样做了,我会看到 BBEdit 将我的替换模式解释为“匹配组 13,后面跟着 `0`,而不是”匹配组 1,后面跟着 `30`,后者是我想要的。由于匹配组 13 是空白的,因此所有变量名都会被替换为 `0`。 +我不能简单地 `30` 替换为 `10`,因为代码中有一些与变量无关的数字 `10`。我认为我很聪明,所以我不想写三个非正则表达式替换,`a10`、`v10` 和 `x10`,每个一个。但是我却没有注意到替换模式中的蓝色。如果我这样做了,我会看到 BBEdit 将我的替换模式解释为“匹配组 13,后面跟着 `0`,而不是”匹配组 1,后面跟着 `30`,后者是我想要的。由于匹配组 13 是空白的,因此所有变量名都会被替换为 `0`。 -你看,BBEdit 可以在搜索模式中匹配多达 99 个组,严格来说,我们应该在替换模式中引用它们时使用两位数字。但在大多数情况下,我们可以使用 `\1` 到 `\9` 而不是 `\01` 到 `\09`,因为这没有歧义。换句话说,如果我尝试将 `a10`、`v10` 和 `x10` 更改为 `az`、`vz` 和 `xz`,那么使用 `\1z`的替换模式就可以了。因为后面的 `z` 意味着不会误解释该模式中 `\1`。 +你看,BBEdit 可以在搜索模式中匹配多达 99 个分组,严格来说,我们应该在替换模式中引用它们时使用两位数字。但在大多数情况下,我们可以使用 `\1` 到 `\9` 而不是 `\01` 到 `\09`,因为这没有歧义。换句话说,如果我尝试将 `a10`、`v10` 和 `x10` 更改为 `az`、`vz` 和 `xz`,那么使用 `\1z`的替换模式就可以了。因为后面的 `z` 意味着不会误解释该模式中 `\1`。 因此,在撤消替换后,我将模式更改为这样: @@ -30,10 +30,9 @@ ![Named BBEdit replacement pattern][4] -在任何情况下,我从来都没有使用过命名组,无论正则表达式是在文本编辑器还是在脚本中。我的总体感觉是,如果模式复杂到我必须使用变量来跟踪所有组,那么我应该停下来并将问题分解为更小的部分。 +我从来都没有使用过命名组,无论正则表达式是在文本编辑器还是在脚本中。我的总体感觉是,如果模式复杂到我必须使用变量来跟踪所有组,那么我应该停下来并将问题分解为更小的部分。 -By the way, you may have heard that BBEdit is celebrating its [25th anniversary][5] of not sucking. When a well-documented app has such a long history, the manual starts to accumulate delightful callbacks to the olden days. As I was looking up the notation for named groups in the BBEdit manual, I ran across this note: -顺便说一下,你可能已经听说 BBEdit 正在庆祝它诞生[25周年][5]。当一个有良好文档的应用有如此历史时,手册的积累能让人愉快地回到过去的日子。当我在 BBEdit 手册中查找命名组的表示法时,我遇到了这个说明: +顺便说一下,你可能已经听说 BBEdit 正在庆祝它诞生[25周年][5]。当一个有良好文档的应用有如此长的历史时,手册的积累能让人愉快地回到过去的日子。当我在 BBEdit 手册中查找命名组的表示法时,我遇到了这个说明: ![BBEdit regex manual excerpt][6] @@ -45,8 +44,8 @@ via: https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/ 作者:[Dr.Drang][a] 选题:[lujun9972][b] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +译者:[s](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 35eb5d7576ce4b7e08ea1dee6d0f4c4a66597ee5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 20:24:37 +0800 Subject: [PATCH 495/813] PUB:20190223 Regex groups and numerals.md @geekpi https://linux.cn/article-10594-1.html --- .../tech => published}/20190223 Regex groups and numerals.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190223 Regex groups and numerals.md (98%) diff --git a/translated/tech/20190223 Regex groups and numerals.md b/published/20190223 Regex groups and numerals.md similarity index 98% rename from translated/tech/20190223 Regex groups and numerals.md rename to published/20190223 Regex groups and numerals.md index 309a176ed2..8e963d8fdb 100644 --- a/translated/tech/20190223 Regex groups and numerals.md +++ b/published/20190223 Regex groups and numerals.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10594-1.html) [#]: subject: (Regex groups and numerals) [#]: via: (https://leancrew.com/all-this/2019/02/regex-groups-and-numerals/) [#]: author: (Dr.Drang https://leancrew.com) From 0602610c66cde9b49af65294eea674f85c318afc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 21:04:47 +0800 Subject: [PATCH 496/813] PRF:20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @An-DJ --- ...nd Swap Utilization Percentage In Linux.md | 135 +++++++++--------- 1 file changed, 64 insertions(+), 71 deletions(-) diff --git a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index 743392e522..ff708261ff 100644 --- a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -1,36 +1,32 @@ [#]: collector: (lujun9972) [#]: translator: (An-DJ) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Check CPU, Memory And Swap Utilization Percentage In Linux?) [#]: via: (https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) -如何查看Linux下CPU,内存和Swap(交换分区)的占用率? +如何查看 Linux 下 CPU、内存和交换分区的占用率? ====== -在Linux下有很多可用的命令和选项来查看内存占用情况,但是我并没有看见关于内存利用率的更多的信息。 +在 Linux 下有很多可以用来查看内存占用情况的命令和选项,但是我并没有看见关于内存占用率的更多的信息。 -在大多数情况下我们只单独查看内存使用情况,并没有考虑占用的百分比究竟是多少。 +在大多数情况下我们只想查看内存使用情况,并没有考虑占用的百分比究竟是多少。如果你想要了解这些信息,那你看这篇文章就对了。我们将会详细地在这里帮助你解决这个问题。 -如果你想要了解这些信息,那你看这篇文章就对了。 +这篇教程将会帮助你在面对 Linux 服务器下频繁的内存高占用情况时,确定内存使用情况。 -我们将会详细地在这里帮助你解决这个问题。 +而在同时,如果你使用的是 `free -m` 或者 `free -g`,占用情况描述地也并不是十分清楚。 -这篇教程将会帮助你在面对Linux服务器下频繁内存高占用情况时,确定内存使用情况。 +这些格式化命令属于 Linux 高级命令。它将会对 Linux 专家和中等水平 Linux 使用者非常有用。 -但是在同时,如果你使用的是`free -m`或者`free -g`,占用情况描述地并不是十分清楚。 +### 方法-1:如何查看 Linux 下内存占用率? -这些格式化命令属于Linux高级命令。它将会对Linux专家和中等水平Linux使用者非常有用。 +我们可以使用下面命令的组合来达到此目的。在该方法中,我们使用的是 `free` 和 `awk` 命令的组合来获取内存占用率。 -### 方法-1:如何查看Linux下内存占用率? +如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 [free 命令][1]、[smem 命令][2]、[ps_mem 命令][3]、[vmstat 命令][4] 及 [查看物理内存大小的多种方式][5]。 -我们可以使用下面命令的组合来达到此目的。在该方法中,我们使用的是`free`和`awk`命令的组合来获取内存占用率。 - -如果你正在寻找其他有关于内存的文章,你可以导航到如下链接。这些文章有 **[free命令][1]** , **[smem命令][2]** , **[ps_mem命令][3]** , **[vmstat命令][4]** 及 **[多种方式来查看物理内存大小][5]**. - -对于获取不包含百分比符号的`内存`占用率: +要获取不包含百分比符号的内存占用率: ``` $ free -t | awk 'NR == 2 {print "Current Memory Utilization is : " $3/$2*100}' @@ -40,7 +36,7 @@ $ free -t | awk 'FNR == 2 {print "Current Memory Utilization is : " $3/$2*100}' Current Memory Utilization is : 20.4194 ``` -对于获取不包含百分比符号的`Swap(交换分区)`占用率: +要获取不包含百分比符号的交换分区占用率: ``` $ free -t | awk 'NR == 3 {print "Current Swap Utilization is : " $3/$2*100}' @@ -50,7 +46,7 @@ $ free -t | awk 'FNR == 3 {print "Current Swap Utilization is : " $3/$2*100}' Current Swap Utilization is : 0 ``` -对于获取包含百分比符号及保留两位小数的`内存`占用率: +要获取包含百分比符号及保留两位小数的内存占用率: ``` $ free -t | awk 'NR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' @@ -60,7 +56,7 @@ $ free -t | awk 'FNR == 2 {printf("Current Memory Utilization is : %.2f%"), $3/$ Current Memory Utilization is : 20.42% ``` -对于获取包含百分比符号及保留两位小数的`Swap(交换分区)`占用率: +要获取包含百分比符号及保留两位小数的交换分区占用率: ``` $ free -t | awk 'NR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' @@ -70,114 +66,113 @@ $ free -t | awk 'FNR == 3 {printf("Current Swap Utilization is : %.2f%"), $3/$2* Current Swap Utilization is : 0.00% ``` -如果你正在寻找有关于内存的其他文章,你可以导航至如下链接。这些链接有 **[使用LVM(逻辑盘卷管理,Logical Volume Manager)创建和扩展Swap交换分区][6]** , **[多种方式创建或扩展Swap交换分区][7]** 和 **[多种方式创建/删除和挂载交换分区文件][8]**。 +如果你正在寻找有关于交换分区的其他文章,你可以导航至如下链接。这些链接有 [使用 LVM(逻辑盘卷管理)创建和扩展交换分区][6],[创建或扩展交换分区的多种方式][7] 和 [创建/删除和挂载交换分区文件的多种方式][8]。 -键入free命令会更好地作出阐释: +键入 `free` 命令会更好地作出阐释: ``` $ free - total used free shared buff/cache available -Mem: 15867 3730 9868 1189 2269 10640 -Swap: 17454 0 17454 -Total: 33322 3730 27322 + total used free shared buff/cache available +Mem: 15867 3730 9868 1189 2269 10640 +Swap: 17454 0 17454 +Total: 33322 3730 27322 ``` -如下是一些细节: +细节如下: - * **`free:`** free是一个标准命令,用于在Linux下查看内存使用情况。 - * **`awk:`** awk是一个专门用来做文本数据处理的强大命令。 - * **`FNR == 2:`** 该命令给出了对于每一个输入文件的行数。其基本上用于挑选出给定的行(针对于这里,它选择的是行数为2的行) - * **`NR == 2:`** 该命令给出了处理的行总数。其基本上用于过滤给出的行(针对于这里,它选择的是行数为2的行) - * **`$3/$2*100:`** 该命令将列3除以列2并将结果乘以100。 - * **`printf:`** 该命令用于格式化和打印数据。 - * **`%.2f%:`** 默认情况下,其打印小数点后保留6位的浮点数。使用后跟的格式来约束小数位。 + * `free`:是一个标准命令,用于在 Linux 下查看内存使用情况。 + * `awk`:是一个专门用来做文本数据处理的强大命令。 + * `FNR == 2`:该命令给出了每一个输入文件的行数。其基本上用于挑选出给定的行(针对于这里,它选择的是行号为 2 的行) + * `NR == 2`:该命令给出了处理的行总数。其基本上用于过滤给出的行(针对于这里,它选择的是行号为 2 的行) + * `$3/$2*100`:该命令将列 3 除以列 2 并将结果乘以 100。 + * `printf`:该命令用于格式化和打印数据。 + * `%.2f%`:默认情况下,其打印小数点后保留 6 位的浮点数。使用后跟的格式来约束小数位。 +### 方法-2:如何查看 Linux 下内存占用率? +我们可以使用下面命令的组合来达到此目的。在这种方法中,我们使用 `free`、`grep` 和 `awk` 命令的组合来获取内存占用率。 -### 方法-2:如何查看Linux下内存占用率? - -我们可以使用下面命令的组合来达到此目的。在这种方法中,我们使用`free`,`grep`和`awk`命令的组合来获取内存占用率。 - -对于获取不包含百分比符号的`内存`占用率: +要获取不包含百分比符号的内存占用率: ``` $ free -t | grep Mem | awk '{print "Current Memory Utilization is : " $3/$2*100}' Current Memory Utilization is : 20.4228 ``` -对于获取不包含百分比符号的`Swap(交换分区)`占用率: +要获取不包含百分比符号的交换分区占用率: ``` $ free -t | grep Swap | awk '{print "Current Swap Utilization is : " $3/$2*100}' Current Swap Utilization is : 0 ``` -对于获取包含百分比符号及保留两位小数的`内存`占用率: +要获取包含百分比符号及保留两位小数的内存占用率: ``` $ free -t | grep Mem | awk '{printf("Current Memory Utilization is : %.2f%"), $3/$2*100}' Current Memory Utilization is : 20.43% ``` -对于获取包含百分比符号及保留两位小数的`Swap(交换空间)`占用率: +要获取包含百分比符号及保留两位小数的交换空间占用率: + ``` $ free -t | grep Swap | awk '{printf("Current Swap Utilization is : %.2f%"), $3/$2*100}' Current Swap Utilization is : 0.00% ``` -### 方法-1:如何查看Linux下CPU的占用率? +### 方法-1:如何查看 Linux 下 CPU 的占用率? -我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用`top`,`print`和`awk`命令的组合来获取CPU的占用率。 +我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用 `top`、`print` 和 `awk` 命令的组合来获取 CPU 的占用率。 -如果你正在寻找其他有关于CPU(译者勘误,原文为memory)的文章,你可以导航至如下链接。这些文章有 **[top命令][9]** , **[htop命令][10]** , **[atop命令][11]** 及 **[Glances命令][12]**. +如果你正在寻找其他有关于 CPU(LCTT 译注:原文误为 memory)的文章,你可以导航至如下链接。这些文章有 [top 命令][9]、[htop 命令][10]、[atop 命令][11] 及 [Glances 命令][12]。 -如果在输出中展示的是多个CPU的情况,那么你需要使用下面的方法。 +如果在输出中展示的是多个 CPU 的情况,那么你需要使用下面的方法。 ``` $ top -b -n1 | grep ^%Cpu -%Cpu0 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 5.3 si, 0.0 st -%Cpu3 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -%Cpu4 : 10.5 us, 15.8 sy, 0.0 ni, 73.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -%Cpu5 : 0.0 us, 5.0 sy, 0.0 ni, 95.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -%Cpu6 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -%Cpu7 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu0 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 5.3 si, 0.0 st +%Cpu3 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu4 : 10.5 us, 15.8 sy, 0.0 ni, 73.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu5 : 0.0 us, 5.0 sy, 0.0 ni, 95.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu6 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +%Cpu7 : 5.3 us, 0.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st ``` -对于获取不包含百分比符号的`CPU`占用率: +要获取不包含百分比符号的 CPU 占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{cpu+=$9}END{print "Current CPU Utilization is : " 100-cpu/NR}' Current CPU Utilization is : 21.05 ``` -对于获取包含百分比符号及保留2位小数的`CPU`占用率: +要获取包含百分比符号及保留两位小数的 CPU 占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{cpu+=$9}END{printf("Current CPU Utilization is : %.2f%"), 100-cpu/NR}' Current CPU Utilization is : 14.81% ``` -### 方法-2:如何查看Linux下CPU的占用率? +### 方法-2:如何查看 Linux 下 CPU 的占用率? -我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用的是`top`,`print/printf`和`awk`命令的组合来获取CPU的占用率。 +我们可以使用如下命令的组合来达到此目的。在这种方法中,我们使用的是 `top`、`print`/`printf` 和 `awk` 命令的组合来获取 CPU 的占用率。 -如果在单个输出中一起展示了所有的CPU的情况,那么你需要使用下面的方法。 +如果在单个输出中一起展示了所有的 CPU 的情况,那么你需要使用下面的方法。 ``` $ top -b -n1 | grep ^%Cpu %Cpu(s): 15.3 us, 7.2 sy, 0.8 ni, 69.0 id, 6.7 wa, 0.0 hi, 1.0 si, 0.0 st ``` -对于获取不包含百分比符号的`CPU`占用率: +要获取不包含百分比符号的 CPU 占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{print "Current CPU Utilization is : " 100-$8}' Current CPU Utilization is : 5.6 ``` -对于获取包含百分比符号及保留2位小数的`CPU`占用率: +要获取包含百分比符号及保留两位小数的 CPU 占用率: ``` $ top -b -n1 | grep ^%Cpu | awk '{printf("Current CPU Utilization is : %.2f%"), 100-$8}' @@ -186,17 +181,15 @@ Current CPU Utilization is : 5.40% 如下是一些细节: - * **`top:`** top命令是一种用于查看当前Linux系统下正在运行的进程的非常好的命令。 - * **`-b:`** -b选项,允许top命令切换至批处理的模式。当你从本地系统运行top命令至远程系统时,它将会非常有用。 - * **`-n1:`** 迭代次数 - * **`^%Cpu:`** 过滤以%CPU开头的行。 - * **`awk:`** awk是一种专门用来做文本数据处理的强大命令。 - * **`cpu+=$9:`** 对于每一行,将第9列添加至变量‘cpu'。 - * **`printf:`** 该命令用于格式化和打印数据。 - * **`%.2f%:`** 默认情况下,它打印小数点后保留6位的浮点数。使用后跟的格式来限制小数位数。 - * **`100-cpu/NR:`** 最终打印出’CPU平均占用‘,即用100减去其并除以行数。 - - + * `top`:是一种用于查看当前 Linux 系统下正在运行的进程的非常好的命令。 + * `-b`:选项允许 `top` 命令切换至批处理的模式。当你从本地系统运行 `top` 命令至远程系统时,它将会非常有用。 + * `-n1`:迭代次数。 + * `^%Cpu`:过滤以 `%CPU` 开头的行。 + * `awk`:是一种专门用来做文本数据处理的强大命令。 + * `cpu+=$9`:对于每一行,将第 9 列添加至变量 `cpu`。 + * `printf`:该命令用于格式化和打印数据。 + * `%.2f%`:默认情况下,它打印小数点后保留 6 位的浮点数。使用后跟的格式来限制小数位数。 + * `100-cpu/NR`:最终打印出 CPU 平均占用率,即用 100 减去其并除以行数。 -------------------------------------------------------------------------------- @@ -205,7 +198,7 @@ via: https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage 作者:[Vinoth Kumar][a] 选题:[lujun9972][b] 译者:[An-DJ](https://github.com/An-DJ) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8877018e3ef566c3c5519cb325c37c9300833179 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 21:05:26 +0800 Subject: [PATCH 497/813] PUB:20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @An-DJ https://linux.cn/article-10595-1.html --- ...ck CPU, Memory And Swap Utilization Percentage In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md (99%) diff --git a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md b/published/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md similarity index 99% rename from translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md rename to published/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md index ff708261ff..cee9dc5f2c 100644 --- a/translated/tech/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md +++ b/published/20190212 How To Check CPU, Memory And Swap Utilization Percentage In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (An-DJ) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10595-1.html) [#]: subject: (How To Check CPU, Memory And Swap Utilization Percentage In Linux?) [#]: via: (https://www.2daygeek.com/linux-check-cpu-memory-swap-utilization-percentage/) [#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) From b102b295b3523fa9031677b23bb4a5dde4f1f06b Mon Sep 17 00:00:00 2001 From: mokshal <33783846+mokshal@users.noreply.github.com> Date: Wed, 6 Mar 2019 22:18:16 +0800 Subject: [PATCH 498/813] Update 20181205 5 reasons to give Linux for the holidays.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译“20181205 5 reasons to give Linux for the holidays” --- .../talk/20181205 5 reasons to give Linux for the holidays.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181205 5 reasons to give Linux for the holidays.md b/sources/talk/20181205 5 reasons to give Linux for the holidays.md index 2bcd6d642c..71d65741ed 100644 --- a/sources/talk/20181205 5 reasons to give Linux for the holidays.md +++ b/sources/talk/20181205 5 reasons to give Linux for the holidays.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (mokshal) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (5 reasons to give Linux for the holidays) From 5e86c4417e17aad458b53ffc09dd8117cd2f30ca Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 7 Mar 2019 08:50:52 +0800 Subject: [PATCH 499/813] translated --- ...e Linux Design Tool We-ve Always Wanted.md | 92 ------------------- ...e Linux Design Tool We-ve Always Wanted.md | 91 ++++++++++++++++++ 2 files changed, 91 insertions(+), 92 deletions(-) delete mode 100644 sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md create mode 100644 translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md diff --git a/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md b/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md deleted file mode 100644 index ee973a67a4..0000000000 --- a/sources/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Akira: The Linux Design Tool We’ve Always Wanted?) -[#]: via: (https://itsfoss.com/akira-design-tool) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Akira: The Linux Design Tool We’ve Always Wanted? -====== - -Let’s make it clear, I am not a professional designer – but I’ve used certain tools on Windows (like Photoshop, Illustrator, etc.) and [Figma][1] (which is a browser-based interface design tool). I’m sure there are a lot more design tools available for Mac and Windows. - -Even on Linux, there is a limited number of dedicated [graphic design tools][2]. A few of these tools like [GIMP][3] and [Inkscape][4] are used by professionals as well. But most of them are not considered professional grade, unfortunately. - -Even if there are a couple more solutions – I’ve never come across a native Linux application that could replace [Sketch][5], Figma, or Adobe **** XD. Any professional designer would agree to that, isn’t it? - -### Is Akira going to replace Sketch, Figma, and Adobe XD on Linux? - -Well, in order to develop something that would replace those awesome proprietary tools – [Alessandro Castellani][6] – came up with a [Kickstarter campaign][7] by teaming up with a couple of experienced developers – -[Alberto Fanjul][8], [Bilal Elmoussaoui][9], and [Felipe Escoto][10]. - -So, yes, Akira is still pretty much just an idea- with a working prototype of its interface (as I observed in their [live stream session][11] via Kickstarter recently). - -### If it does not exist, why the Kickstarter campaign? - -![][12] - -The aim of the Kickstarter campaign is to gather funds in order to hire the developers and take a few months off to dedicate their time in order to make Akira possible. - -Nonetheless, if you want to support the project, you should know some details, right? - -Fret not, we asked a couple of questions in their livestream session – let’s get into it… - -### Akira: A few more details - -![Akira prototype interface][13] -Image Credits: Kickstarter - -As the Kickstarter campaign describes: - -> The main purpose of Akira is to offer a fast and intuitive tool to **create Web and Mobile interfaces** , more like **Sketch** , **Figma** , or **Adobe XD** , with a completely native experience for Linux. - -They’ve also written a detailed description as to how the tool will be different from Inkscape, Glade, or QML Editor. Of course, if you want all the technical details, [Kickstarter][7] is the way to go. But, before that, let’s take a look at what they had to say when I asked some questions about Akira. - -Q: If you consider your project – similar to what Figma offers – why should one consider installing Akira instead of using the web-based tool? Is it just going to be a clone of those tools – offering a native Linux experience or is there something really interesting to encourage users to switch (except being an open source solution)? - -**Akira:** A native experience on Linux is always better and fast in comparison to a web-based electron app. Also, the hardware configuration matters if you choose to utilize Figma – but Akira will be light on system resource and you will still be able to do similar stuff without needing to go online. - -Q: Let’s assume that it becomes the open source solution that Linux users have been waiting for (with similar features offered by proprietary tools). What are your plans to sustain it? Do you plan to introduce any pricing plans – or rely on donations? - -**Akira** : The project will mostly rely on Donations (something like [Krita Foundation][14] could be an idea). But, there will be no “pro” pricing plans – it will be available for free and it will be an open source project. - -So, with the response I got, it definitely seems to be something promising that we should probably support. - -### Wrapping Up - -What do you think about Akira? Is it just going to remain a concept? Or do you hope to see it in action? - -Let us know your thoughts in the comments below. - -![][15] - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/akira-design-tool - -作者:[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.figma.com/ -[2]: https://itsfoss.com/best-linux-graphic-design-software/ -[3]: https://itsfoss.com/gimp-2-10-release/ -[4]: https://inkscape.org/ -[5]: https://www.sketchapp.com/ -[6]: https://github.com/Alecaddd -[7]: https://www.kickstarter.com/projects/alecaddd/akira-the-linux-design-tool/description -[8]: https://github.com/albfan -[9]: https://github.com/bilelmoussaoui -[10]: https://github.com/Philip-Scott -[11]: https://live.kickstarter.com/alessandro-castellani/live-stream/the-current-state-of-akira -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-design-tool-kickstarter.jpg?resize=800%2C451&ssl=1 -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-mockup.png?ssl=1 -[14]: https://krita.org/en/about/krita-foundation/ -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-design-tool-kickstarter.jpg?fit=812%2C458&ssl=1 diff --git a/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md b/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md new file mode 100644 index 0000000000..ad957f697d --- /dev/null +++ b/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Akira: The Linux Design Tool We’ve Always Wanted?) +[#]: via: (https://itsfoss.com/akira-design-tool) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Akira:我们一直想要的 Linux 设计工具? +====== + +先说一下,我不是一个专业的设计师 - 但我在 Windows 上使用了某些工具(如 Photoshop、Illustrator 等)和 [Figma] [1](这是一个基于浏览器的界面设计工具)。我相信 Mac 和 Windows 上还有更多的设计工具。 + +即使在 Linux 上,也只有有限的专用[图形设计工具][2]。其中一些工具如 [GIMP][3] 和 [Inkscape][4] 也被专业人士使用。但不幸的是,它们中的大多数都不被视为专业级。 + +即使有更多解决方案 - 我也从未遇到过可以取代 [Sketch][5]、Figma 或 Adobe XD 的原生 Linux 应用。任何专业设计师都同意这点,不是吗? + +### Akira 是否会在 Linux 上取代 Sketch、Figma 和 Adobe XD? + +所以,为了开发一些能够取代那些专有工具的应用 - [Alessandro Castellani][6] 发起了一个 [Kickstarter 活动][7],并与几位经验丰富的开发人员 [Alberto Fanjul][8]、[Bilal Elmoussaoui][9] 和 [Felipe Escoto][10] 组队合作。 + +是的,Akira 仍然只是一个想法,只有一个界面原型(正如我最近在 Kickstarter 的[直播流][11]中看到的那样)。 + +### 如果它还没有,为什么会发起 Kickstarter 活动? + +![][12] + +Kickstarter 活动的目的是收集资金,以便雇用开发人员,并花几个月的时间开发,以使 Akira 成为可能。 + +尽管如此,如果你想支持这个项目,你应该知道一些细节,对吧? + +不用担心,我们在他们的直播中问了几个问题 - 让我们看下 + +### Akira:更多细节 + +![Akira prototype interface][13] +图片来源:Kickstarter + +如 Kickstarter 活动描述的那样: + +> Akira 的主要目的是提供一个快速而直观的工具来**创建 Web 和移动界面**,更像是 **Sketch**、**Figma** 或 **Adob​​e XD**,并且是 Linux 原生体验。 + +他们还详细描述了该工具与 Inkscape、Glade 或 QML Editor 的不同之处。当然,如果你想要所有的技术细节,请查看 [Kickstarter][7]。但是,在此之前,让我们看一看当我询问有关 Akira 的一些问题时他们说了些什么。 + +问:如果你认为你的项目类似于 Figma - 人们为什么要考虑安装 Akira 而不是使用基于网络的工具?它是否只是这些工具的克隆 - 提供原生 Linux 体验,还是有一些非常有趣的东西可以鼓励用户切换(除了是开源解决方案之外)? + +** Akira:** 与基于网络的 electron 应用相比,Linux 原生体验总是更好、更快。此外,如果你选择使用 Figma,硬件配置也很重要 - 但 Akira 将会占用很少的系统资源,并且你可以在不需要上网的情况下完成类似工作。 + +问:假设它成为了 Linux用户一直在等待的开源方案(拥有专有工具的类似功能)。你有什么维护计划?你是否计划引入定价 - 或依赖捐赠? + +**Akira:**该项目主要依靠捐赠(类似于 [Krita 基金会][14] 这样的想法)。但是,不会有“专业版”计划 - 它将免费提供,它将是一个开源项目。 + +根据我得到的回答,它看起来似乎很有希望,我们应该支持。 + +### 总结 + +你怎么认为 Akira?它只是一个概念吗?或者你希望看到进展? + +请在下面的评论中告诉我们你的想法。 + +![][15] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/akira-design-tool + +作者:[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.figma.com/ +[2]: https://itsfoss.com/best-linux-graphic-design-software/ +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://inkscape.org/ +[5]: https://www.sketchapp.com/ +[6]: https://github.com/Alecaddd +[7]: https://www.kickstarter.com/projects/alecaddd/akira-the-linux-design-tool/description +[8]: https://github.com/albfan +[9]: https://github.com/bilelmoussaoui +[10]: https://github.com/Philip-Scott +[11]: https://live.kickstarter.com/alessandro-castellani/live-stream/the-current-state-of-akira +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-design-tool-kickstarter.jpg?resize=800%2C451&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-mockup.png?ssl=1 +[14]: https://krita.org/en/about/krita-foundation/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/akira-design-tool-kickstarter.jpg?fit=812%2C458&ssl=1 From 9da8bb3a9295a1bb91bd4ba241c711a69e068ee7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 7 Mar 2019 09:08:26 +0800 Subject: [PATCH 500/813] translating --- sources/tech/20190301 How to use sudo access in winSCP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190301 How to use sudo access in winSCP.md b/sources/tech/20190301 How to use sudo access in winSCP.md index 750c37e318..a2821fefab 100644 --- a/sources/tech/20190301 How to use sudo access in winSCP.md +++ b/sources/tech/20190301 How to use sudo access in winSCP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 772115a9e410332e79c77d3c09c47f516a7912fc Mon Sep 17 00:00:00 2001 From: AnDJ_W Date: Thu, 7 Mar 2019 10:49:15 +0800 Subject: [PATCH 501/813] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20190304 How to Install MongoDB on Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190304 How to Install MongoDB on Ubuntu.md b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md index 5dad6b0b54..30d588ddba 100644 --- a/sources/tech/20190304 How to Install MongoDB on Ubuntu.md +++ b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (An-DJ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8300fe3517a2d8b130a5b866c483b43fd5d5f9b0 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Thu, 7 Mar 2019 10:51:05 +0800 Subject: [PATCH 502/813] Update and rename sources/tech/20180202 Tips for success when getting started with Ansible.md to translated/tech/20180202 Tips for success when getting started with Ansible.md --- ...ccess when getting started with Ansible.md | 75 ------------------- ...ccess when getting started with Ansible.md | 71 ++++++++++++++++++ 2 files changed, 71 insertions(+), 75 deletions(-) delete mode 100644 sources/tech/20180202 Tips for success when getting started with Ansible.md create mode 100644 translated/tech/20180202 Tips for success when getting started with Ansible.md diff --git a/sources/tech/20180202 Tips for success when getting started with Ansible.md b/sources/tech/20180202 Tips for success when getting started with Ansible.md deleted file mode 100644 index 2b70c04e4d..0000000000 --- a/sources/tech/20180202 Tips for success when getting started with Ansible.md +++ /dev/null @@ -1,75 +0,0 @@ -jdh8383 is translating. - -Tips for success when getting started with Ansible -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-big-data.png?itok=L34b2exg) - -Ansible is an open source automation tool used to configure servers, install software, and perform a wide variety of IT tasks from one central location. It is a one-to-many agentless mechanism where all instructions are run from a control machine that communicates with remote clients over SSH, although other protocols are also supported. - -While targeted for system administrators with privileged access who routinely perform tasks such as installing and configuring applications, Ansible can also be used by non-privileged users. For example, a database administrator using the `mysql` login ID could use Ansible to create databases, add users, and define access-level controls. - -Let's go over a very simple example where a system administrator provisions 100 servers each day and must run a series of Bash commands on each one before handing it off to users. - -![](https://opensource.com/sites/default/files/u128651/mapping-bash-commands-to-ansible.png) - -This is a simple example, but should illustrate how easily commands can be specified in yaml files and executed on remote servers. In a heterogeneous environment, conditional statements can be added so that certain commands are only executed in certain servers (e.g., "only execute `yum` commands in systems that are not Ubuntu or Debian"). - -One important feature in Ansible is that a playbook describes a desired state in a computer system, so a playbook can be run multiple times against a server without impacting its state. If a certain task has already been implemented (e.g., "user `sysman` already exists"), then Ansible simply ignores it and moves on. - -### Definitions - - * **Tasks:**``A task is the smallest unit of work. It can be an action like "Install a database," "Install a web server," "Create a firewall rule," or "Copy this configuration file to that server." - * **Plays:**``A play is made up of tasks. For example, the play: "Prepare a database to be used by a web server" is made up of tasks: 1) Install the database package; 2) Set a password for the database administrator; 3) Create a database; and 4) Set access to the database. - * **Playbook:**``A playbook is made up of plays. A playbook could be: "Prepare my website with a database backend," and the plays would be 1) Set up the database server; and 2) Set up the web server. - * **Roles:**``Roles are used to save and organize playbooks and allow sharing and reuse of playbooks. Following the previous examples, if you need to fully configure a web server, you can use a role that others have written and shared to do just that. Since roles are highly configurable (if written correctly), they can be easily reused to suit any given deployment requirements. - * **Ansible Galaxy:**``Ansible [Galaxy][1] is an online repository where roles are uploaded so they can be shared with others. It is integrated with GitHub, so roles can be organized into Git repositories and then shared via Ansible Galaxy. - - - -These definitions and their relationships are depicted here: - -![](https://opensource.com/sites/default/files/u128651/ansible-definitions.png) - -Please note this is just one way to organize the tasks that need to be executed. We could have split up the installation of the database and the web server into separate playbooks and into different roles. Most roles in Ansible Galaxy install and configure individual applications. You can see examples for installing [mysql][2] and installing [httpd][3]. - -### Tips for writing playbooks - -The best source for learning Ansible is the official [documentation][4] site. And, as usual, online search is your friend. I recommend starting with simple tasks, like installing applications or creating users. Once you are ready, follow these guidelines: - - * When testing, use a small subset of servers so that your plays execute faster. If they are successful in one server, they will be successful in others. - * Always do a dry run to make sure all commands are working (run with `--check-mode` flag). - * Test as often as you need to without fear of breaking things. Tasks describe a desired state, so if a desired state is already achieved, it will simply be ignored. - * Be sure all host names defined in `/etc/ansible/hosts` are resolvable. - * Because communication to remote hosts is done using SSH, keys have to be accepted by the control machine, so either 1) exchange keys with remote hosts prior to starting; or 2) be ready to type in "Yes" to accept SSH key exchange requests for each remote host you want to manage. - * Although you can combine tasks for different Linux distributions in one playbook, it's cleaner to write a separate playbook for each distro. - - - -### In the final analysis - -Ansible is a great choice for implementing automation in your data center: - - * It's agentless, so it is simpler to install than other automation tools. - * Instructions are in YAML (though JSON is also supported) so it's easier than writing shell scripts. - * It's open source software, so contribute back to it and make it even better! - - - -How have you used Ansible to automate your data center? Share your experience in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/tips-success-when-getting-started-ansible - -作者:[Jose Delarosa][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/jdelaros1 -[1]:https://galaxy.ansible.com/ -[2]:https://galaxy.ansible.com/bennojoy/mysql/ -[3]:https://galaxy.ansible.com/xcezx/httpd/ -[4]:http://docs.ansible.com/ diff --git a/translated/tech/20180202 Tips for success when getting started with Ansible.md b/translated/tech/20180202 Tips for success when getting started with Ansible.md new file mode 100644 index 0000000000..395a46a5e1 --- /dev/null +++ b/translated/tech/20180202 Tips for success when getting started with Ansible.md @@ -0,0 +1,71 @@ +Ansible 初学者成功指南 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-big-data.png?itok=L34b2exg) + +Ansible 是一个开源自动化工具,可以从中央控制节点统一配置服务器、安装软件或执行各种 IT 任务。它采用一对多、无客户端agentless的机制,从控制节点上通过 SSH 发送指令给远端的客户机来完成任务(当然除了 SSH 外也可以用别的协议)。 + +Ansible 的主要使用群体是系统管理员,他们经常会周期性地执行一些安装、配置应用的工作。尽管如此,一些非特权用户也可以使用 Ansible,例如数据库管理员就可以通过 Ansible 用 `mysql` 这个用户来创建数据库、添加数据库用户、定义访问权限等。 + +让我们来看一个简单的使用场景,一位系统管理员每天要配置 100 台服务器,并且必须在每台机器上执行一系列 Bash 命令,然后交付给用户。 + +![](https://opensource.com/sites/default/files/u128651/mapping-bash-commands-to-ansible.png) + +这是个简单的例子,但应该能够证明:在 yaml 文件里写好命令然后在远程服务器上运行,是一件非常轻松的事。而且如果运行环境不同,就可以加入判断条件,指明某些命令只能在特定的服务器上运行(如:只在那些不是 Ubuntu 或 Debian 的系统上运行 `yum` 命令)。 + +Ansible 的一个重要特性是用 playbook 来描述一个计算机系统的最终状态,所以一个 playbook 可以在服务器上反复执行而不影响其最终状态(译者注:即是幂等的)。如果某个任务已经被实施过了(如,“用户 `sysman` 已经存在”),那么 Ansible 就会忽略它继续执行后续的任务。 + +### 定义 + + * **任务Tasks:** task 是工作的最小单位,它可以是个动作,比如“安装一个数据库服务”、“安装一个 web 服务器”、“创建一条防火墙规则”或者“把这个配置文件拷贝到那个服务器上去”。 + * **战术动作Plays:** play 由 task 组成,例如,一个 play 的内容是要:“设置一个数据库,给 web 服务用”,这就包含了如下任务:1)安装数据库包;2)设置数据库管理员密码;3)创建数据库实例;4)为该实例分配权限。 + * **战术手册Playbook:**(译者注:playbook 原指美式橄榄球队的[战术手册][5]) playbook 由 play 组成,一个 playbook 可能像这样:“设置我的网站,包含后端数据库”,其中的 play 包括:1)设置数据库服务器;2)设置 web 服务器。 + * **角色Roles:** Role 用来保存和组织 playbook,以便分享和再次使用它们。还拿上个例子来说,如果你需要一个全新的 web 服务器,就可以用别人已经写好并分享出来的 role 来设置。因为 role 是高度可配置的(如果编写正确的话),可以根据部署需求轻松地复用它们。 + * **Ansible 星系Ansible Galaxy:** [Ansible Galaxy][1] 是一个在线仓库,里面保存的是由社区成员上传的 role,方便彼此分享。它与 GitHub 紧密集成,因此这些 role 可以先在 Git 仓库里组织好,然后通过 Ansible Galaxy 分享出来。 + + +这些定义以及它们之间的关系可以用下图来描述: + +![](https://opensource.com/sites/default/files/u128651/ansible-definitions.png) + +请注意上面的例子只是组织任务的方式之一,我们当然也可以把安装数据库和安装 web 服务器的 playbook 拆开,放到不同的 role 里。Ansible Galaxy 上最常见的 role 是独立安装配置每个应用服务,你可以参考这些安装 [mysql][2] 和 [httpd][3] 的例子。 + +### 编写 playbook 的小贴士 + +学习 Ansible 最好的资源是其[官方文档][4]。另外,像学习其他东西一样,搜索引擎是你的好朋友。我推荐你从一些简单的任务开始,比如安装应用或创建用户。下面是一些有用的指南: + + * 在测试的时候少选几台服务器,这样你的 play 可以执行的更快一些。如果它们在一台机器上执行成功,在其他机器上也没问题。 + * 总是在真正运行前做一次测试dry run以确保所有的命令都能正确执行(要运行测试,加上 `--check-mode` 参数 )。 + * 尽可能多做测试,别担心搞砸。任务里描述的是所需的状态,如果系统已经达到预期状态,任务会被简单地忽略掉。 + * 确保在 `/etc/ansible/hosts` 里定义的主机名都可以被正确解析。 + * 因为是用 SSH 与远程主机通信,主控节点必须要接受密钥,所以你面临如下选择:1)要么在正式使用之前就做好与远程主机的密钥交换工作;2)要么在开始管理某台新的远程主机时做好准备输入“Yes”,因为你要接受对方的 SSH 密钥交换请求(译者注:还有另一个不那么安全的选择,修改主控节点的 ssh 配置文件,将 `StrictHostKeyChecking` 设置成“no”)。 + * 尽管你可以在同一个 playbook 内把不同 Linux 发行版的任务整合到一起,但为每个发行版单独编写 playbook 会更明晰一些。 + + +### 总结一下 + +Ansible 是你在数据中心里实施运维自动化的好选择,因为它: + + * 无需客户端,所以比其他自动化工具更易安装。 + * 将指令保存在 YAML 文件中(虽然也支持 JSON),比写 shell 脚本更简单。 + * 开源,因此你也可以做出自己的贡献,让它更加强大! + + +你是怎样使用 Ansible 让数据中心更加自动化的呢?请在评论中分享您的经验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/2/tips-success-when-getting-started-ansible + +作者:[Jose Delarosa][a] +译者:[jdh8383](https://github.com/jdh8383) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jdelaros1 +[1]:https://galaxy.ansible.com/ +[2]:https://galaxy.ansible.com/bennojoy/mysql/ +[3]:https://galaxy.ansible.com/xcezx/httpd/ +[4]:http://docs.ansible.com/ +[5]:https://usafootball.com/football-playbook/ From adb60499d7f8a9ef314b81c6f877c0b11ed6a13b Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 7 Mar 2019 13:11:55 +0800 Subject: [PATCH 503/813] Delete 20190208 7 steps for hunting down Python code bugs.md --- ...steps for hunting down Python code bugs.md | 114 ------------------ 1 file changed, 114 deletions(-) delete mode 100644 sources/tech/20190208 7 steps for hunting down Python code bugs.md diff --git a/sources/tech/20190208 7 steps for hunting down Python code bugs.md b/sources/tech/20190208 7 steps for hunting down Python code bugs.md deleted file mode 100644 index 77b2c802a0..0000000000 --- a/sources/tech/20190208 7 steps for hunting down Python code bugs.md +++ /dev/null @@ -1,114 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 steps for hunting down Python code bugs) -[#]: via: (https://opensource.com/article/19/2/steps-hunting-code-python-bugs) -[#]: author: (Maria Mckinley https://opensource.com/users/parody) - -7 steps for hunting down Python code bugs -====== -Learn some tricks to minimize the time you spend tracking down the reasons your code fails. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) - -It is 3 pm on a Friday afternoon. Why? Because it is always 3 pm on a Friday when things go down. You get a notification that a customer has found a bug in your software. After you get over your initial disbelief, you contact DevOps to find out what is happening with the logs for your app, because you remember receiving a notification that they were being moved. - -Turns out they are somewhere you can't get to, but they are in the process of being moved to a web application—so you will have this nifty application for searching and reading them, but of course, it is not finished yet. It should be up in a couple of days. I know, totally unrealistic situation, right? Unfortunately not; it seems logs or log messages often come up missing at just the wrong time. Before we track down the bug, a public service announcement: Check your logs to make sure they are where you think they are and logging what you think they should log, regularly. Amazing how these things just change when you aren't looking. - -OK, so you found the logs or tried the call, and indeed, the customer has found a bug. Maybe you even think you know where the bug is. - -You immediately open the file you think might be the problem and start poking around. - -### 1. Don't touch your code yet - -Go ahead and look at it, maybe even come up with a hypothesis. But before you start mucking about in the code, take that call that creates the bug and turn it into a test. This will be an integration test because although you may have suspicions, you do not yet know exactly where the problem is. - -Make sure this test fails. This is important because sometimes the test you make doesn't mimic the broken call; this is especially true if you are using a web or other framework that can obfuscate the tests. Many things may be stored in variables, and it is unfortunately not always obvious, just by looking at the test, what call you are making in the test. I'm not going to say that I have created a test that passed when I was trying to imitate a broken call, but, well, I have, and I don't think that is particularly unusual. Learn from my mistakes. - -### 2. Write a failing test - -Now that you have a failing test or maybe a test with an error, it is time to troubleshoot. But before you do that, let's do a review of the stack, as this makes troubleshooting easier. - -The stack consists of all of the tasks you have started but not finished. So, if you are baking a cake and adding the flour to the batter, then your stack would be: - - * Make cake - * Make batter - * Add flour - - - -You have started making your cake, you have started making the batter, and you are adding the flour. Greasing the pan is not on the list since you already finished that, and making the frosting is not on the list because you have not started that. - -If you are fuzzy on the stack, I highly recommend playing around on [Python Tutor][1], where you can watch the stack as you execute lines of code. - -Now, if something goes wrong with your Python program, the interpreter helpfully prints out the stack for you. This means that whatever the program was doing at the moment it became apparent that something went wrong is on the bottom. - -### 3. Always check the bottom of the stack first - -Not only is the bottom of the stack where you can see which error occurred, but often the last line of the stack is where you can find the issue. If the bottom doesn't help, and your code has not been linted in a while, it is amazing how helpful it can be to run. I recommend pylint or flake8. More often than not, it points right to where there is an error that I have been overlooking. - -If the error is something that seems obscure, your next move might just be to Google it. You will have better luck if you don't include information that is relevant only to your code, like the name of variables, files, etc. If you are using Python 3 (which you should be), it's helpful to include the 3 in the search; otherwise, Python 2 solutions tend to dominate the top. - -Once upon a time, developers had to troubleshoot without the benefit of a search engine. This was a dark time. Take advantage of all the tools available to you. - -Unfortunately, sometimes the problem occurred earlier and only became apparent during the line executed on the bottom of the stack. Think about how forgetting to add the baking powder becomes obvious when the cake doesn't rise. - -It is time to look up the stack. Chances are quite good that the problem is in your code, and not Python core or even third-party packages, so scan the stack looking for lines in your code first. Plus it is usually much easier to put a breakpoint in your own code. Stick the breakpoint in your code a little further up the stack and look around to see if things look like they should. - -"But Maria," I hear you say, "this is all helpful if I have a stack trace, but I just have a failing test. Where do I start?" - -Pdb, the Python Debugger. - -Find a place in your code where you know this call should hit. You should be able to find at least one place. Stick a pdb break in there. - -#### A digression - -Why not a print statement? I used to depend on print statements. They still come in handy sometimes. But once I started working with complicated code bases, and especially ones making network calls, print just became too slow. I ended up with print statements all over the place, I lost track of where they were and why, and it just got complicated. But there is a more important reason to mostly use pdb. Let's say you put a print statement in and discover that something is wrong—and must have gone wrong earlier. But looking at the function where you put the print statement, you have no idea how you got there. Looking at code is a great way to see where you are going, but it is terrible for learning where you've been. And yes, I have done a grep of my code base looking for where a function is called, but this can get tedious and doesn't narrow it down much with a popular function. Pdb can be very helpful. - -You follow my advice, and put in a pdb break and run your test. And it whooshes on by and fails again, with no break at all. Leave your breakpoint in, and run a test already in your test suite that does something very similar to the broken test. If you have a decent test suite, you should be able to find a test that is hitting the same code you think your failed test should hit. Run that test, and when it gets to your breakpoint, do a `w` and look at the stack. If you have no idea by looking at the stack how/where the other call may have gone haywire, then go about halfway up the stack, find some code that belongs to you, and put a breakpoint in that file, one line above the one in the stack trace. Try again with the new test. Keep going back and forth, moving up the stack to figure out where your call went off the rails. If you get all the way up to the top of the trace without hitting a breakpoint, then congratulations, you have found the issue: Your app was spelled wrong. No experience here, nope, none at all. - -### 4. Change things - -If you still feel lost, try making a new test where you vary something slightly. Can you get the new test to work? What is different? What is the same? Try changing something else. Once you have your test, and maybe additional tests in place, it is safe to start changing things in the code to see if you can narrow down the problem. Remember to start troubleshooting with a fresh commit so you can easily back out changes that do not help. (This is a reference to version control, if you aren't using version control, it will change your life. Well, maybe it will just make coding easier. See "[A Visual Guide to Version Control][2]" for a nice introduction.) - -### 5. Take a break - -In all seriousness, when it stops feeling like a fun challenge or game and starts becoming really frustrating, your best course of action is to walk away from the problem. Take a break. I highly recommend going for a walk and trying to think about something else. - -### 6. Write everything down - -When you come back, if you aren't suddenly inspired to try something, write down any information you have about the problem. This should include: - - * Exactly the call that is causing the problem - * Exactly what happened, including any error messages or related log messages - * Exactly what you were expecting to happen - * What you have done so far to find the problem and any clues that you have discovered while troubleshooting - - - -Sometimes this is a lot of information, but trust me, it is really annoying trying to pry information out of someone piecemeal. Try to be concise, but complete. - -### 7. Ask for help - -I often find that just writing down all the information triggers a thought about something I have not tried yet. Sometimes, of course, I realize what the problem is immediately after hitting the submit button. At any rate, if you still have not thought of anything after writing everything down, try sending an email to someone. First, try colleagues or other people involved in your project, then move on to project email lists. Don't be afraid to ask for help. Most people are kind and helpful, and I have found that to be especially true in the Python community. - -Maria McKinley will present [Hunting the Bugs][3] at [PyCascades 2019][4], February 23-24 in Seattle. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/steps-hunting-code-python-bugs - -作者:[Maria Mckinley][a] -选题:[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/parody -[b]: https://github.com/lujun9972 -[1]: http://www.pythontutor.com/ -[2]: https://betterexplained.com/articles/a-visual-guide-to-version-control/ -[3]: https://2019.pycascades.com/talks/hunting-the-bugs -[4]: https://2019.pycascades.com/ From bb7af13016aa53733a6e17d92b0a59bd7d135bca Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 7 Mar 2019 13:29:39 +0800 Subject: [PATCH 504/813] Check translation of 7 steps for hunting down Python code bugs. --- ...08 7 steps for hunting down Python code bugs.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 04d302964c..5f280ae17c 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -16,7 +16,7 @@ 结果这些日志被转移到了你获取不到的地方,但他们正在导到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。这个应用预计会在几天内完成。我知道,这完全不符合实际情况,对吧?然而并不是,日志或者日志消息似乎经常在错误的时间出现缺失。在我们开始查错前,一个忠告:经常检查你的日志以确保他们在你认为它们应该在的地方并记录你认为它们应该记的东西。当你不检查的时候,这些东西往往会发生令人惊讶的变化。 -好的,你找到了日志或者尝试了呼叫运维人员,而客户确实发现了一个错误。甚至你可能认为你知道错误在哪儿。 +好的,你找到了日志或者尝试了呼叫运维人员,而客户确实发现了一个错误。甚至你可能认为你已经知道错误在哪儿。 你立即打开你认为可能有问题的文件并开始查错。 @@ -48,23 +48,23 @@ 如果对错误看起来很迷惑,你下一步行动可能是用 Google 搜索它。如果你搜索的内容不包含你的代码的相关信息,如变量名、文件等,那你将获得更好的搜索结果。如果你使用的是 Python 3(你应该使用它),那么搜索内容包含 Python 3 是有帮助的,否则 Python 2 的解决方案往往会占据大多数。 -很久以前,开发者需要在没有搜索引擎的帮助下解决问题。这是一段黑暗的时光。充分利用你可以使用的所有工具。 +很久以前,开发者需要在没有搜索引擎的帮助下解决问题。那是一段黑暗的时光。充分利用你可以使用的所有工具。 不幸的是,有时候问题发生得比较早但只有在调用栈底部执行的地方才变得明显。就像当蛋糕没有膨胀时,忘记加发酵粉的事才被发现。 -那就该检查整个调用栈。问题很可能在于你的代码而不算 Python 核心或者第三方包,所以先检查调用栈内你的代码。另外,在你的代码中放置断点通常会更容易检查代码。在调用栈的代码中放置断点然后看看周围是否如你预期。 +那就该检查整个调用栈。问题更可能在你的代码而不是 Python 标准库或者第三方包,所以先检查调用栈内你的代码。另外,在你的代码中放置断点通常会更容易检查代码。在调用栈的代码中放置断点然后看看周围是否如你预期。 “但是,玛丽,”我听到你说,“如果我有一个调用栈,那这些都是有帮助的,但我只有一个失败的测试。我该从哪里开始?” Pdb, 一个 Python 调试器。 -找到你代码里会被这个调用命中的地方。你应该能至少找到一个这样的地方。在那里打上一个 pdb 的断点。 +找到你代码里会被这个调用命中的地方。你应该能够找到至少一个这样的地方。在那里打上一个 pdb 的断点。 #### 一句题外话 -为什么不使用 print 语句呢?我曾经依赖于 print 语句。他们有时候仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。但是主要使用 pdb 还有一个更重要的原因。假设你添加一条 print 语句去发现错误问题,而且 print 语句必须早于错误出现的地方。但是,看看你放 print 语句的函数,你不知道你是怎么调用它的。查看代码是寻找的好方法,但看你以前写的代码是恐怖的。是的,我会用 grep 处理我的代码库以寻找调用函数的地方,但这会变得乏味而且匹配一个通用函数时不能缩小范围。Pdb 就变得非常有用。 +为什么不使用 print 语句呢?我曾经依赖于 print 语句。有时候,他们仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。但是主要使用 pdb 还有一个更重要的原因。假设你添加一条 print 语句去发现错误问题,而且 print 语句必须早于错误出现的地方。但是,看看你放 print 语句的函数,你不知道你的代码是怎么执行到那个位置的。查看代码是寻找调用路径的好方法,但看你以前写的代码是恐怖的。是的,我会用 grep 处理我的代码库以寻找调用函数的地方,但这会变得乏味,而且搜索一个通用函数时并不能缩小搜索范围。Pdb 就变得非常有用。 -你遵循我的建议,打上 pdb 断点并运行你的测试。然后测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。运行这个测试,然后当它打到你的断点,按下 `w` 并检查调用栈。如果你不知道如何查看因为其他调用而变得混乱的调用栈,那么在调用栈的中间找到属于你的代码,并在其中堆栈中代码的上一行放置一个断点。再试一次新的测试。如果仍然没打到断点,那么继续,向上追踪调用栈并找出你的调用在哪里脱轨了。如果你一直没有打到断点,最后到了追踪的顶部,那么恭喜你,你发现了问题:你的应用程序拼写错了。没有经验,没有经验,一点都没有经验。 +你遵循我的建议,打上 pdb 断点并运行你的测试。然而测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。运行这个测试,然后当它打到你的断点,按下 `w` 并检查调用栈。如果你不知道如何查看因为其他调用而变得混乱的调用栈,那么在调用栈的中间找到属于你的代码,并在其中堆栈中代码的上一行放置一个断点。再试一次新的测试。如果仍然没打到断点,那么继续,向上追踪调用栈并找出你的调用在哪里脱轨了。如果你一直没有打到断点,最后到了追踪的顶部,那么恭喜你,你发现了问题:你的应用程序拼写错了。没有经验,没有经验,一点都没有经验。 ### 4. 修改代码 @@ -87,7 +87,7 @@ Pdb, 一个 Python 调试器。 ### 7. 寻求帮助 -我经常发现写下所以信息会引发我对还没尝试过的东西的思考。当然,有时候我在点击提交按钮后立刻意识到问题是是什么。无论如何,当你在写下所有东西仍一无所获,那就试着向他人发邮件。首先是你的同事或者其他参与你的项目的人,然后是项目的邮件列表。不要害怕向人求助。大多数人都是友善和乐于助人的,我发现在 Python 社区里尤其如此。 +我经常发现写下所有信息能够启迪我想到还没尝试过的东西。当然,有时候我在点击提交按钮后立刻意识到问题是是什么。无论如何,当你在写下所有东西仍一无所获,那就试试向他人发邮件求助。首先是你的同事或者其他参与你的项目的人,然后是项目的邮件列表。不要害怕向人求助。大多数人都是友善和乐于助人的,我发现在 Python 社区里尤其如此。 Maria McKinley 将在 [PyCascades 2019][4] 发表[代码查错][3],二月 23-24,于西雅图。 From c74d1e7e58e82cd542435a5878488f79044d8474 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Mar 2019 21:42:22 +0800 Subject: [PATCH 505/813] PRF:20190219 Logical - in Bash.md @zero-MK --- translated/tech/20190219 Logical - in Bash.md | 129 +++++++----------- 1 file changed, 47 insertions(+), 82 deletions(-) diff --git a/translated/tech/20190219 Logical - in Bash.md b/translated/tech/20190219 Logical - in Bash.md index 1b69e80e00..a01924d19b 100644 --- a/translated/tech/20190219 Logical - in Bash.md +++ b/translated/tech/20190219 Logical - in Bash.md @@ -1,60 +1,50 @@ [#]: collector: "lujun9972" [#]: translator: "zero-mk" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Logical & in Bash" [#]: via: "https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash" [#]: author: "Paul Brown https://www.linux.com/users/bro66" -Bash中的逻辑和(`&`) +Bash 中的逻辑和(&) ====== +> 在 Bash 中,你可以使用 & 作为 AND(逻辑和)操作符。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ampersand-brian-taylor-unsplash.jpg?itok=Iq6vxSNK) -有人可能会认为两篇文章中的`&`意思差不多,但实际上并不是。虽然 [第一篇文章讨论了如何在命令末尾使用`&`来将命令转到后台运行][1] 之后分解为解释流程管理, 第二篇文章将 [`&` 看作引用文件描述符的方法][2], 这些文章让我们知道了,与 `<` 和 `>` 结合使用后,你可以将输入或输出引导到别的地方。 +有人可能会认为两篇文章中的 `&` 意思差不多,但实际上并不是。虽然 [第一篇文章讨论了如何在命令末尾使用 & 来将命令转到后台运行][1],在之后剖析了流程管理,第二篇文章将 [ & 看作引用文件描述符的方法][2],这些文章让我们知道了,与 `<` 和 `>` 结合使用后,你可以将输入或输出引导到别的地方。 -但我们还没接触过作为 AND 操作符使用的`&`。所以,让我们来看看。 +但我们还没接触过作为 AND 操作符使用的 `&`。所以,让我们来看看。 ### & 是一个按位运算符 -如果您完全熟悉二进制数操作,您肯定听说过 AND 和 OR 。这些是按位操作,对二进制数的各个位进行操作。在 Bash 中,使用`&`作为AND运算符,使用`|`作为 OR 运算符: +如果你十分熟悉二进制数操作,你肯定听说过 AND 和 OR 。这些是按位操作,对二进制数的各个位进行操作。在 Bash 中,使用 `&` 作为 AND 运算符,使用 `|` 作为 OR 运算符: -**AND** +**AND**: ``` 0 & 0 = 0 - 0 & 1 = 0 - 1 & 0 = 0 - 1 & 1 = 1 ``` -**OR** +**OR**: ``` 0 | 0 = 0 - 0 | 1 = 1 - 1 | 0 = 1 - 1 | 1 = 1 - ``` - -您可以通过对任何两个数字进行 AND 运算并使用`echo`输出结果: +你可以通过对任何两个数字进行 AND 运算并使用 `echo` 输出结果: ``` $ echo $(( 2 & 3 )) # 00000010 AND 00000011 = 00000010 - 2 - $ echo $(( 120 & 97 )) # 01111000 AND 01100001 = 01100000 - 96 ``` @@ -62,132 +52,107 @@ OR(`|`)也是如此: ``` $ echo $(( 2 | 3 )) # 00000010 OR 00000011 = 00000011 - 3 - $ echo $(( 120 | 97 )) # 01111000 OR 01100001 = 01111001 - 121 ``` +说明: -关于这个不得不说的三件事: +1. 使用 `(( ... ))` 告诉 Bash 双括号之间的内容是某种算术或逻辑运算。`(( 2 + 2 ))`、 `(( 5 % 2 ))` (`%` 是[求模][3]运算符)和 `((( 5 % 2 ) + 1))`(等于 3)都可以工作。 +2. [像变量一样][4],使用 `$` 提取值,以便你可以使用它。 +3. 空格并没有影响:`((2+3))` 等价于 `(( 2+3 ))` 和 `(( 2 + 3 ))`。 +4. Bash 只能对整数进行操作。试试这样做: `(( 5 / 2 ))` ,你会得到 `2`;或者这样 `(( 2.5 & 7 ))` ,但会得到一个错误。然后,在按位操作中使用除了整数之外的任何东西(这就是我们现在所讨论的)通常是你不应该做的事情。 -1. 使用`(( ... ))`告诉 Bash 双括号之间的内容是某种算术或逻辑运算。`(( 2 + 2 ))`, `(( 5 % 2 ))` (`%`是[求模][3]运算符)和`((( 5 % 2 ) + 1))`(等于3)一切都会奏效。 - - 2. [像变量一样][4], 使用`$`提取值,以便你可以使用它。 - 3. 空格并没有影响: `((2+3))` 将等价于 `(( 2+3 ))` 和 `(( 2 + 3 ))`。 - 4. Bash只能对整数进行操作. 试试这样做: `(( 5 / 2 ))` ,你会得到"2";或者这样 `(( 2.5 & 7 ))` ,但会得到一个错误。然后,在按位操作中使用除整数之外的任何东西(这就是我们现在所讨论的)通常是你不应该做的事情。 - - - -**提示:** 如果您想看看十进制数字在二进制下会是什么样子,你可以使用 _bc_ ,这是一个大多数 Linux 发行版都预装了的命令行计算器。比如: +**提示:** 如果你想看看十进制数字在二进制下会是什么样子,你可以使用 `bc` ,这是一个大多数 Linux 发行版都预装了的命令行计算器。比如: ``` bc <<< "obase=2; 97" ``` -这个操作将会把 `97`转换成十二进制(`obase` 中的 _o_ 代表 _output_ ,也即,_输出_)。 +这个操作将会把 `97` 转换成十二进制(`obase` 中的 `o` 代表 “output” ,也即,“输出”)。 ``` bc <<< "ibase=2; 11001011" ``` -这个操作将会把 `11001011`转换成十进制(`ibase` 中的 _i_ 代表 _input_ ,也即,_输入_)。 -### &&是一个逻辑运算符 +这个操作将会把 `11001011` 转换成十进制(`ibase` 中的 `i` 代表 “input”,也即,“输入”)。 -虽然它使用与其按位表达相同的逻辑原理,但Bash的`&&`运算符只能呈现两个结果:1(“true”)和0(“false”)。对于Bash来说,任何不是0的数字都是“true”,任何等于0的数字都是“false”。什么也是false也不是数字: +### && 是一个逻辑运算符 + +虽然它使用与其按位表达相同的逻辑原理,但 Bash 的 `&&` 运算符只能呈现两个结果:`1`(“真值”)和`0`(“假值”)。对于 Bash 来说,任何不是 `0` 的数字都是 “真值”,任何等于 `0` 的数字都是 “假值”。什么也是 “假值”同时也不是数字呢: ``` -$ echo $(( 4 && 5 )) # 两个非零数字, 两个为true = true - +$ echo $(( 4 && 5 )) # 两个非零数字,两个为 true = true 1 - -$ echo $(( 0 && 5 )) # 有一个为零, 一个为false = false - +$ echo $(( 0 && 5 )) # 有一个为零,一个为 false = false 0 - -$ echo $(( b && 5 )) # 其中一个不是数字, 一个为false = false - +$ echo $(( b && 5 )) # 其中一个不是数字,一个为 false = false 0 ``` 与 `&&` 类似, OR 对应着 `||` ,用法正如你想的那样。 -以上这些都很简单... 直到进入命令的退出状态。 +以上这些都很简单……直到它用在命令的退出状态时。 -### &&是命令退出状态的逻辑运算符 +### && 是命令退出状态的逻辑运算符 -[正如我们在之前的文章中看到的][2],当命令运行时,它会输出错误消息。更重要的是,对于今天的讨论,它在结束时也会输出一个数字。此数字称为_exit code_(即_返回码_),如果为0,则表示该命令在执行期间未遇到任何问题。如果是任何其他数字,即使命令完成,也意味着某些地方出错了。 -所以 0 意味着非常棒,任何其他数字都说明有问题发生,并且,在返回码的上下文中,0 意味着“真”,其他任何数字都意味着“假”。对!这 **与您所熟知的逻辑操作完全相反** ,但是你能用这个做什么? 不同的背景,不同的规则。这种用处很快就会显现出来。 +[正如我们在之前的文章中看到的][2],当命令运行时,它会输出错误消息。更重要的是,对于今天的讨论,它在结束时也会输出一个数字。此数字称为“返回码”,如果为 0,则表示该命令在执行期间未遇到任何问题。如果是任何其他数字,即使命令完成,也意味着某些地方出错了。 + +所以 0 意味着是好的,任何其他数字都说明有问题发生,并且,在返回码的上下文中,0 意味着“真”,其他任何数字都意味着“假”。对!这 **与你所熟知的逻辑操作完全相反** ,但是你能用这个做什么? 不同的背景,不同的规则。这种用处很快就会显现出来。 让我们继续! -返回码 _临时_ 储存在 [特殊变量][5] `?` 中— 是的,我知道:这又是一个令人迷惑的选择。但不管怎样, [别忘了我们在讨论变量的文章中说过][4], 那时我们说你要用 `$` 符号来读取变量中的值,在这里也一样。所以,如果你想知道一个命令是否顺利运行,你需要在命令结束后,在运行别的命令之前马上用 `$?` 来读取 `?` 的值。 +返回码 *临时* 储存在 [特殊变量][5] `?` 中 —— 是的,我知道:这又是一个令人迷惑的选择。但不管怎样,[别忘了我们在讨论变量的文章中说过][4],那时我们说你要用 `$` 符号来读取变量中的值,在这里也一样。所以,如果你想知道一个命令是否顺利运行,你需要在命令结束后,在运行别的命令之前马上用 `$?` 来读取 `?` 变量的值。 试试下面的命令: ``` $ find /etc -iname "*.service" - find: '/etc/audisp/plugins.d': Permission denied - /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service - /etc/systemd/system/dbus-org.freedesktop.ModemManager1.service - -[等等内容] +[......] ``` -[正如你在上一篇文章中看到的一样][2],普通用户权限在 _/etc_ 下运行 `find` 通常将抛出错误,因为它试图读取你没有权限访问的子目录。 +[正如你在上一篇文章中看到的一样][2],普通用户权限在 `/etc` 下运行 `find` 通常将抛出错误,因为它试图读取你没有权限访问的子目录。 -所以,如果你在执行 `find` 后立马执行... +所以,如果你在执行 `find` 后立马执行…… ``` echo $? ``` -...,,它将打印 `1`,表明存在错误。 +……,它将打印 `1`,表明存在错误。 -注意:当你在一行中运行两遍 `echo $?` ,你将得到一个 `0` 。这是因为 `$?` 将包含 `echo $?` 的返回码,而这条命令按理说一定会执行成功。所以学习如何使用 `$?` 的第一课就是: **单独执行 `$?`** 或者将它保存在别的安全的地方 —— 比如保存在一个变量里,不然你会很快丢失它。) +(注意:当你在一行中运行两遍 `echo $?` ,你将得到一个 `0` 。这是因为 `$?` 将包含第一个 `echo $?` 的返回码,而这条命令按理说一定会执行成功。所以学习如何使用 `$?` 的第一课就是: **单独执行 `$?`** 或者将它保存在别的安全的地方 —— 比如保存在一个变量里,不然你会很快丢失它。) -一个直接使用 `?` 的用法是将它并入一串链式命令列表,这样 Bash 运行这串命令时若有任何操作失败,后面命令将终止。例如,您可能熟悉构建和编译应用程序源代码的过程。你可以像这样手动一个接一个地运行它们: +一个直接使用 `?` 变量的用法是将它并入一串链式命令列表,这样 Bash 运行这串命令时若有任何操作失败,后面命令将终止。例如,你可能熟悉构建和编译应用程序源代码的过程。你可以像这样手动一个接一个地运行它们: ``` $ configure - . - . - . - $ make - . - . - . - $ make install - . - . - . ``` -你也可以把这三行合并成一行... +你也可以把这三行合并成一行…… ``` $ configure; make; make install ``` -... 但你要希望上天保佑。 +…… 但你要希望上天保佑。 -为什么这样说呢?因为你这样做是有缺点的,比方说 `configure` 执行失败了, Bash 将仍会尝试执行 `make` 和 `sudo make install`——就算没东西可 make ,实际上,是没东西会安装。 +为什么这样说呢?因为你这样做是有缺点的,比方说 `configure` 执行失败了, Bash 将仍会尝试执行 `make` 和 `sudo make install`——就算没东西可 `make` ,实际上,是没东西会安装。 聪明一点的做法是: @@ -195,19 +160,19 @@ $ configure; make; make install $ configure && make && make install ``` -这将从每个命令中获取退出代码,并将其用作链式 `&&` 操作的操作数。 -但是,没什么好抱怨的,Bash 知道如果 `configure` 返回非零结果,整个过程都会失败。如果发生这种情况,不必运行 `make` 来检查它的退出代码,因为无论如何都会失败的。因此,它放弃运行 `make` ,只是将非零结果传递给下一步操作。并且,由于 `configure && make` 传递了错误,Bash 也不必运行`make install`。这意味着,在一长串命令中,您可以使用 `&&` 连接它们,并且一旦失败,您可以节省时间,因为其他命令会立即被取消运行。 +这将从每个命令中获取退出码,并将其用作链式 `&&` 操作的操作数。 + +但是,没什么好抱怨的,Bash 知道如果 `configure` 返回非零结果,整个过程都会失败。如果发生这种情况,不必运行 `make` 来检查它的退出代码,因为无论如何都会失败的。因此,它放弃运行 `make`,只是将非零结果传递给下一步操作。并且,由于 `configure && make` 传递了错误,Bash 也不必运行`make install`。这意味着,在一长串命令中,你可以使用 `&&` 连接它们,并且一旦失败,你可以节省时间,因为其他命令会立即被取消运行。 你可以类似地使用 `||`,OR 逻辑操作符,这样就算只有一部分命令成功执行,Bash 也能运行接下来链接在一起的命令。 -鉴于所有这些(以及我们之前介绍过的内容),您现在应该更清楚地了解我们在 [本文开头][1] 开头设置的命令行: + +鉴于所有这些(以及我们之前介绍过的内容),你现在应该更清楚地了解我们在 [这篇文章开头][1] 出现的命令行: ``` mkdir test_dir 2>/dev/null || touch backup/dir/images.txt && find . -iname "*jpg" > backup/dir/images.txt & ``` -因此,假设您从具有读写权限的目录运行上述内容,它做了什么以及如何做到这一点?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你这些答案的结果,我们将讨论 brackets: curly, curvy and straight. 不要错过了哟! - -因此,假设您在具有读写权限的目录运行上述内容,它会执行的操作以及如何执行此操作?它如何避免不合时宜且可能导致执行错误的错误?下周,除了给你解决方案,我们将处理包括:卷曲,曲线和直线。不要错过! +因此,假设你从具有读写权限的目录运行上述内容,它做了什么以及如何做到这一点?它如何避免不合时宜且可能导致执行中断的错误?下周,除了给你这些答案的结果,我们将讨论圆括号,不要错过了哟! -------------------------------------------------------------------------------- @@ -216,14 +181,14 @@ via: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[zero-MK](https://github.com/zero-mk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.linux.com/users/bro66 [b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[2]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash +[1]: https://linux.cn/article-10587-1.html +[2]: https://linux.cn/article-10591-1.html [3]: https://en.wikipedia.org/wiki/Modulo_operation [4]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise [5]: https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html From 13795f2db66ed59d92cc12b4c0e4b9935d698686 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Mar 2019 21:42:54 +0800 Subject: [PATCH 506/813] PUB:20190219 Logical - in Bash.md @zero-MK https://linux.cn/article-10596-1.html --- {translated/tech => published}/20190219 Logical - in Bash.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190219 Logical - in Bash.md (99%) diff --git a/translated/tech/20190219 Logical - in Bash.md b/published/20190219 Logical - in Bash.md similarity index 99% rename from translated/tech/20190219 Logical - in Bash.md rename to published/20190219 Logical - in Bash.md index a01924d19b..990b73311e 100644 --- a/translated/tech/20190219 Logical - in Bash.md +++ b/published/20190219 Logical - in Bash.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "zero-mk" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10596-1.html" [#]: subject: "Logical & in Bash" [#]: via: "https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash" [#]: author: "Paul Brown https://www.linux.com/users/bro66" From 93c8cad8620cdf681de3ea22450b4b1ff3c2579a Mon Sep 17 00:00:00 2001 From: oska874 Date: Thu, 7 Mar 2019 23:47:26 +0800 Subject: [PATCH 507/813] =?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 --- ...atory - Raspberry Pi- Lesson 10 Input01.md | 270 +++++++++--------- 1 file changed, 138 insertions(+), 132 deletions(-) rename {sources => translated}/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md (53%) diff --git a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md similarity index 53% rename from sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md rename to translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md index e81d460001..ca6d421a15 100644 --- a/sources/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 10 Input01.md @@ -7,7 +7,6 @@ [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) -ezio is translating 计算机实验课 – 树莓派: 课程 10 输入01 ====== @@ -58,7 +57,7 @@ USB 标准的设计目的是通过复杂的硬件来简化硬件。 Table 4.1 USB 键盘值 | 序号 | 描述 | 序号 | 描述 | 序号 | 描述 | 序号 | 描述 | | -| ------ | ---------------- | ------- | ---------------------- | -------- | -------------- | --------------- | -------------------- | | +| ------ | ---------------- | ------- | ---------------------- | -------- | -------------- | --------------- | -------------------- |----| | 4 | a and A | 5 | b and B | 6 | c and C | 7 | d and D | | | 8 | e and E | 9 | f and F | 10 | g and G | 11 | h and H | | | 12 | i and I | 13 | j and J | 14 | k and K | 15 | l and L | | @@ -70,7 +69,7 @@ Table 4.1 USB 键盘值 | 36 | 7 and & | 37 | 8 and * | 38 | 9 and ( | 39 | 0 and ) | | | 40 | Return (Enter) | 41 | Escape | 42 | Delete (Backspace) | 43 | Tab | | | 44 | Spacebar | 45 | - and _ | 46 | = and + | 47 | [ and { | | -| 48 | ] and } | 49 | \ and | | 50 | # and ~ | 51 | ; and : | +| 48 | ] and } | 49 | \ and | 50 | # and ~ | 51 | ; and : | | 52 | ' and " | 53 | ` and ~ | 54 | , and < | 55 | . and > | | | 56 | / and ? | 57 | Caps Lock | 58 | F1 | 59 | F2 | | | 60 | F3 | 61 | F4 | 62 | F5 | 63 | F6 | | @@ -83,7 +82,7 @@ Table 4.1 USB 键盘值 | 88 | Keypad Enter | 89 | Keypad 1 and End | 90 | Keypad 2 and Down Arrow | 91 | Keypad 3 and Page Down | | | 92 | Keypad 4 and Left Arrow | 93 | Keypad 5 | 94 | Keypad 6 and Right Arrow | 95 | Keypad 7 and Home | | | 96 | Keypad 8 and Up Arrow | 97 | Keypad 9 and Page Up | 98 | Keypad 0 and Insert | 99 | Keypad . and Delete | | -| 100 | \ and | | 101 | Application | 102 | Power | 103 | Keypad = | +| 100 | \ and | 101 | Application | 102 | Power | 103 | Keypad = | | 104 | F13 | 105 | F14 | 106 | F15 | 107 | F16 | | | 108 | F17 | 109 | F18 | 110 | F19 | 111 | F20 | | | 112 | F21 | 113 | F22 | 114 | F23 | 115 | F24 | | @@ -92,7 +91,6 @@ Table 4.1 USB 键盘值 | 124 | Copy | 125 | Paste | 126 | Find | 127 | Mute | | | 128 | Volume Up | 129 | Volume Down | | | | | | -The full list can be found in section 10, page 53 of [HID Usage Tables 1.12][2]. 完全列表可以在[HID 页表 1.12][2]的 53 页,第 10 节找到 ### 5 车轮后的螺母 @@ -104,82 +102,84 @@ The full list can be found in section 10, page 53 of [HID Usage Tables 1.12][2]. 通常,当你使用其他人的代码,他们会提供一份自己代码的总结,描述代码都做了什么,粗略介绍了是如何工作的,以及什么情况下会出错。下面是一个使用我的 USB 驱动的相关步骤要求。 -Table 5.1 Keyboard related functions in CSUD -| Function | Arguments | Returns | Description | +Table 5.1 CSUD 中和键盘相关的函数 +| 函数 | 参数 | 返回值 | 描述 | | ----------------------- | ----------------------- | ----------------------- | -----------------------| -| UsbInitialise | None | r0 is result code | This method is the all-in-one method that loads the USB driver, enumerates all devices and attempts to communicate with them. This method generally takes about a second to execute, though with a few USB hubs plugged in this can be significantly longer. After this method is completed methods in the keyboard driver become available, regardless of whether or not a keyboard is indeed inserted. Result code explained below. | -| UsbCheckForChange | None | None | Essentially provides the same effect as UsbInitialise, but does not provide the same one time initialisation. This method checks every port on every connected hub recursively, and adds new devices if they have been added. This should be very quick if there are no changes, but can take up to a few seconds if a hub with many devices is attached.| -| KeyboardCount | None | r0 is count | Returns the number of keyboards currently connected and detected. UsbCheckForChange may update this. Up to 4 keyboards are supported by default. Up to this many keyboards may be accessed through this driver.| -| KeyboardGetAddress | r0 is index | r0 is address | Retrieves the address of a given keyboard. All other functions take a keyboard address in order to know which keyboard to access. Thus, to communicate with a keyboard, first check the count, then retrieve the address, then use other methods. Note, the order of keyboards that this method returns may change after calls to UsbCheckForChange.| -| KeyboardPoll | r0 is address | r0 is result code | Reads in the current key state from the keyboard. This operates via polling the device directly, contrary to the best practice. This means that if this method is not called frequently enough, a key press could be missed. All reading methods simply return the value as of the last poll.| -| KeyboardGetModifiers | r0 is address | r0 is modifier state | Retrieves the status of the modifier keys as of the last poll. These are the shift, alt control and GUI keys on both sides. This is returned as a bit field, such that a 1 in the bit 0 means left control is held, bit 1 means left shift, bit 2 means left alt, bit 3 means left GUI and bits 4 to 7 mean the right versions of those previous. If there is a problem r0 contains 0.| -| KeyboardGetKeyDownCount | r0 is address | r0 is count | Retrieves the number of keys currently held down on the keyboard. This excludes modifier keys. Normally, this cannot go above 6. If there is an error this method returns 0.| -| KeyboardGetKeyDown | r0 is address, r1 is key number | r0 is scan code | Retrieves the scan code (see Table 4.1) of a particular held down key. Normally, to work out which keys are down, call KeyboardGetKeyDownCount and then call KeyboardGetKeyDown up to that many times with increasing values of r1 to determine which keys are down. Returns 0 if there is a problem. It is safe (but not recommended) to call this method without calling KeyboardGetKeyDownCount and interpret 0s as keys not held. Note, the order or scan codes can change randomly (some keyboards sort numerically, some sort temporally, no guarantees are made). | -| KeyboardGetKeyIsDown | r0 is address, r1 is scan code | r0 is status | Alternative to KeyboardGetKeyDown, checks if a particular scan code is among the held down keys. Returns 0 if not, or a non-zero value if so. Faster when detecting particular scan codes (e.g. looking for ctrl+c). On error, returns 0.| -| KeyboardGetLedSupport | r0 is address | r0 is LEDs | Checks which LEDs a particular keyboard supports. Bit 0 being 1 represents Number Lock, bit 1 represents Caps Lock, bit 2 represents Scroll Lock, bit 3 represents Compose, bit 4 represents Kana, bit 5 represents Power, bit 6 represents Mute and bit 7 represents Compose. As per the USB standard, none of these LEDs update automatically (e.g. Caps Lock must be set manually when the Caps Lock scan code is detected).| -| KeyboardSetLeds | r0 is address, r1 is LEDs | r0 is result code | Attempts to turn on/off the specified LEDs on the keyboard. See below for result code values. See KeyboardGetLedSupport for LEDs' values.| +| UsbInitialise | None | r0 is result code | 这个方法是一个集多种功能于一身的方法,它加载USB驱动程序,枚举所有设备并尝试与它们通信。这种方法通常需要大约一秒钟的时间来执行,但是如果插入几个USB集线器,执行时间会明显更长。在此方法完成之后,键盘驱动程序中的方法就可用了,不管是否确实插入了键盘。返回代码如下解释。| +| UsbCheckForChange | None | None | 本质上提供与 `usbinitialization` 相同的效果,但不提供相同的一次初始化。该方法递归地检查每个连接的集线器上的每个端口,如果已经添加了新设备,则添加它们。如果没有更改,这应该是非常快的,但是如果连接了多个设备的集线器,则可能需要几秒钟的时间。| +| KeyboardCount | None | r0 is count | 返回当前连接并检测到的键盘数量。`UsbCheckForChange` 可能会对此进行更新。默认情况下最多支持4个键盘。多达这么多的键盘可以通过这个驱动程序访问。| +| KeyboardGetAddress | r0 is index | r0 is address | 检索给定键盘的地址。所有其他函数都需要一个键盘地址,以便知道要访问哪个键盘。因此,要与键盘通信,首先要检查计数,然后检索地址,然后使用其他方法。注意,在调用 `UsbCheckForChange` 之后,此方法返回的键盘顺序可能会改变。 +| +| KeyboardPoll | r0 is address | r0 is result code | 从键盘读取当前键状态。这是通过直接轮询设备来操作的,与最佳实践相反。这意味着,如果没有频繁地调用此方法,可能会错过一个按键。所有读取方法只返回上次轮询时的值。 +| +| KeyboardGetModifiers | r0 is address | r0 is modifier state | 检索上次轮询时修饰符键的状态。这是两边的 `shift` 键、`alt` 键和 `GUI` 键。这回作为一个位字段返回,这样,位0中的1表示左控件被保留,位1表示左 `shift`,位2表示左 `alt` ,位3表示左 `GUI`,位4到7表示前几位的右版本。如果有问题,`r0` 包含0。| +| KeyboardGetKeyDownCount | r0 is address | r0 is count | 检索当前按下键盘的键数。这排除了修饰键。这通常不能超过6次。如果有错误,这个方法返回0。| +| KeyboardGetKeyDown | r0 is address, r1 is key number | r0 is scan code | 检索特定下拉键的扫描代码(见表4.1)。通常,要计算出哪些键是关闭的,可以调用 `KeyboardGetKeyDownCount`,然后多次调用 `KeyboardGetKeyDown` ,将 `r1` 的值递增,以确定哪些键是关闭的。如果有问题,返回0。在不调用 `KeyboardGetKeyDownCount` 并将0解释为未持有的键的情况下调用此方法是安全的(但不建议这样做)。注意,顺序或扫描代码可以随机更改(有些键盘按数字排序,有些键盘按时间排序,没有任何保证)。| +| KeyboardGetKeyIsDown | r0 is address, r1 is scan code | r0 is status | 除了 `KeyboardGetKeyDown` 之外,还可以检查下拉键中是否有特定的扫描代码。如果不是,返回0;如果是,返回一个非零值。当检测特定的扫描代码(例如寻找ctrl+c)更快。出错时,返回0。 +| +| KeyboardGetLedSupport | r0 is address | r0 is LEDs | 检查特定键盘支持哪些led。第0位代表数字锁定,第1位代表大写锁定,第2位代表滚动锁定,第3位代表合成,第4位代表假名,第5位代表能量,第6位代表静音,第7位代表合成。根据USB标准,这些led都不是自动更新的(例如,当检测到大写锁定扫描代码时,必须手动设置大写锁定)。| +| KeyboardSetLeds | r0 is address, r1 is LEDs | r0 is result code | 试图打开/关闭键盘上指定的 LED 灯。查看下面的结果代码值。参见 `KeyboardGetLedSupport` 获取 LED 的值。 +| ``` -Result codes are an easy way to handle errors, but often more elegant solutions exist in higher level code. +返回值是一种处理错误的简单方法,但是通常更优雅的解决途径存在于更高层次的代码。 ``` -Several methods return 'result codes'. These are commonplace in C code, and are just numbers which represent what happened in a method call. By convention, 0 always indicates success. The following result codes are used by this driver. +有几种方法返回 ‘返回值’。这些都是 C 代码的老生常谈了,就是用数字代表函数调用发生了什么。通常情况, 0 总是代表操作成功。下面的是驱动用到的返回值。 -Table 5.2 - CSUD Result Codes -| Code | Description | +Table 5.2 - CSUD 返回值 + +| 代码 | 描述 | | ---- | ----------------------------------------------------------------------- | -| 0 | Method completed successfully. | -| -2 | Argument: A method was called with an invalid argument. | -| -4 | Device: The device did not respond correctly to the request. | -| -5 | Incompatible: The driver is not compatible with this request or device. | -| -6 | Compiler: The driver was compiled incorrectly, and is broken. | -| -7 | Memory: The driver ran out of memory. | -| -8 | Timeout: The device did not respond in the expected time. | -| -9 | Disconnect: The device requested has disconnected, and cannot be used. | +| 0 | 方法成功完成。 | +| -2 | 参数: 函数调用了无效参数。 | +| -4 | 设备: 设备没有正确响应请求。 | +| -5 | 不匹配: 驱动不适用于这个请求或者设备。 | +| -6 | 编译器: 驱动没有正确编译,或者被破坏了。 | +| -7 | 内存: 驱动用尽了内存。 | +| -8 | 超时: 设备没有在预期的时间内响应请求。 | +| -9 | 断开连接: 被请求的设备断开连接,或者不能使用。 | -The general usage of the driver is as follows: +驱动的通常用法如下: - 1. Call UsbInitialise - 2. Call UsbCheckForChange - 3. Call KeyboardCount - 4. If this is 0, go to 2. - 5. For each keyboard you support: - 1. Call KeyboardGetAddress - 2. Call KeybordGetKeyDownCount - 3. For each key down: - 1. Check whether or not it has just been pushed - 2. Store that the key is down - 4. For each key stored: - 3. Check whether or not key is released - 4. Remove key if released - 6. Perform actions based on keys pushed/released - 7. Go to 2. + 1. 调用 `UsbInitialise` + 2. 调用 `UsbCheckForChange` + 3. 调用 `KeyboardCount` + 4. 如果返回 0,重复步骤 2。 + 5. 针对你支持的每种键盘: + 1. 调用 ·KeyboardGetAddress· + 2. 调用 ·KeybordGetKeyDownCount· + 3. 针对每个按下的按键: + 1. 检查它是否已经被按下了 + 2. 保存按下的按键 + 4. 针对每个保存的按键: + 3. 检查按键是否被释放了 + 4. 如果释放了就删除 + 6. 根据按下/释放的案件执行操作 + 7. 重复步骤 2. +最后,你可能做所有你想对键盘做的事,而这些方法应该允许你访问键盘的全部功能。在接下来的两节课,我们将会着眼于完成文本终端的输入部分,类似于大部分的命令行电脑,以及命令的解释。为了做这些,我们将需要在更有用的形式下得到一个键盘输入。你可能注意到我的驱动是(故意)没有太大帮助,因为它并没有方法来判断是否一个案件刚刚按下或释放了,它只有芳芳来判断当前那个按键是按下的。这就意味着我们需要自己编写这些方法。 -Ultimately, you may do whatever you wish to with the keyboard, and these methods should allow you to access all of its functionality. Over the next 2 lessons, we shall look at completing the input side of a text terminal, similarly to most command line computers, and interpreting the commands. In order to do this, we're going to need to have keyboard inputs in a more useful form. You may notice that my driver is (deliberately) unhelpful, because it doesn't have methods to deduce whether or not a key has just been pushed down or released, it only has methods about what is currently held down. This means we'll need to write such methods ourselves. +### 6 可用更新 -### 6 Updates Available +重复检查更新被称为 ‘轮询’。这是针对驱动 IO 中断而言的,这种情况下设备在准备好后会发一个信号。 -Repeatedly checking for updates is called 'polling'. This is in contrast to interrupt driven IO, where the device sends a signal when data is ready. +首先,让我们实现一个 `KeyboardUpdate` 方法,检查第一个键盘,并使用轮询方法来获取当前的输入,以及保存最后一个输入来对比。然后我们可以使用这个数据和其它方法来将扫描码转换成按键。这个方法应该按照下面的说明准确操作: -First of all, let's implement a method KeyboardUpdate which detects the first keyboard and uses its poll method to get the current input, as well as saving the last inputs for comparison. We can then use this data with other methods to translate scan codes to keys. The method should do precisely the following: + 1. 提取一个保存好的键盘地址(初始值为 0)。 + 2. 如果不是0 ,进入步骤9. + 3. 调用 `UsbCheckForChange` 检测新键盘。 + 4. 调用 `KeyboardCount` 检测有几个键盘在线。 + 5. 如果返回0,意味着没有键盘可以让我们操作,只能退出了。 + 6. 调用 `KeyboardGetAddress` 参数是 0,获取第一个键盘的地址。 + 7. 保存这个地址。 + 8. 如果这个值是0,那么退出,这里应该有些问题。 + 9. 调用 `KeyboardGetKeyDown` 6 次,获取每次按键按下的值并保存。 + 10. 调用 `KeyboardPoll` + 11. 如果返回值非 0,进入步骤 3。这里应该有些问题(比如键盘断开连接)。 - 1. Retrieve a stored keyboard address (initially 0). - 2. If this is not 0, go to 9. - 3. Call UsbCheckForChange to detect new keyboards. - 4. Call KeyboardCount to detect how many keyboards are present. - 5. If this is 0 store the address as 0 and return; we can't do anything with no keyboard. - 6. Call KeyboardGetAddress with parameter 0 to get the first keyboard's address. - 7. Store this address. - 8. If this is 0, return; there is some problem. - 9. Call KeyboardGetKeyDown 6 times to get each key currently down and store them - 10. Call KeyboardPoll - 11. If the result is non-zero go to 3. There is some problem (such as disconnected keyboard). - - - -To store the values mentioned above, we will need the following values in the .data section. +要保存上面提到的值,我们将需要下面 `.data` 段的值。 ``` .section .data @@ -193,14 +193,14 @@ KeyboardOldDown: ``` ``` -.hword num inserts the half word constant num into the file directly. +.hword num 直接将半字的常数插入文件。 ``` ``` -.rept num [commands] .endr copies the commands commands to the output num times. +.rept num [commands] .endr 复制 `commands` 命令到输出 num 次。 ``` -Try to implement the method yourself. My implementation for this is as follows: +试着自己实现这个方法。对此,我的实现如下: 1. ``` @@ -213,24 +213,28 @@ kbd .req r4 ldr r0,=KeyboardAddress ldr kbd,[r0] ``` -We load in the keyboard address. +我们加载键盘的地址。 + 2. ``` teq kbd,#0 bne haveKeyboard$ ``` -If the address is non-zero, we have a keyboard. Calling UsbCheckForChanges is slow, and so if everything works we avoid it. +如果地址非0,就说明我们有一个键盘。调用 `UsbCheckForChanges` 慢,所以如果全部事情都起作用,我们要避免调用这个函数。 + 3. ``` getKeyboard$: bl UsbCheckForChange ``` -If we don't have a keyboard, we have to check for new devices. +如果我们一个键盘都没有,我们就必须检查新设备。 + 4. ``` bl KeyboardCount ``` -Now we see if a new keyboard has been added. +如果有心键盘添加,我们就会看到这个。 + 5. ``` teq r0,#0 @@ -238,26 +242,30 @@ ldreq r1,=KeyboardAddress streq r0,[r1] beq return$ ``` -There are no keyboards, so we have no keyboard address. +如果没有键盘,我们就没有键盘地址。 + 6. ``` mov r0,#0 bl KeyboardGetAddress ``` -Let's just get the address of the first keyboard. You may want to allow more. +让我们获取第一个键盘的地址。你可能想要更多。 + 7. ``` ldr r1,=KeyboardAddress str r0,[r1] ``` -Store the keyboard's address. +保存键盘地址。 + 8. ``` teq r0,#0 beq return$ mov kbd,r0 ``` -If we have no address, there is nothing more to do. +如果我们没有地址,这里就没有其它活要做了。 + 9. ``` saveKeys$: @@ -273,13 +281,14 @@ saveKeys$: blt saveKeys$ ``` Loop through all the keys, storing them in KeyboardOldDown. If we ask for too many, this returns 0 which is fine. +查询遍全部按键,在 `KeyboardOldDown` 保存下来。如果我们询问的太多了,返回 0 也是正确的。 10. ``` mov r0,kbd bl KeyboardPoll ``` -Now we get the new keys. +现在哦我们得到了新的按键。 11. ``` @@ -290,22 +299,21 @@ return$: pop {r4,r5,pc} .unreq kbd ``` -Finally we check if KeyboardPoll worked. If not, we probably disconnected. +最后我们要检查 `KeyboardOldDown` 是否工作了。如果没工作,那么我们可能是断开连接了。 +有了我们新的 `KeyboardUpdate` 方法,检查输入变得简单到固定周期调用这个方法,而它甚至可以检查断开连接,等等。这是一个有用的方法,因为我们实际的按键处理会根据条件不同而有所差别,所以能够用一个函数调以它的原始方式获取当前的输入是可行的。下一个方法我们理想希望的是 `KeyboardGetChar`,简单的返回下一个按下的按钮的 ASCII 字符,或者如果没有按键按下就返回 0。这可以扩展到支持将一个按键多次按下,如果它保持了一个特定时间,也支持‘锁定’键和修饰键。 -With our new KeyboardUpdate method, checking for inputs becomes as simple as calling this method at regular intervals, and it will even check for disconnections etc. This is a useful method to have, as our actual key processing may differ based on the situation, and so being able to get the current input in its raw form with one method call is generally applicable. The next method we ideally want is KeyboardGetChar, a method that simply returns the next key pressed as an ASCII character, or returns 0 if no key has just been pressed. This could be extended to support typing a key multiple times if it is held for a certain duration, and to support the 'lock' keys as well as modifiers. +要使这个方法有用,如果我们有一个 `KeyWasDown` 方法,如果给定的扫描代码不在keyboard dolddown值中,它只返回0,否则返回一个非零值。你可以自己尝试一下。与往常一样,可以在下载页面找到解决方案。 -To make this method it is useful if we have a method KeyWasDown, which simply returns 0 if a given scan code is not in the KeyboardOldDown values, and returns a non-zero value otherwise. Have a go at implementing this yourself. As always, a solution can be found on the downloads page. - -### 7 Look Up Tables +### 7 查找表 ``` -In many areas of programming, the larger the program, the faster it is. Look up tables are large, but are very fast. Some problems can be solved by a mixture of look up tables and normal functions. +在编程的许多领域,程序越大,速度越快。查找表很大,但是速度很快。有些问题可以通过查找表和普通函数的组合来解决。 ``` -The KeyboardGetChar method could be quite complex if we write it poorly. There are 100s of scan codes, each with different effects depending on the presence or absence of the shift key or other modifiers. Not all of the keys can be translated to a character. For some characters, multiple keys can produce the same character. A useful trick in situations with such vast arrays of possibilities is look up tables. A look up table, much like in the physical sense, is a table of values and their results. For some limited functions, the simplest way to deduce the answer is just to precompute every answer, and just return the correct one by retrieving it. In this case, we could build up a sequence of values in memory such that the nth value into the sequence is the ASCII character code for the scan code n. This means our method would simply have to detect if a key was pressed, and then retrieve its value from the table. Further, we could have a separate table for the values when shift is held, so that the shift key simply changes which table we're working with. +`KeyboardGetChar`方法如果写得不好,可能会非常复杂。有 100 多种扫描代码,每种代码都有不同的效果,这取决于 shift 键或其他修饰符的存在与否。并不是所有的键都可以转换成一个字符。对于一些字符,多个键可以生成相同的字符。在有如此多可能性的情况下,一个有用的技巧是查找表。查找表与物理意义上的查找表非常相似,它是一个值及其结果的表。对于一些有限的函数,推导出答案的最简单方法就是预先计算每个答案,然后通过检索返回正确的答案。在这种情况下,我们可以建立一个序列的值在内存中,n值序列的ASCII字符代码扫描代码n。这意味着我们的方法只会发现如果一个键被按下,然后从表中检索它的值。此外,当按住shift键时,我们可以为值创建一个单独的表,这样shift键就可以简单地更改正在处理的表。 -After the .section .data command, copy the following tables: +在 `.section` `.data` 命令之后,复制下面的表: ``` .align 3 @@ -342,31 +350,30 @@ KeysShift: ``` ``` -.byte num inserts the byte constant num into the file directly. +.byte num 直接插入字节常量 num 到文件。 ``` ``` -Most assemblers and compilers recognise escape sequences; character sequences such as \t which insert special characters instead. +大部分的汇编器和编译器识别转义序列;插入特殊字符的字符序列,如\t。 ``` -These tables map directly the first 104 scan codes onto the ASCII characters as a table of bytes. We also have a separate table describing the effects of the shift key on those scan codes. I've used the ASCII null character (0) for all keys without direct mappings in ASCII (such as the function keys). Backspace is mapped to the ASCII backspace character (8 denoted \b), enter is mapped to the ASCII new line character (10 denoted \n) and tab is mapped to the ASCII horizontal tab character (9 denoted \t). - -The KeyboardGetChar method will need to do the following: - - 1. Check if KeyboardAddress is 0. If so, return 0. - 2. Call KeyboardGetKeyDown up to 6 times. Each time: - 1. If key is 0, exit loop. - 2. Call KeyWasDown. If it was, go to the next key. - 3. If the scan code is more than 103, go to the next key. - 4. Call KeyboardGetModifiers - 5. If shift is held, load the address of KeysShift. Otherwise load KeysNormal. - 6. Read the ASCII value from the table. - 7. If it is 0, go to the next key otherwise return this ASCII code and exit. - 3. Return 0. +这些表直接将前 104 个扫描代码映射到 ASCII 字符,作为一个字节表。我们还有一个单独的表来描述 `shift` 键对这些扫描代码的影响。我使用 ASCII `null`字符(0)表示所有没有直接映射的 ASCII 键(例如函数键)。退格映射到ASCII退格字符(8表示 `\b` ), `enter` 映射到ASCII新行字符(10表示 `\n`), `tab` 映射到ASCII水平制表符(9表示 `\t` )。 +`KeyboardGetChar` 方法需要做以下工作: + 1. 检查 `KeyboardAddress` 是否返回 0。如果是,则返回0。 + 2. 调用 `KeyboardGetKeyDown` 最多 6 次。每次: + 1. 如果按键时0,跳出循环。 + 2. 调用 `KeyWasDown`。 如果返回是,处理下一个按键。 + 3. 如果扫描码超过 103,进入下一个按键。 + 4. 调用 `KeyboardGetModifiers` + 5. 如果 `shift` 是被按着的,就加载 `KeysShift` 的地址。否则加载 `KeysNormal` 的地址。 + 6. 从表中读出 ASCII 码值。 + 7. 如果是 0,进行下一个按键,否则返回 ASCII 码值并退出。 + 3. 返回0。 -Try to implement this yourself. My implementation is presented below: + +试着自己实现。我的实现展示在下面: 1. ``` @@ -378,7 +385,7 @@ teq r1,#0 moveq r0,#0 moveq pc,lr ``` -Simple check to see if we have a keyboard. +简单的检查我们是否有键盘。 2. ``` @@ -393,13 +400,14 @@ keyLoop$: bl KeyboardGetKeyDown ``` r5 will hold the index of the key, r4 holds the keyboard address. +`r5` 将会保存按键的索引, `r4` 保存键盘的地址。 1. ``` teq r0,#0 beq keyLoopBreak$ ``` - If a scan code is 0, it either means there is an error, or there are no more keys. + 如果扫描码是0,它要么意味着有错,要么说明没有更多按键了。 2. ``` @@ -408,21 +416,21 @@ r5 will hold the index of the key, r4 holds the keyboard address. teq r0,#0 bne keyLoopContinue$ ``` - If a key was already down it is uninteresting, we only want ot know about key presses. + 如果按键已经按下了,那么他就没意思了,我们只想知道按下的按键。 3. ``` cmp key,#104 bge keyLoopContinue$ ``` - If a key has a scan code higher than 104, it will be outside our table, and so is not relevant. + 如果一个按键有个超过 104 的扫描码,他将会超出我们的表,所以它是无关的按键。 4. ``` mov r0,kbd bl KeyboardGetModifiers ``` - We need to know about the modifier keys in order to deduce the character. + 我们需要知道修饰键来推断字符。 5. ``` @@ -430,15 +438,16 @@ r5 will hold the index of the key, r4 holds the keyboard address. ldreq r0,=KeysNormal ldrne r0,=KeysShift ``` - We detect both a left and right shift key as changing the characters to their shift variants. Remember, a tst instruction computes the logical AND and then compares it to zero, so it will be equal to 0 if and only if both of the shift bits are zero. + 当将字符更改为其移位变体时,我们要同时检测左 `shift` 键和右 `shift` 键。记住,`tst` 指令计算的是逻辑和,然后将其与 0 进行比较,所以当且仅当移位位都为 0 时,它才等于0。 - 6. + + 1. ``` ldrb r0,[r0,key] ``` - Now we can load in the key from the look up table. + 现在我们可以从查找表加载按键了。 - 7. + 1. ``` teq r0,#0 bne keyboardGetCharReturn$ @@ -447,9 +456,9 @@ r5 will hold the index of the key, r4 holds the keyboard address. cmp r5,#6 blt keyLoop$ ``` - If the look up code contains a zero, we must continue. To continue, we increment the index, and check if we've reached 6. + 如果查找码包含一个 0,我们必须继续。为了继续,我们要增加索引,并检查是否到 6 次了。 -3. +1. ``` keyLoopBreak$: mov r0,#0 @@ -458,29 +467,26 @@ pop {r4,r5,r6,pc} .unreq kbd .unreq key ``` -We return our key here, if we reach keyLoopBreak$, then we know there is no key held, so return 0. +在这里我们返回我们的按键,如果我们到达 `keyLoopBreak$` ,然后我们就知道这里没有按键被握住,所以返回0。 + +### 8 记事本操作系统 + +现在我们有了 `KeyboardGetChar` 方法,可以创建一个操作系统,只输入用户对着屏幕所写的内容。为了简单起见,我们将忽略所有不寻常的键。在 `main.s` ,删除`bl SetGraphicsAddress` 之后的所有代码。调用 `UsbInitialise`,将 `r4` 和 `r5` 设置为 0,然后循环执行以下命令: + + 1. 调用 `KeyboardUpdate` + 2. 调用 `KeyboardGetChar` + 3. 如果返回 0,跳转到步骤1 + 4. 复制 `r4` 和 `r5` 到 `r1` 和 `r2` ,然后调用 `DrawCharacter` + 5. 把 `r0` 加到 `r4` + 6. 如果 `r4` 是 1024,将 `r1` 加到 `r5`,然后设置 `r4` 为 0。 + 7. 如果 `r5` 是 768,设置 `r5` 为0 + 8. 跳转到步骤1 +现在编译这个,然后在 PI 上测试。您几乎可以立即开始在屏幕上输入文本。如果没有,请参阅我们的故障排除页面。 -### 8 Notepad OS - -Now we have our KeyboardGetChar method, we can make an operating system that just types what the user writes to the screen. For simplicity we'll ignore all the unusual keys. In 'main.s' delete all code after bl SetGraphicsAddress. Call UsbInitialise, set r4 and r5 to 0, then loop forever over the following commands: - - 1. Call KeyboardUpdate - 2. Call KeyboardGetChar - 3. If it is 0, got to 1 - 4. Copy r4 and r5 to r1 and r2 then call DrawCharacter - 5. Add r0 to r4 - 6. If r4 is 1024, add r1 to r5 and set r4 to 0 - 7. If r5 is 768 set r5 to 0 - 8. Go to 1 - - - -Now compile this and test it on the Pi. You should almost immediately be able to start typing text to the screen when the Pi starts. If not, please see our troubleshooting page. - -When it works, congratulations, you've achieved an interface with the computer. You should now begin to realise that you've almost got a primitive operating system together. You can now interface with the computer, issuing it commands, and receive feedback on screen. In the next tutorial, [Input02][3] we will look at producing a full text terminal, in which the user types commands, and the computer executes them. +当它工作时,祝贺您,您已经实现了与计算机的接口。现在您应该开始意识到,您几乎已经拥有了一个原始的操作系统。现在,您可以与计算机交互,发出命令,并在屏幕上接收反馈。在下一篇教程[输入02][3]中,我们将研究如何生成一个全文本终端,用户在其中输入命令,然后计算机执行这些命令。 -------------------------------------------------------------------------------- From be87625cb617de064e6db03e7d44a0cd5a71857a Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 8 Mar 2019 08:58:02 +0800 Subject: [PATCH 508/813] translated --- ...ith Proprietary Nvidia Graphics Drivers.md | 122 ------------------ ...ith Proprietary Nvidia Graphics Drivers.md | 121 +++++++++++++++++ 2 files changed, 121 insertions(+), 122 deletions(-) delete mode 100644 sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md create mode 100644 translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md diff --git a/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md b/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md deleted file mode 100644 index 31cc2f155a..0000000000 --- a/sources/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md +++ /dev/null @@ -1,122 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers) -[#]: via: (https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-built.html) -[#]: author: (Logix https://plus.google.com/118280394805678839070) - -How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers -====== -**Some applications and games built with OpenGL support and packaged as Flatpak fail to start with proprietary Nvidia drivers. This article explains how to get such Flatpak applications or games them to start, without installing the open source drivers (Nouveau).** - -Here's an example. I'm using the proprietary Nvidia drivers on my Ubuntu 18.04 desktop (`nvidia-driver-390`) and when I try to launch the latest -``` -$ /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=krita --file-forwarding org.kde.krita -Gtk-Message: Failed to load module "canberra-gtk-module" -Gtk-Message: Failed to load module "canberra-gtk-module" -libGL error: No matching fbConfigs or visuals found -libGL error: failed to load driver: swrast -Could not initialize GLX - -``` - -To fix Flatpak games and applications not starting when using OpenGL with proprietary Nvidia graphics drivers, you'll need to install a runtime for your currently installed proprietary Nvidia drivers. Here's how to do this. - -**1\. Add the FlatHub repository if you haven't already. You can find exact instructions for your Linux distribution[here][1].** - -**2. Now you'll need to figure out the exact version of the proprietary Nvidia drivers installed on your system. ** - -_This step is dependant of the Linux distribution you're using and I can't cover all cases. The instructions below are Ubuntu-oriented (and Ubuntu flavors) but hopefully you can figure out for yourself the Nvidia drivers version installed on your system._ - -To do this in Ubuntu, open `Software & Updates` , switch to the `Additional Drivers` tab and note the name of the Nvidia driver package. - -As an example, this is `nvidia-driver-390` in my case, as you can see here: - -![](https://1.bp.blogspot.com/-FAfjtGNeUJc/WzYXMYTFBcI/AAAAAAAAAx0/xUhIO83IAjMuK4Hn0jFUYKJhSKw8y559QCLcBGAs/s1600/additional-drivers-nvidia-ubuntu.png) - -That's not all. We've only found out the Nvidia drivers major version but we'll also need to know the minor version. To get the exact Nvidia driver version, which we'll need for the next step, run this command (should work in any Debian-based Linux distribution, like Ubuntu, Linux Mint and so on): -``` -apt-cache policy NVIDIA-PACKAGE-NAME - -``` - -Where NVIDIA-PACKAGE-NAME is the Nvidia drivers package name listed in `Software & Updates` . For example, to see the exact installed version of the `nvidia-driver-390` package, run this command: -``` -$ apt-cache policy nvidia-driver-390 -nvidia-driver-390: - Installed: 390.48-0ubuntu3 - Candidate: 390.48-0ubuntu3 - Version table: - * 390.48-0ubuntu3 500 - 500 http://ro.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages - 100 /var/lib/dpkg/status - -``` - -In this command's output, look for the `Installed` section and note the version numbers (excluding `-0ubuntu3` and anything similar). Now we know the exact version of the installed Nvidia drivers (`390.48` in my example). Remember this because we'll need it for the next step. - -**3\. And finally, you can install the Nvidia runtime for your installed proprietary Nvidia graphics drivers, from FlatHub** - -To list all the available Nvidia runtime packages available on FlatHub, you can use this command: -``` -flatpak remote-ls flathub | grep nvidia - -``` - -Hopefully the runtime for your installed Nvidia drivers is available on FlatHub. You can now proceed to install the runtime by using this command: - - * For 64bit systems: - - -``` -flatpak install flathub org.freedesktop.Platform.GL.nvidia-MAJORVERSION-MINORVERSION - -``` - -Replace MAJORVERSION with the Nvidia driver major version installed on your computer (390 in my example above) and -MINORVERSION with the minor version (48 in my example from step 2). - -For example, to install the runtime for Nvidia graphics driver version 390.48, you'd have to use this command: -``` -flatpak install flathub org.freedesktop.Platform.GL.nvidia-390-48 - -``` - - * For 32bit systems (or to be able to run 32bit applications or games on 64bit), install the 32bit runtime using: - - -``` -flatpak install flathub org.freedesktop.Platform.GL32.nvidia-MAJORVERSION-MINORVERSION - -``` - -Once again, replace MAJORVERSION with the Nvidia driver major version installed on your computer (390 in my example above) and MINORVERSION with the minor version (48 in my example from step 2). - -For example, to install the 32bit runtime for Nvidia graphics driver version 390.48, you'd have to use this command: -``` -flatpak install flathub org.freedesktop.Platform.GL32.nvidia-390-48 - -``` - -That is all you need to do to get applications or games packaged as Flatpak that are built with OpenGL to run. - - --------------------------------------------------------------------------------- - -via: https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-built.html - -作者:[Logix][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/118280394805678839070 -[1]:https://flatpak.org/setup/ -[2]:https://www.linuxuprising.com/2018/06/free-painting-software-krita-410.html -[3]:https://www.linuxuprising.com/2018/06/winepak-is-flatpak-repository-for.html -[4]:https://github.com/winepak/applications/issues/23 -[5]:https://github.com/flatpak/flatpak/issues/138 diff --git a/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md b/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md new file mode 100644 index 0000000000..33b8b8e530 --- /dev/null +++ b/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers) +[#]: via: (https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-built.html) +[#]: author: (Logix https://plus.google.com/118280394805678839070) + +如何使得支持 OpenGL 的 Flatpak 应用和游戏在专有 Nvidia 图形驱动下工作 +====== +**一些支持 OpenGL 并打包为 Flatpak 的应用和游戏无法使用专有 Nvidia 驱动启动。本文将介绍如何在不安装开源驱动(Nouveau)的情况下启动这些 Flatpak 应用或游戏。** + +这有个例子。我在我的 Ubuntu 18.04 桌面上使用专有的 Nvidia 驱动程序 (`nvidia-driver-390`),当我尝试启动最新版本时: +``` +$ /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=krita --file-forwarding org.kde.krita +Gtk-Message: Failed to load module "canberra-gtk-module" +Gtk-Message: Failed to load module "canberra-gtk-module" +libGL error: No matching fbConfigs or visuals found +libGL error: failed to load driver: swrast +Could not initialize GLX + +``` + +要修复使用 OpenGL 和专有 Nvidia 图形驱动时无法启动的 Flatpak 游戏和应用,你需要为已安装的专有驱动安装运行时。以下是步骤。 + +**1\. 如果尚未添加 FlatHub 仓库,请添加它。你可以在[此处][1]找到针对 Linux 发行版的说明。** + +**2. 现在,你需要确定系统上安装的专有 Nvidia 驱动的确切版本。** + +_这一步取决于你使用的 Linux 发行版,我无法涵盖所有​​情况。下面的说明是面向 Ubuntu(以及 Ubuntu 风格的版本),但希望你可以自己弄清楚系统上安装的 Nvidia 驱动版本._ + +要在 Ubuntu 中执行此操作,请打开 `Software&Updates`,切换到 `Additional Drivers` 选项卡并记下 Nvidia 驱动包的名称。 + +比如,你可以看到我的是 `nvidia-driver-390`: + +![](https://1.bp.blogspot.com/-FAfjtGNeUJc/WzYXMYTFBcI/AAAAAAAAAx0/xUhIO83IAjMuK4Hn0jFUYKJhSKw8y559QCLcBGAs/s1600/additional-drivers-nvidia-ubuntu.png) + +这里还没完成。我们只是找到了 Nvidia 驱动的主要版本,但我们还需要知道次要版本。要获得我们下一步所需的确切 Nvidia 驱动版本,请运行此命令(应该适用于任何基于 Debian 的 Linux 发行版,如 Ubuntu、Linux Mint 等): +``` +apt-cache policy NVIDIA-PACKAGE-NAME + +``` + +NVIDIA-PACKAGE-NAME 是 `Software & Updates` 中列出的 Nvidia 驱动包名称。例如,要查看 `nvidia-driver-390` 包的确切安装版本,请运行以下命令: +``` +$ apt-cache policy nvidia-driver-390 +nvidia-driver-390: + Installed: 390.48-0ubuntu3 + Candidate: 390.48-0ubuntu3 + Version table: + * 390.48-0ubuntu3 500 + 500 http://ro.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages + 100 /var/lib/dpkg/status + +``` + +在这个命令的输出中,查找 `Installed` 部分并记下版本号(不包括 `-0ubuntu3` 之类)。现在我们知道了已安装的 Nvidia 驱动的确切版本(我例子中的是 `390.48`)。记住它,因为下一步我们需要。 + +**3\. 最后,你可以从 FlatHub 为你已安装的专有 Nvidia 图形驱动安装运行时。** + +要列出 FlatHub 上所有可用的 Nvidia 运行时包,你可以使用以下命令: +``` +flatpak remote-ls flathub | grep nvidia + +``` + +幸运地是 FlatHub 上提供这个 Nvidia 驱动的运行时。你现在可以使用以下命令继续安装运行时: + + * 针对 64 位系统: + + +``` +flatpak install flathub org.freedesktop.Platform.GL.nvidia-MAJORVERSION-MINORVERSION + +``` + +将 MAJORVERSION 替换为 Nvidia 驱动的主要版本(在上面的示例中为 390),将 MINORVERSION 替换为次要版本(步骤2,我例子中的为 48)。 + +例如,要为 Nvidia 图形驱动版本 390.48 安装运行时,你必须使用以下命令: +``` +flatpak install flathub org.freedesktop.Platform.GL.nvidia-390-48 + +``` + + * 对于 32 位系统(或能够在 64 位上运行 32 位的应用或游戏),使用以下命令安装 32 位运行时: + + +``` +flatpak install flathub org.freedesktop.Platform.GL32.nvidia-MAJORVERSION-MINORVERSION + +``` + +再说一次,将 MAJORVERSION 替换为 Nvidia 驱动的主要版本(在上面的示例中为 390),将 MINORVERSION 替换为次要版本(步骤2,我例子中的为 48)。 + +比如,要为 Nvidia 图形驱动版本 390.48 安装 32 位运行时,你需要使用以下命令: +``` +flatpak install flathub org.freedesktop.Platform.GL32.nvidia-390-48 + +``` + +以上就是你要运行支持 OpenGL 的 Flatpak 的应用或游戏的方法。 + + +-------------------------------------------------------------------------------- + +via: https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-built.html + +作者:[Logix][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/118280394805678839070 +[1]:https://flatpak.org/setup/ +[2]:https://www.linuxuprising.com/2018/06/free-painting-software-krita-410.html +[3]:https://www.linuxuprising.com/2018/06/winepak-is-flatpak-repository-for.html +[4]:https://github.com/winepak/applications/issues/23 +[5]:https://github.com/flatpak/flatpak/issues/138 From 8803b436dc0683019bcd08b3d4aa9fe4e6c117d5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 8 Mar 2019 09:00:43 +0800 Subject: [PATCH 509/813] translating --- ...28 Connecting a VoIP phone directly to an Asterisk server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md index 16b9d442e2..07027a097d 100644 --- a/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md +++ b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8cff002069e4a4e5b61668358709e1029ee4cfdc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Mar 2019 09:25:52 +0800 Subject: [PATCH 510/813] PRF:20180202 Tips for success when getting started with Ansible.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jdh8383 翻译的不错,就“战术手册”我考虑之后,还是觉得采用更常见的“剧本”译法。当然,这个译名其实我并没见到官方核定的译法。 --- ...ccess when getting started with Ansible.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20180202 Tips for success when getting started with Ansible.md b/translated/tech/20180202 Tips for success when getting started with Ansible.md index 395a46a5e1..ab189fef6f 100644 --- a/translated/tech/20180202 Tips for success when getting started with Ansible.md +++ b/translated/tech/20180202 Tips for success when getting started with Ansible.md @@ -1,6 +1,8 @@ -Ansible 初学者成功指南 +Ansible 入门秘诀 ====== +> 用 Ansible 自动化你的数据中心的关键点。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-big-data.png?itok=L34b2exg) Ansible 是一个开源自动化工具,可以从中央控制节点统一配置服务器、安装软件或执行各种 IT 任务。它采用一对多、无客户端agentless的机制,从控制节点上通过 SSH 发送指令给远端的客户机来完成任务(当然除了 SSH 外也可以用别的协议)。 @@ -11,36 +13,34 @@ Ansible 的主要使用群体是系统管理员,他们经常会周期性地执 ![](https://opensource.com/sites/default/files/u128651/mapping-bash-commands-to-ansible.png) -这是个简单的例子,但应该能够证明:在 yaml 文件里写好命令然后在远程服务器上运行,是一件非常轻松的事。而且如果运行环境不同,就可以加入判断条件,指明某些命令只能在特定的服务器上运行(如:只在那些不是 Ubuntu 或 Debian 的系统上运行 `yum` 命令)。 +这是个简单的例子,但应该能够证明:在 yaml 文件里写好命令然后在远程服务器上运行,是一件非常轻松的事。而且如果运行环境不同,就可以加入判断条件,指明某些命令只能在特定的服务器上运行(如:只在那些不是 Ubuntu 或 Debian 的系统上运行 `yum` 命令)。 -Ansible 的一个重要特性是用 playbook 来描述一个计算机系统的最终状态,所以一个 playbook 可以在服务器上反复执行而不影响其最终状态(译者注:即是幂等的)。如果某个任务已经被实施过了(如,“用户 `sysman` 已经存在”),那么 Ansible 就会忽略它继续执行后续的任务。 +Ansible 的一个重要特性是用剧本playbook来描述一个计算机系统的最终状态,所以一个剧本可以在服务器上反复执行而不影响其最终状态(LCTT 译注:即是幂等的)。如果某个任务已经被实施过了(如,“用户 `sysman` 已经存在”),那么 Ansible 就会忽略它继续执行后续的任务。 ### 定义 - * **任务Tasks:** task 是工作的最小单位,它可以是个动作,比如“安装一个数据库服务”、“安装一个 web 服务器”、“创建一条防火墙规则”或者“把这个配置文件拷贝到那个服务器上去”。 - * **战术动作Plays:** play 由 task 组成,例如,一个 play 的内容是要:“设置一个数据库,给 web 服务用”,这就包含了如下任务:1)安装数据库包;2)设置数据库管理员密码;3)创建数据库实例;4)为该实例分配权限。 - * **战术手册Playbook:**(译者注:playbook 原指美式橄榄球队的[战术手册][5]) playbook 由 play 组成,一个 playbook 可能像这样:“设置我的网站,包含后端数据库”,其中的 play 包括:1)设置数据库服务器;2)设置 web 服务器。 - * **角色Roles:** Role 用来保存和组织 playbook,以便分享和再次使用它们。还拿上个例子来说,如果你需要一个全新的 web 服务器,就可以用别人已经写好并分享出来的 role 来设置。因为 role 是高度可配置的(如果编写正确的话),可以根据部署需求轻松地复用它们。 - * **Ansible 星系Ansible Galaxy:** [Ansible Galaxy][1] 是一个在线仓库,里面保存的是由社区成员上传的 role,方便彼此分享。它与 GitHub 紧密集成,因此这些 role 可以先在 Git 仓库里组织好,然后通过 Ansible Galaxy 分享出来。 - + * 任务task:是工作的最小单位,它可以是个动作,比如“安装一个数据库服务”、“安装一个 web 服务器”、“创建一条防火墙规则”或者“把这个配置文件拷贝到那个服务器上去”。 + * 动作play: 由任务组成,例如,一个动作的内容是要“设置一个数据库,给 web 服务用”,这就包含了如下任务:1)安装数据库包;2)设置数据库管理员密码;3)创建数据库实例;4)为该实例分配权限。 + * 剧本playbook:(LCTT 译注:playbook 原指美式橄榄球队的[战术手册][5],也常指“剧本”,此处惯例采用“剧本”译名)由动作组成,一个剧本可能像这样:“设置我的网站,包含后端数据库”,其中的动作包括:1)设置数据库服务器;2)设置 web 服务器。 + * 角色role:用来保存和组织剧本,以便分享和再次使用它们。还拿上个例子来说,如果你需要一个全新的 web 服务器,就可以用别人已经写好并分享出来的角色来设置。因为角色是高度可配置的(如果编写正确的话),可以根据部署需求轻松地复用它们。 + * [Ansible 星系][1]Ansible Galaxy:是一个在线仓库,里面保存的是由社区成员上传的角色,方便彼此分享。它与 GitHub 紧密集成,因此这些角色可以先在 Git 仓库里组织好,然后通过 Ansible 星系分享出来。 这些定义以及它们之间的关系可以用下图来描述: ![](https://opensource.com/sites/default/files/u128651/ansible-definitions.png) -请注意上面的例子只是组织任务的方式之一,我们当然也可以把安装数据库和安装 web 服务器的 playbook 拆开,放到不同的 role 里。Ansible Galaxy 上最常见的 role 是独立安装配置每个应用服务,你可以参考这些安装 [mysql][2] 和 [httpd][3] 的例子。 +请注意上面的例子只是组织任务的方式之一,我们当然也可以把安装数据库和安装 web 服务器的剧本拆开,放到不同的角色里。Ansible 星系上最常见的角色是独立安装、配置每个应用服务,你可以参考这些安装 [mysql][2] 和 [httpd][3] 的例子。 -### 编写 playbook 的小贴士 +### 编写剧本的小技巧 学习 Ansible 最好的资源是其[官方文档][4]。另外,像学习其他东西一样,搜索引擎是你的好朋友。我推荐你从一些简单的任务开始,比如安装应用或创建用户。下面是一些有用的指南: - * 在测试的时候少选几台服务器,这样你的 play 可以执行的更快一些。如果它们在一台机器上执行成功,在其他机器上也没问题。 - * 总是在真正运行前做一次测试dry run以确保所有的命令都能正确执行(要运行测试,加上 `--check-mode` 参数 )。 + * 在测试的时候少选几台服务器,这样你的动作可以执行的更快一些。如果它们在一台机器上执行成功,在其他机器上也没问题。 + * 总是在真正运行前做一次测试dry run,以确保所有的命令都能正确执行(要运行测试,加上 `--check-mode` 参数 )。 * 尽可能多做测试,别担心搞砸。任务里描述的是所需的状态,如果系统已经达到预期状态,任务会被简单地忽略掉。 * 确保在 `/etc/ansible/hosts` 里定义的主机名都可以被正确解析。 - * 因为是用 SSH 与远程主机通信,主控节点必须要接受密钥,所以你面临如下选择:1)要么在正式使用之前就做好与远程主机的密钥交换工作;2)要么在开始管理某台新的远程主机时做好准备输入“Yes”,因为你要接受对方的 SSH 密钥交换请求(译者注:还有另一个不那么安全的选择,修改主控节点的 ssh 配置文件,将 `StrictHostKeyChecking` 设置成“no”)。 - * 尽管你可以在同一个 playbook 内把不同 Linux 发行版的任务整合到一起,但为每个发行版单独编写 playbook 会更明晰一些。 - + * 因为是用 SSH 与远程主机通信,主控节点必须要能接受密钥,所以你面临如下选择:1)要么在正式使用之前就做好与远程主机的密钥交换工作;2)要么在开始管理某台新的远程主机时做好准备输入 “Yes”,因为你要接受对方的 SSH 密钥交换请求(LCTT 译注:还有另一个不那么安全的选择,修改主控节点的 ssh 配置文件,将 `StrictHostKeyChecking` 设置成 “no”)。 + * 尽管你可以在同一个剧本内把不同 Linux 发行版的任务整合到一起,但为每个发行版单独编写剧本会更明晰一些。 ### 总结一下 @@ -50,7 +50,6 @@ Ansible 是你在数据中心里实施运维自动化的好选择,因为它: * 将指令保存在 YAML 文件中(虽然也支持 JSON),比写 shell 脚本更简单。 * 开源,因此你也可以做出自己的贡献,让它更加强大! - 你是怎样使用 Ansible 让数据中心更加自动化的呢?请在评论中分享您的经验。 -------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ via: https://opensource.com/article/18/2/tips-success-when-getting-started-ansib 作者:[Jose Delarosa][a] 译者:[jdh8383](https://github.com/jdh8383) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 750eb54184c347f76b5a37070c72f6c9fa3d4ad1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Mar 2019 09:26:27 +0800 Subject: [PATCH 511/813] PUB:20180202 Tips for success when getting started with Ansible.md @jdh8383 https://linux.cn/article-10598-1.html --- ...20180202 Tips for success when getting started with Ansible.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180202 Tips for success when getting started with Ansible.md (100%) diff --git a/translated/tech/20180202 Tips for success when getting started with Ansible.md b/published/20180202 Tips for success when getting started with Ansible.md similarity index 100% rename from translated/tech/20180202 Tips for success when getting started with Ansible.md rename to published/20180202 Tips for success when getting started with Ansible.md From 90c87ae59a4cf99ea80ac08efbcd8363a67cd8b8 Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Fri, 8 Mar 2019 10:54:40 +0800 Subject: [PATCH 512/813] translated --- .../20190128 Top Hex Editors for Linux.md | 146 ----------------- .../20190128 Top Hex Editors for Linux.md | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 146 deletions(-) delete mode 100644 sources/tech/20190128 Top Hex Editors for Linux.md create mode 100644 translated/tech/20190128 Top Hex Editors for Linux.md diff --git a/sources/tech/20190128 Top Hex Editors for Linux.md b/sources/tech/20190128 Top Hex Editors for Linux.md deleted file mode 100644 index 2f4c387b24..0000000000 --- a/sources/tech/20190128 Top Hex Editors for Linux.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-mk) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top Hex Editors for Linux) -[#]: via: (https://itsfoss.com/hex-editors-linux) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Top Hex Editors for Linux -====== - -Hex editor lets you view/edit the binary data of a file – which is in the form of “hexadecimal” values and hence the name “Hex” editor. Let’s be frank, not everyone needs it. Only a specific group of users who have to deal with the binary data use it. - -If you have no idea, what it is, let me give you an example. Suppose, you have the configuration files of a game, you can open them using a hex editor and change certain values to have more ammo/score and so on. To know more about Hex editors, you should start with the [Wikipedia page][1]. - -In case you already know what’s it used for – let us take a look at the best Hex editors available for Linux. - -### 5 Best Hex Editors Available - -![Best Hex Editors for Linux][2] - -**Note:** The hex editors mentioned are in no particular order of ranking. - -#### 1\. Bless Hex Editor - -![bless hex editor][3] - -**Key Features** : - - * Raw disk editing - * Multilevel undo/redo operations. - * Multiple tabs - * Conversion table - * Plugin support to extend the functionality - - - -Bless is one of the most popular Hex editor available for Linux. You can find it listed in your AppCenter or Software Center. If that is not the case, you can check out their [GitHub page][4] for the build and the instructions associated. - -It can easily handle editing big files without slowing down – so it’s a fast hex editor. - -#### 2\. GNOME Hex Editor - -![gnome hex editor][5] - -**Key Features:** - - * View/Edit in either Hex/Ascii - - * Edit large files - - * - - -Yet another amazing Hex editor – specifically tailored for GNOME. Well, I personally use Elementary OS, so I find it listed in the App Center. You should find it in the Software Center as well. If not, refer to the [GitHub page][6] for the source. - -You can use this editor to view/edit in either hex or ASCII. The user interface is quite simple – as you can see in the image above. - -#### 3\. Okteta - -![okteta][7] - -**Key Features:** - - * Customizable data views - * Multiple tabs - * Character encodings: All 8-bit encodings as supplied by Qt, EBCDIC - * Decoding table listing common simple data types. - - - -Okteta is a simple hex editor with not so fancy features. Although it can handle most of the tasks. There’s a separate module of it which you can use to embed this in other programs to view/edit files. - -Similar to all the above-mentioned editors, you can find this listed on your AppCenter and Software center as well. - -#### 4\. wxHexEditor - -![wxhexeditor][8] - -**Key Features:** - - * Easily handle big files - * Has x86 disassembly support - * **** Sector Indication **** on Disk devices - * Supports customizable hex panel formatting and colors. - - - -This is something interesting. It is primarily a Hex editor but you can also use it as a low level disk editor. For example, if you have a problem with your HDD, you can use this editor to edit the the sectors in raw hex and fix it. - -You can find it listed on your App Center and Software Center. If not, [Sourceforge][9] is the way to go. - -#### 5\. Hexedit (Command Line) - -![hexedit][10] - -**Key Features** : - - * Works via terminal - * It’s fast and simple - - - -If you want something to work on your terminal, you can go ahead and install Hexedit via the console. It’s my favorite Linux hex editor in command line. - -When you launch it, you will have to specify the location of the file, and it’ll then open it for you. - -To install it, just type in: - -``` -sudo apt install hexedit -``` - -### Wrapping Up - -Hex editors could come in handy to experiment and learn. If you are someone experienced, you should opt for the one with more feature – with a GUI. Although, it all comes down to personal preferences. - -What do you think about the usefulness of Hex editors? Which one do you use? Did we miss listing your favorite? Let us know in the comments! - -![][11] - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/hex-editors-linux - -作者:[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://en.wikipedia.org/wiki/Hex_editor -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-hex-editors-800x450.jpeg?resize=800%2C450&ssl=1 -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/bless-hex-editor.jpg?ssl=1 -[4]: https://github.com/bwrsandman/Bless -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/ghex-hex-editor.jpg?ssl=1 -[6]: https://github.com/GNOME/ghex -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/okteta-hex-editor-800x466.jpg?resize=800%2C466&ssl=1 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/wxhexeditor.jpg?ssl=1 -[9]: https://sourceforge.net/projects/wxhexeditor/ -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/hexedit-console.jpg?resize=800%2C566&ssl=1 -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-hex-editors.jpeg?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190128 Top Hex Editors for Linux.md b/translated/tech/20190128 Top Hex Editors for Linux.md new file mode 100644 index 0000000000..ed3eba4c9f --- /dev/null +++ b/translated/tech/20190128 Top Hex Editors for Linux.md @@ -0,0 +1,147 @@ +[#]: collector: "lujun9972" +[#]: translator: "zero-mk " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Top Hex Editors for Linux" +[#]: via: "https://itsfoss.com/hex-editors-linux" +[#]: author: "Ankush Das https://itsfoss.com/author/ankush/" + +Top Hex Editors for Linux +====== + +十六进制编辑器可以让你以十六进制的形式查看/编辑文件的二进制数据,因此其被命名为“十六进制”编辑器。说实话,并不是每个人都需要它。只有必须处理二进制数据的特定用户组才会使用到它。 + +如果您不知道,它是什么,让我举个例子。假设您拥有游戏的配置文件,您可以使用十六进制编辑器打开它们并更改某些值以获得更多的弹药/分数等等。 想要了解有关Hex编辑器的更多信息,你可以参阅 [Wikipedia page][1]。 + +如果你已经知道它用来干什么了 —— 让我们来看看Linux最好的Hex编辑器。 + +### 5个最好的十六进制编辑器 + +![Best Hex Editors for Linux][2] + +**注意:**提到的十六进制编辑器没有特定的排名顺序。 + +#### 1\. Bless Hex Editor + +![bless hex editor][3] + +**主要特点:** + + * 编辑裸设备(Raw disk ) + * 多级撤消/重做操作 + * 多个标签 + * 转换表 + * 支持插件扩展功能 + + + +Bless是Linux上最流行的Hex编辑器之一。您可以在AppCenter或软件中心中找到它。 如果不是这种情况,您可以查看他们的 [GitHub page][4] 获取构建和相关的说明。 + +它可以轻松处理编辑大文件而不会降低速度——因此它是一个快速的十六进制编辑器。 + +#### 2\. GNOME Hex Editor + +![gnome hex editor][5] + +**主要特点:** + + * 以 十六进制/Ascii格式 查看/编辑 + + * 编辑大文件 + + * + + +另一个神奇的十六进制编辑器-专门为GNOME量身定做的。 我个人用的是 Elementary OS, 所以我可以在 软件中心(AppCenter)找到它.。您也可以在软件中心找到它。如果没有,请参考 [GitHub page][6] 获取源代码。 + +您可以使用此编辑器以十六进制或ASCII格式 查看/编辑 文件。用户界面非常简单——正如您在上面的图像中看到的那样。 + +#### 3\. Okteta + +![okteta][7] + +**主要特点:** + + * 可自定义的数据视图 + * 多个选项卡 + * 字符编码:支持Qt、EBCDIC的所有8位编码 + * 解码表列出常见的简单数据类型 + + + +Okteta是一个简单的十六进制编辑器,没有那么奇特的功能。虽然它可以处理大部分任务。它有一个单独的模块,你可以使用它嵌入其他程序来查看/编辑文件。 + + +与上述所有编辑器类似,您也可以在应用中心(App Center)和软件中心(Software Center)上找到列出的编辑器。 + +#### 4\. wxHexEditor + +![wxhexeditor][8] + +**主要特点:** + + * 轻松处理大文件 + * 支持x86反汇编 + * **** Sector Indication **** on Disk devices + * 支持自定义十六进制面板格式和颜色 + + + +这很有趣。它主要是一个十六进制编辑器,但您也可以将其用作低级磁盘编辑器。例如,如果您的硬盘有问题,可以使用此编辑器编辑RAW格式原始数据镜像文件,在十六进制中的扇区并修复它。 + +你可以在你的应用中心(App Center)和软件中心(Software Center)找到它。 如果不是, [Sourceforge][9] 是个正确的选择。 + +#### 5\. Hexedit (命令行工具) + +![hexedit][10] + +**主要特点:** + + * 运行在命令行终端上 + * 它又快又简单 + + + +如果您想在终端上工作,可以继续通过控制台安装hexedit。它是我最喜欢的命令行Linux十六进制编辑器。 + +当你启动它时,你必须指定要打开的文件的位置,然后它会为你打开它。 + +要安装它,只需输入: + +``` +sudo apt install hexedit +``` + +### 结束 + +十六进制编辑器可以方便地进行实验和学习。如果你是一个有经验的人,你应该选择一个有更多功能的——GUI。 尽管这一切都取决于个人喜好。 + +你认为十六进制编辑器的有用性如何?你用哪一个?我们没有列出你最喜欢的吗?请在评论中告诉我们! + +![][11] + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/hex-editors-linux + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[zero-mk](https://github.com/zero-mk) +校对:[校对者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://en.wikipedia.org/wiki/Hex_editor +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-hex-editors-800x450.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/bless-hex-editor.jpg?ssl=1 +[4]: https://github.com/bwrsandman/Bless +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/ghex-hex-editor.jpg?ssl=1 +[6]: https://github.com/GNOME/ghex +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/okteta-hex-editor-800x466.jpg?resize=800%2C466&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/wxhexeditor.jpg?ssl=1 +[9]: https://sourceforge.net/projects/wxhexeditor/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/hexedit-console.jpg?resize=800%2C566&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/Linux-hex-editors.jpeg?fit=800%2C450&ssl=1 From 7b352e8aeba1e8e817cd8a684988aec7b23fa2c6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Mar 2019 23:28:29 +0800 Subject: [PATCH 513/813] PRF:20190220 An Automated Way To Install Essential Applications On Ubuntu.md @geekpi --- ...nstall Essential Applications On Ubuntu.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md index a8adecc72a..e7fe6b18b1 100644 --- a/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md +++ b/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An Automated Way To Install Essential Applications On Ubuntu) @@ -9,11 +9,12 @@ 在 Ubuntu 上自动化安装基本应用的方法 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2019/02/alfred-720x340.png) -默认的 Ubuntu 安装并未预先安装所有必需的应用。你可能需要在网上花几个小时或者向其他 Linux 用户寻求帮助寻找和安装 Ubuntu 所需的应用。如果你是新手,那么你肯定需要花更多的时间来学习如何从命令行(使用 apt-get 或 dpkg)或从 Ubuntu 软件中心搜索和安装应用。一些用户,特别是新手,可能希望轻松快速地安装他们喜欢的每个应用。如果你是其中之一,不用担心。在本指南中,我们将了解如何使用名为 **“Alfred”** 的简单命令行程序在 Ubuntu 上安装基本应用。 +默认安装的 Ubuntu 并未预先安装所有必需的应用。你可能需要在网上花几个小时或者向其他 Linux 用户寻求帮助才能找到并安装 Ubuntu 所需的应用。如果你是新手,那么你肯定需要花更多的时间来学习如何从命令行(使用 `apt-get` 或 `dpkg`)或从 Ubuntu 软件中心搜索和安装应用。一些用户,特别是新手,可能希望轻松快速地安装他们喜欢的每个应用。如果你是其中之一,不用担心。在本指南中,我们将了解如何使用名为 “Alfred” 的简单命令行程序在 Ubuntu 上安装基本应用。 -Alfred是用 **Python** 语言编写的免费开源脚本。它使用 **Zenity** 创建了一个简单的图形界面,用户只需点击几下鼠标即可轻松选择和安装他们选择的应用。你不必花费数小时来搜索所有必要的应用程序、PPA、deb、AppImage、snap 或 flatpak。Alfred 将所有常见的应用、工具和小程序集中在一起,并自动安装所选的应用。如果你是最近从 Windows 迁移到 Ubuntu Linux 的新手,Alfred 会帮助你在新安装的 Ubuntu 系统上进行无人值守的软件安装,而无需太多用户干预。请注意,还有一个名称相似的 Mac OS 应用,但两者有不同的用途。 +Alfred 是用 Python 语言编写的自由、开源脚本。它使用 Zenity 创建了一个简单的图形界面,用户只需点击几下鼠标即可轻松选择和安装他们选择的应用。你不必花费数小时来搜索所有必要的应用程序、PPA、deb、AppImage、snap 或 flatpak。Alfred 将所有常见的应用、工具和小程序集中在一起,并自动安装所选的应用。如果你是最近从 Windows 迁移到 Ubuntu Linux 的新手,Alfred 会帮助你在新安装的 Ubuntu 系统上进行无人值守的软件安装,而无需太多用户干预。请注意,还有一个名称相似的 Mac OS 应用,但两者有不同的用途。 ### 在 Ubuntu 上安装 Alfred @@ -21,11 +22,10 @@ Alfred 安装很简单!只需下载脚本并启动它。就这么简单。 ``` $ wget https://raw.githubusercontent.com/derkomai/alfred/master/alfred.py - $ python3 alfred.py ``` -或者,使用 wget 下载脚本,如上所示,只需将 **alfred.py** 移动到 $PATH 中: +或者,使用 `wget` 下载脚本,如上所示,只需将 `alfred.py` 移动到 `$PATH` 中: ``` $ sudo cp alfred.py /usr/local/bin/alfred @@ -53,7 +53,7 @@ $ alfred * 网络浏览器, * 邮件客户端, - * 短消息, + * 消息, * 云存储客户端, * 硬件驱动程序, * 编解码器, @@ -67,21 +67,19 @@ $ alfred * 录屏工具, * 视频编码器, * 流媒体应用, - * 3D建模和动画工具, + * 3D 建模和动画工具, * 图像查看器和编辑器, * CAD 软件, - * Pdf 工具, + * PDF 工具, * 游戏模拟器, * 磁盘管理工具, * 加密工具, * 密码管理器, * 存档工具, - * Ftp 软件, + * FTP 软件, * 系统资源监视器, * 应用启动器等。 - - 你可以选择任何一个或多个应用并立即安装它们。在这里,我将安装 “Developer bundle”,因此我选择它并单击 OK 按钮。 ![][3] @@ -90,13 +88,13 @@ $ alfred ![][4] -安装完成后,不将看到以下消息。 +安装完成后,你将看到以下消息。 ![][5] 恭喜你!已安装选定的软件包。 -你可以使用以下命令[**在 Ubuntu 上查看最近安装的应用**][6]: +你可以使用以下命令[在 Ubuntu 上查看最近安装的应用][6]: ``` $ grep " install " /var/log/dpkg.log @@ -104,7 +102,9 @@ $ grep " install " /var/log/dpkg.log 你可能需要重启系统才能使用某些已安装的应用。类似地,你可以方便地安装列表中的任何程序。 -提示一下,还有一个由不同的开发人员编写的类似脚本,名为 **post_install.sh**。它与 Alfred 完全相同,但提供了一些不同的应用。请查看以下链接获取更多详细信息。 +提示一下,还有一个由不同的开发人员编写的类似脚本,名为 `post_install.sh`。它与 Alfred 完全相同,但提供了一些不同的应用。请查看以下链接获取更多详细信息。 + +- [Ubuntu Post Installation Script](https://www.ostechnix.com/ubuntu-post-installation-script/) 这两个脚本能让懒惰的用户,特别是新手,只需点击几下鼠标就能够轻松快速地安装他们想要在 Ubuntu Linux 中使用的大多数常见应用、工具、更新、小程序,而无需依赖官方或者非官方文档的帮助。 @@ -121,7 +121,7 @@ via: https://www.ostechnix.com/an-automated-way-to-install-essential-application 作者:[SK][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 878641acb8e42839cbb1883f74ef74d821fabc3e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Mar 2019 23:29:20 +0800 Subject: [PATCH 514/813] PUB:20190220 An Automated Way To Install Essential Applications On Ubuntu.md @geekpi https://linux.cn/article-10600-1.html --- ...tomated Way To Install Essential Applications On Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190220 An Automated Way To Install Essential Applications On Ubuntu.md (98%) diff --git a/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/published/20190220 An Automated Way To Install Essential Applications On Ubuntu.md similarity index 98% rename from translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md rename to published/20190220 An Automated Way To Install Essential Applications On Ubuntu.md index e7fe6b18b1..fb7f2ffde2 100644 --- a/translated/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md +++ b/published/20190220 An Automated Way To Install Essential Applications On Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10600-1.html) [#]: subject: (An Automated Way To Install Essential Applications On Ubuntu) [#]: via: (https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 6a0d30e3602fc8eb0d6121bbc7ef9ec03babbf0b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Mar 2019 08:53:57 +0800 Subject: [PATCH 515/813] PRF:20181216 Schedule a visit with the Emacs psychiatrist.md @lujun9972 --- ...ule a visit with the Emacs psychiatrist.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md b/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md index 7e05a0e930..b8d96b03cb 100644 --- a/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md +++ b/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md @@ -1,16 +1,18 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(Schedule a visit with the Emacs psychiatrist) -[#]:via:(https://opensource.com/article/18/12/linux-toy-eliza) -[#]:author:(Jason Baker https://opensource.com/users/jason-baker) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Schedule a visit with the Emacs psychiatrist) +[#]: via: (https://opensource.com/article/18/12/linux-toy-eliza) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) 预约 Emacs 心理医生 ====== -Eliza 是一个隐藏于某个 Linux 最流行文本编辑器中的自然语言处理聊天机器人。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-eliza.png?itok=3ioiBik_) + +> Eliza 是一个隐藏于某个 Linux 最流行文本编辑器中的自然语言处理聊天机器人。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-eliza.png?itok=3ioiBik_) 欢迎你,今天时期 24 天的 Linux 命令行玩具的又一天。如果你是第一次访问本系列,你可能会问什么是命令行玩具呢。我们将会逐步确定这个概念,但一般来说,它可能是一个游戏,或任何能让你在终端玩的开心的其他东西。 @@ -22,24 +24,23 @@ Eliza 是一个隐藏于某个 Linux 最流行文本编辑器中的自然语言 要启动 [Eliza][1],首先,你需要启动 Emacs。很有可能 Emacs 已经安装在你的系统中了,但若没有,它基本上也肯定在你默认的软件仓库中。 -由于我要求本系列的工具一定要时运行在终端内,因此使用 **-nw** 标志来启动 Emacs 让它在你的终端模拟器中运行。 +由于我要求本系列的工具一定要时运行在终端内,因此使用 `-nw` 标志来启动 Emacs 让它在你的终端模拟器中运行。 ``` $ emacs -nw ``` -在 Emacs 中,输入 M-x doctor 来启动 Eliza。对于像我这样有 Vim 背景的人可能不知道这是什么意思,只需要按下 escape,输入 x 然后输入 doctor。然后,向它倾述所有假日的烦恼吧。 +在 Emacs 中,输入 `M-x doctor` 来启动 Eliza。对于像我这样有 Vim 背景的人可能不知道这是什么意思,只需要按下 `escape`,输入 `x` 然后输入 `doctor`。然后,向它倾述所有假日的烦恼吧。 -Eliza 历史悠久,最早可以追溯到 1960 年代中期的 MIT 人工智能实验室。[维基百科 ][2] 上有它历史的详细说明。 - -Eliza 并不是 Emacs 中唯一的娱乐工具。查看 [手册 ][3] 可以看到一整列好玩的玩具。 +Eliza 历史悠久,最早可以追溯到 1960 年代中期的 MIT 人工智能实验室。[维基百科][2] 上有它历史的详细说明。 +Eliza 并不是 Emacs 中唯一的娱乐工具。查看 [手册][3] 可以看到一整列好玩的玩具。 ![Linux toy:eliza animated][5] 你有什么喜欢的命令行玩具值得推荐吗?我们时间不多了,但我还是想听听你的建议。请在下面评论中告诉我,我会查看的。另外也欢迎告诉我你们对本次玩具的想法。 -请一定要看看昨天的玩具,[带着这个复刻版吃豆人来到 Linux 终端游乐中心 ][6],然后明天再来看另一个玩具! +请一定要看看昨天的玩具,[带着这个复刻版吃豆人来到 Linux 终端游乐中心][6],然后明天再来看另一个玩具! -------------------------------------------------------------------------------- @@ -48,7 +49,7 @@ via: https://opensource.com/article/18/12/linux-toy-eliza 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cc171425db480f44977c8feced0313818c60b043 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Mar 2019 08:54:59 +0800 Subject: [PATCH 516/813] PUB:20181216 Schedule a visit with the Emacs psychiatrist.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lujun9972 https://linux.cn/article-10601-1.html 注意不要将标点符号全替换成中文的。 --- .../20181216 Schedule a visit with the Emacs psychiatrist.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181216 Schedule a visit with the Emacs psychiatrist.md (97%) diff --git a/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md b/published/20181216 Schedule a visit with the Emacs psychiatrist.md similarity index 97% rename from translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md rename to published/20181216 Schedule a visit with the Emacs psychiatrist.md index b8d96b03cb..304beda2ff 100644 --- a/translated/tech/20181216 Schedule a visit with the Emacs psychiatrist.md +++ b/published/20181216 Schedule a visit with the Emacs psychiatrist.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10601-1.html) [#]: subject: (Schedule a visit with the Emacs psychiatrist) [#]: via: (https://opensource.com/article/18/12/linux-toy-eliza) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 62a0ff82fae45fafbe83bb6684d11790ea1f9e3d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Mar 2019 09:13:00 +0800 Subject: [PATCH 517/813] PRF:20190104 Midori- A Lightweight Open Source Web Browser.md @geekpi --- ...- A Lightweight Open Source Web Browser.md | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md b/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md index 9cc0673527..8af346b6ef 100644 --- a/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md +++ b/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Midori: A Lightweight Open Source Web Browser) @@ -10,13 +10,13 @@ Midori:轻量级开源 Web 浏览器 ====== -**这是一个对再次回归的轻量级、快速、开源的 Web 浏览器 Midori 的快速回顾** +> 这是一个对再次回归的轻量级、快速、开源的 Web 浏览器 Midori 的快速回顾。 如果你正在寻找一款轻量级[网络浏览器替代品][1],请试试 Midori。 [Midori][2]是一款开源的网络浏览器,它更注重轻量级而不是提供大量功能。 -如果你从未听说过 Midori,你可能会认为它是一个新的应用程序,但实际上 Midori 于 2007 年首次发布。 +如果你从未听说过 Midori,你可能会认为它是一个新的应用程序,但实际上 Midori 首次发布于 2007 年。 因为它专注于速度,所以 Midori 很快就聚集了一群爱好者,并成为了 Bodhi Linux、SilTaz 等轻量级 Linux 发行版的默认浏览器。 @@ -28,25 +28,23 @@ Midori:轻量级开源 Web 浏览器 ![Midori web browser][4] -以下是Midori浏览器的一些主要功能 +以下是 Midori 浏览器的一些主要功能 - * 使用 Vala 编写,带有 GTK+3 和 WebKit 渲染引擎。 -  * 标签、窗口和会话管理 -  * 快速拨号 -  * 默认保存下一个会话的选项卡 + * 使用 Vala 编写,使用 GTK+3 和 WebKit 渲染引擎。 +  * 标签、窗口和会话管理。 +  * 快速拨号。 +  * 默认保存下一个会话的选项卡。   * 使用 DuckDuckGo 作为默认搜索引擎。可以更改为 Google 或 Yahoo。 -  * 书签管理 -  * 可定制和可扩展的界面 -  * 扩展模块可以用 C 和 Vala 编写 -  * 支持 HTML5 +  * 书签管理。 +  * 可定制和可扩展的界面。 +  * 扩展模块可以用 C 和 Vala 编写。 +  * 支持 HTML5。   * 少量的扩展程序包括广告拦截器、彩色标签等。没有第三方扩展程序。 -  * 表格历史 -  * 隐私浏览 -  * 可用于 Linux 和 Windows +  * 表单历史。 +  * 隐私浏览。 +  * 可用于 Linux 和 Windows。 - - -小知识:Midori 是日语单词,意思是绿色。如果你因此在猜想一些东西,Midori 的开发者实际不是日本人。 +小知识:Midori 是日语单词,意思是绿色。如果你因此而猜想的话,但 Midori 的开发者实际不是日本人。 ### 体验 Midori @@ -54,7 +52,7 @@ Midori:轻量级开源 Web 浏览器 这几天我一直在使用 Midori。体验基本很好。它支持 HTML5 并能快速渲染网站。广告拦截器也没问题。正如你对任何标准 Web 浏览器所期望的那样,浏览体验挺顺滑。 -缺少扩展一直是 Midori 的弱点所以​​我不打算谈论这个。 +缺少扩展一直是 Midori 的弱点,所以​​我不打算谈论这个。 我注意到的是它不支持国际语言。我找不到添加新语言支持的方法。它根本无法渲染印地语字体,我猜对其他非[罗曼语言][6]也是一样。 @@ -70,7 +68,7 @@ Midori 没有像 Chrome 那样吃我的内存,所以这是一个很大的优 如果你使用的是 Ubuntu,你可以在软件中心找到 Midori(Snap 版)并从那里安装。 -![Midori browser is available in Ubuntu Software Center][8]Midori browser is available in Ubuntu Software Center +![Midori browser is available in Ubuntu Software Center][8] 对于其他 Linux 发行版,请确保你[已启用 Snap 支持][9],然后你可以使用以下命令安装 Midori: @@ -80,6 +78,8 @@ sudo snap install midori 你可以选择从源代码编译。你可以从 Midori 的网站下载它的代码。 +- [下载 Midori](https://www.midori-browser.org/download/) + 如果你喜欢 Midori 并希望帮助这个开源项目,请向他们捐赠或[从他们的商店购买 Midori 商品][10]。 你在使用 Midori 还是曾经用过么?你的体验如何?你更喜欢使用哪种其他网络浏览器?请在下面的评论栏分享你的观点。 @@ -91,7 +91,7 @@ via: https://itsfoss.com/midori-browser 作者:[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 8cef2ba62dae39dbc0626c927c39b92852e0b92d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 9 Mar 2019 09:14:49 +0800 Subject: [PATCH 518/813] PUB:20190104 Midori- A Lightweight Open Source Web Browser.md @geekpi https://linux.cn/article-10602-1.html --- .../20190104 Midori- A Lightweight Open Source Web Browser.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190104 Midori- A Lightweight Open Source Web Browser.md (98%) diff --git a/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md b/published/20190104 Midori- A Lightweight Open Source Web Browser.md similarity index 98% rename from translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md rename to published/20190104 Midori- A Lightweight Open Source Web Browser.md index 8af346b6ef..e263fc38ca 100644 --- a/translated/tech/20190104 Midori- A Lightweight Open Source Web Browser.md +++ b/published/20190104 Midori- A Lightweight Open Source Web Browser.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10602-1.html) [#]: subject: (Midori: A Lightweight Open Source Web Browser) [#]: via: (https://itsfoss.com/midori-browser) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 1dc2c2fd20976f2846c389013ad5c4b2d20fa13c Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Mar 2019 15:54:54 +0800 Subject: [PATCH 519/813] Translating by qhwdw --- ...0190305 5 ways to teach kids to program with Raspberry Pi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md index bfd980e56e..9b829c39f1 100644 --- a/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md +++ b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f5863caea237c596a59cc7bc45a8ce1690c71eeb Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Mar 2019 17:04:41 +0800 Subject: [PATCH 520/813] Translated by qhwdw --- ...teach kids to program with Raspberry Pi.md | 65 ------------------- ...teach kids to program with Raspberry Pi.md | 65 +++++++++++++++++++ 2 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md create mode 100644 translated/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md diff --git a/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md deleted file mode 100644 index 9b829c39f1..0000000000 --- a/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 ways to teach kids to program with Raspberry Pi) -[#]: via: (https://opensource.com/article/19/3/teach-kids-program-raspberry-pi) -[#]: author: (Anderson Silva https://opensource.com/users/ansilva) - -5 ways to teach kids to program with Raspberry Pi -====== -The fifth article in our guide to getting started with the Raspberry Pi explores resources for helping kids learn to program. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4) - -As countless schools, libraries, and families have proven, the Raspberry Pi is a great way to expose kids to programming. In the first four articles in this series, you've learned about [purchasing][1], [installing][2], and [configuring][3] a Raspberry Pi. In this fifth article, I'll share some helpful resources to get kids started programming with the Raspberry Pi. - -### Scratch - -[Scratch][4] is a great way to introduce kids to basic programming concepts like variables, boolean logic, loops, and more. It's included in Raspbian, and you can find numerous articles and tutorials about Scratch on the internet, including [Is Scratch today like the Logo of the '80s for teaching kids to code?][5] on Opensource.com. - -![](https://opensource.com/sites/default/files/uploads/scratch2.png) - -### Code.org - -[Code.org][6] is another great online resource for kids learning to program. The organization's mission is to expose more people to coding through courses, tutorials, and the popular Hour of Code event. Many schools—including my fifth-grade son's—use it to expose more kids to programming and computer science concepts. - -### Reading - -Reading books is another great way to learn how to program. You don't necessarily need to speak English to learn how to program, but the more you know, the easier it will be, as most programming languages use English keywords to describe the commands. If your English is good enough to follow this Raspberry Pi series, you are most likely well-equipped to read books, forums, and other publications about programming. One book I recommend is [Python for Kids: A Playful Introduction to Programming][7] by Jason Biggs. - -### Raspberry Jam - -Another way to get your kids into programming is by helping them interact with others at meetups. The Raspberry Pi Foundation sponsors events called [Raspberry Jams][8] around the world where kids and adults can join forces and learn together on the Raspberry Pi. If there isn't a Raspberry Jam in your area, the foundation has a [guidebook][9] and other resources to help you start one. - -### Gaming - -Last, but not least, there's a version of [Minecraft][10] for the Raspberry Pi. Minecraft has grown from a multi-player "digital Lego"-like game into a programming platform where anyone can use Python and other languages to build on Minecraft's virtual world. Check out [Getting Started with Minecraft Pi][11] and [Minecraft Hour of Code Tutorials][12]. - -What are your favorite resources for teaching kids to program with Raspberry Pi? Please share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi - -作者:[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/article/19/2/how-buy-raspberry-pi -[2]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi -[3]: https://opensource.com/article/19/3/learn-linux-raspberry-pi -[4]: https://scratch.mit.edu/ -[5]: https://opensource.com/article/17/3/logo-scratch-teach-programming-kids -[6]: https://code.org/ -[7]: https://www.amazon.com/Python-Kids-Playful-Introduction-Programming/dp/1593274076 -[8]: https://www.raspberrypi.org/jam/#map-section -[9]: https://static.raspberrypi.org/files/jam/Raspberry-Jam-Guidebook-2017-04-26.pdf -[10]: https://minecraft.net/en-us/edition/pi/ -[11]: https://projects.raspberrypi.org/en/projects/getting-started-with-minecraft-pi -[12]: https://code.org/minecraft diff --git a/translated/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md b/translated/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md new file mode 100644 index 0000000000..2886c4bf69 --- /dev/null +++ b/translated/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to teach kids to program with Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/teach-kids-program-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +教孩子们使用树莓派学编程的 5 种方法。 +====== +这是我们的《树莓派入门指南》系列的第五篇文章,它探索了帮助孩子们学习编程的一些资源。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4) + +无数的学校、图书馆和家庭已经证明,树莓派是让孩子们接触编程的最好方式。在本系列的前四篇文章中,你已经学习了如何去[购买][1]、[安装][2]、和[配置][3]一个树莓派。在第五篇文章中,我们将分享一些帮助孩子们使用树莓派编程的入门级资源。 + +### Scratch + +[Scratch][4] 是让孩子们了解编程基本概念(比如变量、布尔逻辑、循环等等)的一个很好的方式。你在 Raspbian 中就可以找到它,并且在互联网上你可以找到非常多的有关 Scratch 的文章和教程,包括在 `Opensource.com` 上的 [今天的 Scratch 是不是像“上世纪八十年代教孩子学LOGO编程”?][5]。 + +![](https://opensource.com/sites/default/files/uploads/scratch2.png) + +### Code.org + +[Code.org][6] 是另一个非常好的教孩子学编程的在线资源。这个组织的使命是让更多的人通过课程、教程和流行的一小时学编程来接触编程。许多学校 — 包括我五年级的儿子就读的学校 — 都使用它,让更多的孩子学习编程和计算机科学的概念。 + +### 阅读 + +读书是学习编程的另一个很好的方式。学习如何编程并不需要你会说英语,当然,如果你会英语的话,学习起来将更容易,因为大多数的编程语言都是使用英文关键字去描述命令的。如果你的英语很好,能够轻松地阅读接下来的这个树莓派系列文章,那么你就完全有能力去阅读有关编程的书籍、论坛和其它的出版物。我推荐一本由 `Jason Biggs` 写的书: [儿童学 Python:非常有趣的 Python 编程入门][7]。 + +### Raspberry Jam + +另一个让你的孩子进入编程世界的好方法是在聚会中让他与其他人互动。树莓派基金会赞助了一个称为 [Raspberry Jams][8] 的活动,让世界各地的孩子和成人共同参与在树莓派上学习。如果你所在的地区没有 `Raspberry Jam`,基金会有一个[指南][9]和其它资源帮你启动一个 `Raspberry Jam`。 + +### 游戏 + +最后一个(是本文的最后一个,当然还有其它的方式),[Minecraft][10] 有一个树莓派版本。我的世界Minecraft已经从一个多玩家的、类似于”数字乐高“这样的游戏,成长为一个任何人都能使用 Pythonb 和其它编程语言去构建我自己的虚拟世界。更多内容查看 [Minecraft Pi 入门][11] 和 [Minecraft 一小时入门教程][12]。 + +你还有教孩子用树莓派学编程的珍藏资源吗?请在下面的评论区共享出来吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者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/article/19/2/how-buy-raspberry-pi +[2]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi +[3]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[4]: https://scratch.mit.edu/ +[5]: https://opensource.com/article/17/3/logo-scratch-teach-programming-kids +[6]: https://code.org/ +[7]: https://www.amazon.com/Python-Kids-Playful-Introduction-Programming/dp/1593274076 +[8]: https://www.raspberrypi.org/jam/#map-section +[9]: https://static.raspberrypi.org/files/jam/Raspberry-Jam-Guidebook-2017-04-26.pdf +[10]: https://minecraft.net/en-us/edition/pi/ +[11]: https://projects.raspberrypi.org/en/projects/getting-started-with-minecraft-pi +[12]: https://code.org/minecraft From a2cef5c3320154e8a0390e2978c577ce2d34e923 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Mar 2019 17:07:40 +0800 Subject: [PATCH 521/813] Translating by qhwdw --- sources/tech/20190301 Which Raspberry Pi should you choose.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190301 Which Raspberry Pi should you choose.md b/sources/tech/20190301 Which Raspberry Pi should you choose.md index b7c5009051..a7a66abdba 100644 --- a/sources/tech/20190301 Which Raspberry Pi should you choose.md +++ b/sources/tech/20190301 Which Raspberry Pi should you choose.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 21091d76c7fe35592de863946ccd0ea80af7e427 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Mar 2019 17:59:41 +0800 Subject: [PATCH 522/813] Translated by qhwdw --- ...01 Which Raspberry Pi should you choose.md | 48 ------------------- ...01 Which Raspberry Pi should you choose.md | 47 ++++++++++++++++++ 2 files changed, 47 insertions(+), 48 deletions(-) delete mode 100644 sources/tech/20190301 Which Raspberry Pi should you choose.md create mode 100644 translated/tech/20190301 Which Raspberry Pi should you choose.md diff --git a/sources/tech/20190301 Which Raspberry Pi should you choose.md b/sources/tech/20190301 Which Raspberry Pi should you choose.md deleted file mode 100644 index a7a66abdba..0000000000 --- a/sources/tech/20190301 Which Raspberry Pi should you choose.md +++ /dev/null @@ -1,48 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Which Raspberry Pi should you choose?) -[#]: via: (https://opensource.com/article/19/3/which-raspberry-pi-choose) -[#]: author: (Anderson Silva https://opensource.com/users/ansilva) - -Which Raspberry Pi should you choose? -====== -In the first article in our series on getting started with Raspberry Pi, learn the three criteria for choosing the right model for you. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) - -This is the first article in a 14-day series on getting started with the [Raspberry Pi][1]. Although the series is geared towards people who have never used a Raspberry Pi or Linux or programming, there will definitely be things for more experienced readers—and I encourage those readers to leave comments and tips that build on what I write. If everyone contributes, we can make this series even more useful for beginners, other experienced readers, and even me! - -So, you want to give the Raspberry Pi a shot, but you don't know which model to buy. Maybe you want one for your classroom or your kid, but there are so many options, and you aren't sure which one is right for you. - -![](https://opensource.com/sites/default/files/uploads/raspberrypi_1_boards.png) - -My three main criteria for choosing a new Raspberry Pi are: - - * **Cost:** Don't just consider the cost of the Raspberry Pi board, but also factor the peripherals you will need in order to use it. In the US, the Raspberry Pi's cost varies from $5 (for the Raspberry Pi Zero) to $35 (for the Raspberry Pi 3 B and 3 B+). However, if you pick the Zero you will probably also need a USB hub for your mouse and keyboard, possibly a wireless adapter, and some sort of display adapter. Unless you have most (if not all) of the peripherals needed for whatever you want to do with your Raspberry Pi, make sure to add those to your Pi budget. Also, in some countries, a Raspberry Pi on its own (even without any peripherals) may be a cost burden for many students and teachers. - - * **Availability:** Finding the Raspberry Pi you want can vary depending on your location, as it may be easier (or harder) to get certain versions in some countries. Availability is an even bigger issue after new models are released, and it can take a few days or even weeks for new versions to become available in your market. - - * **Purpose:** Location and cost may not affect everyone, but every buyer must consider why they want a Raspberry Pi. The eight different models vary in RAM, CPU core, CPU speed, physical size, network connectivity, peripheral expansion, etc. For example, if you want the most robust solution with more "horsepower," you probably will want the Raspberry Pi 3 B+, which has the most RAM, fastest CPU, and largest number of cores. If you want something that won't require network connectivity, won't be used for CPU-intensive work, and can be hidden in a small space, you could go with a Raspberry Pi Zero. - - -[Wikipedia's Raspberry Pi specs chart][2] is an easy way to compare the eight Raspberry Pis models. - -Now that you know what to look for in a Raspberry Pi, in the next article, I will explain how to buy one. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/3/which-raspberry-pi-choose - -作者:[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://www.raspberrypi.org/ -[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications diff --git a/translated/tech/20190301 Which Raspberry Pi should you choose.md b/translated/tech/20190301 Which Raspberry Pi should you choose.md new file mode 100644 index 0000000000..53b500e65e --- /dev/null +++ b/translated/tech/20190301 Which Raspberry Pi should you choose.md @@ -0,0 +1,47 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Which Raspberry Pi should you choose?) +[#]: via: (https://opensource.com/article/19/3/which-raspberry-pi-choose) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +你应该选择哪种树莓派? +====== +在我们的《树莓派使用入门》系列的第一篇文章中,我们将学习选择符合你要求的树莓派型号的三个标准。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) + +本文是《14 天学会[树莓派][1]使用》系列文章的第一篇。虽然本系列文章主要面向没有使用过树莓派或 Linux 或没有编程经验的人群,但是肯定有些东西还是需要有经验的读者的,我希望这些读者能够留下他们有益的评论、提示和补充。如果每个人都能贡献,这将会让本系列文章对初学者、其它有经验的读者、甚至是我更受益! + +言归正传,如果你想拥有一个树莓派,但不知道应该买哪个型号。或许你希望为你的教学活动或你的孩子买一个,但面对这么多的选择,却不知道应该买哪个才是正确的决定。 + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_1_boards.png) + +关于选择一个新的树莓派,我有三个主要的标准: + + * **成本:** 不能只考虑树莓派板的成本,还需要考虑到你使用它时外围附件的成本。在美国,树莓派的成本区间是从 5 美元(树莓派 Zero)到 35 美元(树莓派 3 B 和 3 B+)。但是,如果你选择 `Zero`,那么你或许还需要一个 `USB hub` 去连接你的鼠标、键盘、无线网卡、以及某种显示适配器。不论你想使用树莓派做什么,除非你已经有了(假如不是全部)大部分的外设,那么你一定要把这些外设考虑到预算之中。此外,在一些国家,对于许多学生和老师,树莓派(即便没有任何外设)的购置成本也或许是一个不少的成本负担。 + + * **可获得性:** 根据你所在地去查找你想要的树莓派,因为在一些国家得到某些版本的树莓派可能很容易(或很困难)。在新型号刚发布后,可获得性可能是个很大的问题,在你的市场上获得最新版本的树莓派可能需要几天或几周的时间。 + + * **用途:** 所在地和成本可能并不会影响每个人,但每个购买者必须要考虑的是买树莓派做什么。因内存、CPU 核心、CPU 速度、物理尺寸、网络连接、外设扩展等不同衍生出八个不同的型号。比如,如果你需要一个拥有更大的“马力”时鲁棒性更好的解决方案,那么你或许应该选择树莓派 3 B+,它有更大的内存、最快的 CPU、以及更多的核心数。如果你的解决方案并不需要网络连接,并不用于 CPU 密集型的工作,并且需要将它隐藏在一个非常小的空间中,那么一个树莓派 Zero 将是你的最佳选择。 + +[维基百科的树莓派规格表][2] 是比较八种树莓派型号的好办法。 + +现在,你已经知道了如何找到适合你的树莓派了,下一篇文章中,我将介绍如何购买它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/which-raspberry-pi-choose + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者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://www.raspberrypi.org/ +[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications From a870e23e150b56932df2b69cfd7e5ac39b1bd73e Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 9 Mar 2019 18:02:06 +0800 Subject: [PATCH 523/813] Translating by qhwdw --- sources/tech/20190302 How to buy a Raspberry Pi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190302 How to buy a Raspberry Pi.md b/sources/tech/20190302 How to buy a Raspberry Pi.md index 974a6b75fb..bf4082d01d 100644 --- a/sources/tech/20190302 How to buy a Raspberry Pi.md +++ b/sources/tech/20190302 How to buy a Raspberry Pi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 808b6a36a202218e51d11ba0f8964f505851e173 Mon Sep 17 00:00:00 2001 From: alim0x Date: Sun, 10 Mar 2019 00:53:27 +0800 Subject: [PATCH 524/813] [translated]Booting Linux faster --- sources/talk/20190121 Booting Linux faster.md | 54 ------------------- .../talk/20190121 Booting Linux faster.md | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 sources/talk/20190121 Booting Linux faster.md create mode 100644 translated/talk/20190121 Booting Linux faster.md diff --git a/sources/talk/20190121 Booting Linux faster.md b/sources/talk/20190121 Booting Linux faster.md deleted file mode 100644 index 871efc1957..0000000000 --- a/sources/talk/20190121 Booting Linux faster.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (alim0x) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Booting Linux faster) -[#]: via: (https://opensource.com/article/19/1/booting-linux-faster) -[#]: author: (Stewart Smith https://opensource.com/users/stewart-ibm) - -Booting Linux faster -====== -Doing Linux kernel and firmware development leads to lots of reboots and lots of wasted time. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY) -Of all the computers I've ever owned or used, the one that booted the quickest was from the 1980s; by the time your hand moved from the power switch to the keyboard, the BASIC interpreter was ready for your commands. Modern computers take anywhere from 15 seconds for a laptop to minutes for a small home server to boot. Why is there such a difference in boot times? - -A microcomputer from the 1980s that booted straight to a BASIC prompt had a very simple CPU that started fetching and executing instructions from a memory address immediately upon getting power. Since these systems had BASIC in ROM, there was no loading time—you got to the BASIC prompt really quickly. More complex systems of that same era, such as the IBM PC or Macintosh, took a significant time to boot (~30 seconds), although this was mostly due to having to read the operating system (OS) off a floppy disk. Only a handful of seconds were spent in firmware before being able to load an OS. - -Modern servers typically spend minutes, rather than seconds, in firmware before getting to the point of booting an OS from disk. This is largely due to modern systems' increased complexity. No longer can a CPU just come up and start executing instructions at full speed; we've become accustomed to CPU frequency scaling, idle states that save a lot of power, and multiple CPU cores. In fact, inside modern CPUs are a surprising number of simpler CPUs that help start the main CPU cores and provide runtime services such as throttling the frequency when it gets too hot. On most CPU architectures, the code running on these cores inside your CPU is provided as opaque binary blobs. - -On OpenPOWER systems, every instruction executed on every core inside the CPU is open source software. On machines with [OpenBMC][1] (such as IBM's AC922 system and Raptor's TALOS II and Blackbird systems), this extends to the code running on the Baseboard Management Controller as well. This means we can get a tremendous amount of insight into what takes so long from the time you plug in a power cable to the time a familiar login prompt is displayed. - -If you're part of a team that works on the Linux kernel, you probably boot a lot of kernels. If you're part of a team that works on firmware, you're probably going to boot a lot of different firmware images, followed by an OS to ensure your firmware still works. If we can reduce the hardware's boot time, these teams can become more productive, and end users may be grateful when they're setting up systems or rebooting to install firmware or OS updates. - -Over the years, many improvements have been made to Linux distributions' boot time. Modern init systems deal well with doing things concurrently and on-demand. On a modern system, once the kernel starts executing, it can take very few seconds to get to a login prompt. This handful of seconds are not the place to optimize boot time; we have to go earlier: before we get to the OS. - -On OpenPOWER systems, the firmware loads an OS by booting a Linux kernel stored in the firmware flash chip that runs a userspace program called [Petitboot][2] to find the disk that holds the OS the user wants to boot and [kexec][3][()][3] to it. This code reuse leverages the efforts that have gone into making Linux boot quicker. Even so, we found places in our kernel config and userspace where we could improve and easily shave seconds off boot time. With these optimizations, booting the Petitboot environment is a single-digit percentage of boot time, so we had to find more improvements elsewhere. - -Before the Petitboot environment starts, there's a prior bit of firmware called [Skiboot][4], and before that there's [Hostboot][5]. Prior to Hostboot is the [Self-Boot Engine][6], a separate core on the die that gets a single CPU core up and executing instructions out of Level 3 cache. These components are where we can make the most headway in reducing boot time, as they take up the overwhelming majority of it. Perhaps some of these components aren't optimized enough or doing as much in parallel as they could be? - -Another avenue of attack is reboot time rather than boot time. On a reboot, do we really need to reinitialize all the hardware? - -Like any modern system, the solutions to improving boot (and reboot) time have been a mixture of doing more in parallel, dealing with legacy, and (arguably) cheating. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/booting-linux-faster - -作者:[Stewart Smith][a] -选题:[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/stewart-ibm -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/OpenBMC -[2]: https://github.com/open-power/petitboot -[3]: https://en.wikipedia.org/wiki/Kexec -[4]: https://github.com/open-power/skiboot -[5]: https://github.com/open-power/hostboot -[6]: https://github.com/open-power/sbe -[7]: https://linux.conf.au/schedule/presentation/105/ -[8]: https://linux.conf.au/ diff --git a/translated/talk/20190121 Booting Linux faster.md b/translated/talk/20190121 Booting Linux faster.md new file mode 100644 index 0000000000..60645965b1 --- /dev/null +++ b/translated/talk/20190121 Booting Linux faster.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (alim0x) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Booting Linux faster) +[#]: via: (https://opensource.com/article/19/1/booting-linux-faster) +[#]: author: (Stewart Smith https://opensource.com/users/stewart-ibm) + +更快启动 Linux +====== +进行 Linux 内核与固件开发的时候,往往需要多次的重启,会浪费大把的时间。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY) +在所有我拥有或使用过的电脑中,启动最快的那台是 20 世纪 80 年代的电脑。在你把手从电源键移到键盘上的时候,BASIC 解释器已经在等待你输入命令了。对于现代的电脑,启动时间从笔记本电脑的 15 秒到小型家庭服务器的数分钟不等。为什么它们的启动时间有差别? + +那台直接启动到 BASIC 命令行提示符的 20 世纪 80 年代微电脑,有着一颗非常简单的 CPU,它在通电的时候就立即开始从一个存储地址中获取和执行指令。因为这些系统在 ROM 里面有 BASIC,基本不需要载入的时间——你很快就进到 BASIC 命令提示符中了。同时代更加复杂的系统,比如 IBM PC 或 Macintosh,需要一段可观的时间来启动(大约 30 秒),尽管这主要是因为需要从软盘上读取操作系统的缘故。在可以加载操作系统之前,只有很小一部分时间是花在固件上的。 + +现代服务器往往在从磁盘上读取操作系统之前,在固件上花费了数分钟而不是数秒。这主要是因为现代系统日益增加的复杂性。CPU 不再能够只是起来就开始全速执行指令,我们已经习惯于 CPU 频率变化,节省能源的待机状态以及 CPU 多核。实际上,在现代 CPU 内部有惊人数量的更简单的处理器,它们协助主 CPU 核心启动并提供运行时服务,比如在过热的时候压制频率。在绝大多数 CPU 架构中,在你的 CPU 内的这些核心上运行的代码都以不透明的二进制 blob 形式提供。 + +在 OpenPOWER 系统上,所有运行在 CPU 内部每个核心的指令都是开源的。在有 [OpenBMC][1](比如 IBM 的 AC922 系统和 Raptor 的 TALOS II 以及 Blackbird 系统)的机器上,这还延伸到了运行在基板管理控制器上的代码。这就意味着我们可以一探究竟,到底为什么从接入电源线到显示出熟悉的登陆界面花了这么长时间。 + +如果你是内核相关团队的一员,你可能启动过许多内核。如果你是固件相关团队的一员,你可能要启动许多不同的固件映像,接着是一个操作系统,来确保你的固件仍能工作。如果我们可以减少硬件的启动时间,这些团队可以更有生产力,并且终端用户在搭建系统或重启安装固件或系统更新的时候会对此表示感激。 + +过去的几年,Linux 发行版的启动时间已经做了很多改善。现代 init 系统在处理并行和按需任务上做得很好。在一个现代系统上,一旦内核开始执行,它可以在短短数秒内进入登陆提示符界面。这里短短的数秒不是优化启动时间的下手之处,我们得到更早的地方:在我们到达操作系统之前。 + +在 OpenPOWER 系统上,固件通过启动一个存储在固件闪存芯片上的 Linux 内核来加载操作系统,它运行一个叫做 [Petitboot][2] 的用户态程序去寻找用户想要启动的系统所在磁盘,并通过 [kexec][3] 启动它。有了这些优化,启动 Petitboot 环境只占了启动时间的个位数百分比,所以我们还得从其他地方寻找优化项。 + +在 Petitboot 环境启动前,有一个先导固件,叫做 [Skiboot][4],在它之前有个 [Hostboot][5]。在 Hostboot 之前是 [Self-Boot Engine][6],一个 die 上的单独核心,它启动单个 CPU 核心并执行来自 Level 3 缓存的指令。这些组件是我们可以在减少启动时间上取得进展的主要部分,因为它们花费了启动的绝大部分时间。或许这些组件中的一部分没有进行足够的优化或尽可能做到并行? + +另一个研究路径是重启时间而不是启动时间。在重启的时候,我们真的需要对所有硬件重新初始化吗? + +正如任何现代系统那样,改善启动(或重启)时间的方案已经变成了更多并行、解决遗留问题、(可以认为)作弊的结合体。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/booting-linux-faster + +作者:[Stewart Smith][a] +选题:[lujun9972][b] +译者:[alim0x](https://github.com/alim0x) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stewart-ibm +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/OpenBMC +[2]: https://github.com/open-power/petitboot +[3]: https://en.wikipedia.org/wiki/Kexec +[4]: https://github.com/open-power/skiboot +[5]: https://github.com/open-power/hostboot +[6]: https://github.com/open-power/sbe +[7]: https://linux.conf.au/schedule/presentation/105/ +[8]: https://linux.conf.au/ From 028ca6840b4aab5c9c243b609403fcf553201ef8 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 10 Mar 2019 01:30:30 +0800 Subject: [PATCH 525/813] Translated by qhwdw --- .../20190302 How to buy a Raspberry Pi.md | 51 ------------------- .../20190302 How to buy a Raspberry Pi.md | 51 +++++++++++++++++++ 2 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 sources/tech/20190302 How to buy a Raspberry Pi.md create mode 100644 translated/tech/20190302 How to buy a Raspberry Pi.md diff --git a/sources/tech/20190302 How to buy a Raspberry Pi.md b/sources/tech/20190302 How to buy a Raspberry Pi.md deleted file mode 100644 index bf4082d01d..0000000000 --- a/sources/tech/20190302 How to buy a Raspberry Pi.md +++ /dev/null @@ -1,51 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to buy a Raspberry Pi) -[#]: via: (https://opensource.com/article/19/3/how-buy-raspberry-pi) -[#]: author: (Anderson Silva https://opensource.com/users/ansilva) - -How to buy a Raspberry Pi -====== -Find out the best ways to get a Raspberry Pi in the second article in our getting started guide - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) - -The first article in this series on getting started with Raspberry Pi offered some advice on [which model you should buy][1]. Now that you have an idea of which version you want, let's find out how to get one. - -The most obvious—and probably the safest and simplest—way is through the [official Raspberry Pi website][2]. If you click on "Buy a Raspberry Pi" from the homepage, you'll be taken to the organization's [online store][3], where you can find authorized Raspberry Pi sellers in your country where you can place an order. If your country isn't listed, there is a "Rest of the World" option, which should let you put in an international order. - -Second, check Amazon.com or another major online technology retailer in your country that allows smaller shops to sell new and used items. Given the relatively low cost and size of the Raspberry Pi, it should be fairly easy for smaller shop owners to import and export the boards for reselling purposes. Before you place an order, keep an eye on the sellers' reviews though. - -Third, ask your geek friends! You never know if someone has an unused Raspberry Pi gathering dust. I have given at least three Raspberry Pis away to family, not as planned gifts, but because they were just so curious about this mini-computer. I had so many lying around that I just told them to keep one! - -### Don't forget the extras - -One final thought: don't forget that you'll need some peripherals to set up and operate your Raspberry Pi. At a minimum, you'll need a keyboard, an HDMI cable to connect to a display (and a display), a Micro SD card to install the operating system, a power cord, and a mouse will be handy, too. - -![](https://opensource.com/sites/default/files/uploads/raspberrypi_2a_pi0w-kit.jpg) - -If you don't already have these items, try borrowing them from friends or order them at the same time you buy your Raspberry Pi. You may want to consider one of the starter kits available from the authorized Raspberry Pi vendors—that will avoid the hassle of searching for parts one at a time. - -![](https://opensource.com/sites/default/files/uploads/raspberrypi_2b_pi3b.jpg) - -Now that you have a Raspberry Pi, in the next article in this series, we'll install the operating system and start using it. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/3/how-buy-raspberry-pi - -作者:[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/article/19/2/which-raspberry-pi-should-you-get -[2]: https://www.raspberrypi.org/ -[3]: https://www.raspberrypi.org/products/ diff --git a/translated/tech/20190302 How to buy a Raspberry Pi.md b/translated/tech/20190302 How to buy a Raspberry Pi.md new file mode 100644 index 0000000000..e1c3583f52 --- /dev/null +++ b/translated/tech/20190302 How to buy a Raspberry Pi.md @@ -0,0 +1,51 @@ +[#]: collector: "lujun9972" +[#]: translator: "qhwdw" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to buy a Raspberry Pi" +[#]: via: "https://opensource.com/article/19/3/how-buy-raspberry-pi" +[#]: author: "Anderson Silva https://opensource.com/users/ansilva" + +如何购买一个树莓派 +====== +在我们的《树莓派入门指南》系列文章的第二篇中,我们将介绍获取树莓派的最佳途径。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) + +在本系列指南的第一篇文章中,我们提供了一个关于 [你应该购买哪个版本的树莓派][1] 的一些建议。哪个版本才是你想要的,你应该有了主意了,现在,我们来看一下如何获得它。 + +最显而易见的方式— 并且也或许是最安全最简单的方式 —非[树莓派的官方网站][2] 莫属了。如果你从官网主页上点击“Buy a Raspberry Pi”,它将跳转到官方的 [在线商店][3],在那里,它可以给你提供你的国家所在地的授权销售商。如果你的国家没有在清单中,还有一个“其它”选项,它可以提供国际订购。 + +第二,查看亚马逊或在你的国家里允许销售新的或二手商品的其它主流技术类零售商。鉴于树莓派比较便宜并且尺寸很小,一些小商家基于转售目的的进出口它,应该是非常容易的。在你下订单时,一定要关注对卖家的评价。 + +第三,打听你的极客朋友!你可能从没想过一些人的树莓派正在“吃灰”。我已经给家人送了至少三个树莓派,当然它们并不是计划要送的礼物,只是因为他们对这个“迷你计算机”感到很好奇而已。我身边有好多个,因此我让他们拿走一个! + +### 不要忘了外设 + +最后一个建设是:不要忘了外设,你将需要一些外设去配置和操作你的树莓派。至少你会用到键盘、一个 HDMI 线缆去连接显示器、一个 Micro SD 卡去安装操作系统,一个供电线、以及一个好用的鼠标。 + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_2a_pi0w-kit.jpg) + +如果你没有准备好这些东西,试着从朋友那儿借用,或与树莓派一起购买。你可以从授权的树莓派销售商那儿考虑订购一个起步套装 — 它可以让你避免查找的麻烦而一次性搞定。 + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_2b_pi3b.jpg) + +现在,你有了树莓派,在本系列的下一篇文章中,我们将安装树莓派的操作系统并开始使用它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-buy-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者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/article/19/2/which-raspberry-pi-should-you-get +[2]: https://www.raspberrypi.org/ +[3]: https://www.raspberrypi.org/products/ From 2016492db107f38680cde8c0ab685f3fee467d1a Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 10 Mar 2019 09:47:47 +0800 Subject: [PATCH 526/813] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...easure Twice Compute Once with Xen Linux TPM 2.0 and TXT.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20171010 In Device We Trust Measure Twice Compute Once with Xen Linux TPM 2.0 and TXT.md b/sources/tech/20171010 In Device We Trust Measure Twice Compute Once with Xen Linux TPM 2.0 and TXT.md index 20c14074c6..3c61f6dd8f 100644 --- a/sources/tech/20171010 In Device We Trust Measure Twice Compute Once with Xen Linux TPM 2.0 and TXT.md +++ b/sources/tech/20171010 In Device We Trust Measure Twice Compute Once with Xen Linux TPM 2.0 and TXT.md @@ -1,3 +1,6 @@ +ezio is translating + + In Device We Trust: Measure Twice, Compute Once with Xen, Linux, TPM 2.0 and TXT ============================================================ From 52d784cfcf9815747807a1e2da5ef80938f640c8 Mon Sep 17 00:00:00 2001 From: cycoe Date: Sun, 10 Mar 2019 11:22:37 +0800 Subject: [PATCH 527/813] translated by cycoe --- ...ain- How to add one to your Python game.md | 138 +++++++++--------- 1 file changed, 68 insertions(+), 70 deletions(-) diff --git a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md index 52b46c1adb..a4a2138136 100644 --- a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md +++ b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md @@ -1,46 +1,44 @@ -Translating by cycoe -Cycoe 翻译中 -What's a hero without a villain? How to add one to your Python game +没有恶棍,英雄又将如何?如何向你的 Python 游戏中添加一个敌人 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z) -In the previous articles in this series (see [part 1][1], [part 2][2], [part 3][3], and [part 4][4]), you learned how to use Pygame and Python to spawn a playable character in an as-yet empty video game world. But, what's a hero without a villain? +在本系列的前几篇文章中(参见 [第一部分][1]、[第二部分][2]、[第三部分][3] 以及 [第四部分][4]),你已经学习了如何使用 Pygame 和 Python 在一个空白的视频游戏世界中生成一个可玩的角色。但没有恶棍,英雄又将如何? -It would make for a pretty boring game if you had no enemies, so in this article, you'll add an enemy to your game and construct a framework for building levels. +如果你没有敌人,那将会是一个非常无聊的游戏。所以在此篇文章中,你将为你的游戏添加一个敌人并构建一个用于创建关卡的框架。 -It might seem strange to jump ahead to enemies when there's still more to be done to make the player sprite fully functional, but you've learned a lot already, and creating villains is very similar to creating a player sprite. So relax, use the knowledge you already have, and see what it takes to stir up some trouble. +在对玩家妖精实现全部功能仍有许多事情可做之前,跳向敌人似乎就很奇怪。但你已经学到了很多东西,创造恶棍与与创造玩家妖精非常相似。所以放轻松,使用你已经掌握的知识,看看能挑起怎样一些麻烦。 -For this exercise, you can download some pre-built assets from [Open Game Art][5]. Here are some of the assets I use: +针对本次训练,你能够从 [Open Game Art][5] 下载一些预创建的素材。此处是我使用的一些素材: -+ Inca tileset -+ Some invaders -+ Sprites, characters, objects, and effects ++ 印加花砖(译注:游戏中使用的花砖贴图) ++ 一些侵略者 ++ 妖精、角色、物体以及特效 -### Creating the enemy sprite +### 创造敌方妖精 -Yes, whether you realize it or not, you basically already know how to implement enemies. The process is very similar to creating a player sprite: +是的,不管你意识到与否,你其实已经知道如何去实现敌人。这个过程与创造一个玩家妖精非常相似: - 1. Make a class so enemies can spawn. - 2. Create an `update` function so enemies can detect collisions. - 3. Create a `move` function so your enemy can roam around. + 1. 创建一个类用于敌人生成 + 2. 创建 `update` 方法使得敌人能够检测碰撞 + 3. 创建 `move` 方法使得敌人能够四处游荡 -Start with the class. Conceptually, it's mostly the same as your Player class. You set an image or series of images, and you set the sprite's starting position. +从类入手。从概念上看,它与你的 Player 类大体相同。你设置一张或者一组图片,然后设置妖精的初始位置。 -Before continuing, make sure you have a graphic for your enemy, even if it's just a temporary one. Place the graphic in your game project's `images` directory (the same directory where you placed your player image). +在继续下一步之前,确保你有一张你的敌人的图像,即使只是一张临时图像。将图像放在你的游戏项目的 `images` 目录(你放置你的玩家图像的相同目录)。 -A game looks a lot better if everything alive is animated. Animating an enemy sprite is done the same way as animating a player sprite. For now, though, keep it simple, and use a non-animated sprite. +如果所有的活物都拥有动画,那么游戏看起来会好得多。为敌方妖精设置动画与为玩家妖精设置动画具有相同的方式。但现在,为了保持简单,我们使用一个没有动画的妖精。 -At the top of the `objects` section of your code, create a class called Enemy with this code: +在你代码 `objects` 节的顶部,使用以下代码创建一个叫做 `Enemy` 的类: ``` class Enemy(pygame.sprite.Sprite):     ''' -    Spawn an enemy + 生成一个敌人     ''' @@ -62,45 +60,45 @@ class Enemy(pygame.sprite.Sprite): ``` -If you want to animate your enemy, do it the [same way][4] you animated your player. +如果你想让你的敌人动起来,使用让你的玩家拥有动画的 [相同方式][4]。 -### Spawning an enemy +### 生成一个敌人 -You can make the class useful for spawning more than just one enemy by allowing yourself to tell the class which image to use for the sprite and where in the world the sprite should appear. This means you can use this same enemy class to generate any number of enemy sprites anywhere in the game world. All you have to do is make a call to the class, and tell it which image to use and the X and Y coordinates of your desired spawn point. +你能够通过告诉类,妖精应使用哪张图像,应出现在世界上的什么地方,来生成不只一个敌人。这意味着,你能够使用相同的敌人类,在游戏世界的任意地方生成任意数量的敌方妖精。你需要做的仅仅是调用这个类,并告诉它应使用哪张图像,以及你期望生成点的 X 和 Y 坐标。 -Again, this is similar in principle to spawning a player sprite. In the `setup` section of your script, add this code: +再次,这从原则上与生成一个玩家精灵相似。在你脚本的 `setup` 节添加如下代码: ``` -enemy   = Enemy(20,200,'yeti.png')# spawn enemy +enemy   = Enemy(20,200,'yeti.png') # 生成敌人 -enemy_list = pygame.sprite.Group()   # create enemy group +enemy_list = pygame.sprite.Group() # 创建敌人组 -enemy_list.add(enemy)                # add enemy to group +enemy_list.add(enemy)              # 将敌人加入敌人组 ``` -In that sample code, `20` is the X position and `200` is the Y position. You might need to adjust these numbers, depending on how big your enemy sprite is, but try to get it to spawn in a place so that you can reach it with your player sprite. `Yeti.png` is the image used for the enemy. +在示例代码中,X 坐标为 20,Y 坐标为 200。你可能需要根据你的敌方妖精的大小,来调整这些数字,但尽量生成在一个地方,使得你的玩家妖精能够到它。`Yeti.png` 是用于敌人的图像。 -Next, draw all enemies in the enemy group to the screen. Right now, you have only one enemy, but you can add more later if you want. As long as you add an enemy to the enemies group, it will be drawn to the screen during the main loop. The middle line is the new line you need to add: +接下来,将敌人组的所有敌人绘制在屏幕上。现在,你只有一个敌人,如果你想要更多你可以稍后添加。一但你将一个敌人加入敌人组,它就会在主循环中被绘制在屏幕上。中间这一行是你需要添加的新行: ```     player_list.draw(world) -    enemy_list.draw(world)  # refresh enemies +    enemy_list.draw(world)  # 刷新敌人     pygame.display.flip() ``` -Launch your game. Your enemy appears in the game world at whatever X and Y coordinate you chose. +启动你的游戏,你的敌人会出现在游戏世界中你选择的 X 和 Y 坐标处。 -### Level one +### 关卡一 -Your game is in its infancy, but you will probably want to add another level. It's important to plan ahead when you program so your game can grow as you learn more about programming. Even though you don't even have one complete level yet, you should code as if you plan on having many levels. +你的游戏仍处在襁褓期,但你可能想要为它添加另一个关卡。为你的程序做好未来规划非常重要,因为随着你学会更多的编程技巧,你的程序也会随之成长。即使你现在仍没有一个完整的关卡,你也应该按照假设会有很多关卡来编程。 -Think about what a "level" is. How do you know you are at a certain level in a game? +思考一下“关卡”是什么。你如何知道你是在游戏中的一个特定关卡中呢? -You can think of a level as a collection of items. In a platformer, such as the one you are building here, a level consists of a specific arrangement of platforms, placement of enemies and loot, and so on. You can build a class that builds a level around your player. Eventually, when you create more than one level, you can use this class to generate the next level when your player reaches a specific goal. +你可以把关卡想成一系列项目的集合。就像你刚刚创建的这个平台中,一个关卡,包含了平台、敌人放置、赃物等的一个特定排列。你可以创建一个类,用来在你的玩家附近创建关卡。最终,当你创建了超过一个关卡,你就可以在你的玩家达到特定目标时,使用这个类生成下一个关卡。 -Move the code you wrote to create an enemy and its group into a new function that will be called along with each new level. It requires some modification so that each time you create a new level, you can create several enemies: +将你写的用于生成敌人及其群组的代码,移动到一个每次生成新关卡时都会被调用的新函数中。你需要做一些修改,使得每次你创建新关卡时,你都能够创建一些敌人。 ``` class Level(): @@ -108,11 +106,11 @@ class Level():         if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 -            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list = pygame.sprite.Group() # 生成敌人组 -            enemy_list.add(enemy)              # add enemy to group +            enemy_list.add(enemy)              # 将敌人加入敌人组         if lvl == 2: @@ -124,9 +122,9 @@ class Level(): ``` -The `return` statement ensures that when you use the `Level.bad` function, you're left with an `enemy_list` containing each enemy you defined. +`return` 语句确保了当你调用 `Level.bad` 方法时,你将会得到一个 `enemy_list` 变量包含了所有你定义的敌人。 -Since you are creating enemies as part of each level now, your `setup` section needs to change, too. Instead of creating an enemy, you must define where the enemy will spawn and what level it belongs to. +因为你现在将创造敌人作为每个关卡的一部分,你的 `setup` 部分也需要做些更改。不同于创造一个敌人,取而代之的是你必须去定义敌人在那里生成,以及敌人属于哪个关卡。 ``` eloc = [] @@ -136,15 +134,15 @@ enemy_list = Level.bad( 1, eloc ) ``` -Run the game again to confirm your level is generating correctly. You should see your player, as usual, and the enemy you added in this chapter. +再次运行游戏来确认你的关卡生成正确。与往常一样,你应该会看到你的玩家,并且能看到你在本章节中添加的敌人。 -### Hitting the enemy +### 痛击敌人 -An enemy isn't much of an enemy if it has no effect on the player. It's common for enemies to cause damage when a player collides with them. +一个敌人如果对玩家没有效果,那么它不太算得上是一个敌人。当玩家与敌人发生碰撞时,他们通常会对玩家造成伤害。 -Since you probably want to track the player's health, the collision check happens in the Player class rather than in the Enemy class. You can track the enemy's health, too, if you want. The logic and code are pretty much the same, but, for now, just track the player's health. +因为你可能想要去跟踪玩家的生命值,因此碰撞检测发生在 Player 类,而不是 Enemy 类中。当然如果你想,你也可以跟踪敌人的生命值。它们之间的逻辑与代码大体相似,现在,我们只需要跟踪玩家的生命值。 -To track player health, you must first establish a variable for the player's health. The first line in this code sample is for context, so add the second line to your Player class: +为了跟踪玩家的生命值,你必须为它确定一个变量。代码示例中的第一行是上下文提示,那么将第二行代码添加到你的 Player 类中: ```         self.frame  = 0 @@ -152,7 +150,7 @@ To track player health, you must first establish a variable for the player's hea ``` -In the `update` function of your Player class, add this code block: +在你 Player 类的 `update` 方法中,添加如下代码块: ```         hit_list = pygame.sprite.spritecollide(self, enemy_list, False) @@ -164,21 +162,21 @@ In the `update` function of your Player class, add this code block: ``` -This code establishes a collision detector using the Pygame function `sprite.spritecollide`, called `enemy_hit`. This collision detector sends out a signal any time the hitbox of its parent sprite (the player sprite, where this detector has been created) touches the hitbox of any sprite in `enemy_list`. The `for` loop is triggered when such a signal is received and deducts a point from the player's health. +这段代码使用 Pygame 的 `sprite.spritecollide` 方法,建立了一个碰撞检测器,称作 `enemy_hit`。每当它的父类妖精(生成检测器的玩家妖精)的碰撞区触碰到 `enemy_list` 中的任一妖精的碰撞区时,碰撞检测器都会发出一个信号。当这个信号被接收,`for` 循环就会被触发,同时扣除一点玩家生命值。 -Since this code appears in the `update` function of your player class and `update` is called in your main loop, Pygame checks for this collision once every clock tick. +一旦这段代码出现在你 Player 类的 `update` 方法,并且 `update` 方法在你的主循环中被调用,Pygame 会在每个时钟 tick 检测一次碰撞。 -### Moving the enemy +### 移动敌人 -An enemy that stands still is useful if you want, for instance, spikes or traps that can harm your player, but the game is more of a challenge if the enemies move around a little. +如果你愿意,静止不动的敌人也可以很有用,比如能够对你的玩家造成伤害的尖刺和陷阱。但如果敌人能够四处徘徊,那么游戏将更富有挑战。 -Unlike a player sprite, the enemy sprite is not controlled by the user. Its movements must be automated. +与玩家妖精不同,敌方妖精不是由玩家控制,因此它必须自动移动。 -Eventually, your game world will scroll, so how do you get an enemy to move back and forth within the game world when the game world itself is moving? +最终,你的游戏世界将会滚动。那么,如何在游戏世界自身滚动的情况下,使游戏世界中的敌人前后移动呢? -You tell your enemy sprite to take, for example, 10 paces to the right, then 10 paces to the left. An enemy sprite can't count, so you have to create a variable to keep track of how many paces your enemy has moved and program your enemy to move either right or left depending on the value of your counting variable. +举个例子,你告诉你的敌方妖精向右移动 10 步,向左移动 10 步。但敌方妖精不会计数,因此你需要创建一个变量来跟踪你的敌人已经移动了多少步,并根据计数变量的值来向左或向右移动你的敌人。 -First, create the counter variable in your Enemy class. Add the last line in this code sample: +首先,在你的 Enemy 类中创建计数变量。添加以下代码示例中的最后一行代码: ```         self.rect = self.image.get_rect() @@ -186,27 +184,27 @@ First, create the counter variable in your Enemy class. Add the last line in thi         self.rect.y = y -        self.counter = 0 # counter variable +        self.counter = 0 # 计数变量 ``` -Next, create a `move` function in your Enemy class. Use an if-else loop to create what is called an infinite loop: +然后,在你的 Enemy 类中创建一个 `move` 方法。使用 if-else 循环来创建一个所谓的死循环: - * Move right if the counter is on any number from 0 to 100. - * Move left if the counter is on any number from 100 to 200. - * Reset the counter back to 0 if the counter is greater than 200. + * 如果计数在 0 到 100 之间,向右移动; + * 如果计数在 100 到 200 之间,向左移动; + * 如果计数大于 200,则将计数重置为 0。 -An infinite loop has no end; it loops forever because nothing in the loop is ever untrue. The counter, in this case, is always either between 0 and 100 or 100 and 200, so the enemy sprite walks right to left and right to left forever. +死循环没有终点,因为循环判断条件永远为真,所以它将永远循环下去。在此情况下,计数器总是介于 0 到 100 或 100 到 200 之间,因此敌人会永远地从左向右再从右向左移动。 -The actual numbers you use for how far the enemy will move in either direction depending on your screen size, and possibly, eventually, the size of the platform your enemy is walking on. Start small and work your way up as you get used to the results. Try this first: +你用于敌人在每个方向上移动距离的具体值,取决于你的屏幕尺寸,更确切地说,取决于你的敌人移动的平台大小。从较小的值开始,依据习惯逐步提高数值。首先进行如下尝试: ```     def move(self):         ''' -        enemy movement + 敌人移动         ''' @@ -234,11 +232,11 @@ The actual numbers you use for how far the enemy will move in either direction d ``` -You can adjust the distance and speed as needed. +你可以根据需要调整距离和速度。 -Will this code work if you launch your game now? +当你现在启动游戏,这段代码有效果吗? -Of course not, and you probably know why. You must call the `move` function in your main loop. The first line in this sample code is for context, so add the last two lines: +当然不,你应该也知道原因。你必须在主循环中调用 `move` 方法。如下示例代码中的第一行是上下文提示,那么添加最后两行代码: ```     enemy_list.draw(world) #refresh enemy @@ -248,13 +246,13 @@ Of course not, and you probably know why. You must call the `move` function in y ``` -Launch your game and see what happens when you hit your enemy. You might have to adjust where the sprites spawn so that your player and your enemy sprite can collide. When they do collide, look in the console of [IDLE][6] or [Ninja-IDE][7] to see the health points being deducted. +启动你的游戏看看当你打击敌人时发生了什么。你可能需要调整妖精的生成地点,使得你的玩家和敌人能够碰撞。当他们发生碰撞时,查看 [IDLE][6] 或 [Ninja-IDE][7] 的控制台,你可以看到生命值正在被扣除。 ![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/yeti.png?itok=4_GsDGor) -You may notice that health is deducted for every moment your player and enemy are touching. That's a problem, but it's a problem you'll solve later, after you've had more practice with Python. +你应该已经注意到,在你的玩家和敌人接触时,生命值在时刻被扣除。这是一个问题,但你将在对 Python 进行更多练习以后解决它。 -For now, try adding some more enemies. Remember to add each enemy to the `enemy_list`. As an exercise, see if you can think of how you can change how far different enemy sprites move. +现在,尝试添加更多敌人。记得将每个敌人加入 `enemy_list`。作为一个练习,看看你能否想到如何改变不同敌方妖精的移动距离。 -------------------------------------------------------------------------------- @@ -262,7 +260,7 @@ via: https://opensource.com/article/18/5/pygame-enemy 作者:[Seth Kenlon][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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 4df9beff566ce3d1127f2e652482e9be3f0764c7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 11:24:08 +0800 Subject: [PATCH 528/813] PRF:20190208 7 steps for hunting down Python code bugs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @LazyWolfLin 翻译的很好 --- ...steps for hunting down Python code bugs.md | 64 ++++++++++--------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index 5f280ae17c..fe8ee12d47 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -1,34 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (7 steps for hunting down Python code bugs) [#]: via: (https://opensource.com/article/19/2/steps-hunting-code-python-bugs) [#]: author: (Maria Mckinley https://opensource.com/users/parody) -7 步检查 Python 代码错误 +Python 七步捉虫法 ====== -了解一些技巧助你减少代码查错时间。 + +> 了解一些技巧助你减少代码查错时间。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) -在周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经移动了的通知。 +现在是周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经搬家了的通知。 -结果这些日志被转移到了你获取不到的地方,但他们正在导到一个网页应用中——所以你将可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。这个应用预计会在几天内完成。我知道,这完全不符合实际情况,对吧?然而并不是,日志或者日志消息似乎经常在错误的时间出现缺失。在我们开始查错前,一个忠告:经常检查你的日志以确保他们在你认为它们应该在的地方并记录你认为它们应该记的东西。当你不检查的时候,这些东西往往会发生令人惊讶的变化。 +结果这些日志被转移到了你获取不到的地方,但它们正在导入到一个网页应用中——所以到时候你可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。这个应用预计会在几天内完成。我知道,你觉得这完全不切实际。然而并不是,日志或者日志消息似乎经常在错误的时间消失不见。在我们开始查错前,一个忠告:经常检查你的日志以确保它们还在你认为它们应该在的地方,并记录你认为它们应该记的东西。当你不注意的时候,这些东西往往会发生令人惊讶的变化。 好的,你找到了日志或者尝试了呼叫运维人员,而客户确实发现了一个错误。甚至你可能认为你已经知道错误在哪儿。 你立即打开你认为可能有问题的文件并开始查错。 -### 1. 不要碰你的代码 +### 1、先不要碰你的代码 -阅读代码,你甚至可能会想到一个假设。但是在开始修改你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有其他疑问,目前你还没能准确地知道问题在哪儿。 +阅读代码,你甚至可能会想到该阅读哪些部分。但是在开始搞乱你的代码前,请重现导致错误的调用并把它变成一个测试。这将是一个集成测试,因为你可能还有其他疑问,目前你还不能准确地知道问题在哪儿。 -确保这个测试是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。当我尝试着重现这个失败的调用时,我不准备说我创建了一个新测试,但是,对的,我确实已经创建了新的一个测试,但我不认为这是特别不寻常的。从自己的错误中吸取教训。 +确保这个测试结果是失败的。这很重要,因为有时你的测试不能重现失败的调用,尤其是你使用了可以混淆测试的 web 或者其他框架。很多东西可能被存储在变量中,但遗憾的是,只通过观察测试,你在测试里调用的东西并不总是明显可见的。当我尝试着重现这个失败的调用时,我并不是说我要创建一个可以通过的测试,但是,好吧,我确实是创建了一个测试,但我不认为这特别不寻常。 -### 2. 编写错误的测试 +> 从自己的错误中吸取教训。 -现在,你有了一个失败的测试或者可能是一个带有错误的测试,那么是时候解决问题了。但是在你开干之前,让我们先检查下调用栈,因为这样可以更轻松地解决问题。 +### 2、编写错误的测试 + +现在,你有了一个失败的测试,或者可能是一个带有错误的测试,那么是时候解决问题了。但是在你开干之前,让我们先检查下调用栈,因为这样可以更轻松地解决问题。 调用栈包括你已经启动但尚未完成地所有任务。因此,比如你正在烤蛋糕并准备往面糊里加面粉,那你的调用栈将是: @@ -36,45 +40,47 @@ * 打面糊 * 加面粉 -你已经开始做蛋糕,开始打面糊,而你现在正在加面粉。往锅底抹油不在这个列表中因为你已经完成了,而做糖霜不在这个列表上因为你还没开始做。 +你已经开始做蛋糕,开始打面糊,而你现在正在加面粉。往锅底抹油不在这个列表中,因为你已经完成了,而做糖霜不在这个列表上因为你还没开始做。 如果你对调用栈不清楚,我强烈建议你使用 [Python Tutor][1],它能帮你在执行代码时观察调用栈。 -现在,如果你的 Python 程序出现了错误,接收器会帮你打印出当前调用栈。这意味着无论那一时刻程序在做什么,很明显错误发生在调用栈的底部。 +现在,如果你的 Python 程序出现了错误, Python 解释器会帮你打印出当前调用栈。这意味着无论那一时刻程序在做什么,很明显错误发生在调用栈的底部。 -### 3. 始终先检查 stack 的底部 +### 3、始终先检查调用栈底部 -你不仅能在栈底看到发生了哪个错误,而且通常可以在调用栈的最后一行发现问题。如果栈底对你没有帮助,而你的代码还没有经过代码分析,那么使用代码分析非常有用。我推荐 pylint 或者 flake8。通常情况下,它会指出我一直忽略的错误的地方。 +在栈底你不仅能看到发生了哪个错误,而且通常可以在调用栈的最后一行发现问题。如果栈底对你没有帮助,而你的代码还没有经过代码分析,那么使用代码分析是非常有用的。我推荐 pylint 或者 flake8。通常情况下,它会指出我一直忽略的错误的地方。 -如果对错误看起来很迷惑,你下一步行动可能是用 Google 搜索它。如果你搜索的内容不包含你的代码的相关信息,如变量名、文件等,那你将获得更好的搜索结果。如果你使用的是 Python 3(你应该使用它),那么搜索内容包含 Python 3 是有帮助的,否则 Python 2 的解决方案往往会占据大多数。 +如果错误看起来很迷惑,你下一步行动可能是用 Google 搜索它。如果你搜索的内容不包含你的代码的相关信息,如变量名、文件等,那你将获得更好的搜索结果。如果你使用的是 Python 3(你应该使用它),那么搜索内容包含 Python 3 是有帮助的,否则 Python 2 的解决方案往往会占据大多数。 -很久以前,开发者需要在没有搜索引擎的帮助下解决问题。那是一段黑暗的时光。充分利用你可以使用的所有工具。 +很久以前,开发者需要在没有搜索引擎的帮助下解决问题。那是一段黑暗时光。充分利用你可以使用的所有工具。 -不幸的是,有时候问题发生得比较早但只有在调用栈底部执行的地方才变得明显。就像当蛋糕没有膨胀时,忘记加发酵粉的事才被发现。 +不幸的是,有时候问题发生在更早阶段,但只有在调用栈底部执行的地方才显现出来。就像当蛋糕没有膨胀时,忘记加发酵粉的事才被发现。 -那就该检查整个调用栈。问题更可能在你的代码而不是 Python 标准库或者第三方包,所以先检查调用栈内你的代码。另外,在你的代码中放置断点通常会更容易检查代码。在调用栈的代码中放置断点然后看看周围是否如你预期。 +那就该检查整个调用栈。问题更可能在你的代码而不是 Python 标准库或者第三方包,所以先检查调用栈内你的代码。另外,在你的代码中放置断点通常会更容易检查代码。在调用栈的代码中放置断点,然后看看周围是否如你预期。 “但是,玛丽,”我听到你说,“如果我有一个调用栈,那这些都是有帮助的,但我只有一个失败的测试。我该从哪里开始?” -Pdb, 一个 Python 调试器。 +pdb,一个 Python 调试器。 找到你代码里会被这个调用命中的地方。你应该能够找到至少一个这样的地方。在那里打上一个 pdb 的断点。 #### 一句题外话 -为什么不使用 print 语句呢?我曾经依赖于 print 语句。有时候,他们仍然派得上用场。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,print 语句就变得太慢了。我最终得到所有打印出来的数据,但我没法追踪他们的位置和原因,而且他们变得复杂了。但是主要使用 pdb 还有一个更重要的原因。假设你添加一条 print 语句去发现错误问题,而且 print 语句必须早于错误出现的地方。但是,看看你放 print 语句的函数,你不知道你的代码是怎么执行到那个位置的。查看代码是寻找调用路径的好方法,但看你以前写的代码是恐怖的。是的,我会用 grep 处理我的代码库以寻找调用函数的地方,但这会变得乏味,而且搜索一个通用函数时并不能缩小搜索范围。Pdb 就变得非常有用。 +为什么不使用 `print` 语句呢?我曾经依赖于 `print` 语句。有时候,它们仍然很方便。但当我开始处理复杂的代码库,尤其是有网络调用的代码库,`print` 语句就变得太慢了。我最终在各种地方都加上了 `print` 语句,但我没法追踪它们的位置和原因,而且变得更复杂了。但是主要使用 pdb 还有一个更重要的原因。假设你添加一条 `print` 语句去发现错误问题,而且 `print` 语句必须早于错误出现的地方。但是,看看你放 `print` 语句的函数,你不知道你的代码是怎么执行到那个位置的。查看代码是寻找调用路径的好方法,但看你以前写的代码是恐怖的。是的,我会用 `grep` 处理我的代码库以寻找调用函数的地方,但这会变得乏味,而且搜索一个通用函数时并不能缩小搜索范围。pdb 就变得非常有用。 -你遵循我的建议,打上 pdb 断点并运行你的测试。然而测试再次失败,但是没有任何一个断点被打到。保留你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试,你应该能够找到一个测试。它会击中了你认为你的失败测试应该击中的代码。运行这个测试,然后当它打到你的断点,按下 `w` 并检查调用栈。如果你不知道如何查看因为其他调用而变得混乱的调用栈,那么在调用栈的中间找到属于你的代码,并在其中堆栈中代码的上一行放置一个断点。再试一次新的测试。如果仍然没打到断点,那么继续,向上追踪调用栈并找出你的调用在哪里脱轨了。如果你一直没有打到断点,最后到了追踪的顶部,那么恭喜你,你发现了问题:你的应用程序拼写错了。没有经验,没有经验,一点都没有经验。 +你遵循我的建议,打上 pdb 断点并运行你的测试。然而测试再次失败,但是没有任何一个断点被命中。留着你的断点,并运行测试套件中一个同这个失败的测试非常相似的测试。如果你有个不错的测试套件,你应该能够找到一个这样的测试。它会命中了你认为你的失败测试应该命中的代码。运行这个测试,然后当它运行到你的断点,按下 `w` 并检查调用栈。如果你不知道如何查看因为其他调用而变得混乱的调用栈,那么在调用栈的中间找到属于你的代码,并在堆栈中该代码的上一行放置一个断点。再试一次新的测试。如果仍然没命中断点,那么继续,向上追踪调用栈并找出你的调用在哪里脱轨了。如果你一直没有命中断点,最后到了追踪的顶部,那么恭喜你,你发现了问题:你的应用程序名称拼写错了。 -### 4. 修改代码 +> 没有经验,小白,一点都没有经验。 -如果你仍觉得迷惑,在你稍微改变了一些的地方尝试新的测试。你能让新的测试跑起来么?有什么不同的呢?有什么相同的呢?尝试改变别的东西。当你有了你的测试,可能也还有其他测试,那就可以开始安全地修改代码,确定是否可以缩小问题范围。记得从一个新提交开始解决问题,以便于可以轻松地撤销无效地更改。(这就是版本控制,如果你没有使用版本控制,这将会改变你的生活。好吧,可能它只是让编码更容易。查阅“版本控制可视指南”,以了解更多。) +### 4、修改代码 -### 5. 休息一下 +如果你仍觉得迷惑,在你稍微改变了一些的地方尝试新的测试。你能让新的测试跑起来么?有什么是不同的呢?有什么是相同的呢?尝试改变一下别的东西。当你有了你的测试,以及可能也还有其它的测试,那就可以开始安全地修改代码了,确定是否可以缩小问题范围。记得从一个新提交开始解决问题,以便于可以轻松地撤销无效地更改。(这就是版本控制,如果你没有使用过版本控制,这将会改变你的生活。好吧,可能它只是让编码更容易。查阅“[版本控制可视指南][2]”,以了解更多。) + +### 5、休息一下 尽管如此,当它不再感觉起来像一个有趣的挑战或者游戏而开始变得令人沮丧时,你最好的举措是脱离这个问题。休息一下。我强烈建议你去散步并尝试考虑别的事情。 -### 6. 把一切写下来 +### 6、把一切写下来 当你回来了,如果你没有突然受到启发,那就把你关于这个问题所知的每一个点信息写下来。这应该包括: @@ -85,11 +91,11 @@ Pdb, 一个 Python 调试器。 有时这里有很多信息,但相信我,从零碎中挖掘信息是很烦人。所以尽量简洁,但是要完整。 -### 7. 寻求帮助 +### 7、寻求帮助 -我经常发现写下所有信息能够启迪我想到还没尝试过的东西。当然,有时候我在点击提交按钮后立刻意识到问题是是什么。无论如何,当你在写下所有东西仍一无所获,那就试试向他人发邮件求助。首先是你的同事或者其他参与你的项目的人,然后是项目的邮件列表。不要害怕向人求助。大多数人都是友善和乐于助人的,我发现在 Python 社区里尤其如此。 +我经常发现写下所有信息能够启迪我想到还没尝试过的东西。当然,有时候我在点击求助邮件(或表单)的提交按钮后立刻意识到问题是是什么。无论如何,当你在写下所有东西仍一无所获时,那就试试向他人发邮件求助。首先是你的同事或者其他参与你的项目的人,然后是该项目的邮件列表。不要害怕向人求助。大多数人都是友善和乐于助人的,我发现在 Python 社区里尤其如此。 -Maria McKinley 将在 [PyCascades 2019][4] 发表[代码查错][3],二月 23-24,于西雅图。 +Maria McKinley 已在 [PyCascades 2019][4] 演讲 [代码查错][3],2 月 23-24,于西雅图。 -------------------------------------------------------------------------------- @@ -98,7 +104,7 @@ via: https://opensource.com/article/19/2/steps-hunting-code-python-bugs 作者:[Maria Mckinley][a] 选题:[lujun9972][b] 译者:[LazyWolfLin](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 41502a9b2ded9f3676c8055a3c12be5aa0f4117d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 11:25:28 +0800 Subject: [PATCH 529/813] PRF:20190208 7 steps for hunting down Python code bugs.md --- .../tech/20190208 7 steps for hunting down Python code bugs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/translated/tech/20190208 7 steps for hunting down Python code bugs.md index fe8ee12d47..ac4e014bec 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/translated/tech/20190208 7 steps for hunting down Python code bugs.md @@ -14,7 +14,7 @@ Python 七步捉虫法 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews) -现在是周五的下午三点钟。为什么是这个时间?因为事情总会在周五下午三点钟发生。你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经搬家了的通知。 +在周五的下午三点钟(为什么是这个时间?因为事情总会在周五下午三点钟发生),你收到一条通知,客户发现你的软件出现一个错误。在有了初步的怀疑后,你联系运维,查看你的软件日志以了解发生了什么,因为你记得收到过日志已经搬家了的通知。 结果这些日志被转移到了你获取不到的地方,但它们正在导入到一个网页应用中——所以到时候你可以用这个漂亮的应用来检索日志,但是,这个应用现在还没完成。这个应用预计会在几天内完成。我知道,你觉得这完全不切实际。然而并不是,日志或者日志消息似乎经常在错误的时间消失不见。在我们开始查错前,一个忠告:经常检查你的日志以确保它们还在你认为它们应该在的地方,并记录你认为它们应该记的东西。当你不注意的时候,这些东西往往会发生令人惊讶的变化。 From 1be482d6e59a4c3968afb2ce078bbd49f3f09b5e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 11:26:19 +0800 Subject: [PATCH 530/813] PUB:20190208 7 steps for hunting down Python code bugs.md @LazyWolfLin https://linux.cn/article-10603-1.html --- .../20190208 7 steps for hunting down Python code bugs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190208 7 steps for hunting down Python code bugs.md (99%) diff --git a/translated/tech/20190208 7 steps for hunting down Python code bugs.md b/published/20190208 7 steps for hunting down Python code bugs.md similarity index 99% rename from translated/tech/20190208 7 steps for hunting down Python code bugs.md rename to published/20190208 7 steps for hunting down Python code bugs.md index ac4e014bec..1d89b8fd2d 100644 --- a/translated/tech/20190208 7 steps for hunting down Python code bugs.md +++ b/published/20190208 7 steps for hunting down Python code bugs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10603-1.html) [#]: subject: (7 steps for hunting down Python code bugs) [#]: via: (https://opensource.com/article/19/2/steps-hunting-code-python-bugs) [#]: author: (Maria Mckinley https://opensource.com/users/parody) From d038711d15af367dd27c24bdb1858b2272c61a11 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 11:43:40 +0800 Subject: [PATCH 531/813] PRF:20190109 Configure Anaconda on Emacs - iD.md @lujun9972 --- ...190109 Configure Anaconda on Emacs - iD.md | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/translated/tech/20190109 Configure Anaconda on Emacs - iD.md b/translated/tech/20190109 Configure Anaconda on Emacs - iD.md index 09dcfd9a1c..030aaaab56 100644 --- a/translated/tech/20190109 Configure Anaconda on Emacs - iD.md +++ b/translated/tech/20190109 Configure Anaconda on Emacs - iD.md @@ -1,25 +1,23 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(Configure Anaconda on Emacs – iD) -[#]:via:(https://idevji.com/configure-anaconda-on-emacs/) -[#]:author:(Devji Chhanga https://idevji.com/author/admin/) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Configure Anaconda on Emacs – iD) +[#]: via: (https://idevji.com/configure-anaconda-on-emacs/) +[#]: author: (Devji Chhanga https://idevji.com/author/admin/) 在 Emacs 上配置 Anaconda ====== -也许我所最求的究极 IDE 就是 [Emacs][1] 了。我的目标是使 Emacs 成为一款全能的 Python IDE。本文描述了如何在 Emacs 上配置 Anaconda。 +也许我所追求的究极 IDE 就是 [Emacs][1] 了。我的目标是使 Emacs 成为一款全能的 Python IDE。本文描述了如何在 Emacs 上配置 Anaconda。(LCTT 译注:Anaconda 自称“世界上最流行的 Python/R 的数据分析平台”) 我的配置信息: -``` -OS: Trisquel 8.0 -Emacs: GNU Emacs 25.3.2 -``` +- OS:Trisquel 8.0 +- Emacs:GNU Emacs 25.3.2 -快捷键说明 [(参见完全指南 )][2]: +快捷键说明([参见完全指南][2]): ``` C-x = Ctrl + x @@ -27,25 +25,26 @@ M-x = Alt + x RET = ENTER ``` -### 1。下载并安装 Anaconda +### 1、下载并安装 Anaconda -#### 1.1 下载: -[从这儿 ][3] 下载 Anaconda。你应该下载 Python 3.x 版本因为 Python 2 在 2020 年就不再支持了。你无需预先安装 Python 3.x。安装脚本会自动进行安装。 +#### 1.1 下载 -#### 1.2 安装: +[从这儿][3] 下载 Anaconda。你应该下载 Python 3.x 的版本,因为 Python 2 在 2020 年就不再支持了。你无需预先安装 Python 3.x。这个安装脚本会自动安装它。 + +#### 1.2 安装 ``` - cd ~/Downloads +cd ~/Downloads bash Anaconda3-2018.12-Linux-x86.sh ``` - -### 2。将 Anaconda 添加到 Emacs +### 2、将 Anaconda 添加到 Emacs #### 2.1 将 MELPA 添加到 Emacs -我们需要用到 _anaconda-mode_ 这个 Emacs 包。该包位于 MELPA 仓库中。Emacs25 需要手工添加该仓库。 -[注意:点击本文查看如何将 MELPA 添加到 Emacs。][4] +我们需要用到 `anaconda-mode` 这个 Emacs 包。该包位于 MELPA 仓库中。Emacs25 需要手工添加该仓库。 + +- [注意:点击本文查看如何将 MELPA 添加到 Emacs][4] #### 2.2 为 Emacs 安装 anaconda-mode 包 @@ -60,8 +59,7 @@ anaconda-mode RET echo "(add-hook 'python-mode-hook 'anaconda-mode)" > ~/.emacs.d/init.el ``` - -### 3。在 Emacs 上通过 Anaconda 运行你第一个脚本 +### 3、在 Emacs 上通过 Anaconda 运行你第一个脚本 #### 3.1 创建新 .py 文件 @@ -83,7 +81,7 @@ C-c C-p C-c C-c ``` -输出为 +输出为: ``` Python 3.7.1 (default, Dec 14 2018, 19:46:24) @@ -94,8 +92,9 @@ Type "help", "copyright", "credits" or "license" for more information. >>> ``` -我是受到 [Codingquark;][5] 的影响才开始使用 Emacs 的。 -有任何错误和遗漏请在评论中之处。干杯! +我是受到 [Codingquark][5] 的影响才开始使用 Emacs 的。 + +有任何错误和遗漏请在评论中写下。干杯! -------------------------------------------------------------------------------- @@ -104,7 +103,7 @@ via: https://idevji.com/configure-anaconda-on-emacs/ 作者:[Devji Chhanga][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 93ae803454886f8f281e59cdd317f35772643b14 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 11:44:19 +0800 Subject: [PATCH 532/813] PUB:20190109 Configure Anaconda on Emacs - iD.md @lujun9972 https://linux.cn/article-10604-1.html --- .../20190109 Configure Anaconda on Emacs - iD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190109 Configure Anaconda on Emacs - iD.md (97%) diff --git a/translated/tech/20190109 Configure Anaconda on Emacs - iD.md b/published/20190109 Configure Anaconda on Emacs - iD.md similarity index 97% rename from translated/tech/20190109 Configure Anaconda on Emacs - iD.md rename to published/20190109 Configure Anaconda on Emacs - iD.md index 030aaaab56..5c6125e2e9 100644 --- a/translated/tech/20190109 Configure Anaconda on Emacs - iD.md +++ b/published/20190109 Configure Anaconda on Emacs - iD.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10604-1.html) [#]: subject: (Configure Anaconda on Emacs – iD) [#]: via: (https://idevji.com/configure-anaconda-on-emacs/) [#]: author: (Devji Chhanga https://idevji.com/author/admin/) From 2e1a8ae8d31b32142d373ccfba61b6692bfcadd8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 11:48:13 +0800 Subject: [PATCH 533/813] Revert "Translated by cycoe" --- ...ain- How to add one to your Python game.md | 138 +++++++++--------- 1 file changed, 70 insertions(+), 68 deletions(-) diff --git a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md index a4a2138136..52b46c1adb 100644 --- a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md +++ b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md @@ -1,44 +1,46 @@ -没有恶棍,英雄又将如何?如何向你的 Python 游戏中添加一个敌人 +Translating by cycoe +Cycoe 翻译中 +What's a hero without a villain? How to add one to your Python game ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z) -在本系列的前几篇文章中(参见 [第一部分][1]、[第二部分][2]、[第三部分][3] 以及 [第四部分][4]),你已经学习了如何使用 Pygame 和 Python 在一个空白的视频游戏世界中生成一个可玩的角色。但没有恶棍,英雄又将如何? +In the previous articles in this series (see [part 1][1], [part 2][2], [part 3][3], and [part 4][4]), you learned how to use Pygame and Python to spawn a playable character in an as-yet empty video game world. But, what's a hero without a villain? -如果你没有敌人,那将会是一个非常无聊的游戏。所以在此篇文章中,你将为你的游戏添加一个敌人并构建一个用于创建关卡的框架。 +It would make for a pretty boring game if you had no enemies, so in this article, you'll add an enemy to your game and construct a framework for building levels. -在对玩家妖精实现全部功能仍有许多事情可做之前,跳向敌人似乎就很奇怪。但你已经学到了很多东西,创造恶棍与与创造玩家妖精非常相似。所以放轻松,使用你已经掌握的知识,看看能挑起怎样一些麻烦。 +It might seem strange to jump ahead to enemies when there's still more to be done to make the player sprite fully functional, but you've learned a lot already, and creating villains is very similar to creating a player sprite. So relax, use the knowledge you already have, and see what it takes to stir up some trouble. -针对本次训练,你能够从 [Open Game Art][5] 下载一些预创建的素材。此处是我使用的一些素材: +For this exercise, you can download some pre-built assets from [Open Game Art][5]. Here are some of the assets I use: -+ 印加花砖(译注:游戏中使用的花砖贴图) -+ 一些侵略者 -+ 妖精、角色、物体以及特效 ++ Inca tileset ++ Some invaders ++ Sprites, characters, objects, and effects -### 创造敌方妖精 +### Creating the enemy sprite -是的,不管你意识到与否,你其实已经知道如何去实现敌人。这个过程与创造一个玩家妖精非常相似: +Yes, whether you realize it or not, you basically already know how to implement enemies. The process is very similar to creating a player sprite: - 1. 创建一个类用于敌人生成 - 2. 创建 `update` 方法使得敌人能够检测碰撞 - 3. 创建 `move` 方法使得敌人能够四处游荡 + 1. Make a class so enemies can spawn. + 2. Create an `update` function so enemies can detect collisions. + 3. Create a `move` function so your enemy can roam around. -从类入手。从概念上看,它与你的 Player 类大体相同。你设置一张或者一组图片,然后设置妖精的初始位置。 +Start with the class. Conceptually, it's mostly the same as your Player class. You set an image or series of images, and you set the sprite's starting position. -在继续下一步之前,确保你有一张你的敌人的图像,即使只是一张临时图像。将图像放在你的游戏项目的 `images` 目录(你放置你的玩家图像的相同目录)。 +Before continuing, make sure you have a graphic for your enemy, even if it's just a temporary one. Place the graphic in your game project's `images` directory (the same directory where you placed your player image). -如果所有的活物都拥有动画,那么游戏看起来会好得多。为敌方妖精设置动画与为玩家妖精设置动画具有相同的方式。但现在,为了保持简单,我们使用一个没有动画的妖精。 +A game looks a lot better if everything alive is animated. Animating an enemy sprite is done the same way as animating a player sprite. For now, though, keep it simple, and use a non-animated sprite. -在你代码 `objects` 节的顶部,使用以下代码创建一个叫做 `Enemy` 的类: +At the top of the `objects` section of your code, create a class called Enemy with this code: ``` class Enemy(pygame.sprite.Sprite):     ''' - 生成一个敌人 +    Spawn an enemy     ''' @@ -60,45 +62,45 @@ class Enemy(pygame.sprite.Sprite): ``` -如果你想让你的敌人动起来,使用让你的玩家拥有动画的 [相同方式][4]。 +If you want to animate your enemy, do it the [same way][4] you animated your player. -### 生成一个敌人 +### Spawning an enemy -你能够通过告诉类,妖精应使用哪张图像,应出现在世界上的什么地方,来生成不只一个敌人。这意味着,你能够使用相同的敌人类,在游戏世界的任意地方生成任意数量的敌方妖精。你需要做的仅仅是调用这个类,并告诉它应使用哪张图像,以及你期望生成点的 X 和 Y 坐标。 +You can make the class useful for spawning more than just one enemy by allowing yourself to tell the class which image to use for the sprite and where in the world the sprite should appear. This means you can use this same enemy class to generate any number of enemy sprites anywhere in the game world. All you have to do is make a call to the class, and tell it which image to use and the X and Y coordinates of your desired spawn point. -再次,这从原则上与生成一个玩家精灵相似。在你脚本的 `setup` 节添加如下代码: +Again, this is similar in principle to spawning a player sprite. In the `setup` section of your script, add this code: ``` -enemy   = Enemy(20,200,'yeti.png') # 生成敌人 +enemy   = Enemy(20,200,'yeti.png')# spawn enemy -enemy_list = pygame.sprite.Group() # 创建敌人组 +enemy_list = pygame.sprite.Group()   # create enemy group -enemy_list.add(enemy)              # 将敌人加入敌人组 +enemy_list.add(enemy)                # add enemy to group ``` -在示例代码中,X 坐标为 20,Y 坐标为 200。你可能需要根据你的敌方妖精的大小,来调整这些数字,但尽量生成在一个地方,使得你的玩家妖精能够到它。`Yeti.png` 是用于敌人的图像。 +In that sample code, `20` is the X position and `200` is the Y position. You might need to adjust these numbers, depending on how big your enemy sprite is, but try to get it to spawn in a place so that you can reach it with your player sprite. `Yeti.png` is the image used for the enemy. -接下来,将敌人组的所有敌人绘制在屏幕上。现在,你只有一个敌人,如果你想要更多你可以稍后添加。一但你将一个敌人加入敌人组,它就会在主循环中被绘制在屏幕上。中间这一行是你需要添加的新行: +Next, draw all enemies in the enemy group to the screen. Right now, you have only one enemy, but you can add more later if you want. As long as you add an enemy to the enemies group, it will be drawn to the screen during the main loop. The middle line is the new line you need to add: ```     player_list.draw(world) -    enemy_list.draw(world)  # 刷新敌人 +    enemy_list.draw(world)  # refresh enemies     pygame.display.flip() ``` -启动你的游戏,你的敌人会出现在游戏世界中你选择的 X 和 Y 坐标处。 +Launch your game. Your enemy appears in the game world at whatever X and Y coordinate you chose. -### 关卡一 +### Level one -你的游戏仍处在襁褓期,但你可能想要为它添加另一个关卡。为你的程序做好未来规划非常重要,因为随着你学会更多的编程技巧,你的程序也会随之成长。即使你现在仍没有一个完整的关卡,你也应该按照假设会有很多关卡来编程。 +Your game is in its infancy, but you will probably want to add another level. It's important to plan ahead when you program so your game can grow as you learn more about programming. Even though you don't even have one complete level yet, you should code as if you plan on having many levels. -思考一下“关卡”是什么。你如何知道你是在游戏中的一个特定关卡中呢? +Think about what a "level" is. How do you know you are at a certain level in a game? -你可以把关卡想成一系列项目的集合。就像你刚刚创建的这个平台中,一个关卡,包含了平台、敌人放置、赃物等的一个特定排列。你可以创建一个类,用来在你的玩家附近创建关卡。最终,当你创建了超过一个关卡,你就可以在你的玩家达到特定目标时,使用这个类生成下一个关卡。 +You can think of a level as a collection of items. In a platformer, such as the one you are building here, a level consists of a specific arrangement of platforms, placement of enemies and loot, and so on. You can build a class that builds a level around your player. Eventually, when you create more than one level, you can use this class to generate the next level when your player reaches a specific goal. -将你写的用于生成敌人及其群组的代码,移动到一个每次生成新关卡时都会被调用的新函数中。你需要做一些修改,使得每次你创建新关卡时,你都能够创建一些敌人。 +Move the code you wrote to create an enemy and its group into a new function that will be called along with each new level. It requires some modification so that each time you create a new level, you can create several enemies: ``` class Level(): @@ -106,11 +108,11 @@ class Level():         if lvl == 1: -            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy -            enemy_list = pygame.sprite.Group() # 生成敌人组 +            enemy_list = pygame.sprite.Group() # create enemy group -            enemy_list.add(enemy)              # 将敌人加入敌人组 +            enemy_list.add(enemy)              # add enemy to group         if lvl == 2: @@ -122,9 +124,9 @@ class Level(): ``` -`return` 语句确保了当你调用 `Level.bad` 方法时,你将会得到一个 `enemy_list` 变量包含了所有你定义的敌人。 +The `return` statement ensures that when you use the `Level.bad` function, you're left with an `enemy_list` containing each enemy you defined. -因为你现在将创造敌人作为每个关卡的一部分,你的 `setup` 部分也需要做些更改。不同于创造一个敌人,取而代之的是你必须去定义敌人在那里生成,以及敌人属于哪个关卡。 +Since you are creating enemies as part of each level now, your `setup` section needs to change, too. Instead of creating an enemy, you must define where the enemy will spawn and what level it belongs to. ``` eloc = [] @@ -134,15 +136,15 @@ enemy_list = Level.bad( 1, eloc ) ``` -再次运行游戏来确认你的关卡生成正确。与往常一样,你应该会看到你的玩家,并且能看到你在本章节中添加的敌人。 +Run the game again to confirm your level is generating correctly. You should see your player, as usual, and the enemy you added in this chapter. -### 痛击敌人 +### Hitting the enemy -一个敌人如果对玩家没有效果,那么它不太算得上是一个敌人。当玩家与敌人发生碰撞时,他们通常会对玩家造成伤害。 +An enemy isn't much of an enemy if it has no effect on the player. It's common for enemies to cause damage when a player collides with them. -因为你可能想要去跟踪玩家的生命值,因此碰撞检测发生在 Player 类,而不是 Enemy 类中。当然如果你想,你也可以跟踪敌人的生命值。它们之间的逻辑与代码大体相似,现在,我们只需要跟踪玩家的生命值。 +Since you probably want to track the player's health, the collision check happens in the Player class rather than in the Enemy class. You can track the enemy's health, too, if you want. The logic and code are pretty much the same, but, for now, just track the player's health. -为了跟踪玩家的生命值,你必须为它确定一个变量。代码示例中的第一行是上下文提示,那么将第二行代码添加到你的 Player 类中: +To track player health, you must first establish a variable for the player's health. The first line in this code sample is for context, so add the second line to your Player class: ```         self.frame  = 0 @@ -150,7 +152,7 @@ enemy_list = Level.bad( 1, eloc ) ``` -在你 Player 类的 `update` 方法中,添加如下代码块: +In the `update` function of your Player class, add this code block: ```         hit_list = pygame.sprite.spritecollide(self, enemy_list, False) @@ -162,21 +164,21 @@ enemy_list = Level.bad( 1, eloc ) ``` -这段代码使用 Pygame 的 `sprite.spritecollide` 方法,建立了一个碰撞检测器,称作 `enemy_hit`。每当它的父类妖精(生成检测器的玩家妖精)的碰撞区触碰到 `enemy_list` 中的任一妖精的碰撞区时,碰撞检测器都会发出一个信号。当这个信号被接收,`for` 循环就会被触发,同时扣除一点玩家生命值。 +This code establishes a collision detector using the Pygame function `sprite.spritecollide`, called `enemy_hit`. This collision detector sends out a signal any time the hitbox of its parent sprite (the player sprite, where this detector has been created) touches the hitbox of any sprite in `enemy_list`. The `for` loop is triggered when such a signal is received and deducts a point from the player's health. -一旦这段代码出现在你 Player 类的 `update` 方法,并且 `update` 方法在你的主循环中被调用,Pygame 会在每个时钟 tick 检测一次碰撞。 +Since this code appears in the `update` function of your player class and `update` is called in your main loop, Pygame checks for this collision once every clock tick. -### 移动敌人 +### Moving the enemy -如果你愿意,静止不动的敌人也可以很有用,比如能够对你的玩家造成伤害的尖刺和陷阱。但如果敌人能够四处徘徊,那么游戏将更富有挑战。 +An enemy that stands still is useful if you want, for instance, spikes or traps that can harm your player, but the game is more of a challenge if the enemies move around a little. -与玩家妖精不同,敌方妖精不是由玩家控制,因此它必须自动移动。 +Unlike a player sprite, the enemy sprite is not controlled by the user. Its movements must be automated. -最终,你的游戏世界将会滚动。那么,如何在游戏世界自身滚动的情况下,使游戏世界中的敌人前后移动呢? +Eventually, your game world will scroll, so how do you get an enemy to move back and forth within the game world when the game world itself is moving? -举个例子,你告诉你的敌方妖精向右移动 10 步,向左移动 10 步。但敌方妖精不会计数,因此你需要创建一个变量来跟踪你的敌人已经移动了多少步,并根据计数变量的值来向左或向右移动你的敌人。 +You tell your enemy sprite to take, for example, 10 paces to the right, then 10 paces to the left. An enemy sprite can't count, so you have to create a variable to keep track of how many paces your enemy has moved and program your enemy to move either right or left depending on the value of your counting variable. -首先,在你的 Enemy 类中创建计数变量。添加以下代码示例中的最后一行代码: +First, create the counter variable in your Enemy class. Add the last line in this code sample: ```         self.rect = self.image.get_rect() @@ -184,27 +186,27 @@ enemy_list = Level.bad( 1, eloc )         self.rect.y = y -        self.counter = 0 # 计数变量 +        self.counter = 0 # counter variable ``` -然后,在你的 Enemy 类中创建一个 `move` 方法。使用 if-else 循环来创建一个所谓的死循环: +Next, create a `move` function in your Enemy class. Use an if-else loop to create what is called an infinite loop: - * 如果计数在 0 到 100 之间,向右移动; - * 如果计数在 100 到 200 之间,向左移动; - * 如果计数大于 200,则将计数重置为 0。 + * Move right if the counter is on any number from 0 to 100. + * Move left if the counter is on any number from 100 to 200. + * Reset the counter back to 0 if the counter is greater than 200. -死循环没有终点,因为循环判断条件永远为真,所以它将永远循环下去。在此情况下,计数器总是介于 0 到 100 或 100 到 200 之间,因此敌人会永远地从左向右再从右向左移动。 +An infinite loop has no end; it loops forever because nothing in the loop is ever untrue. The counter, in this case, is always either between 0 and 100 or 100 and 200, so the enemy sprite walks right to left and right to left forever. -你用于敌人在每个方向上移动距离的具体值,取决于你的屏幕尺寸,更确切地说,取决于你的敌人移动的平台大小。从较小的值开始,依据习惯逐步提高数值。首先进行如下尝试: +The actual numbers you use for how far the enemy will move in either direction depending on your screen size, and possibly, eventually, the size of the platform your enemy is walking on. Start small and work your way up as you get used to the results. Try this first: ```     def move(self):         ''' - 敌人移动 +        enemy movement         ''' @@ -232,11 +234,11 @@ enemy_list = Level.bad( 1, eloc ) ``` -你可以根据需要调整距离和速度。 +You can adjust the distance and speed as needed. -当你现在启动游戏,这段代码有效果吗? +Will this code work if you launch your game now? -当然不,你应该也知道原因。你必须在主循环中调用 `move` 方法。如下示例代码中的第一行是上下文提示,那么添加最后两行代码: +Of course not, and you probably know why. You must call the `move` function in your main loop. The first line in this sample code is for context, so add the last two lines: ```     enemy_list.draw(world) #refresh enemy @@ -246,13 +248,13 @@ enemy_list = Level.bad( 1, eloc ) ``` -启动你的游戏看看当你打击敌人时发生了什么。你可能需要调整妖精的生成地点,使得你的玩家和敌人能够碰撞。当他们发生碰撞时,查看 [IDLE][6] 或 [Ninja-IDE][7] 的控制台,你可以看到生命值正在被扣除。 +Launch your game and see what happens when you hit your enemy. You might have to adjust where the sprites spawn so that your player and your enemy sprite can collide. When they do collide, look in the console of [IDLE][6] or [Ninja-IDE][7] to see the health points being deducted. ![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/yeti.png?itok=4_GsDGor) -你应该已经注意到,在你的玩家和敌人接触时,生命值在时刻被扣除。这是一个问题,但你将在对 Python 进行更多练习以后解决它。 +You may notice that health is deducted for every moment your player and enemy are touching. That's a problem, but it's a problem you'll solve later, after you've had more practice with Python. -现在,尝试添加更多敌人。记得将每个敌人加入 `enemy_list`。作为一个练习,看看你能否想到如何改变不同敌方妖精的移动距离。 +For now, try adding some more enemies. Remember to add each enemy to the `enemy_list`. As an exercise, see if you can think of how you can change how far different enemy sprites move. -------------------------------------------------------------------------------- @@ -260,7 +262,7 @@ via: https://opensource.com/article/18/5/pygame-enemy 作者:[Seth Kenlon][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[cycoe](https://github.com/cycoe) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From aa0c1fa5fe539a2bf2a4df02014b19065c1fd413 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 10 Mar 2019 14:12:15 +0800 Subject: [PATCH 534/813] Translating by qhwdw --- sources/tech/20190304 Learn Linux with the Raspberry Pi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190304 Learn Linux with the Raspberry Pi.md b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md index 079e42dbc1..689c65da72 100644 --- a/sources/tech/20190304 Learn Linux with the Raspberry Pi.md +++ b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 94e40aab924c6d493d384c6d22adf6690aa5c87b Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 10 Mar 2019 14:58:15 +0800 Subject: [PATCH 535/813] Translated by qhwdw --- ...90304 Learn Linux with the Raspberry Pi.md | 53 ------------------- ...90304 Learn Linux with the Raspberry Pi.md | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 sources/tech/20190304 Learn Linux with the Raspberry Pi.md create mode 100644 translated/tech/20190304 Learn Linux with the Raspberry Pi.md diff --git a/sources/tech/20190304 Learn Linux with the Raspberry Pi.md b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md deleted file mode 100644 index 689c65da72..0000000000 --- a/sources/tech/20190304 Learn Linux with the Raspberry Pi.md +++ /dev/null @@ -1,53 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn Linux with the Raspberry Pi) -[#]: via: (https://opensource.com/article/19/3/learn-linux-raspberry-pi) -[#]: author: (Andersn Silva https://opensource.com/users/ansilva) - -Learn Linux with the Raspberry Pi -====== -The fourth article in our guide to getting started with the Raspberry Pi dives into the Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) - -In the [third article][1] in this series on getting started with Raspberry Pi, I shared info on installing Raspbian, the official version of Linux for Raspberry Pi. Now that you've installed Raspbian and booted up your new Pi, you're ready to start learning about Linux. - -It's impossible to tackle a topic as big as "how to use Linux" in a short article like this, so instead I'll give you some ideas about how you can use the Raspberry Pi to learn more about Linux in general. - -Start by spending time on the command line (aka the "terminal"). Linux [window managers][2] and graphical interfaces have come a long way since the mid-'90s. Nowadays you can use Linux by pointing-and-clicking on things, just as easily as you can in other operating systems. In my opinion, there is a difference between just "using Linux" and being "a Linux user," and the latter means at a minimum being able to navigate in the terminal. - -![](https://opensource.com/sites/default/files/uploads/man-terminal.png) - -If you want to become a Linux user, start by trying out the following on the command line: - - * Navigate your home directory with commands like **ls** , **cd** , and **pwd**. - * Create, delete, and rename directories using the **mkdir** , **rm** , **mv** , and **cp** commands. - * Create a text file with a command line editor such as Vi, Vim, Emacs, or Nano. - * Try out some other useful commands, such as **chmod** , **chown** , **w** , **cat** , **more** , **less** , **tail** , **free** , **df** , **ps** , **uname** , and **kill** - * Look around **/bin** and **/usr/bin** for other commands. - - - -The best way to get help with a command is by reading its "man page" (short for manual); type **man ** on the command line to pull it up. And make sure to search the internet for Linux command cheat sheets—you should find a lot of options that will help you learn. - -Raspbian, like most Linux distributions, has many commands and over time you will end up using some commands a lot more than others. I've been using Linux on the command line for over two decades, and there are still some commands that I've never used, even ones that have been around as long as I've been using Linux. - -At the end of the day, you can use your graphical interface environment to get work done faster, but make sure to dive into the Linux command line, for that's where you will get the true power and knowledge of the operating system. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/3/learn-linux-raspberry-pi - -作者:[Andersn 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/article/19/2/how-boot-new-raspberry-pi -[2]: https://opensource.com/article/18/8/window-manager diff --git a/translated/tech/20190304 Learn Linux with the Raspberry Pi.md b/translated/tech/20190304 Learn Linux with the Raspberry Pi.md new file mode 100644 index 0000000000..5946082838 --- /dev/null +++ b/translated/tech/20190304 Learn Linux with the Raspberry Pi.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn Linux with the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/learn-linux-raspberry-pi) +[#]: author: (Andersn Silva https://opensource.com/users/ansilva) + +用树莓派学 Linux +====== +我们的《树莓派使用入门》的第四篇文章将进入到 Linux 命令行。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) + +在本系列的 [第三篇文章][1] 中开始了我们的树莓派探索之旅,我分享了如何安装 `Raspbian`,它是树莓派的官方 Linux 版本。现在,你已经安装好了 `Raspbian` 并用它引导你的新树莓派,你已经具备学习 Linux 相关知识的条件了。 + +在这样简短的文章中去解决像“如何使用 Linux” 这样的宏大主题显然是不切实际的,因此,我只是给你提供一些如何使用树莓派来学习更多的 Linux 知识的一些创意而已。 + +我们花一些时间从命令行(又称“终端”)开始。自上世纪九十年代中期以来,Linux 的 [窗口管理器][2] 和图形界面已经得到长足的发展。如今,你可以在 Linux 上通过鼠标点击来做一些事情了,就如同其它的操作系统一样容易。在我看来,只是“使用 Linux”和成为“一个 Linux 用户”是有区别的,后者至少能够在终端中“遨游“。 + +![](https://opensource.com/sites/default/files/uploads/man-terminal.png) + +如果你想成为一个 Linux 用户,从终端中尝试以下的命令行开始: + + * 使用像 **ls**、**cd**、和 **pwd** 这样的命令导航到你的 Home 目录。 + * 使用 **mkdir**、**rm**、**mv**、和 **cp** 命令创建、删除、和重命名目录。 + * 使用命令行编辑器(如 Vi、Vim、Emacs 或 Nano)去创建一个文本文件。 + * 尝试一些其它命令,比如 **chmod**、**chown**、**w**、**cat**、**more**、**less**、**tail**、**free**、**df**、**ps**、**uname**、和 **kill**。 + * 尝试一下 **/bin** 和 **/usr/bin** 目录中的其它命令。 + + + +学习命令行的最佳方式还是阅读它的 “man 手册”(简称手册);在命令行中输入 **man ** 就可以像上面那样打开它。并且在互联网上搜索 Linux 命令速查表可以让你更清楚地了解命令的用法 — 你应该会找到一大堆能帮你学习的资料。 + +Raspbian 就像主流的 Linux 发行版一样有非常多的命令,假以时日,你最终将比其他人会用更多的命令。我使用 Linux 命令行已经超过二十年了,即便这样仍然有些一些命令我从来没有使用过,即便是那些我使用的过程中一直就存在的命令。 + +最后,你可以使用图形环境去更快地工作,但是只有深入到 Linux 命令行,你才能够获得操作系统真正的强大功能和知识。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/learn-linux-raspberry-pi + +作者:[Andersn Silva][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者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/article/19/2/how-boot-new-raspberry-pi +[2]: https://opensource.com/article/18/8/window-manager From 1df9b05a9e0af12a673757ec5f94bc1f05b8ba68 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 21:03:42 +0800 Subject: [PATCH 536/813] PRF:20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @qhwdw --- ...atory - Raspberry Pi- Lesson 9 Screen04.md | 127 +++++++++--------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md index 76573c4bd8..aad8af35f6 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md +++ b/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @@ -1,73 +1,72 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 9 Screen04) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) -计算机实验室 – 树莓派:课程 9 屏幕04 +计算机实验室之树莓派:课程 9 屏幕04 ====== 屏幕04 课程基于屏幕03 课程来构建,它教你如何操作文本。假设你已经有了[课程 8:屏幕03][1] 的操作系统代码,我们将以它为基础。 ### 1、操作字符串 -``` -变长函数在汇编代码中看起来似乎不好理解,然而 ,它却是非常有用和很强大的概念。 -``` - 能够绘制文本是极好的,但不幸的是,现在你只能绘制预先准备好的字符串。如果能够像命令行那样显示任何东西才是完美的,而理想情况下应该是,我们能够显示任何我们期望的东西。一如既往地,如果我们付出努力而写出一个非常好的函数,它能够操作我们所希望的所有字符串,而作为回报,这将使我们以后写代码更容易。曾经如此复杂的函数,在 C 语言编程中只不过是一个 `sprintf` 而已。这个函数基于给定的另一个字符串和作为描述的额外的一个参数而生成一个字符串。我们对这个函数感兴趣的地方是,这个函数是个变长函数。这意味着它可以带可变数量的参数。参数的数量取决于具体的格式字符串,因此它的参数的数量不能预先确定。 -完整的函数有许多选项,而我们在这里只列出了几个。在本教程中将要实现的选项我做了高亮处理,当然,你可以尝试去实现更多的选项。 +> 变长函数在汇编代码中看起来似乎不好理解,然而 ,它却是非常有用和很强大的概念。 -函数通过读取格式字符串来工作,然后使用下表的意思去解释它。一旦一个参数已经使用了,就不会再次考虑它了。函数 的返回值是写入的字符数。如果方法失败,将返回一个负数。 +这个完整的函数有许多选项,而我们在这里只列出了几个。在本教程中将要实现的选项我做了高亮处理,当然,你可以尝试去实现更多的选项。 + +函数通过读取格式化字符串来工作,然后使用下表的意思去解释它。一旦一个参数已经使用了,就不会再次考虑它了。函数的返回值是写入的字符数。如果方法失败,将返回一个负数。 表 1.1 sprintf 格式化规则 + | 选项 | 含义 | | -------------------------- | ------------------------------------------------------------ | -| ==Any character except %== | 复制字符到输出。 | -| ==%%== | 写一个 % 字符到输出。 | -| ==%c== | 将下一个参数写成字符格式。 | -| ==%d or %i== | 将下一个参数写成十进制的有符号整数。 | -| %e | 将下一个参数写成科学记数法,使用 eN 意思是 ×10N。 | -| %E | 将下一个参数写成科学记数法,使用 EN 意思是 ×10N。 | -| %f | 将下一个参数写成十进制的 IEEE 754 浮点数。 | -| %g | 与 %e 和 %f 的指数表示形式相同。 | -| %G | 与 %E 和 %f 的指数表示形式相同。 | -| ==%o== | 将下一个参数写成八进制的无符号整数。 | -| ==%s== | 下一个参数如果是一个指针,将它写成空终止符字符串。 | -| ==%u== | 将下一个参数写成十进制无符号整数。 | -| ==%x== | 将下一个参数写成十六进制无符号整数(使用小写的 a、b、c、d、e 和 f)。 | -| %X | 将下一个参数写成十六进制的无符号整数(使用大写的 A、B、C、D、E 和 F)。 | -| %p | 将下一个参数写成指针地址。 | -| ==%n== | 什么也不输出。而是复制到目前为止被下一个参数在本地处理的字符个数。 | +| ==除了 `%` 之外的任何支付== | 复制字符到输出。 | +| ==`%%`== | 写一个 % 字符到输出。 | +| ==`%c`== | 将下一个参数写成字符格式。 | +| ==`%d` 或 `%i`== | 将下一个参数写成十进制的有符号整数。 | +| `%e` | 将下一个参数写成科学记数法,使用 eN,意思是 ×10N。 | +| `%E` | 将下一个参数写成科学记数法,使用 EN,意思是 ×10N。 | +| `%f` | 将下一个参数写成十进制的 IEEE 754 浮点数。 | +| `%g` | 与 `%e` 和 `%f` 的指数表示形式相同。 | +| `%G` | 与 `%E` 和 `%f` 的指数表示形式相同。 | +| ==`%o`== | 将下一个参数写成八进制的无符号整数。 | +| ==`%s`== | 下一个参数如果是一个指针,将它写成空终止符字符串。 | +| ==`%u`== | 将下一个参数写成十进制无符号整数。 | +| ==`%x`== | 将下一个参数写成十六进制无符号整数(使用小写的 a、b、c、d、e 和 f)。 | +| `%X` | 将下一个参数写成十六进制的无符号整数(使用大写的 A、B、C、D、E 和 F)。 | +| `%p` | 将下一个参数写成指针地址。 | +| ==`%n`== | 什么也不输出。而是复制到目前为止被下一个参数在本地处理的字符个数。 | 除此之外,对序列还有许多额外的处理,比如指定最小长度,符号等等。更多信息可以在 [sprintf - C++ 参考][2] 上找到。 下面是调用方法和返回的结果的示例。 表 1.2 sprintf 调用示例 + | 格式化字符串 | 参数 | 结果 | -| "%d" | 13 | "13" | -| "+%d degrees" | 12 | "+12 degrees" | -| "+%x degrees" | 24 | "+1c degrees" | -| "'%c' = 0%o" | 65, 65 | "'A' = 0101" | -| "%d * %d%% = %d" | 200, 40, 80 | "200 * 40% = 80" | -| "+%d degrees" | -5 | "+-5 degrees" | -| "+%u degrees" | -5 | "+4294967291 degrees" | +|---------------|-------|---------------------| +| `"%d"` | 13 | "13" | +| `"+%d degrees"` | 12 | "+12 degrees" | +| `"+%x degrees"` | 24 | "+1c degrees" | +| `"'%c' = 0%o"` | 65, 65 | "'A' = 0101" | +| `"%d * %d%% = %d"` | 200, 40, 80 | "200 * 40% = 80" | +| `"+%d degrees"` | -5 | "+-5 degrees" | +| `"+%u degrees"` | -5 | "+4294967291 degrees" | 希望你已经看到了这个函数是多么有用。实现它需要大量的编程工作,但给我们的回报却是一个非常有用的函数,可以用于各种用途。 ### 2、除法 -``` -除法是非常慢的,也是非常复杂的基础数学运算。它在 ARM 汇编代码中不能直接实现,因为如果直接实现的话,它得出答案需要花费很长的时间,因此它不是个“简单的”运算。 -``` - 虽然这个函数看起来很强大、也很复杂。但是,处理它的许多情况的最容易的方式可能是,编写一个函数去处理一些非常常见的任务。它是个非常有用的函数,可以为任何底的一个有符号或无符号的数字生成一个字符串。那么,我们如何去实现呢?在继续阅读之前,尝试快速地设计一个算法。 +> 除法是非常慢的,也是非常复杂的基础数学运算。它在 ARM 汇编代码中不能直接实现,因为如果直接实现的话,它得出答案需要花费很长的时间,因此它不是个“简单的”运算。 + 最简单的方法或许就是我在 [课程 1:OK01][3] 中提到的“除法余数法”。它的思路如下: 1. 用当前值除以你使用的底。 @@ -75,11 +74,10 @@ 3. 如果得到的新值不为 0,转到第 1 步。 4. 将余数反序连起来就是答案。 - - 例如: 表 2.1 以 2 为底的例子 + 转换 | 值 | 新值 | 余数 | @@ -100,7 +98,8 @@ 我们复习一下长除法 > 假如我们想把 4135 除以 17。 -> +> +> ``` > 0243 r 4 > 17)4135 > 0 0 × 17 = 0000 @@ -111,9 +110,10 @@ > 55 735 - 680 = 55 > 51 3 × 17 = 51 > 4 55 - 51 = 4 +> ``` > 答案:243 余 4 > -> 首先我们来看被除数的最高位。 我们看到它是小于或等于除数的最小倍数,因此它是 0。我们在结果中写一个 0。 +> 首先我们来看被除数的最高位。我们看到它是小于或等于除数的最小倍数,因此它是 0。我们在结果中写一个 0。 > > 接下来我们看被除数倒数第二位和所有的高位。我们看到小于或等于那个数的除数的最小倍数是 34。我们在结果中写一个 2,和减去 3400。 > @@ -124,16 +124,18 @@ 在汇编代码中做除法,我们将实现二进制的长除法。我们之所以实现它是因为,数字都是以二进制方式保存的,这让我们很容易地访问所有重要位的移位操作,并且因为在二进制中做除法比在其它高进制中做除法都要简单,因为它的数更少。 -> 1011 r 1 ->1010)1101111 -> 1010 -> 11111 -> 1010 -> 1011 -> 1010 -> 1 -这个示例展示了如何做二进制的长除法。简单来说就是,在不超出被除数的情况下,尽可能将除数右移,根据位置输出一个 1,和减去这个数。剩下的就是余数。在这个例子中,我们展示了 11011112 ÷ 10102 = 10112 余数为 12。用十进制表示就是,111 ÷ 10 = 11 余 1。 +``` + 1011 r 1 +1010)1101111 + 1010 + 11111 + 1010 + 1011 + 1010 + 1 +``` +这个示例展示了如何做二进制的长除法。简单来说就是,在不超出被除数的情况下,尽可能将除数右移,根据位置输出一个 1,和减去这个数。剩下的就是余数。在这个例子中,我们展示了 11011112 ÷ 10102 = 10112 余数为 12。用十进制表示就是,111 ÷ 10 = 11 余 1。 你自己尝试去实现这个长除法。你应该去写一个函数 `DivideU32` ,其中 `r0` 是被除数,而 `r1` 是除数,在 `r0` 中返回结果,在 `r1` 中返回余数。下面,我们将完成一个有效的实现。 @@ -155,7 +157,7 @@ end function 这段代码实现了我们的目标,但却不能用于汇编代码。我们出现的问题是,我们的寄存器只能保存 32 位,而 `divisor << shift` 的结果可能在一个寄存器中装不下(我们称之为溢出)。这确实是个问题。你的解决方案是否有溢出的问题呢? -幸运的是,有一个称为 `clz` 或 `计数前导零(count leading zeros)` 的指令,它能计算一个二进制表示的数字的前导零的个数。这样我们就可以在溢出发生之前,可以将寄存器中的值进行相应位数的左移。你可以找出的另一个优化就是,每个循环我们计算 `divisor << shift` 了两遍。我们可以通过将除数移到开始位置来改进它,然后在每个循环结束的时候将它移下去,这样可以避免将它移到别处。 +幸运的是,有一个称为 `clz`(计数前导零count leading zeros)的指令,它能计算一个二进制表示的数字的前导零的个数。这样我们就可以在溢出发生之前,可以将寄存器中的值进行相应位数的左移。你可以找出的另一个优化就是,每个循环我们计算 `divisor << shift` 了两遍。我们可以通过将除数移到开始位置来改进它,然后在每个循环结束的时候将它移下去,这样可以避免将它移到别处。 我们来看一下进一步优化之后的汇编代码。 @@ -192,11 +194,10 @@ mov pc,lr .unreq shift ``` -```assembly -clz dest,src 将第一个寄存器 dest 中二进制表示的值的前导零的数量,保存到第二个寄存器 src 中。 -``` +你可能毫无疑问的认为这是个非常高效的作法。它是很好,但是除法是个代价非常高的操作,并且我们的其中一个愿望就是不要经常做除法,因为如果能以任何方式提升速度就是件非常好的事情。当我们查看有循环的优化代码时,我们总是重点考虑一个问题,这个循环会运行多少次。在本案例中,在输入为 1 的情况下,这个循环最多运行 31 次。在不考虑特殊情况的时候,这很容易改进。例如,当 1 除以 1 时,不需要移位,我们将把除数移到它上面的每个位置。这可以通过简单地在被除数上使用新的 `clz` 命令并从中减去它来改进。在 `1 ÷ 1` 的案例中,这意味着移位将设置为 0,明确地表示它不需要移位。如果它设置移位为负数,表示除数大于被除数,因此我们就可以知道结果是 0,而余数是被除数。我们可以做的另一个快速检查就是,如果当前值为 0,那么它是一个整除的除法,我们就可以停止循环了。 + +> `clz dest,src` 将第一个寄存器 `dest` 中二进制表示的值的前导零的数量,保存到第二个寄存器 `src` 中。 -你可能毫无疑问的认为这是个非常高效的作法。它是很好,但是除法是个代价非常高的操作,并且我们的其中一个愿望就是不要经常做除法,因为如果能以任何方式提升速度就是件非常好的事情。当我们查看有循环的优化代码时,我们总是重点考虑一个问题,这个循环会运行多少次。在本案例中,在输入为 1 的情况下,这个循环最多运行 31 次。在不考虑特殊情况的时候,这很容易改进。例如,当 1 除以 1 时,不需要移位,我们将把除数移到它上面的每个位置。这可以通过简单地在被除数上使用新的 clz 命令并从中减去它来改进。在 `1 ÷ 1` 的案例中,这意味着移位将设置为 0,明确地表示它不需要移位。如果它设置移位为负数,表示除数大于被除数,因此我们就可以知道结果是 0,而余数是被除数。我们可以做的另一个快速检查就是,如果当前值为 0,那么它是一个整除的除法,我们就可以停止循环了。 ```assembly .globl DivideU32 @@ -291,17 +292,15 @@ end function ### 4、格式化字符串 -我们继续回到我们的字符串格式化方法。因为我们正在编写我们自己的操作系统,我们根据我们自己的意愿来添加或修改格式化规则。我们可以发现,添加一个 `a %b` 操作去输出一个二进制的数字比较有用,而如果你不使用空终止符字符串,那么你应该去修改 `%s` 的行为,让它从另一个参数中得到字符串的长度,或者如果你愿意,可以从长度前缀中获取。我在下面的示例中使用了一个空终止符。 +我们继续回到我们的字符串格式化方法。因为我们正在编写我们自己的操作系统,我们根据我们自己的意愿来添加或修改格式化规则。我们可以发现,添加一个 `a % b` 操作去输出一个二进制的数字比较有用,而如果你不使用空终止符字符串,那么你应该去修改 `%s` 的行为,让它从另一个参数中得到字符串的长度,或者如果你愿意,可以从长度前缀中获取。我在下面的示例中使用了一个空终止符。 实现这个函数的一个主要的障碍是它的参数个数是可变的。根据 ABI 规定,额外的参数在调用方法之前以相反的顺序先推送到栈上。比如,我们使用 8 个参数 1、2、3、4、5、6、7 和 8 来调用我们的方法,我们将按下面的顺序来处理: - 1. Set r0 = 5、r1 = 6、r2 = 7、r3 = 8 - 2. Push {r0,r1,r2,r3} - 3. Set r0 = 1、r1 = 2、r2 = 3、r3 = 4 - 4. 调用函数 - 5. Add sp,#4*4 - - +1. 设置 r0 = 5、r1 = 6、r2 = 7、r3 = 8 +2. 推入 {r0,r1,r2,r3} +3. 设置 r0 = 1、r1 = 2、r2 = 3、r3 = 4 +4. 调用函数 +5. 将 sp 和 #4*4 加起来 现在,我们必须确定我们的函数确切需要的参数。在我的案例中,我将寄存器 `r0` 用来保存格式化字符串地址,格式化字符串长度则放在寄存器 `r1` 中,目标字符串地址放在寄存器 `r2` 中,紧接着是要求的参数列表,从寄存器 `r3` 开始和像上面描述的那样在栈上继续。如果你想去使用一个空终止符格式化字符串,在寄存器 r1 中的参数将被移除。如果你想有一个最大缓冲区长度,你可以将它保存在寄存器 `r3` 中。由于有额外的修改,我认为这样修改函数是很有用的,如果目标字符串地址为 0,意味着没有字符串被输出,但如果仍然返回一个精确的长度,意味着能够精确的判断格式化字符串的长度。 @@ -526,13 +525,13 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html 作者:[Alex Chadwick][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.cl.cam.ac.uk [b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen03.html +[1]: https://linux.cn/article-10585-1.html [2]: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[3]: https://linux.cn/article-10458-1.html [4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html From c4e27c527aff05747b205571a8e6c45478a8c305 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 10 Mar 2019 21:04:24 +0800 Subject: [PATCH 537/813] PUB:20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @qhwdw https://linux.cn/article-10605-1.html --- ...6 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md (99%) diff --git a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md similarity index 99% rename from translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md rename to published/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md index aad8af35f6..523394f8a2 100644 --- a/translated/tech/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md +++ b/published/20150616 Computer Laboratory - Raspberry Pi- Lesson 9 Screen04.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10605-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 9 Screen04) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html) [#]: author: (Alex Chadwick https://www.cl.cam.ac.uk) From 27574ba986237aafb7ce85aefcd617bcf9eda289 Mon Sep 17 00:00:00 2001 From: darksun Date: Sun, 10 Mar 2019 22:00:31 +0800 Subject: [PATCH 538/813] translate done: 20170519 zsh shell inside Emacs on Windows.md --- ...70519 zsh shell inside Emacs on Windows.md | 121 ------------------ ...70519 zsh shell inside Emacs on Windows.md | 113 ++++++++++++++++ 2 files changed, 113 insertions(+), 121 deletions(-) delete mode 100644 sources/tech/20170519 zsh shell inside Emacs on Windows.md create mode 100644 translated/tech/20170519 zsh shell inside Emacs on Windows.md diff --git a/sources/tech/20170519 zsh shell inside Emacs on Windows.md b/sources/tech/20170519 zsh shell inside Emacs on Windows.md deleted file mode 100644 index 3a93941d0b..0000000000 --- a/sources/tech/20170519 zsh shell inside Emacs on Windows.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (zsh shell inside Emacs on Windows) -[#]: via: (https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) -[#]: author: (Peter Mosmans https://www.onwebsecurity.com/) - -zsh shell inside Emacs on Windows -====== - -![zsh shell inside Emacs on Windows][5] - -The most obvious advantage of running a cross-platform shell (for example Bash or zsh) is that you can use the same syntax and scripts on multiple platforms. Setting up (alternative) shells on Windows can be pretty tricky, but the small investment is well worth the reward. - -The MSYS2 subsystem allows you to run shells like Bash or zsh on Windows. An important part of MSYS2 is making sure that the search paths are all pointing to the MSYS2 subsystem: There are a lot of dependencies. - -Bash is the default shell once MSYS2 is installed; zsh can be installed using the package manager: - -``` -pacman -Sy zsh -``` - -Setting zsh as default shell can be done by modifying the ` /etc/passwd` file, for instance: - -``` -mkpasswd -c | sed -e 's/bash/zsh/' | tee -a /etc/passwd -``` - -This will change the default shell from bash to zsh. - -Running zsh under Emacs on Windows can be done by modifying the ` shell-file-name` variable, and pointing it to the zsh binary from the MSYS2 subsystem. The shell binary has to be somewhere in the Emacs ` exec-path` variable. - -``` -(setq shell-file-name (executable-find "zsh.exe")) -``` - -Don't forget to modify the PATH environment variable for Emacs, as the MSYS2 paths should be resolved before Windows paths. Using the same example, where MSYS2 is installed under - -``` -c:\programs\msys2 -``` - -: - -``` -(setenv "PATH" "C:\\programs\\msys2\\mingw64\\bin;C:\\programs\\msys2\\usr\\local\\bin;C:\\programs\\msys2\\usr\\bin;C:\\Windows\\System32;C:\\Windows") -``` - -After setting these two variables in the Emacs configuration file, running - -``` -M-x shell -``` - -in Emacs should bring up the familiar zsh prompt. - -Emacs' terminal settings (eterm) are different than MSYS2' standard terminal settings (xterm-256color). This means that some plugins or themes (prompts) might not work - especially when using oh-my-zsh. - -Detecting whether zsh is started under Emacs is easy, using the variable - -``` -$INSIDE_EMACS -``` - -. This codesnippet in - -``` -.zshrc -``` - -(which will be sourced for interactive shells) only enables the git plugin when being run in Emacs, and changes the theme - -``` -# Disable some plugins while running in Emacs -if [[ -n "$INSIDE_EMACS" ]]; then - plugins=(git) - ZSH_THEME="simple" -else - ZSH_THEME="compact-grey" -fi -``` - -. This codesnippet in(which will be sourced for interactive shells) only enables the git plugin when being run in Emacs, and changes the theme - -By adding the ` INSIDE_EMACS` variable to the local ` ~/.ssh/config` as ` SendEnv` variable... - -``` -Host myhost -SendEnv INSIDE_EMACS -``` - -... and to a ssh server as ` AcceptEnv` variable in ` /etc/ssh/sshd_config` ... - -``` -AcceptEnv LANG LC_* INSIDE_EMACS -``` - -... this even works when ssh'ing inside an Emacs shell session to another ssh server, running zsh. When ssh'ing in the zsh shell inside Emacs on Windows, using the parameters ` -t -t` forces pseudo-tty allocation (which is necessary, as Emacs on Windows don't have a true tty). - -Cross-platform, open-source goodyness... - --------------------------------------------------------------------------------- - -via: https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html - -作者:[Peter Mosmans][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://www.onwebsecurity.com/ -[b]: https://github.com/lujun9972 -[1]: https://www.onwebsecurity.com/category/configuration.html -[2]: https://www.onwebsecurity.com/tag/emacs.html -[3]: https://www.onwebsecurity.com/tag/msys2.html -[4]: https://www.onwebsecurity.com/tag/zsh.html -[5]: https://www.onwebsecurity.com//images/zsh-shell-inside-emacs-on-windows.png diff --git a/translated/tech/20170519 zsh shell inside Emacs on Windows.md b/translated/tech/20170519 zsh shell inside Emacs on Windows.md new file mode 100644 index 0000000000..82b3394812 --- /dev/null +++ b/translated/tech/20170519 zsh shell inside Emacs on Windows.md @@ -0,0 +1,113 @@ +[#]:collector:(lujun9972) +[#]:translator:(lujun9972) +[#]:reviewer:( ) +[#]:publisher:( ) +[#]:url:( ) +[#]:subject:(zsh shell inside Emacs on Windows) +[#]:via:(https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) +[#]:author:(Peter Mosmans https://www.onwebsecurity.com/) + +Windows 下 Emacs 中的 zsh shell +====== + +![zsh shell inside Emacs on Windows][5] + +运行跨平台 shell( 例如 Bash 或 zsh) 的最大优势在于你能在多平台上使用同样的语法和脚本。在 Windows 上设置 (替换) shells 挺麻烦的,但所获得的回报远远超出这小小的付出。 + +MSYS2 子系统允许你在 Windows 上运行 Bash 或 zsh 之类的 shell。使用 MSYS2 很重要的一点在于确保搜索路径都指向 MSYS2 子系统本身:存在太多依赖关系了。 + +MSYS2 安装后默认的 shell 就是 Bash; zsh 则可以通过包管理器进行安装: + +``` +pacman -Sy zsh +``` + +通过修改 `etc/passwd` 文件可以设置 zsh 作为默认 shell,例如: + +``` +mkpasswd -c | sed -e 's/bash/zsh/' | tee -a /etc/passwd +``` + +这会将默认 shell 从 bash 改成 zsh。 + +要在 Windows 上的 Emacs 运行 zsh 需要修改 ` shell-file-name` 变量,将它指向 MSYS2 子系统中的 zsh 二进制文件。该二进制 shell 文件在 Emacs ` exec-path` 变量中的某个地方。 + +``` +(setq shell-file-name (executable-find "zsh.exe")) +``` + +不要忘了修改 Emacs 的 PATH 环境变量,因为 MSYS2 路径应该先于 Windows 路径。接上一个例子,假设 MSYS2 安装在 + +``` +c:\programs\msys2 +``` + +中,那么执行: + +``` +(setenv "PATH" "C:\\programs\\msys2\\mingw64\\bin;C:\\programs\\msys2\\usr\\local\\bin;C:\\programs\\msys2\\usr\\bin;C:\\Windows\\System32;C:\\Windows") +``` + +在 Emacs 配置文件中设置好这两个变量后,在 Emacs 中运行 + +``` +M-x shell +``` + +应该就能看到熟悉的 zsh 提示符了。 + +Emacs' 的终端设置 (eterm) 与 MSYS2 的标准终端设置 (xterm-256color) 不一样。这意味着某些插件和主题(标识符)可能不能正常工作 - 尤其在使用 oh-my-zsh 时。 + +检测 zsh 否则在 Emacs 中运行很简单,使用变量 + +``` +$INSIDE_EMACS +``` + +. 下面这段代码片段取自 `.zshrc`( 当以交互式 shell 模式启动时会被加载),它会在 zsh 在 Emacs 中运行时启动 git 插件并更改主题 + +``` +# Disable some plugins while running in Emacs +if [[ -n "$INSIDE_EMACS" ]]; then + plugins=(git) + ZSH_THEME="simple" +else + ZSH_THEME="compact-grey" +fi +``` + +通过在本地 `~/.ssh/config` 文件中将 `INSIDE_EMACS` 变量设置为 `SendEnv` 变量。.。 + +``` +Host myhost +SendEnv INSIDE_EMACS +``` + +.。. 同时在 ssh 服务器的 `/etc/ssh/sshd_config` 中设置为 `AcceptEnv` 变量 .。。 + +``` +AcceptEnv LANG LC_* INSIDE_EMACS +``` + +.。. 这使得在 Emacs shell 会话中通过 ssh 登录另一个运行着 zsh 的 ssh 服务器也能工作的很好。当在 Windows 下的 Emacs 中的 zsh 上通过 ssh 远程登录时,记得使用参数 `-t` `-t` 参数会强制分配伪终端(之所以需要这样,时因为 Windows 下的 Emacs 并没有真正的 tty)。 + +跨平台,开源真是个好东西。.。 + +-------------------------------------------------------------------------------- + +via: https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html + +作者:[Peter Mosmans][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://www.onwebsecurity.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.onwebsecurity.com/category/configuration.html +[2]: https://www.onwebsecurity.com/tag/emacs.html +[3]: https://www.onwebsecurity.com/tag/msys2.html +[4]: https://www.onwebsecurity.com/tag/zsh.html +[5]: https://www.onwebsecurity.com//images/zsh-shell-inside-emacs-on-windows.png From 16d044406789821b3fcfb775c8143d0ed7816212 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 Mar 2019 08:53:11 +0800 Subject: [PATCH 539/813] translated --- ...days of productivity in 2019- The fails.md | 78 ------------------- ...days of productivity in 2019- The fails.md | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20190131 19 days of productivity in 2019- The fails.md create mode 100644 translated/tech/20190131 19 days of productivity in 2019- The fails.md diff --git a/sources/tech/20190131 19 days of productivity in 2019- The fails.md b/sources/tech/20190131 19 days of productivity in 2019- The fails.md deleted file mode 100644 index aa9a1d62fe..0000000000 --- a/sources/tech/20190131 19 days of productivity in 2019- The fails.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (19 days of productivity in 2019: The fails) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-wish-list) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -19 days of productivity in 2019: The fails -====== -Here are some tools the open source world doesn't do as well as it could. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Part of being productive is accepting that failure happens. I am a big proponent of [Howard Tayler's][1] Maxim 70: "Failure is not an option—it is mandatory. The option is whether or not to let failure be the last thing you do." And there were many things I wanted to talk about in this series that I failed to find good answers for. - -So, for the final edition of my 19 new (or new-to-you) open source tools to help you be more productive in 2019, I present the tools I wanted but didn't find. I am hopeful that you, the reader, will be able to help me find some good solutions to the items below. If you do, please share them in the comments. - -### Calendaring - -![](https://opensource.com/sites/default/files/uploads/thunderbird-1.png) - -If there is one thing the open source world is weak on, it is calendaring. I've tried about as many calendar programs as I've tried email programs. There are basically three good options for shared calendaring: [Evolution][2], the [Lightning add-on to Thunderbird][3], or [KOrganizer][4]. All the other applications I've tried (including [Orage][5], [Osmo][6], and almost all of the [Org mode][7] add-ons) seem to reliably support only read-only access to remote calendars. If the shared calendar uses either [Google Calendar][8] or [Microsoft Exchange][9] as the server, the first three are the only easily configured options (and even then, additional add-ons are often required). - -### Linux on the inside - -![](https://opensource.com/sites/default/files/uploads/android-x86-2.png) - -I love [Chrome OS][10], with its simplicity and lightweight requirements. I have owned several Chromebooks, including the latest models from Google. I find it to be reasonably distraction-free, lightweight, and easy to use. With the addition of Android apps and a Linux container, it's easy to be productive almost anywhere. - -I'd like to carry that over to some of the older laptops I have hanging around, but unless I do a full compile of Chromium OS, it is hard to find that same experience. The desktop [Android][11] projects like [Bliss OS][12], [Phoenix OS][13], and [Android-x86][14] are getting close, and I'm keeping an eye on them for the future. - -### Help desks - -![](https://opensource.com/sites/default/files/uploads/opennms_jira_dashboard-3.png) - -Customer service is a big deal for companies big and small. And with the added focus on DevOps these days, it is important to have tools to help bridge the gap. Almost every company I've worked with uses either [Jira][15], [GitHub][16], or [GitLab][17] for code issues, but none of these tools are very good at customer support tickets (without a lot of work). While there are many applications designed around customer support tickets and issues, most (if not all) of them are silos that don't play nice with other systems, again without a lot of work. - -On my wishlist is an open source solution that allows customers, support, and developers to work together without an unwieldy pile of code to glue multiple systems together. - -### Your turn - -![](https://opensource.com/sites/default/files/uploads/asciiquarium-4.png) - -I'm sure there are a lot of options I missed during this series. I try new applications regularly, in the hopes that they will help me be more productive. I encourage everyone to do the same, because when it comes to being productive with open source tools, there is always something new to try. And, if you have favorite open source productivity apps that didn't make it into this series, please make sure to share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-wish-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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://www.schlockmercenary.com/ -[2]: https://wiki.gnome.org/Apps/Evolution -[3]: https://www.thunderbird.net/en-US/calendar/ -[4]: https://userbase.kde.org/KOrganizer -[5]: https://github.com/xfce-mirror/orage -[6]: http://clayo.org/osmo/ -[7]: https://orgmode.org/ -[8]: https://calendar.google.com -[9]: https://products.office.com/ -[10]: https://en.wikipedia.org/wiki/Chrome_OS -[11]: https://www.android.com/ -[12]: https://blissroms.com/ -[13]: http://www.phoenixos.com/ -[14]: http://www.android-x86.org/ -[15]: https://www.atlassian.com/software/jira -[16]: https://github.com -[17]: https://about.gitlab.com/ diff --git a/translated/tech/20190131 19 days of productivity in 2019- The fails.md b/translated/tech/20190131 19 days of productivity in 2019- The fails.md new file mode 100644 index 0000000000..a0a7100a00 --- /dev/null +++ b/translated/tech/20190131 19 days of productivity in 2019- The fails.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (19 days of productivity in 2019: The fails) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-wish-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +2019 年的 19 个高效日:失败了 +====== +以下是开源世界没有做到的一些工具。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) + +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 + +保持高效一部分是接受失败发生。我是 [Howard Tayler's][1] 的第 70 条座右铭的支持者:“失败不是一种选择,它是一定的。可以选择的是是否让失败成为你做的最后一件事。”我对这个系列的有很多话想多,但是我没有找到好的答案。 + +关于我的 19 个新的(或对你而言新的)帮助你在 2019 年更高效的工具的最终版,我想到了一些我想要的,但是没有找到的。我希望读者你能够帮我找到下面这些项目的好的方案。如果你发现了,请在下面的留言中分享。 + +### 日历 + +![](https://opensource.com/sites/default/files/uploads/thunderbird-1.png) + +如果开源世界有一件事缺乏,那就是日历。我尝试过的日历程序和尝试电子邮件程序的数量一样多。共享日历基本上有三个很好的选择:[Evolution][2]、[Thunderbird 中的 Lightning 附加组件][3] 或 [KOrganizer][4]。我尝试过的所有其他应用 (包括 [Orage][5]、[Osmo][6] 以及几乎所有 [Org 模式][7]附加组件) 似乎只可靠地支持对远程日历的只读访问。如果共享日历使用 [Google 日历][8] 或 [Microsoft Exchange][9] 作为服务器,那么前三个是唯一易于配置的选择(即便如此,通常还需要其他附加组件)。 + +### Linux 内核的系统 + +![](https://opensource.com/sites/default/files/uploads/android-x86-2.png) + +我喜欢 [Chrome OS][10] 的简单性和轻量需求。我有几款 Chromebook,包括谷歌的最新型号。我发现它不会分散注意力、重量轻、易于使用。通过添加 Android 应用和 Linux 容器,几乎可以在任何地方轻松高效工作。 + +我想把它安装到我一些闲置的笔记本上,但除非我对 Chromium OS 进行全面编译,否则很难有相同的体验。像 [Bliss OS][12]、[Phoenix OS][13] 和 [Android-x86][14] 这样的桌面 [Android][11] 项目快要完成了,我正在关注它们的未来。 + +### 客户服务 + +![](https://opensource.com/sites/default/files/uploads/opennms_jira_dashboard-3.png) + +对于大大小小的公司来说,客户服务是一件大事。现在,随着近来对 DevOps 的关注,有必要使用工具来弥补差距。我工作的几乎每家公司都使用 [Jira][15]、[GitHub][16] 或 [GitLab][17] 来提代码问题,但这些工具都不是很擅长客户支持工单(没有很多工作)。虽然围绕客户支持工单和问题设计了许多应用,但大多数(如果不是全部)应用都是与其他系统不兼容的孤岛,同样没有大量工作。 + +我的愿望是有一个开源解决方案,它能让客户、支持人员和开发人员一起工作,而无需笨重的代码将多个系统粘合在一起。 + +### 轮到你了 + +![](https://opensource.com/sites/default/files/uploads/asciiquarium-4.png) + +我相信这个系列中我错过了很多选择。我经常尝试新的应用,希望它们能帮助我提高工作效率。我鼓励每个人都这样做,因为当谈到使用开源工具提高工作效率时,总会有新的选择。如果你有喜欢的开源生产力应用没有进入本系列,请务必在评论中分享它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-wish-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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://www.schlockmercenary.com/ +[2]: https://wiki.gnome.org/Apps/Evolution +[3]: https://www.thunderbird.net/en-US/calendar/ +[4]: https://userbase.kde.org/KOrganizer +[5]: https://github.com/xfce-mirror/orage +[6]: http://clayo.org/osmo/ +[7]: https://orgmode.org/ +[8]: https://calendar.google.com +[9]: https://products.office.com/ +[10]: https://en.wikipedia.org/wiki/Chrome_OS +[11]: https://www.android.com/ +[12]: https://blissroms.com/ +[13]: http://www.phoenixos.com/ +[14]: http://www.android-x86.org/ +[15]: https://www.atlassian.com/software/jira +[16]: https://github.com +[17]: https://about.gitlab.com/ From 7f84f31f976411e192e8f7ecd1bd21fbb29624ba Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 Mar 2019 08:56:05 +0800 Subject: [PATCH 540/813] translating --- .../20190226 How To SSH Into A Particular Directory On Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md index 37d52656a8..6dea8d9f24 100644 --- a/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md +++ b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6ab8a412dbc65cc38763e00a6512025cfa0f987f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Mar 2019 15:01:13 +0800 Subject: [PATCH 541/813] PRF:20190121 Booting Linux faster.md @alim0x --- .../talk/20190121 Booting Linux faster.md | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/translated/talk/20190121 Booting Linux faster.md b/translated/talk/20190121 Booting Linux faster.md index 60645965b1..97365adbe5 100644 --- a/translated/talk/20190121 Booting Linux faster.md +++ b/translated/talk/20190121 Booting Linux faster.md @@ -1,35 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Booting Linux faster) [#]: via: (https://opensource.com/article/19/1/booting-linux-faster) [#]: author: (Stewart Smith https://opensource.com/users/stewart-ibm) -更快启动 Linux +让 Linux 启动更快 ====== -进行 Linux 内核与固件开发的时候,往往需要多次的重启,会浪费大把的时间。 + +> 进行 Linux 内核与固件开发的时候,往往需要多次的重启,会浪费大把的时间。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY) + 在所有我拥有或使用过的电脑中,启动最快的那台是 20 世纪 80 年代的电脑。在你把手从电源键移到键盘上的时候,BASIC 解释器已经在等待你输入命令了。对于现代的电脑,启动时间从笔记本电脑的 15 秒到小型家庭服务器的数分钟不等。为什么它们的启动时间有差别? -那台直接启动到 BASIC 命令行提示符的 20 世纪 80 年代微电脑,有着一颗非常简单的 CPU,它在通电的时候就立即开始从一个存储地址中获取和执行指令。因为这些系统在 ROM 里面有 BASIC,基本不需要载入的时间——你很快就进到 BASIC 命令提示符中了。同时代更加复杂的系统,比如 IBM PC 或 Macintosh,需要一段可观的时间来启动(大约 30 秒),尽管这主要是因为需要从软盘上读取操作系统的缘故。在可以加载操作系统之前,只有很小一部分时间是花在固件上的。 +那台直接启动到 BASIC 命令行提示符的 20 世纪 80 年代微电脑,有着一颗非常简单的 CPU,它在通电的时候就立即开始从一个内存地址中获取和执行指令。因为这些系统的 BASIC 在 ROM 里面,基本不需要载入的时间——你很快就进到 BASIC 命令提示符中了。同时代更加复杂的系统,比如 IBM PC 或 Macintosh,需要一段可观的时间来启动(大约 30 秒),尽管这主要是因为需要从软盘上读取操作系统的缘故。在可以加载操作系统之前,只有很小一部分时间是花费在固件上的。 -现代服务器往往在从磁盘上读取操作系统之前,在固件上花费了数分钟而不是数秒。这主要是因为现代系统日益增加的复杂性。CPU 不再能够只是起来就开始全速执行指令,我们已经习惯于 CPU 频率变化,节省能源的待机状态以及 CPU 多核。实际上,在现代 CPU 内部有惊人数量的更简单的处理器,它们协助主 CPU 核心启动并提供运行时服务,比如在过热的时候压制频率。在绝大多数 CPU 架构中,在你的 CPU 内的这些核心上运行的代码都以不透明的二进制 blob 形式提供。 +现代服务器往往在从磁盘上读取操作系统之前,在固件上花费了数分钟而不是数秒。这主要是因为现代系统日益增加的复杂性。CPU 不再能够只是运行起来就开始全速执行指令,我们已经习惯于 CPU 频率变化、节省能源的待机状态以及 CPU 多核。实际上,在现代 CPU 内部有数量惊人的更简单的处理器,它们协助主 CPU 核心启动并提供运行时服务,比如在过热的时候压制频率。在绝大多数 CPU 架构中,在你的 CPU 内的这些核心上运行的代码都以不透明的二进制 blob 形式提供。 -在 OpenPOWER 系统上,所有运行在 CPU 内部每个核心的指令都是开源的。在有 [OpenBMC][1](比如 IBM 的 AC922 系统和 Raptor 的 TALOS II 以及 Blackbird 系统)的机器上,这还延伸到了运行在基板管理控制器上的代码。这就意味着我们可以一探究竟,到底为什么从接入电源线到显示出熟悉的登陆界面花了这么长时间。 +在 OpenPOWER 系统上,所有运行在 CPU 内部每个核心的指令都是开源的。在有 [OpenBMC][1](比如 IBM 的 AC922 系统和 Raptor 的 TALOS II 以及 Blackbird 系统)的机器上,这还延伸到了运行在基板管理控制器Baseboard Management Controller上的代码。这就意味着我们可以一探究竟,到底为什么从接入电源线到显示出熟悉的登录界面花了这么长时间。 如果你是内核相关团队的一员,你可能启动过许多内核。如果你是固件相关团队的一员,你可能要启动许多不同的固件映像,接着是一个操作系统,来确保你的固件仍能工作。如果我们可以减少硬件的启动时间,这些团队可以更有生产力,并且终端用户在搭建系统或重启安装固件或系统更新的时候会对此表示感激。 -过去的几年,Linux 发行版的启动时间已经做了很多改善。现代 init 系统在处理并行和按需任务上做得很好。在一个现代系统上,一旦内核开始执行,它可以在短短数秒内进入登陆提示符界面。这里短短的数秒不是优化启动时间的下手之处,我们得到更早的地方:在我们到达操作系统之前。 +过去的几年,Linux 发行版的启动时间已经做了很多改善。现代的初始化系统在处理并行和按需任务上做得很好。在一个现代系统上,一旦内核开始执行,它可以在短短数秒内进入登录提示符界面。这里短短的数秒不是优化启动时间的下手之处,我们要到更早的地方:在我们到达操作系统之前。 -在 OpenPOWER 系统上,固件通过启动一个存储在固件闪存芯片上的 Linux 内核来加载操作系统,它运行一个叫做 [Petitboot][2] 的用户态程序去寻找用户想要启动的系统所在磁盘,并通过 [kexec][3] 启动它。有了这些优化,启动 Petitboot 环境只占了启动时间的个位数百分比,所以我们还得从其他地方寻找优化项。 +在 OpenPOWER 系统上,固件通过启动一个存储在固件闪存芯片上的 Linux 内核来加载操作系统,它运行一个叫做 [Petitboot][2] 的用户态程序去寻找用户想要启动的系统所在磁盘,并通过 [kexec][3] 启动它。有了这些优化,启动 Petitboot 环境只占了启动时间的百分之几,所以我们还得从其他地方寻找优化项。 -在 Petitboot 环境启动前,有一个先导固件,叫做 [Skiboot][4],在它之前有个 [Hostboot][5]。在 Hostboot 之前是 [Self-Boot Engine][6],一个 die 上的单独核心,它启动单个 CPU 核心并执行来自 Level 3 缓存的指令。这些组件是我们可以在减少启动时间上取得进展的主要部分,因为它们花费了启动的绝大部分时间。或许这些组件中的一部分没有进行足够的优化或尽可能做到并行? +在 Petitboot 环境启动前,有一个先导固件,叫做 [Skiboot][4],在它之前有个 [Hostboot][5]。在 Hostboot 之前是 [Self-Boot Engine][6],一个晶圆切片(die)上的单独核心,它启动单个 CPU 核心并执行来自 Level 3 缓存的指令。这些组件是我们可以在减少启动时间上取得进展的主要部分,因为它们花费了启动的绝大部分时间。或许这些组件中的一部分没有进行足够的优化或尽可能做到并行? 另一个研究路径是重启时间而不是启动时间。在重启的时候,我们真的需要对所有硬件重新初始化吗? -正如任何现代系统那样,改善启动(或重启)时间的方案已经变成了更多并行、解决遗留问题、(可以认为)作弊的结合体。 +正如任何现代系统那样,改善启动(或重启)时间的方案已经变成了更多的并行执行、解决遗留问题、(可以认为)作弊的结合体。 -------------------------------------------------------------------------------- @@ -38,7 +41,7 @@ via: https://opensource.com/article/19/1/booting-linux-faster 作者:[Stewart Smith][a] 选题:[lujun9972][b] 译者:[alim0x](https://github.com/alim0x) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 385ac0b73c8825a6d04a5813d081fa8d3701b5f5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Mar 2019 15:01:50 +0800 Subject: [PATCH 542/813] PUB:20190121 Booting Linux faster.md @alim0x https://linux.cn/article-10607-1.html --- .../talk => published}/20190121 Booting Linux faster.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190121 Booting Linux faster.md (98%) diff --git a/translated/talk/20190121 Booting Linux faster.md b/published/20190121 Booting Linux faster.md similarity index 98% rename from translated/talk/20190121 Booting Linux faster.md rename to published/20190121 Booting Linux faster.md index 97365adbe5..8b1f9ce50e 100644 --- a/translated/talk/20190121 Booting Linux faster.md +++ b/published/20190121 Booting Linux faster.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10607-1.html) [#]: subject: (Booting Linux faster) [#]: via: (https://opensource.com/article/19/1/booting-linux-faster) [#]: author: (Stewart Smith https://opensource.com/users/stewart-ibm) From 92acf398aca9722105880e7b8d003a2ebe2b5807 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Mar 2019 15:19:12 +0800 Subject: [PATCH 543/813] PRF:20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @geekpi --- ...e Linux Design Tool We-ve Always Wanted.md | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md b/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md index ad957f697d..ed80f790a0 100644 --- a/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md +++ b/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Akira: The Linux Design Tool We’ve Always Wanted?) [#]: via: (https://itsfoss.com/akira-design-tool) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Akira:我们一直想要的 Linux 设计工具? +Akira 是我们一直想要的 Linux 设计工具吗? ====== -先说一下,我不是一个专业的设计师 - 但我在 Windows 上使用了某些工具(如 Photoshop、Illustrator 等)和 [Figma] [1](这是一个基于浏览器的界面设计工具)。我相信 Mac 和 Windows 上还有更多的设计工具。 +先说一下,我不是一个专业的设计师,但我在 Windows 上使用过某些工具(如 Photoshop、Illustrator 等)和 [Figma] [1](这是一个基于浏览器的界面设计工具)。我相信 Mac 和 Windows 上还有更多的设计工具。 -即使在 Linux 上,也只有有限的专用[图形设计工具][2]。其中一些工具如 [GIMP][3] 和 [Inkscape][4] 也被专业人士使用。但不幸的是,它们中的大多数都不被视为专业级。 +即使在 Linux 上,也有数量有限的专用[图形设计工具][2]。其中一些工具如 [GIMP][3] 和 [Inkscape][4] 也被专业人士使用。但不幸的是,它们中的大多数都不被视为专业级。 -即使有更多解决方案 - 我也从未遇到过可以取代 [Sketch][5]、Figma 或 Adobe XD 的原生 Linux 应用。任何专业设计师都同意这点,不是吗? +即使有更多解决方案,我也从未遇到过可以取代 [Sketch][5]、Figma 或 Adobe XD 的原生 Linux 应用。任何专业设计师都同意这点,不是吗? ### Akira 是否会在 Linux 上取代 Sketch、Figma 和 Adobe XD? -所以,为了开发一些能够取代那些专有工具的应用 - [Alessandro Castellani][6] 发起了一个 [Kickstarter 活动][7],并与几位经验丰富的开发人员 [Alberto Fanjul][8]、[Bilal Elmoussaoui][9] 和 [Felipe Escoto][10] 组队合作。 +所以,为了开发一些能够取代那些专有工具的应用,[Alessandro Castellani][6] 发起了一个 [Kickstarter 活动][7],并与几位经验丰富的开发人员 [Alberto Fanjul][8]、[Bilal Elmoussaoui][9] 和 [Felipe Escoto][10] 组队合作。 是的,Akira 仍然只是一个想法,只有一个界面原型(正如我最近在 Kickstarter 的[直播流][11]中看到的那样)。 -### 如果它还没有,为什么会发起 Kickstarter 活动? +### 如果它还不存在,为什么会发起 Kickstarter 活动? ![][12] @@ -30,37 +30,38 @@ Kickstarter 活动的目的是收集资金,以便雇用开发人员,并花 尽管如此,如果你想支持这个项目,你应该知道一些细节,对吧? -不用担心,我们在他们的直播中问了几个问题 - 让我们看下 +不用担心,我们在他们的直播中问了几个问题 - 让我们看下: ### Akira:更多细节 ![Akira prototype interface][13] -图片来源:Kickstarter + +*图片来源:Kickstarter* 如 Kickstarter 活动描述的那样: -> Akira 的主要目的是提供一个快速而直观的工具来**创建 Web 和移动界面**,更像是 **Sketch**、**Figma** 或 **Adob​​e XD**,并且是 Linux 原生体验。 +> Akira 的主要目的是提供一个快速而直观的工具来**创建 Web 和移动端界面**,更像是 **Sketch**、**Figma** 或 **Adob​​e XD**,并且是 Linux 原生体验。 -他们还详细描述了该工具与 Inkscape、Glade 或 QML Editor 的不同之处。当然,如果你想要所有的技术细节,请查看 [Kickstarter][7]。但是,在此之前,让我们看一看当我询问有关 Akira 的一些问题时他们说了些什么。 +他们还详细描述了该工具与 Inkscape、Glade 或 QML Editor 的不同之处。当然,如果你想要了解所有的技术细节,请查看 [Kickstarter][7]。但是,在此之前,让我们看一看当我询问有关 Akira 的一些问题时他们说了些什么。 -问:如果你认为你的项目类似于 Figma - 人们为什么要考虑安装 Akira 而不是使用基于网络的工具?它是否只是这些工具的克隆 - 提供原生 Linux 体验,还是有一些非常有趣的东西可以鼓励用户切换(除了是开源解决方案之外)? +**问:**如果你认为你的项目类似于 Figma,人们为什么要考虑安装 Akira 而不是使用基于网络的工具?它是否只是这些工具的克隆 —— 提供原生 Linux 体验,还是有一些非常有趣的东西可以鼓励用户切换(除了是开源解决方案之外)? -** Akira:** 与基于网络的 electron 应用相比,Linux 原生体验总是更好、更快。此外,如果你选择使用 Figma,硬件配置也很重要 - 但 Akira 将会占用很少的系统资源,并且你可以在不需要上网的情况下完成类似工作。 +**Akira:** 与基于网络的 electron 应用相比,Linux 原生体验总是更好、更快。此外,如果你选择使用 Figma,硬件配置也很重要,但 Akira 将会占用很少的系统资源,并且你可以在不需要上网的情况下完成类似工作。 -问:假设它成为了 Linux用户一直在等待的开源方案(拥有专有工具的类似功能)。你有什么维护计划?你是否计划引入定价 - 或依赖捐赠? +**问:**假设它成为了 Linux 用户一直在等待的开源方案(拥有专有工具的类似功能)。你有什么维护计划?你是否计划引入定价方案,或依赖捐赠? -**Akira:**该项目主要依靠捐赠(类似于 [Krita 基金会][14] 这样的想法)。但是,不会有“专业版”计划 - 它将免费提供,它将是一个开源项目。 +**Akira:**该项目主要依靠捐赠(类似于 [Krita 基金会][14] 这样的想法)。但是,不会有“专业版”计划,它将免费提供,它将是一个开源项目。 根据我得到的回答,它看起来似乎很有希望,我们应该支持。 +- [查看该 Kickstarter 活动](https://www.kickstarter.com/projects/alecaddd/akira-the-linux-design-tool/description) + ### 总结 -你怎么认为 Akira?它只是一个概念吗?或者你希望看到进展? +你怎么看 Akira?它只是一个概念吗?或者你希望看到进展? 请在下面的评论中告诉我们你的想法。 -![][15] - -------------------------------------------------------------------------------- via: https://itsfoss.com/akira-design-tool @@ -68,7 +69,7 @@ via: https://itsfoss.com/akira-design-tool 作者:[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 1d17766376aeb81d41d2a3dde22e8a6e06267587 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Mar 2019 15:19:44 +0800 Subject: [PATCH 544/813] PUB:20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @geekpi https://linux.cn/article-10608-1.html --- ...190121 Akira- The Linux Design Tool We-ve Always Wanted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md (98%) diff --git a/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md b/published/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md similarity index 98% rename from translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md rename to published/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md index ed80f790a0..427bb2d50c 100644 --- a/translated/tech/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md +++ b/published/20190121 Akira- The Linux Design Tool We-ve Always Wanted.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10608-1.html) [#]: subject: (Akira: The Linux Design Tool We’ve Always Wanted?) [#]: via: (https://itsfoss.com/akira-design-tool) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From e63375cdd961f8cab3fae53dbd7906d9636a5022 Mon Sep 17 00:00:00 2001 From: wwhio Date: Mon, 11 Mar 2019 17:52:45 +0800 Subject: [PATCH 545/813] Update 20180314 Pi Day- 12 fun facts and ways to celebrate.md --- ...Day- 12 fun facts and ways to celebrate.md | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md b/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md index 292afeb895..67a7f37675 100644 --- a/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md +++ b/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md @@ -1,40 +1,36 @@ -Translating by wwhio - -Pi Day: 12 fun facts and ways to celebrate +关于圆周率日:12个有趣的事实与庆祝方式 ====== ![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/cio_piday.png?itok=kTht0qV9) -Today, tech teams around the world will celebrate a number. March 14 (written 3/14 in the United States) is known as Pi Day, a holiday that people ring in with pie eating contests, pizza parties, and math puns. If the most important number in mathematics wasn’t enough of a reason to reach for a slice of pie, March 14 also happens to be Albert Einstein’s birthday, the release anniversary of Linux kernel 1.0.0, and the day Eli Whitney patented the cotton gin. +今天,全世界的技术团队都会为一个数字庆祝。3 月 14 日是圆周率日,人们会在这一天举行吃派比赛、披萨舞会,玩数学梗math puns。如果数学领域中重要的常数不足以让 3 月 14 日成为一个节日的话,加上爱因斯坦的生日、Linux 内核 1.0.0 发布的周年纪念日,莱伊·惠特尼在这一天申请了轧花机的专利这些原因,应该足够了吧。 -In honor of this special day, we’ve rounded up a dozen fun facts and interesting pi-related projects. Master you team’s Pi Day trivia, or borrow an idea or two for a team-building exercise. Do a project with a budding technologist. And let us know in the comments if you are doing anything unique to celebrate everyone’s favorite never-ending number. +(LCTT译注:[轧花机](https://zh.wikipedia.org/wiki/%E8%BB%8B%E6%A3%89%E6%A9%9F)是一种快速而且简单地分开棉花纤维和种子的机器,生产力比人手分离高得多。) -### Pi Day celebrations: +很荣幸,我门能在这一天一起了解有关它的有趣的事实和与π相关的活动。来吧,和你的团队一起庆祝圆周率日:找一两个点子来进行团队建设,用新兴技术做一个项目。如果你有庆祝为被大家所喜爱的无限小数的独特方式,请在评论区与大家分享。 - * Today is the 30th anniversary of Pi Day. The first was held in 1988 in San Francisco at the Exploratorium by physicist Larry Shaw. “On [the first Pi Day][1], staff brought in fruit pies and a tea urn for the celebration. At 1:59 – the pi numbers that follow 3.14 – Shaw led a circular parade around the museum with his boombox blaring the digits of pi to the music of ‘Pomp and Circumstance.’” It wasn’t until 21 years later, March 2009, that Pi Day became an official national holiday in the U.S. - * Although it started in San Francisco, one of the biggest Pi Day celebrations can be found in Princeton. The town holds a [number of events][2] over the course of five days, including an Einstein look-alike contest, a pie-throwing event, and a pi recitation competition. Some of the activities even offer a cash prize of $314.15 for the winner. - * MIT Sloan School of Management (on Twitter as [@MITSloan][3]) is celebrating Pi Day with fun facts about pi – and pie. Follow along with the Twitter hashtag #PiVersusPie +### 圆周率日的庆祝方法: + * 今天是圆周率日的第 30 次周年纪念。第一次为它庆祝是在旧金山的探索博物馆Exploratorium由物理学家Larry Shaw 举行。“在第 1 次周年纪念日当天,工作人员带来了水果派和茶壶来庆祝它。在 1 点 59 分,圆周率中紧接着 3.14,Shaw 在博物馆外领着队伍环馆一周。队伍中用扩音器播放着‘Pomp and Circumstance’。” 直到 21 年后,在 2009 年 3 月,圆周率正式成为了美国的法定假日。 + * 虽然它起源于旧金山,可规模最大的庆祝活动是在普林斯顿举行的,小镇举办了为期五天的[数字活动][2],包括爱因斯坦模仿比赛、投掷派比赛,圆周率背诵比赛等等。其中的某些活动甚至会给获胜者提供高达 314.5 美元的奖金。 + * 麻省理工的斯隆管理学院MIT Sloan School of Management正在庆祝圆周率日。他们在 Twitter 上分享着关于圆周率日有趣的事实,详情请关注推特话题Twitter hashtag #PiVersusPie 。 +(LCTT译注:本文写于 2018 年的圆周率日,故在细节上存在出入。例如今天(2019 年 3 月 14 日)是圆周率日的第 31 次周年纪念。) -### Pi-related projects and activities: +### 与圆周率有关的项目与活动: - * If you want to keep your math skills sharpened, NASA Jet Propulsion Lab has posted a [new set of math problems][4] that illustrate how pi can be used to unlock the mysteries of space. This marks the fifth year of NASA’s Pi Day Challenge, geared toward students. - * There's no better way to get into the spirit of Pi Day than to take on a [Raspberry Pi][5] project. Whether you are looking for a project to do with your kids or with your team, there’s no shortage of ideas out there. Since its launch in 2012, millions of the basic computer boards have been sold. In fact, it’s the [third best-selling general purpose computer][6] of all time. Here are a few Raspberry Pi projects and activities that caught our eye: - * Grab an AIY (AI-Yourself) kit from Google. You can create a [voice-controlled digital assistant][7] or an [image-recognition device][8]. - * [Run Kubernetes][9] on a Raspberry Pi. - * Save Princess Peach by building a [retro gaming system][10]. - * Host a [Raspberry Jam][11] with your team. The Raspberry Pi Foundation has released a [Guidebook][12] to make hosting easy. According to the website, Raspberry Jams provide, “a support network for people of all ages in digital making. All around the world, like-minded people meet up to discuss and share their latest projects, give workshops, and chat about all things Pi.” + * 如果你像锻炼你的数学技能,美国国家航空航天局NASA, National Aeronautics and Space Administration喷气推进实验室JPL, Jet Propulsion Lab发布了[一系列数学问题][4],希望通过这些问题展现如何把圆周率用于空间探索。这也是美国国家航天局面向学生举办的第五届圆周率日挑战。 + * 想要领略圆周率日的精神,最好的方法也许就是开展一个[树莓派][5]项目了,无论是和你的孩子还是和你的团队一起完成,都没有什么明显的缺点。树莓派作为一项从 2012 年开启的项目,现在已经有数百万块的基本电脑板被出售。事实上,它已经在[通用计算机畅销榜上排名第三][6]了。这里列举一些可能会吸引你的树莓派项目或活动: + * 来自谷歌的自己做AIAIY (AI-Yourself)项目让你自己创造一个[语音控制的数字助手][7]或者[一个图像识别设备][8]。 + * 在树莓派上[使用 Kubernets][9]。 + * 目标:拯救桃子公主!组装一台[怀旧游戏系统][10]。 + * 和你的团队举办一场[树莓派 Jam][11]。树莓派基金会发布了[GitBook][12]来帮助大家顺利举办。根据网页内容,树莓派 Jam 旨在“给所有年龄的人在数字创作中提供支持,全世界的有着相同想法的人集中起来讨论并分享他们的项目,举办讲习班,讨论和圆周率相关的一切。” +### 其他有关圆周率的事实: + * 当前背诵圆周率的[世界纪录保持者][13]是 Suresh Kumar Sharma,他在 2015 年 10 月花了 17 小时零 14 分钟背出了 70,030 位数字。然而,[非官方记录][14]的保持者 Akira Haraguchi 声称他可以背出 111,700 位数字。 + * 现在,已知的圆周率数字的长度比以往都要多。在 2016 年 11 月,R&D 科学家 Peter Trueb 计算出了 22,459,157,718,361 位圆周率数字,比 2013 年的世界记录多了 [9 万亿数字][15]。据新科学家New Scientist所述,“最终文件包含了圆周率的 22 万亿位数字,大小接近 9 TB。如果将其打印出来,能用数百万本 1000 页的书装满一整个图书馆。” -### Other fun Pi facts: - - * The current [world record holder][13] for reciting pi is Suresh Kumar Sharma, who in October 2015 recited 70,030 digits. It took him 17 hours and 14 minutes to do so. However, the [unofficial record][14] goes to Akira Haraguchi, who claims he can recite up to 111,700 digits. - * And, there’s more to remember than ever before. In November 2016, R&D scientist Peter Trueb calculated 22,459,157,718,361 digits of pi – [9 trillion more digits][15] than the previous world record set in 2013. According to New Scientist, “The final file containing the 22 trillion digits of pi is nearly 9 terabytes in size. If printed out, it would fill a library of several million books containing a thousand pages each." - - - -Happy Pi Day! +祝你圆周率日快乐! -------------------------------------------------------------------------------- @@ -42,7 +38,7 @@ Happy Pi Day! via: https://enterprisersproject.com/article/2018/3/pi-day-12-fun-facts-and-ways-celebrate 作者:[Carla Rudder][a] -译者:[译者ID](https://github.com/译者ID) +译者:[wwhio](https://github.com/wwhio) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e8902597dc741072d9df604cf69bc3eb50182b38 Mon Sep 17 00:00:00 2001 From: wwhio Date: Mon, 11 Mar 2019 17:55:08 +0800 Subject: [PATCH 546/813] Rename sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md to translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md --- .../talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md (100%) diff --git a/sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md b/translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md similarity index 100% rename from sources/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md rename to translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md From c615c0d019adc61e773fa20edc6aab2918e49809 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 6 Mar 2019 10:26:56 +0800 Subject: [PATCH 547/813] =?UTF-8?q?20180926=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180926 HTTP- Brief History of HTTP.md | 286 ------------------ .../20180926 HTTP- Brief History of HTTP.md | 274 +++++++++++++++++ 2 files changed, 274 insertions(+), 286 deletions(-) delete mode 100644 sources/tech/20180926 HTTP- Brief History of HTTP.md create mode 100644 translated/tech/20180926 HTTP- Brief History of HTTP.md diff --git a/sources/tech/20180926 HTTP- Brief History of HTTP.md b/sources/tech/20180926 HTTP- Brief History of HTTP.md deleted file mode 100644 index 64e2abfd6b..0000000000 --- a/sources/tech/20180926 HTTP- Brief History of HTTP.md +++ /dev/null @@ -1,286 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HTTP: Brief History of HTTP) -[#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) -[#]: author: (Ilya Grigorik https://www.igvita.com/) - -HTTP: Brief History of HTTP -====== - -### Introduction - -The Hypertext Transfer Protocol (HTTP) is one of the most ubiquitous and widely adopted application protocols on the Internet: it is the common language between clients and servers, enabling the modern web. From its simple beginnings as a single keyword and document path, it has become the protocol of choice not just for browsers, but for virtually every Internet-connected software and hardware application. - -In this chapter, we will take a brief historical tour of the evolution of the HTTP protocol. A full discussion of the varying HTTP semantics is outside the scope of this book, but an understanding of the key design changes of HTTP, and the motivations behind each, will give us the necessary background for our discussions on HTTP performance, especially in the context of the many upcoming improvements in HTTP/2. - -### §HTTP 0.9: The One-Line Protocol - -The original HTTP proposal by Tim Berners-Lee was designed with simplicity in mind as to help with the adoption of his other nascent idea: the World Wide Web. The strategy appears to have worked: aspiring protocol designers, take note. - -In 1991, Berners-Lee outlined the motivation for the new protocol and listed several high-level design goals: file transfer functionality, ability to request an index search of a hypertext archive, format negotiation, and an ability to refer the client to another server. To prove the theory in action, a simple prototype was built, which implemented a small subset of the proposed functionality: - - * Client request is a single ASCII character string. - - * Client request is terminated by a carriage return (CRLF). - - * Server response is an ASCII character stream. - - - - * Server response is a hypertext markup language (HTML). - - * Connection is terminated after the document transfer is complete. - - - - -However, even that sounds a lot more complicated than it really is. What these rules enable is an extremely simple, Telnet-friendly protocol, which some web servers support to this very day: - -``` -$> telnet google.com 80 - -Connected to 74.125.xxx.xxx - -GET /about/ - -(hypertext response) -(connection closed) -``` - -The request consists of a single line: `GET` method and the path of the requested document. The response is a single hypertext document—no headers or any other metadata, just the HTML. It really couldn’t get any simpler. Further, since the previous interaction is a subset of the intended protocol, it unofficially acquired the HTTP 0.9 label. The rest, as they say, is history. - -From these humble beginnings in 1991, HTTP took on a life of its own and evolved rapidly over the coming years. Let us quickly recap the features of HTTP 0.9: - - * Client-server, request-response protocol. - - * ASCII protocol, running over a TCP/IP link. - - * Designed to transfer hypertext documents (HTML). - - * The connection between server and client is closed after every request. - - -``` -Popular web servers, such as Apache and Nginx, still support the HTTP 0.9 protocol—in part, because there is not much to it! If you are curious, open up a Telnet session and try accessing google.com, or your own favorite site, via HTTP 0.9 and inspect the behavior and the limitations of this early protocol. -``` - -### §HTTP/1.0: Rapid Growth and Informational RFC - -The period from 1991 to 1995 is one of rapid coevolution of the HTML specification, a new breed of software known as a "web browser," and the emergence and quick growth of the consumer-oriented public Internet infrastructure. - -``` -##### §The Perfect Storm: Internet Boom of the Early 1990s - -Building on Tim Berner-Lee’s initial browser prototype, a team at the National Center of Supercomputing Applications (NCSA) decided to implement their own version. With that, the first popular browser was born: NCSA Mosaic. One of the programmers on the NCSA team, Marc Andreessen, partnered with Jim Clark to found Mosaic Communications in October 1994. The company was later renamed Netscape, and it shipped Netscape Navigator 1.0 in December 1994. By this point, it was already clear that the World Wide Web was bound to be much more than just an academic curiosity. - -In fact, that same year the first World Wide Web conference was organized in Geneva, Switzerland, which led to the creation of the World Wide Web Consortium (W3C) to help guide the evolution of HTML. Similarly, a parallel HTTP Working Group (HTTP-WG) was established within the IETF to focus on improving the HTTP protocol. Both of these groups continue to be instrumental to the evolution of the Web. - -Finally, to create the perfect storm, CompuServe, AOL, and Prodigy began providing dial-up Internet access to the public within the same 1994–1995 time frame. Riding on this wave of rapid adoption, Netscape made history with a wildly successful IPO on August 9, 1995—the Internet boom had arrived, and everyone wanted a piece of it! -``` - -The growing list of desired capabilities of the nascent Web and their use cases on the public Web quickly exposed many of the fundamental limitations of HTTP 0.9: we needed a protocol that could serve more than just hypertext documents, provide richer metadata about the request and the response, enable content negotiation, and more. In turn, the nascent community of web developers responded by producing a large number of experimental HTTP server and client implementations through an ad hoc process: implement, deploy, and see if other people adopt it. - -From this period of rapid experimentation, a set of best practices and common patterns began to emerge, and in May 1996 the HTTP Working Group (HTTP-WG) published RFC 1945, which documented the "common usage" of the many HTTP/1.0 implementations found in the wild. Note that this was only an informational RFC: HTTP/1.0 as we know it is not a formal specification or an Internet standard! - -Having said that, an example HTTP/1.0 request should look very familiar: - -``` -$> telnet website.org 80 - -Connected to xxx.xxx.xxx.xxx - -GET /rfc/rfc1945.txt HTTP/1.0 -User-Agent: CERN-LineMode/2.15 libwww/2.17b3 -Accept: */* - -HTTP/1.0 200 OK -Content-Type: text/plain -Content-Length: 137582 -Expires: Thu, 01 Dec 1997 16:00:00 GMT -Last-Modified: Wed, 1 May 1996 12:45:26 GMT -Server: Apache 0.84 - -(plain-text response) -(connection closed) -``` - - 1. Request line with HTTP version number, followed by request headers - - 2. Response status, followed by response headers - - - - -The preceding exchange is not an exhaustive list of HTTP/1.0 capabilities, but it does illustrate some of the key protocol changes: - - * Request may consist of multiple newline separated header fields. - - * Response object is prefixed with a response status line. - - * Response object has its own set of newline separated header fields. - - * Response object is not limited to hypertext. - - * The connection between server and client is closed after every request. - - - - -Both the request and response headers were kept as ASCII encoded, but the response object itself could be of any type: an HTML file, a plain text file, an image, or any other content type. Hence, the "hypertext transfer" part of HTTP became a misnomer not long after its introduction. In reality, HTTP has quickly evolved to become a hypermedia transport, but the original name stuck. - -In addition to media type negotiation, the RFC also documented a number of other commonly implemented capabilities: content encoding, character set support, multi-part types, authorization, caching, proxy behaviors, date formats, and more. - -``` -Almost every server on the Web today can and will still speak HTTP/1.0. Except that, by now, you should know better! Requiring a new TCP connection per request imposes a significant performance penalty on HTTP/1.0; see [Three-Way Handshake][1], followed by [Slow-Start][2]. -``` - -### §HTTP/1.1: Internet Standard - -The work on turning HTTP into an official IETF Internet standard proceeded in parallel with the documentation effort around HTTP/1.0 and happened over a period of roughly four years: between 1995 and 1999. In fact, the first official HTTP/1.1 standard is defined in RFC 2068, which was officially released in January 1997, roughly six months after the publication of HTTP/1.0. Then, two and a half years later, in June of 1999, a number of improvements and updates were incorporated into the standard and were released as RFC 2616. - -The HTTP/1.1 standard resolved a lot of the protocol ambiguities found in earlier versions and introduced a number of critical performance optimizations: keepalive connections, chunked encoding transfers, byte-range requests, additional caching mechanisms, transfer encodings, and request pipelining. - -With these capabilities in place, we can now inspect a typical HTTP/1.1 session as performed by any modern HTTP browser and client: - -``` -$> telnet website.org 80 -Connected to xxx.xxx.xxx.xxx - -GET /index.html HTTP/1.1 -Host: website.org -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -Cookie: __qca=P0-800083390... (snip) - -HTTP/1.1 200 OK -Server: nginx/1.0.11 -Connection: keep-alive -Content-Type: text/html; charset=utf-8 -Via: HTTP/1.1 GWA -Date: Wed, 25 Jul 2012 20:23:35 GMT -Expires: Wed, 25 Jul 2012 20:23:35 GMT -Cache-Control: max-age=0, no-cache -Transfer-Encoding: chunked - -100 - -(snip) - -100 -(snip) - -0 - -GET /favicon.ico HTTP/1.1 -Host: www.website.org -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) -Accept: */* -Referer: http://website.org/ -Connection: close -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -Cookie: __qca=P0-800083390... (snip) - -HTTP/1.1 200 OK -Server: nginx/1.0.11 -Content-Type: image/x-icon -Content-Length: 3638 -Connection: close -Last-Modified: Thu, 19 Jul 2012 17:51:44 GMT -Cache-Control: max-age=315360000 -Accept-Ranges: bytes -Via: HTTP/1.1 GWA -Date: Sat, 21 Jul 2012 21:35:22 GMT -Expires: Thu, 31 Dec 2037 23:55:55 GMT -Etag: W/PSA-GAu26oXbDi - -(icon data) -(connection closed) -``` - - 1. Request for HTML file, with encoding, charset, and cookie metadata - - 2. Chunked response for original HTML request - - 3. Number of octets in the chunk expressed as an ASCII hexadecimal number (256 bytes) - - 4. End of chunked stream response - - 5. Request for an icon file made on same TCP connection - - 6. Inform server that the connection will not be reused - - 7. Icon response, followed by connection close - - - - -Phew, there is a lot going on in there! The first and most obvious difference is that we have two object requests, one for an HTML page and one for an image, both delivered over a single connection. This is connection keepalive in action, which allows us to reuse the existing TCP connection for multiple requests to the same host and deliver a much faster end-user experience; see [Optimizing for TCP][3]. - -To terminate the persistent connection, notice that the second client request sends an explicit `close` token to the server via the `Connection` header. Similarly, the server can notify the client of the intent to close the current TCP connection once the response is transferred. Technically, either side can terminate the TCP connection without such signal at any point, but clients and servers should provide it whenever possible to enable better connection reuse strategies on both sides. - -``` -HTTP/1.1 changed the semantics of the HTTP protocol to use connection keepalive by default. Meaning, unless told otherwise (via `Connection: close` header), the server should keep the connection open by default. - -However, this same functionality was also backported to HTTP/1.0 and enabled via the `Connection: Keep-Alive` header. Hence, if you are using HTTP/1.1, technically you don’t need the `Connection: Keep-Alive` header, but many clients choose to provide it nonetheless. -``` - -Additionally, the HTTP/1.1 protocol added content, encoding, character set, and even language negotiation, transfer encoding, caching directives, client cookies, plus a dozen other capabilities that can be negotiated on each request. - -We are not going to dwell on the semantics of every HTTP/1.1 feature. This is a subject for a dedicated book, and many great ones have been written already. Instead, the previous example serves as a good illustration of both the quick progress and evolution of HTTP, as well as the intricate and complicated dance of every client-server exchange. There is a lot going on in there! - -``` -For a good reference on all the inner workings of the HTTP protocol, check out O’Reilly’s HTTP: The Definitive Guide by David Gourley and Brian Totty. -``` - -### §HTTP/2: Improving Transport Performance - -Since its publication, RFC 2616 has served as a foundation for the unprecedented growth of the Internet: billions of devices of all shapes and sizes, from desktop computers to the tiny web devices in our pockets, speak HTTP every day to deliver news, video, and millions of other web applications we have all come to depend on in our lives. - -What began as a simple, one-line protocol for retrieving hypertext quickly evolved into a generic hypermedia transport, and now a decade later can be used to power just about any use case you can imagine. Both the ubiquity of servers that can speak the protocol and the wide availability of clients to consume it means that many applications are now designed and deployed exclusively on top of HTTP. - -Need a protocol to control your coffee pot? RFC 2324 has you covered with the Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)—originally an April Fools’ Day joke by IETF, and increasingly anything but a joke in our new hyper-connected world. - -> The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol that can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. -> -> RFC 2616: HTTP/1.1, June 1999 - -The simplicity of the HTTP protocol is what enabled its original adoption and rapid growth. In fact, it is now not unusual to find embedded devices—sensors, actuators, and coffee pots alike—using HTTP as their primary control and data protocols. But under the weight of its own success and as we increasingly continue to migrate our everyday interactions to the Web—social, email, news, and video, and increasingly our entire personal and job workspaces—it has also begun to show signs of stress. Users and web developers alike are now demanding near real-time responsiveness and protocol performance from HTTP/1.1, which it simply cannot meet without some modifications. - -To meet these new challenges, HTTP must continue to evolve, and hence the HTTPbis working group announced a new initiative for HTTP/2 in early 2012: - -> There is emerging implementation experience and interest in a protocol that retains the semantics of HTTP without the legacy of HTTP/1.x message framing and syntax, which have been identified as hampering performance and encouraging misuse of the underlying transport. -> -> The working group will produce a specification of a new expression of HTTP’s current semantics in ordered, bi-directional streams. As with HTTP/1.x, the primary target transport is TCP, but it should be possible to use other transports. -> -> HTTP/2 charter, January 2012 - -The primary focus of HTTP/2 is on improving transport performance and enabling both lower latency and higher throughput. The major version increment sounds like a big step, which it is and will be as far as performance is concerned, but it is important to note that none of the high-level protocol semantics are affected: all HTTP headers, values, and use cases are the same. - -Any existing website or application can and will be delivered over HTTP/2 without modification: you do not need to modify your application markup to take advantage of HTTP/2. The HTTP servers will have to speak HTTP/2, but that should be a transparent upgrade for the majority of users. The only difference if the working group meets its goal, should be that our applications are delivered with lower latency and better utilization of the network link! - -Having said that, let’s not get ahead of ourselves. Before we get to the new HTTP/2 protocol features, it is worth taking a step back and examining our existing deployment and performance best practices for HTTP/1.1. The HTTP/2 working group is making fast progress on the new specification, but even if the final standard was already done and ready, we would still have to support older HTTP/1.1 clients for the foreseeable future—realistically, a decade or more. - --------------------------------------------------------------------------------- - -via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol - -作者:[Ilya Grigorik][a] -选题:[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.igvita.com/ -[b]: https://github.com/lujun9972 -[1]: https://hpbn.co/building-blocks-of-tcp/#three-way-handshake -[2]: https://hpbn.co/building-blocks-of-tcp/#slow-start -[3]: https://hpbn.co/building-blocks-of-tcp/#optimizing-for-tcp diff --git a/translated/tech/20180926 HTTP- Brief History of HTTP.md b/translated/tech/20180926 HTTP- Brief History of HTTP.md new file mode 100644 index 0000000000..46df90e42f --- /dev/null +++ b/translated/tech/20180926 HTTP- Brief History of HTTP.md @@ -0,0 +1,274 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (HTTP: Brief History of HTTP) +[#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) +[#]: author: (Ilya Grigorik https://www.igvita.com/) + +HTTP: HTTP 历史简介 +====== + +### 介绍 + +超文本传输协议(HTTP)是 Internet 上最普遍和广泛采用的应用程序协议之一。它是客户端和服务器之间的通用语言,支持现代 Web。从最初作为一个简单的关键字和文档路径开始,它已成为不仅仅是浏览器的首选协议,而且几乎是所有连接互联网硬件和软件应用程序的首选协议。 + +在本文中,我们将简要回顾 HTTP 协议的发展历史。对 HTTP 不同语义的完整讨论超出了本文的范围,但理解 HTTP 的关键设计变更以及每个变更背后的动机将为我们讨论 HTTP 性能提供必要的背景,特别是在 HTTP/2 中即将进行的许多改进。 + +### §HTTP 0.9: 单向协议 + +Tim Berners-Lee 最初的 HTTP 提案在设计时考虑到了简单性,以帮助他采用他的另一个新想法:万维网(World Wide Web)。这个策略看起来奏效了:注意,他是一个有抱负的协议设计者。 + +1991 年,Berners-Lee 概述了新协议的动机,并列出了几个高级设计目标:文件传输功能,请求超文档存档索引搜索的能力,格式协商以及将客户端引用到另一个服务器的能力。为了证明该理论的实际应用,我们构建了一个简单原型,它实现了所提议功能的一小部分。 + + * 客户端请求是一个 ASCII 字符串。 + + * 客户端请求以回车符(CRLF)终止。 + + * 服务器响应是 ASCII 字符流。 + + * 服务器响应是一种超文本标记语言(HTML)。 + + * 文档传输完成后连接终止。 + +这些听起来就挺复杂,而实际情况比这复杂得多。这些规则支持的是一种非常简单的,对 Telnet 友好的协议,一些 Web 服务器至今仍然支持这种协议: + +``` +$> telnet google.com 80 + +Connected to 74.125.xxx.xxx + +GET /about/ + +(hypertext response) +(connection closed) +``` + +请求包含这样一行:`GET` 方法和请求文档的路径。响应是一个超文本文档-没有标题或任何其他元数据,只有 HTML。真的是再简单不过了。此外,由于之前的交互是预期协议的子集,因此它获得了一个非官方的 HTTP 0.9 标签。其余的,就像他们所说的,都是历史。 + +从 1991 年这些不起眼的开始,HTTP 就有了自己的生命,并在接下来几年里迅速发展。让我们快速回顾一下 HTTP 0.9 的特性: + + * 采用客户端-服务器架构,是一种请求-响应协议。 + + * 采用 ASCII 协议,运行在 TCP/IP 链路上。 + + * 旨在传输超文本文档(HTML)。 + + * 每次请求后,服务器和客户端之间的连接都将关闭。 + +``` +流行的 Web 服务器,如 Apache 和 Nginx,仍然支持 HTTP 0.9 协议,部分原因是因为它没有太多功能!如果你感兴趣,打开 Telnet 会话并尝试通过 HTTP 0.9 访问 google.com 或你最喜欢的网站,并检查早期协议的行为和限制。 + +``` +### §HTTP/1.0: 快速增长和 Informational RFC + +1991 年至 1995 年期间, HTML 规范和一种称为 “web 浏览器”的新型软件快速发展,面向消费者的公共互联网基础设施也开始出现并快速增长。 + +``` +##### §完美风暴: 1990 年代初的互联网热潮 + +基于 Tim Berner-Lee 最初的浏览器原型,美国国家超级计算机应用中心(NCSA)的一个团队决定实现他们自己的版本。就这样,第一个流行的浏览器诞生了:NCSA Mosaic。1994 年 10 月,NCSA 团队的一名程序员 Marc Andreessen 与 Jim Clark 合作创建了 Mosaic Communications,该公司后来改名为 Netscape(网景),并于 1994 年 12 月发布了 Netscape Navigator 1.0。从这一点来说,已经很清楚了,万维网已经不仅仅是学术上的好奇心了。 + +实际上,同年在瑞士日内网组织了第一次万维网会议,这导致万维网联盟(W3C)的成立,以帮助指导 HTML 的发展。同样,在 IETF 内部建立了一个并行的 HTTP 工作组(HTTP-WG),专注于改进 HTTP 协议。后来这两个团体一直对 Web 的发展起着重要作用。 + +最后,完美的风暴来临,CompuServe,AOL 和 Prodigy 在 1994-1995 年的同一时间开始向公众提供拨号上网服务。凭借这股迅速的浪潮,Netscape 在 1995 年 8 月 9 日凭借其成功的 IPO 创造了历史。这预示着互联网热潮已经到来,人人都想分一杯羹! +``` + +不断增长的新 Web 所需功能及其在公共网站上的用例很快暴露了 HTTP 0.9 的许多基础限制:我们需要一种能够提供超文本文档、提供关于请求和响应的更丰富的元数据,支持内容协商等等的协议。相应地,新兴的 Web 开发人员社区通过一个特殊的过程生成了大量实验性的 HTTP 服务器和客户端实现来回应:实现,部署,并查看其他人是否采用它。 + +从这些急速增长的实验开始,一系列最佳实践和常见模式开始出现。1996 年 5 月,HTTP 工作组(HTTP-WG)发布了 RFC 1945,它记录了许多被广泛使用的 HTTP/1.0 实现的“常见用法”。请注意,这只是一个信息 RFC:HTTP/1.0,因为我们知道它不是一个正式规范或 Internet 标准! + +话虽如此,HTTP/1.0 请求看起来应该是: + +``` +$> telnet website.org 80 + +Connected to xxx.xxx.xxx.xxx + +GET /rfc/rfc1945.txt HTTP/1.0 +User-Agent: CERN-LineMode/2.15 libwww/2.17b3 +Accept: */* + +HTTP/1.0 200 OK +Content-Type: text/plain +Content-Length: 137582 +Expires: Thu, 01 Dec 1997 16:00:00 GMT +Last-Modified: Wed, 1 May 1996 12:45:26 GMT +Server: Apache 0.84 + +(plain-text response) +(connection closed) +``` + + 1. 请求行有 HTTP 版本号,后面跟请求头 + + 2. 响应状态,后跟响应头 + + +前面交换的并不是 HTTP/1.0 功能的详尽列表,但它确实说明了一些关键的协议更改: + + * 请求可能多个由换行符分隔的请求头字段组成。 + + * 响应对象的前缀是响应状态行。 + + * 响应对象有自己的一组由换行符分隔的响应头字段。 + + * 响应对象不限于超文本。 + + * 每次请求后,服务器和客户端之间的连接都将关闭。 + +请求头和响应头都保留为 ASCII 编码,但响应对象本身可以是任何类型:一个 HTML 文件,一个纯文本文件,一个图像或任何其他内容类型。因此,HTTP 的“超文本传输”部分在引入后不久就变成了用词不当。实际上,HTTP 已经迅速发展成为一种超媒体传输,但最初的名称没有改变。 + +除了媒体类型协商之外,RFC 还记录了许多其他常用功能:内容编码,字符集支持,多部分类型,授权,缓存,代理行为,日期格式等。 + +``` +今天,几乎所有 Web 上的服务器都可以并且仍将使用 HTTP/1.0。不过,现在你应该更加清楚了!每个请求都需要一个新的 TCP 连接,这会对 HTTP/1.0 造成严重的性能损失。参见[三次握手][1],接着会[慢启动][2]。 +``` + +### §HTTP/1.1: Internet 标准 + +将 HTTP 转变为官方 IETF 互联网标准的工作与围绕 HTTP/1.0 的文档工作并行进行,并计划从 1995 年至 1999 年完成。事实上,第一个正式的 HTTP/1.1 标准定义于 RFC 2068,它在 HTTP/1.0 发布大约六个月后,即 1997 年 1 月正式发布。两年半后,即 1999 年 6 月,一些新的改进和更新被纳入标准,并作为 RFC 2616 发布。 + +HTTP/1.1 标准解决了早期版本中发现的许多协议歧义,并引入了一些关键的性能优化:保持连接,分块编码传输,字节范围请求,附加缓存机制,传输编码和请求管道。 + +有了这些功能,我们现在可以审视一下由任何现代 HTTP 浏览器和客户端执行的典型 HTTP/1.1 会话: + +``` +$> telnet website.org 80 +Connected to xxx.xxx.xxx.xxx + +GET /index.html HTTP/1.1 +Host: website.org +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) +Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 +Accept-Encoding: gzip,deflate,sdch +Accept-Language: en-US,en;q=0.8 +Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 +Cookie: __qca=P0-800083390... (snip) + +HTTP/1.1 200 OK +Server: nginx/1.0.11 +Connection: keep-alive +Content-Type: text/html; charset=utf-8 +Via: HTTP/1.1 GWA +Date: Wed, 25 Jul 2012 20:23:35 GMT +Expires: Wed, 25 Jul 2012 20:23:35 GMT +Cache-Control: max-age=0, no-cache +Transfer-Encoding: chunked + +100 + +(snip) + +100 +(snip) + +0 + +GET /favicon.ico HTTP/1.1 +Host: www.website.org +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) +Accept: */* +Referer: http://website.org/ +Connection: close +Accept-Encoding: gzip,deflate,sdch +Accept-Language: en-US,en;q=0.8 +Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 +Cookie: __qca=P0-800083390... (snip) + +HTTP/1.1 200 OK +Server: nginx/1.0.11 +Content-Type: image/x-icon +Content-Length: 3638 +Connection: close +Last-Modified: Thu, 19 Jul 2012 17:51:44 GMT +Cache-Control: max-age=315360000 +Accept-Ranges: bytes +Via: HTTP/1.1 GWA +Date: Sat, 21 Jul 2012 21:35:22 GMT +Expires: Thu, 31 Dec 2037 23:55:55 GMT +Etag: W/PSA-GAu26oXbDi + +(icon data) +(connection closed) +``` + + 1. 请求的 HTML 文件,包括编码,字符集和 cookie 元数据 + + 2. 原始 HTML 请求的分块响应 + + 3. 以 ASCII 十六进制数字(256 字节)表示块中的八位元数 + + 4. 分块流响应结束 + + 5. 在相同的 TCP 连接上请求一个图标文件 + + 6. 通知服务器不再重用连接 + + 7. 图标响应后,然后关闭连接 + + +哇,这里发生了很多事情!第一个也是最明显的区别是我们有两个对象请求,一个用于 HTML 页面,另一个用于图像,它们都通过一个连接完成。这就是保持连接的实际应用,它允许我们重用现有的 TCP 连接到同一个主机的多个请求,提供一个更快的最终用户体验。参见[TCP 优化][3]。 + +要终止持久连接,注意第二个客户端请求通过 `Connection` 请求头向服务器发送显示的 `close`。类似地,一旦传输响应,服务器就可以通知客户端关闭当前 TCP 连接。从技术上讲,任何一方都可以在没有此类信号的情况下终止 TCP 连接,但客户端和服务器应尽可能提供此类信号,以便双方都启用更好的连接重用策略。 + +``` +HTTP/1.1 改变了 HTTP 协议的语义,默认情况下使用保持连接。这意味着,除非另有说明(通过 `Connection:close` 头),否则服务器应默认保持连接打开。 + +但是,同样的功能也被反向移植到 HTTP/1.0 上,通过 `Connection:keep-Alive` 头启用。因此,如果你使用 HTTP/1.1,从技术上讲,你不需要 `Connection:keep-Alive` 头,但许多客户端仍然选择提供它。 +``` + +此外,HTTP/1.1 协议还添加了内容、编码、字符集,甚至语言协商、传输编码、缓存指令、客户端 cookie,以及可以针对每个请求协商的十几个其他功能。 + +我们不打算详细讨论每个 HTTP/1.1 特性的语义。这个主题可以写一本专门的书了,已经有了很多很棒的书。相反,前面的示例很好地说明了 HTTP 的快速进展和演变,以及每个客户端-服务器交换的错综复杂的过程,里面发生了很多事情! + +``` +要了解 HTTP 协议所有内部工作原理,参考 David Gourley 和 Brian Totty 共同撰写的权威指南: The Definitive Guide。(to 校正:这里翻译的不准确) +``` + +### §HTTP/2: 提高传输性能 + +RFC 2616 自发布以来,已经成为互联网空前增长的基础:数十亿各种形状和大小的设备,从台式电脑到我们口袋里的小型网络设备,每天都在使用 HTTP 来传送新闻,视频,在我们生活中的数百万的其他网络应用程序都在依靠它。 + +一开始是一个简单的,用于检索超文本的简单协议,很快演变成了一种通用的超媒体传输,现在十年过去了,它几乎可以为你所能想象到的任何用例提供支持。可以使用协议的服务器无处不在,客户端也可以使用协议,这意味着现在许多应用程序都是专门在 HTTP 之上设计和部署的。 + +需要一个协议来控制你的咖啡壶?RFC 2324 已经涵盖了超文本咖啡壶控制协议(HTCPCP/1.0)- 它原本是 IETF 在愚人节开的一个玩笑,但在我们这个超链接的新世界中,它不仅仅意味着一个玩笑。 + +> 超文本传输协议(HTTP)是一个应用程序级的协议,用于分布式、协作、超媒体信息系统。它是一种通用的、无状态的协议,可以通过扩展请求方法、错误码和头,用于超出超文本之外的许多任务,比如名称服务器和分布式对象管理系统。HTTP 的一个特性是数据表示的类型和协商,允许独立于传输的数据构建系统。 +> +> RFC 2616: HTTP/1.1, June 1999 + +HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上,现在使用 HTTP 作为主要控制和数据协议的嵌入式设备(传感器,执行器和咖啡壶)并不罕见。但在其自身成功的重压下,随着我们越来越多地继续将日常互动转移到网络-社交、电子邮件、新闻和视频,以及越来越多的个人和工作空间,它也开始显示出压力的迹象。用户和 Web 开发人员现在都要求 HTTP/1.1 提供近乎实时的响应能力和协议 +性能,如果不进行一些修改,就无法满足这些要求。 + +为了应对这些新挑战,HTTP 必须继续发展,因此 HTTPbis 工作组在 2012 年初宣布了一项针对 HTTP/2 的新计划: + +> 已经有一个协议中出现了新的实现经验和兴趣,该协议保留了 HTTP 的语义,但是没有保留 HTTP/1.x 的消息框架和语法,这些问题已经被确定为妨碍性能和鼓励滥用底层传输。 +> +> 工作组将使用有序的双向流中生成 HTTP 当前语义的新表达式的规范。与 HTTP/1.x 一样,主要传输目标是 TCP,但是应该可以使用其他方式传输。 +> +> HTTP/2 charter, January 2012 + +HTTP/2 的主要重点是提高传输性能并支持更低的延迟和更高的吞吐量。主要的版本增量听起来像是一个很大的步骤,但就性能而言,它将是一个重大的步骤,但重要的是要注意,没有任何高级协议语义收到影响:所有的 HTTP 头,值和用例是相同的。 + +任何现有的网站或应用程序都可以并且将通过 HTTP/2 传送而无需修改。你无需修改应用程序标记来利用 HTTP/2。HTTP 服务器必须使用 HTTP/2,但这对大多数用户来说应该是透明的升级。如果工作组实现目标,唯一的区别应该是我们的应用程序以更低的延迟和更好的网络连接利用率来传送数据。 + +话虽如此,但我们不要走的太远了。在讨论新的 HTTP/2 协议功能之前,有必要回顾一下我们现有的 HTTP/1.1 部署和性能最佳实践。HTTP/2 工作组正在新规范上取得快速的进展,但即使最终标准已经完成并准备就绪,在可预见的未来,我们仍然必须支持旧的 HTTP/1.1 客户端,实际上,这得十年或更长时间。 + +-------------------------------------------------------------------------------- + +via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol + +作者:[Ilya Grigorik][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://www.igvita.com/ +[b]: https://github.com/lujun9972 +[1]: https://hpbn.co/building-blocks-of-tcp/#three-way-handshake +[2]: https://hpbn.co/building-blocks-of-tcp/#slow-start +[3]: https://hpbn.co/building-blocks-of-tcp/#optimizing-for-tcp From aeaa4a456e1b6ee9c1233a7f4c4f52fde9134e02 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 11 Mar 2019 22:52:11 +0800 Subject: [PATCH 548/813] hankchow translated --- ... x86 vs. ARM for Web Crawling in Python.md | 533 ------------------ ... x86 vs. ARM for Web Crawling in Python.md | 525 +++++++++++++++++ 2 files changed, 525 insertions(+), 533 deletions(-) delete mode 100644 sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md create mode 100644 translated/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md diff --git a/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md b/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md deleted file mode 100644 index 439bd682e5..0000000000 --- a/sources/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md +++ /dev/null @@ -1,533 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (SPEED TEST: x86 vs. ARM for Web Crawling in Python) -[#]: via: (https://blog.dxmtechsupport.com.au/speed-test-x86-vs-arm-for-web-crawling-in-python/) -[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) - -SPEED TEST: x86 vs. ARM for Web Crawling in Python -====== - -![][1] - -Can you imagine if your job was to trawl competitor websites and jot prices down by hand, again and again and again? You’d burn your whole office down by lunchtime. - -So, little wonder web crawlers are huge these days. They can keep track of customer sentiment and trending topics, monitor job openings, real estate transactions, UFC results, all sorts of stuff. - -For those of a certain bent, this is fascinating stuff. Which is how I found myself playing around with [Scrapy][2], an open source web crawling framework written in Python. - -Being wary of the potential to do something catastrophic to my computer while poking with things I didn’t understand, I decided to install it on my main machine but a Raspberry Pi. - -And wouldn’t you know it? It actually didn’t run too shabby on the little tacker. Maybe this is a good use case for an ARM server? - -Google had no solid answer. The nearest thing I found was [this Drupal hosting drag race][3], which showed an ARM server outperforming a much more expensive x86 based account. - -That was definitely interesting. I mean, isn’t a web server kind of like a crawler in reverse? But with one operating on a LAMP stack and the other on a Python interpreter, it’s hardly the exact same thing. - -So what could I do? Only one thing. Get some VPS accounts and make them race each other. - -### What’s the Deal With ARM Processors? - -ARM is now the most popular CPU architecture in the world. - -But it’s generally seen as something you’d opt for to save money and battery life, rather than a serious workhorse. - -It wasn’t always that way: this CPU was designed in Cambridge, England to power the fiendishly expensive [Acorn Archimedes][4]. This was the most powerful desktop computer in the world, and by a long way too: it was multiple times the speed of the fastest 386. - -Acorn, like Commodore and Atari, somewhat ignorantly believed that the making of a great computer company was in the making of great computers. Bill Gates had a better idea. He got DOS on as many x86 machines – of the most widely varying quality and expense – as he could. - -Having the best user base made you the obvious platform for third party developers to write software for; having all the software support made yours the most useful computer. - -Even Apple nearly bit the dust. All the $$$$ were in building a better x86 chip, this was the architecture that ended up being developed for serious computing. - -That wasn’t the end for ARM though. Their chips weren’t just fast, they could run well without drawing much power or emitting much heat. That made them a preferred technology in set top boxes, PDAs, digital cameras, MP3 players, and basically anything that either used a battery or where you’d just rather avoid the noise of a large fan. - -So it was that Acorn spun off ARM, who began an idiosyncratic business model that continues to today: ARM doesn’t actually manufacture any chips, they license their intellectual property to others who do. - -Which is more or less how they ended up in so many phones and tablets. When Linux was ported to the architecture, the door opened to other open source technologies, which is how we can run a web crawler on these chips today. - -#### ARM in the Server Room - -Some big names, like [Microsoft][5] and [Cloudflare][6], have placed heavy bets on the British Bulldog for their infrastructure. But for those of us with more modest budgets, the options are fairly sparse. - -In fact, when it comes to cheap and cheerful VPS accounts that you can stick on the credit card for a few bucks a month, for years the only option was [Scaleway][7]. - -This changed a few months ago when public cloud heavyweight [AWS][8] launched its own ARM processor: the [AWS Graviton][9]. - -I decided to grab one of each, and race them against the most similar Intel offering from the same provider. - -### Looking Under the Hood - -So what are we actually racing here? Let’s jump right in. - -#### Scaleway - -Scaleway positions itself as “designed for developers”. And you know what? I think that’s fair enough: it’s definitely been a good little sandbox for developing and prototyping. - -The dirt simple product offering and clean, easy dashboard guides you from home page to bash shell in minutes. That makes it a strong option for small businesses, freelancers and consultants who just want to get straight into a good VPS at a great price to run some crawls. - -The ARM account we will be using is their [ARM64-2GB][10], which costs 3 euros a month and has 4 Cavium ThunderX cores. This launched in 2014 as the first server-class ARMv8 processor, but is now looking a bit middle-aged, having been superseded by the younger, prettier ThunderX2. - -The x86 account we will be comparing it to is the [1-S][11], which costs a more princely 4 euros a month and has 2 Intel Atom C3995 cores. Intel’s Atom range is a low power single-threaded system on chip design, first built for laptops and then adapted for server use. - -These accounts are otherwise fairly similar: they each have 2 gigabytes of memory, 50 gigabytes of SSD storage and 200 Mbit/s bandwidth. The disk drives possibly differ, but with the crawls we’re going to run here, this won’t come into play, we’re going to be doing everything in memory. - -When I can’t use a package manager I’m familiar with, I become angry and confused, a bit like an autistic toddler without his security blanket, entirely beyond reasoning or consolation, it’s quite horrendous really, so both of these accounts will use Debian Stretch. - -#### Amazon Web Services - -In the same length of time as it takes you to give Scaleway your credit card details, launch a VPS, add a sudo user and start installing dependencies, you won’t even have gotten as far as registering your AWS account. You’ll still be reading through the product pages trying to figure out what’s going on. - -There’s a serious breadth and depth here aimed at enterprises and others with complicated or specialised needs. - -The AWS Graviton we wanna drag race is part of AWS’s “Elastic Compute Cloud” or EC2 range. I’ll be running it as an on-demand instance, which is the most convenient and expensive way to use EC2. AWS also operates a [spot market][12], where you get the server much cheaper if you can be flexible about when it runs. There’s also a [mid-priced option][13] if you want to run it 24/7. - -Did I mention that AWS is complicated? Anyhoo.. - -The two accounts we’re comparing are [a1.medium][14] and [t2.small][15]. They both offer 2GB of RAM. Which begs the question: WTF is a vCPU? Confusingly, it’s a different thing on each account. - -On the a1.medium account, a vCPU is a single core of the new AWS Graviton chip. This was built by Annapurna Labs, an Israeli chip maker bought by Amazon in 2015. This is a single-threaded 64-bit ARMv8 core exclusive to AWS. This has an on-demand price of 0.0255 US dollars per hour. - -Our t2.small account runs on an Intel Xeon – though exactly which Xeon chip it is, I couldn’t really figure out. This has two threads per core – though we’re not really getting the whole core, or even the whole thread. - -Instead we’re getting a “baseline performance of 20%, with the ability to burst above that baseline using CPU credits”. Which makes sense in principle, though it’s completely unclear to me what to actually expect from this. The on-demand price for this account is 0.023 US dollars per hour. - -I couldn’t find Debian in the image library here, so both of these accounts will run Ubuntu 18.04. - -### Beavis and Butthead Do Moz’s Top 500 - -To test these VPS accounts, I need a crawler to run – one that will let the CPU stretch its legs a bit. One way to do this would be to just hammer a few websites with as many requests as fast as possible, but that’s not very polite. What we’ll do instead is a broad crawl of many websites at once. - -So it’s in tribute to my favourite physicist turned filmmaker, Mike Judge, that I wrote beavis.py. This crawls Moz’s Top 500 Websites to a depth of 3 pages to count how many times the words “wood” and “ass” occur anywhere within the HTML source. - -Not all 500 websites will actually get crawled here – some will be excluded by robots.txt and others will require javascript to follow links and so on. But it’s a wide enough crawl to keep the CPU busy. - -Python’s [global interpreter lock][16] means that beavis.py can only make use of a single CPU thread. To test multi-threaded we’re going to have to launch multiple spiders as seperate processes. - -This is why I wrote butthead.py. Any true fan of the show knows that, as crude as Butthead was, he was always slightly more sophisticated than Beavis. - -Splitting the crawl into multiple lists of start pages and allowed domains might slightly impact what gets crawled – fewer external links to other websites in the top 500 will get followed. But every crawl will be different anyway, so we will count how many pages are scraped as well as how long they take. - -### Installing Scrapy on an ARM Server - -Installing Scrapy is basically the same on each architecture. You install pip and various other dependencies, then install Scrapy from pip. - -Installing Scrapy from pip to an ARM device does take noticeably longer though. I’m guessing this is because it has to compile the binary parts from source. - -Once Scrapy is installed, I ran it from the shell to check that it’s fetching pages. - -On Scaleway’s ARM account, there seemed to be a hitch with the service_identity module: it was installed but not working. This issue had come up on the Raspberry Pi as well, but not the AWS Graviton. - -Not to worry, this was easily fixed with the following command: - -``` -sudo pip3 install service_identity --force --upgrade -``` - -Then we were off and racing! - -### Single Threaded Crawls - -The Scrapy docs say to try to [keep your crawls running between 80-90% CPU usage][17]. In practice, it’s hard – at least it is with the script I’ve written. What tends to happen is that the CPU gets very busy early in the crawl, drops a little bit and then rallies again. - -The last part of the crawl, where most of the domains have been finished, can go on for quite a few minutes, which is frustrating, because at that point it feels like more a measure of how big the last website is than anything to do with the processor. - -So please take this for what it is: not a state of the art benchmarking tool, but a short and slightly balding Australian in his underpants running some scripts and watching what happens. - -So let’s get down to brass tacks. We’ll start with the Scaleway crawls. - -| VPS | Account | Time | Pages | Scraped | Pages/Hour | €/million | pages | -| --------- | ------- | ------- | ------ | ---------- | ---------- | --------- | ----- | -| Scaleway | | | | | | | | -| ARM64-2GB | 108m | 59.27s | 38,205 | 21,032.623 | 0.28527 | | | -| --------- | ------- | ------- | ------ | ---------- | ---------- | --------- | ----- | -| Scaleway | | | | | | | | -| 1-S | 97m | 44.067s | 39,476 | 24,324.648 | 0.33011 | | | - -I kept an eye on the CPU use of both of these crawls using [top][18]. Both crawls hit 100% CPU use at the beginning, but the ThunderX chip was definitely redlining a lot more. That means these figures understate how much faster the Atom core crawls than the ThunderX. - -While I was watching CPU use in top, I could also see how much RAM was in use – this increased as the crawl continued. The ARM account used 14.7% at the end of the crawl, while the x86 was at 15%. - -Watching the logs of these crawls, I also noticed a lot more pages timing out and going missing when the processor was maxed out. That makes sense – if the CPU’s too busy to respond to everything then something’s gonna go missing. - -That’s not such a big deal when you’re just racing the things to see which is fastest. But in a real-world situation, with business outcomes at stake in the quality of your data, it’s probably worth having a little bit of headroom. - -And what about AWS? - -| VPS Account | Time | Pages Scraped | Pages / Hour | $ / Million Pages | -| ----------- | ---- | ------------- | ------------ | ----------------- | -| a1.medium | 100m 39.900s | 41,294 | 24,612.725 | 1.03605 | -| t2.small | 78m 53.171s | 41,200 | 31,336.286 | 0.73397 | - -I’ve included these results for sake of comparison with the Scaleway crawls, but these crawls were kind of a bust. Monitoring the CPU use – this time through the AWS dashboard rather than through top – showed that the script wasn’t making good use of the available processing power on either account. - -This was clearest with the a1.medium account – it hardly even got out of bed. It peaked at about 45% near the beginning and then bounced around between 20% and 30% for the rest. - -What’s intriguing to me about this is that the exact same script ran much slower on the ARM processor – and that’s not because it hit a limit of the Graviton’s CPU power. It had oodles of headroom left. Even the Intel Atom core managed to finish, and that was maxing out for some of the crawl. The settings were the same in the code, the way they were being handled differently on the different architecture. - -It’s a bit of a black box to me whether that’s something inherent to the processor itself, the way the binaries were compiled, or some interaction between the two. I’m going to speculate that we might have seen the same thing on the Scaleway ARM VPS, if we hadn’t hit the limit of the CPU core’s processing power first. - -It was harder to know how the t2.small account was doing. The crawl sat at about 20%, sometimes going as high as 35%. Was that it meant by “baseline performance of 20%, with the ability to burst to a higher level”? I had no idea. But I could see on the dashboard I wasn’t burning through any CPU credits. - -Just to make extra sure, I installed [stress][19] and ran it for a few minutes; sure enough, this thing could do 100% if you pushed it. - -Clearly, I was going to need to crank the settings up on both these processors to make them sweat a bit, so I set CONCURRENT_REQUESTS to 5000 and REACTOR_THREADPOOL_MAXSIZE to 120 and ran some more crawls. - -| VPS Account | Time | Pages Scraped | Pages/hr | $/10000 Pages | -| ----------- | ---- | ------------- | -------- | ------------- | -| a1.medium | 46m 13.619s | 40,283 | 52,285.047 | 0.48771 | -| t2.small | 41m7.619s | 36,241 | 52,871.857 | 0.43501 | -| t2.small (No CPU credits) | 73m 8.133s | 34,298 | 28,137.8891 | 0.81740 | - -The a1 instance hit 100% usage about 5 minutes into the crawl, before dropping back to 80% use for another 20 minutes, climbing up to 96% again and then dropping down again as it was wrapping things up. That was probably about as well-tuned as I was going to get it. - -The t2 instance hit 50% early in the crawl and stayed there for until it was nearly done. With 2 threads per core, 50% CPU use is one thread maxed out. - -Here we see both accounts produce similar speeds. But the Xeon thread was redlining for most of the crawl, and the Graviton was not. I’m going to chalk this up as a slight win for the Graviton. - -But what about once you’ve burnt through all your CPU credits? That’s probably the fairer comparison – to only use them as you earn them. I wanted to test that as well. So I ran stress until all the CPU credits were exhausted and ran the crawl again. - -With no credits in the bank, the CPU usage maxed out at 27% and stayed there. So many pages ended up going missing that it actually performed worse than when on the lower settings. - -### Multi Threaded Crawls - -Dividing our crawl up between multiple spiders in separate processes offers a few more options to make use of the available cores. - -I first tried dividing everything up between 10 processes and launching them all at once. This turned out to be slower than just dividing them up into 1 process per core. - -I got the best result by combining these methods – dividing the crawl up into 10 processes and then launching 1 process per core at the start and then the rest as these crawls began to wind down. - -To make this even better, you could try to minimise the problem of the last lingering crawler by making sure the longest crawls start first. I actually attempted to do this. - -Figuring that the number of links on the home page might be a rough proxy for how large the crawl would be, I built a second spider to count them and then sort them in descending order of number of outgoing links. This preprocessing worked well and added a little over a minute. - -It turned out though that blew the crawling time out beyond two hours! Putting all the most link heavy websites together in the same process wasn’t a great idea after all. - -You might effectively deal with this by tweaking the number of domains per process as well – or by shuffling the list after it’s ordered. That’s a bit much for Beavis and Butthead though. - -So I went back to my earlier method that had worked somewhat well: - -| VPS Account | Time | Pages Scraped | Pages/hr | €/10,000 pages | -| ----------- | ---- | ------------- | -------- | -------------- | -| Scaleway ARM64-2GB | 62m 10.078s | 36,158 | 34,897.0719 | 0.17193 | -| Scaleway 1-S | 60m 56.902s | 36,725 | 36,153.5529 | 0.22128 | - -After all that, using more cores did speed up the crawl. But it’s hardly a matter of just halving or quartering the time taken. - -I’m certain that a more experienced coder could better optimise this to take advantage of all the cores. But, as far as “out of the box” Scrapy performance goes, it seems to be a lot easier to speed up a crawl by using faster threads rather than by throwing more cores at it. - -As it is, the Atom has scraped slightly more pages in slightly less time. On a value for money metric, you could possibly say that the ThunderX is ahead. Either way, there’s not a lot of difference here. - -### Everything You Always Wanted to Know About Ass and Wood (But Were Afraid to Ask) - -After scraping 38,205 pages, our crawler found 24,170,435 mentions of ass and 54,368 mentions of wood. - -![][20] - -Considered on its own, this is a respectable amount of wood. - -But when you set it against the sheer quantity of ass we’re dealing with here, the wood looks miniscule. - -### The Verdict - -From what’s visible to me at the moment, it looks like the CPU architecture you use is actually less important than how old the processor is. The AWS Graviton from 2018 was the winner here in single-threaded performance. - -You could of course argue that the Xeon still wins, core for core. But then you’re not really going dollar for dollar anymore, or even thread for thread. - -The Atom from 2017, on the other hand, comfortably bested the ThunderX from 2014. Though, on the value for money metric, the ThunderX might be the clear winner. Then again, if you can run your crawls on Amazon’s spot market, the Graviton is still ahead. - -All in all, I think this shows that, yes, you can crawl the web with an ARM device, and it can compete on both performance and price. - -Whether the difference is significant enough for you to turn what you’re doing upside down is a whole other question of course. Certainly, if you’re already on the AWS cloud – and your code is portable enough – then it might be worthwhile testing out their a1 instances. - -Hopefully we will see more ARM options on the public cloud in near future. - -### The Scripts - -This is my first real go at doing anything in either Python or Scrapy. So this might not be great code to learn from. Some of what I’ve done here – such as using global variables – is definitely a bit kludgey. - -Still, I want to be transparent about my methods, so here are my scripts. - -To run them, you’ll need Scrapy installed and you will need the CSV file of [Moz’s top 500 domains][21]. To run butthead.py you will also need [psutil][22]. - -##### beavis.py - -``` -import scrapy -from scrapy.spiders import CrawlSpider, Rule -from scrapy.linkextractors import LinkExtractor -from scrapy.crawler import CrawlerProcess - -ass = 0 -wood = 0 -totalpages = 0 - -def getdomains(): - - moz500file = open('top500.domains.05.18.csv') - - domains = [] - moz500csv = moz500file.readlines() - - del moz500csv[0] - - for csvline in moz500csv: - leftquote = csvline.find('"') - rightquote = leftquote + csvline[leftquote + 1:].find('"') - domains.append(csvline[leftquote + 1:rightquote]) - - return domains - -def getstartpages(domains): - - startpages = [] - - for domain in domains: - startpages.append('http://' + domain) - - return startpages - -class AssWoodItem(scrapy.Item): - ass = scrapy.Field() - wood = scrapy.Field() - url = scrapy.Field() - -class AssWoodPipeline(object): - def __init__(self): - self.asswoodstats = [] - - def process_item(self, item, spider): - self.asswoodstats.append((item.get('url'), item.get('ass'), item.get('wood'))) - - def close_spider(self, spider): - asstally, woodtally = 0, 0 - - for asswoodcount in self.asswoodstats: - asstally += asswoodcount[1] - woodtally += asswoodcount[2] - - global ass, wood, totalpages - ass = asstally - wood = woodtally - totalpages = len(self.asswoodstats) - -class BeavisSpider(CrawlSpider): - name = "Beavis" - allowed_domains = getdomains() - start_urls = getstartpages(allowed_domains) - #start_urls = [ 'http://medium.com' ] - custom_settings = { - 'DEPTH_LIMIT': 3, - 'DOWNLOAD_DELAY': 3, - 'CONCURRENT_REQUESTS': 1500, - 'REACTOR_THREADPOOL_MAXSIZE': 60, - 'ITEM_PIPELINES': { '__main__.AssWoodPipeline': 10 }, - 'LOG_LEVEL': 'INFO', - 'RETRY_ENABLED': False, - 'DOWNLOAD_TIMEOUT': 30, - 'COOKIES_ENABLED': False, - 'AJAXCRAWL_ENABLED': True - } - - rules = ( Rule(LinkExtractor(), callback='parse_asswood'), ) - - def parse_asswood(self, response): - if isinstance(response, scrapy.http.TextResponse): - item = AssWoodItem() - item['ass'] = response.text.casefold().count('ass') - item['wood'] = response.text.casefold().count('wood') - item['url'] = response.url - yield item - - -if __name__ == '__main__': - - process = CrawlerProcess({ - 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' - }) - - process.crawl(BeavisSpider) - process.start() - - print('Uhh, that was, like, ' + str(totalpages) + ' pages crawled.') - print('Uh huhuhuhuh. It said ass ' + str(ass) + ' times.') - print('Uh huhuhuhuh. It said wood ' + str(wood) + ' times.') -``` - -##### butthead.py - -``` -import scrapy, time, psutil -from scrapy.spiders import CrawlSpider, Rule, Spider -from scrapy.linkextractors import LinkExtractor -from scrapy.crawler import CrawlerProcess -from multiprocessing import Process, Queue, cpu_count - -ass = 0 -wood = 0 -totalpages = 0 -linkcounttuples =[] - -def getdomains(): - - moz500file = open('top500.domains.05.18.csv') - - domains = [] - moz500csv = moz500file.readlines() - - del moz500csv[0] - - for csvline in moz500csv: - leftquote = csvline.find('"') - rightquote = leftquote + csvline[leftquote + 1:].find('"') - domains.append(csvline[leftquote + 1:rightquote]) - - return domains - -def getstartpages(domains): - - startpages = [] - - for domain in domains: - startpages.append('http://' + domain) - - return startpages - -class AssWoodItem(scrapy.Item): - ass = scrapy.Field() - wood = scrapy.Field() - url = scrapy.Field() - -class AssWoodPipeline(object): - def __init__(self): - self.asswoodstats = [] - - def process_item(self, item, spider): - self.asswoodstats.append((item.get('url'), item.get('ass'), item.get('wood'))) - - def close_spider(self, spider): - asstally, woodtally = 0, 0 - - for asswoodcount in self.asswoodstats: - asstally += asswoodcount[1] - woodtally += asswoodcount[2] - - global ass, wood, totalpages - ass = asstally - wood = woodtally - totalpages = len(self.asswoodstats) - - -class ButtheadSpider(CrawlSpider): - name = "Butthead" - custom_settings = { - 'DEPTH_LIMIT': 3, - 'DOWNLOAD_DELAY': 3, - 'CONCURRENT_REQUESTS': 250, - 'REACTOR_THREADPOOL_MAXSIZE': 30, - 'ITEM_PIPELINES': { '__main__.AssWoodPipeline': 10 }, - 'LOG_LEVEL': 'INFO', - 'RETRY_ENABLED': False, - 'DOWNLOAD_TIMEOUT': 30, - 'COOKIES_ENABLED': False, - 'AJAXCRAWL_ENABLED': True - } - - rules = ( Rule(LinkExtractor(), callback='parse_asswood'), ) - - - def parse_asswood(self, response): - if isinstance(response, scrapy.http.TextResponse): - item = AssWoodItem() - item['ass'] = response.text.casefold().count('ass') - item['wood'] = response.text.casefold().count('wood') - item['url'] = response.url - yield item - -def startButthead(domainslist, urlslist, asswoodqueue): - crawlprocess = CrawlerProcess({ - 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' - }) - - crawlprocess.crawl(ButtheadSpider, allowed_domains = domainslist, start_urls = urlslist) - crawlprocess.start() - asswoodqueue.put( (ass, wood, totalpages) ) - - -if __name__ == '__main__': - asswoodqueue = Queue() - domains=getdomains() - startpages=getstartpages(domains) - processlist =[] - cores = cpu_count() - - for i in range(10): - domainsublist = domains[i * 50:(i + 1) * 50] - pagesublist = startpages[i * 50:(i + 1) * 50] - p = Process(target = startButthead, args = (domainsublist, pagesublist, asswoodqueue)) - processlist.append(p) - - for i in range(cores): - processlist[i].start() - - time.sleep(180) - - i = cores - - while i != 10: - time.sleep(60) - if psutil.cpu_percent() < 66.7: - processlist[i].start() - i += 1 - - for i in range(10): - processlist[i].join() - - for i in range(10): - asswoodtuple = asswoodqueue.get() - ass += asswoodtuple[0] - wood += asswoodtuple[1] - totalpages += asswoodtuple[2] - - print('Uhh, that was, like, ' + str(totalpages) + ' pages crawled.') - print('Uh huhuhuhuh. It said ass ' + str(ass) + ' times.') - print('Uh huhuhuhuh. It said wood ' + str(wood) + ' times.') -``` - --------------------------------------------------------------------------------- - -via: https://blog.dxmtechsupport.com.au/speed-test-x86-vs-arm-for-web-crawling-in-python/ - -作者:[James Mawson][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://blog.dxmtechsupport.com.au/author/james-mawson/ -[b]: https://github.com/lujun9972 -[1]: https://blog.dxmtechsupport.com.au/wp-content/uploads/2019/02/quadbike-1024x683.jpg -[2]: https://scrapy.org/ -[3]: https://www.info2007.net/blog/2018/review-scaleway-arm-based-cloud-server.html -[4]: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ -[5]: https://www.computerworld.com/article/3178544/microsoft-windows/microsoft-and-arm-look-to-topple-intel-in-servers.html -[6]: https://www.datacenterknowledge.com/design/cloudflare-bets-arm-servers-it-expands-its-data-center-network -[7]: https://www.scaleway.com/ -[8]: https://aws.amazon.com/ -[9]: https://www.theregister.co.uk/2018/11/27/amazon_aws_graviton_specs/ -[10]: https://www.scaleway.com/virtual-cloud-servers/#anchor_arm -[11]: https://www.scaleway.com/virtual-cloud-servers/#anchor_starter -[12]: https://aws.amazon.com/ec2/spot/pricing/ -[13]: https://aws.amazon.com/ec2/pricing/reserved-instances/ -[14]: https://aws.amazon.com/ec2/instance-types/a1/ -[15]: https://aws.amazon.com/ec2/instance-types/t2/ -[16]: https://wiki.python.org/moin/GlobalInterpreterLock -[17]: https://docs.scrapy.org/en/latest/topics/broad-crawls.html -[18]: https://linux.die.net/man/1/top -[19]: https://linux.die.net/man/1/stress -[20]: https://blog.dxmtechsupport.com.au/wp-content/uploads/2019/02/Screenshot-from-2019-02-16-17-01-08.png -[21]: https://moz.com/top500 -[22]: https://pypi.org/project/psutil/ diff --git a/translated/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md b/translated/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md new file mode 100644 index 0000000000..38344a444b --- /dev/null +++ b/translated/tech/20190218 SPEED TEST- x86 vs. ARM for Web Crawling in Python.md @@ -0,0 +1,525 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SPEED TEST: x86 vs. ARM for Web Crawling in Python) +[#]: via: (https://blog.dxmtechsupport.com.au/speed-test-x86-vs-arm-for-web-crawling-in-python/) +[#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) + +x86 和 ARM 的 Python 爬虫速度对比 +====== + +![][1] + +如果你的老板给你的任务是不断地访问竞争对手的网站,把对方商品的价格记录下来,而且要纯手工操作,恐怕你会想要把整个办公室都烧掉。 + +之所以现在网络爬虫的影响力如此巨大,就是因为网络爬虫可以被用于追踪客户的情绪和趋向、搜寻空缺的职位、监控房地产的交易,甚至是获取 UFC 的比赛结果。除此以外,还有很多意想不到的用途。 + +对于有这方面爱好的人来说,爬虫无疑是一个很好的工具。因此,我使用了 [Scrapy][2] 这个基于 Python 编写的开源网络爬虫框架。 + +鉴于我不太了解这个工具是否会对我的计算机造成伤害,我并没有将它搭建在我的主力机器上,而是搭建在了一台树莓派上面。 + +令人感到意外的是,Scrapy 在树莓派上面的性能并不差,或许这是 ARM 架构服务器的又一个成功例子? + +我尝试 Google 了一下,但并没有得到令我满意的结果,仅仅找到了一篇相关的《[Drupal 建站对比][3]》。这篇文章的结论是,ARM 架构服务器性能比昂贵的 x86 架构服务器要更好。 + +从另一个角度来看,这种 web 服务可以看作是一个“被爬虫”服务,但和 Scrapy 对比起来,前者是基于 LAMP 技术栈,而后者则依赖于 Python,这就导致两者之间没有太多的可比性。 + +那我们该怎样做呢?只能在一些 VPS 上搭建服务来对比一下了。 + +### 什么是 ARM 架构处理器? + +ARM 是目前世界上最流行的 CPU 架构。 + +但 ARM 架构处理器在很多人眼中的地位只是作为一个节省成本的选择,而不是跑在生产环境中的处理器的首选。 + +然而,诞生于英国剑桥的 ARM CPU,最初是用于昂贵的 [Acorn Archimedes][4] 计算机上的,这是当时世界上最强大的计算机,它的运算速度甚至比最快的 386 还要快好几倍。 + +Acorn 公司和 Commodore、Atari 的理念类似,他们认为一家伟大的计算机公司就应该制造出伟大的计算机,让人感觉有点目光短浅。而比尔盖茨的想法则有所不同,他力图在更多不同种类和价格的 x86 机器上使用他的 DOS 系统。 + +拥有大量用户基础的平台会让更多开发者开发出众多适应平台的软件,而软件资源丰富又让计算机更受用户欢迎。 + +即使是苹果公司也在这上面吃到了苦头,不得不在 x86 芯片上投入大量的财力。最终,这些芯片不再仅仅用于专业的计算任务,走进了人们的日常生活中。 + +ARM 架构也并没有消失。基于 ARM 架构的芯片不仅运算速度快,同时也非常节能。因此诸如机顶盒、PDA、数码相机、MP3 播放器这些电子产品多数都会采用 ARM 架构的芯片,甚至在很多需要用电池、不配备大散热风扇的电子产品上,都可以见到 ARM 芯片的身影。 + +而 ARM 则脱离 Acorn 成为了一种独立的商业模式,他们不生产实物芯片,仅仅是向芯片生产厂商出售相关的知识产权。 + +因此,ARM 芯片被应用于很多手机和平板电脑上。当 Linux 被移植到这种架构的芯片上时,开源技术的大门就已经向它打开了,这才让我们今天得以在这些芯片上运行 web 爬虫程序。 + +#### 服务器端的 ARM + +诸如[微软][5]和 [Cloudflare][6] 这些大厂都在基础设施建设上花了重金,所以对于我们这些预算不高的用户来说,可以选择的余地并不多。 + +实际上,如果你的信用卡只够付每月数美元的 VPS 费用,一直以来只能考虑 [Scaleway][7] 这个高性价比的厂商。 + +但自从数个月前公有云巨头 [AWS][8] 推出了他们自研的 ARM 处理器 [AWS Graviton][9] 之后,选择似乎就丰富了一些。 + +我决定在其中选择一款 VPS 厂商,将它提供的 ARM 处理器和 x86 处理器作出对比。 + +### 深入了解 + +所以我们要对比的是什么指标呢? + +#### Scaleway + +Scaleway 自身的定位是“专为开发者设计”。我觉得这个定位很准确,对于开发原型来说,Scaleway 提供的产品确实可以作为一个很好的沙盒环境。 + +Scaleway 提供了一个简洁的页面,让用户可以快速地从主页进入 bash shell 界面。对于很多小企业、自由职业者或者技术顾问,如果想要运行 web 爬虫,这个产品毫无疑问是一个物美价廉的选择。 + +ARM 方面我们选择 [ARM64-2GB][10] 这一款服务器,每月只需要 3 欧元。它带有 4 个 Cavium ThunderX 核心,是在 2014 年推出的第一款服务器级的 ARMv8 处理器。但现在看来它已经显得有点落后了,并逐渐被更新的 ThunderX2 取代。 + +x86 方面我们选择 [1-S][11],每月的费用是 4 欧元。它拥有 2 个英特尔 Atom C3995 核心。英特尔的 Atom 系列处理器的特点是低功耗、单线程,最初是用在笔记本电脑上的,后来也被服务器所采用。 + +两者在处理器以外的条件都大致相同,都使用 2 GB 的内存、50 GB 的 SSD 存储以及 200 Mbit/s 的带宽。磁盘驱动器可能会有所不同,但由于我们运行的是 web 爬虫,基本都是在内存中完成操作,因此这方面的差异可以忽略不计。 + +为了避免我不能熟练使用包管理器的尴尬局面,两方的操作系统我都会选择使用 Debian 9。 + +#### Amazon Web Services + +当你还在注册 AWS 账号的时候,使用 Scaleway 的用户可能已经把提交信用卡信息、启动 VPS 实例、添加sudoer、安装依赖包这一系列流程都完成了。AWS 的操作相对来说比较繁琐,甚至需要详细阅读手册才能知道你正在做什么。 + +当然这也是合理的,对于一些需求复杂或者特殊的企业用户,确实需要通过详细的配置来定制合适的使用方案。 + +我们所采用的 AWS Graviton 处理器是 AWS EC2(Elastic Compute Cloud)的一部分,我会以按需实例的方式来运行,这也是最贵但最简捷的方式。AWS 同时也提供[竞价实例][12],这样可以用较低的价格运行实例,但实例的运行时间并不固定。如果实例需要长时间持续运行,还可以选择[预留实例][13]。 + +看,AWS 就是这么复杂…… + +我们分别选择 [a1.medium][14] 和 [t2.small][15] 两种型号的实例进行对比,两者都带有 2GB 内存。这个时候问题来了,手册中提到的 vCPU 又是什么?两种型号的不同之处就在于此。 + +对于 a1.medium 型号的实例,vCPU 是 AWS Graviton 芯片提供的单个计算核心。这个芯片由被亚马逊在 2015 收购的以色列厂商 Annapurna Labs 研发,是 AWS 独有的单线程 64 位 ARMv8 内核。它的按需价格为每小时 0.0255 美元。 + +而 t2.small 型号实例使用英特尔至强系列芯片,但我不确定具体是其中的哪一款。它每个核心有两个线程,但我们并不能用到整个核心,甚至整个线程。我们能用到的只是“20% 的基准性能,可以使用 CPU 积分突破这个基准”。这可能有一定的原因,但我没有弄懂。它的按需价格是每小时 0.023 美元。 + +在镜像库中没有 Debian 发行版的镜像,因此我选择了 Ubuntu 18.04。 + +### Beavis and Butthead Do Moz’s Top 500 + +要测试这些 VPS 的 CPU 性能,就该使用爬虫了。一般来说都是对几个网站在尽可能短的时间里发出尽可能多的请求,但这种操作太暴力了,我的做法是只向大量网站发出少数几个请求。 + +为此,我编写了 `beavs.py` 这个爬虫程序(致敬我最喜欢的物理学家和制片人 Mike Judge)。这个程序会将 Moz 上排行前 500 的网站都爬取 3 层的深度,并计算 “wood” 和 “ass” 这两个单词在 HTML 文件中出现的次数。 + +但我实际爬取的网站可能不足 500 个,因为我需要遵循网站的 `robot.txt` 协定,另外还有些网站需要提交 javascript 请求,也不一定会计算在内。但这已经是一个足以让 CPU 保持繁忙的爬虫任务了。 + +Python 的[全局解释器锁][16]机制会让我的程序只能用到一个 CPU 线程。为了测试多线程的性能,我需要启动多个独立的爬虫程序进程。 + +因此我还编写了 `butthead.py`,尽管 Butthead 很粗鲁,它也比 Beavis 要略胜一筹(译者注:beavis 和 butt-head 都是 Mike Judge 的动画片《Beavis and Butt-head》中的角色)。 + +我将整个爬虫任务拆分为多个部分,这可能会对爬取到的链接数量有一点轻微的影响。但无论如何,每次爬取都会有所不同,我们要关注的是爬取了多少个页面,以及耗时多长。 + +### 在 ARM 服务器上安装 Scrapy + +安装 Scrapy 的过程与芯片的不同架构没有太大的关系,都是安装 pip 和相关的依赖包之后,再使用 pip 来安装Scrapy。 + +据我观察,在使用 ARM 的机器上使用 pip 安装 Scrapy 确实耗时要长一点,我估计是由于需要从源码编译为二进制文件。 + +在 Scrapy 安装结束后,就可以通过 shell 来查看它的工作状态了。 + +在 Scaleway 的 ARM 机器上,Scrapy 安装完成后会无法正常运行,这似乎和 `service_identity` 模块有关。这个现象也会在树莓派上出现,但在 AWS Graviton 上不会出现。 + +对于这个问题,可以用这个命令来解决: + +``` +sudo pip3 install service_identity --force --upgrade +``` + +接下来就可以开始对比了。 + +### 单线程爬虫 + +Scrapy 的官方文档建议[将爬虫程序的 CPU 使用率控制在 80% 到 90% 之间][17],在真实操作中并不容易,尤其是对于我自己写的代码。根据我的观察,实际的 CPU 使用率变动情况是一开始非常繁忙,随后稍微下降,接着又再次升高。 + +在爬取任务的最后,也就是大部分目标网站都已经被爬取了的这个阶段,会持续数分钟的时间。这让人有点失望,因为在这个阶段当中,任务的运行时长只和网站的大小有比较直接的关系,并不能以之衡量 CPU 的性能。 + +所以这并不是一次严谨的基准测试,只是我通过自己写的爬虫程序来观察实际的现象。 + +下面我们来看看最终的结果。首先是 Scaleway 的机器: + +| 机器种类 | 耗时 | 爬取页面数 | 每小时爬取页面数 | 每百万页面费用(欧元) | +| ------------------ | ----------- | ---------- | ---------------- | ---------------------- | +| Scaleway ARM64-2GB | 108m 59.27s | 38,205 | 21,032.623 | 0.28527 | +| Scaleway 1-S | 97m 44.067s | 39,476 | 24,324.648 | 0.33011 | + +我使用了 [top][18] 工具来查看爬虫程序运行期间的 CPU 使用率。在任务刚开始的时候,两者的 CPU 使用率都达到了 100%,但 ThunderX 大部分时间都达到了 CPU 的极限,无法看出来 Atom 的性能会比 ThunderX 超出多少。 + +通过 top 工具,我还观察了它们的内存使用情况。随着爬取任务的进行,ARM 机器的内存使用率最终达到了 14.7%,而 x86 则最终是 15%。 + +从运行日志还可以看出来,当 CPU 使用率到达极限时,会有大量的超时页面产生,最终导致页面丢失。这也是合理出现的现象,因为 CPU 过于繁忙会无法完整地记录所有爬取到的页面。 + +如果仅仅是为了对比爬虫的速度,页面丢失并不是什么大问题。但在实际中,业务成果和爬虫数据的质量是息息相关的,因此必须为 CPU 留出一些用量,以防出现这种现象。 + +再来看看 AWS 这边: + +| 机器种类 | 耗时 | 爬取页面数 | 每小时爬取页面数 | 每百万页面费用(美元) | +| --------- | ------------ | ---------- | ---------------- | ---------------------- | +| a1.medium | 100m 39.900s | 41,294 | 24,612.725 | 1.03605 | +| t2.small | 78m 53.171s | 41,200 | 31,336.286 | 0.73397 | + +为了方便比较,对于在 AWS 上跑的爬虫,我记录的指标和 Scaleway 上一致,但似乎没有达到预期的效果。这里我没有使用 top,而是使用了 AWS 提供的控制台来监控 CPU 的使用情况,从监控结果来看,我的爬虫程序并没有完全用到这两款服务器所提供的所有性能。 + +a1.medium 型号的机器尤为如此,在任务开始阶段,它的 CPU 使用率达到了峰值 45%,但随后一直在 20% 到 30% 之间。 + +让我有点感到意外的是,这个程序在 ARM 处理器上的运行速度相当慢,但却远未达到 Graviton CPU 能力的极限,而在 Inter 处理器上则可以在某些时候达到 CPU 能力的极限。它们运行的代码是完全相同的,处理器的不同架构可能导致了对代码的不同处理方式。 + +个中原因无论是由于处理器本身的特性,还是而今是文件的编译,又或者是两者皆有,对我来说都是一个黑盒般的存在。我认为,既然在 AWS 机器上没有达到 CPU 处理能力的极限,那么只有在 Scaleway 机器上跑出来的性能数据是可以作为参考的。 + +t2.small 型号的机器性能让人费解。CPU 利用率大概 20%,最高才达到 35%,是因为手册中说的“20% 的基准性能,可以使用 CPU 积分突破这个基准”吗?但在控制台中可以看到 CPU 积分并没有被消耗。 + +为了确认这一点,我安装了 [stress][19] 这个软件,然后运行了一段时间,这个时候发现居然可以把 CPU 使用率提高到 100% 了。 + +显然,我需要调整一下它们的配置文件。我将 CONCURRENT_REQUESTS 参数设置为 5000,将 REACTOR_THREADPOOL_MAXSIZE 参数设置为 120,将爬虫任务的负载调得更大。 + +| 机器种类 | 耗时 | 爬取页面数 | 每小时爬取页面数 | 每万页面费用(美元) | +| ----------------------- | ----------- | ---------- | ---------------- | -------------------- | +| a1.medium | 46m 13.619s | 40,283 | 52,285.047 | 0.48771 | +| t2.small | 41m7.619s | 36,241 | 52,871.857 | 0.43501 | +| t2.small(无 CPU 积分) | 73m 8.133s | 34,298 | 28,137.8891 | 0.81740 | + +a1.medium 型号机器的 CPU 使用率在爬虫任务开始后 5 分钟飙升到了 100%,随后下降到 80% 并持续了 20 分钟,然后再次攀升到 96%,直到任务接近结束时再次下降。这大概就是我想要的效果了。 + +而 t2.small 型号机器在爬虫任务的前期就达到了 50%,并一直保持在这个水平直到任务接近结束。如果每个核心都有两个线程,那么 50% 的 CPU 使用率确实是单个线程可以达到的极限了。 + +现在我们看到它们的性能都差不多了。但至强处理器的线程持续跑满了 CPU,Graviton 处理器则只是有一段时间如此。可以认为 Graviton 略胜一筹。 + +然而,如果 CPU 积分耗尽了呢?这种情况下的对比可能更为公平。为了测试这种情况,我使用 stress 把所有的 CPU 积分用完,然后再次启动了爬虫任务。 + +在没有 CPU 积分的情况下,CPU 使用率在 27% 就到达极限不再上升了,同时又出现了丢失页面的现象。这么看来,它的性能比负载较低的时候更差。 + +### 多线程爬虫 + +将爬虫任务分散到不同的进程中,可以有效利用机器所提供的多个核心。 + +一开始,我将爬虫任务分布在 10 个不同的进程中并同时启动,结果发现比仅使用 1 个进程的时候还要慢。 + +经过尝试,我得到了一个比较好的方案。把爬虫任务分布在 10 个进程中,但每个核心只启动 1 个进程,在每个进程接近结束的时候,再从剩余的进程中选出 1 个进程启动起来。 + +如果还需要优化,还可以让运行时间越长的爬虫进程在启动顺序中排得越靠前,我也在尝试实现这个方法。 + +想要预估某个域名的页面量,一定程度上可以参考这个域名主页的链接数量。我用另一个程序来对这个数量进行了统计,然后按照降序排序。经过这样的预处理之后,只会额外增加 1 分钟左右的时间。 + +结果,爬虫运行的总耗时找过了两个小时!毕竟把链接最多的域名都堆在同一个进程中也存在一定的弊端。 + +针对这个问题,也可以通过调整各个进程爬取的域名数量来进行优化,又或者在排序之后再作一定的修改。不过这种优化可能有点复杂了。 + +因此,我还是用回了最初的方法,它的效果还是相当不错的: + +| 机器种类 | 耗时 | 爬取页面数 | 每小时爬取页面数 | 每万页面费用(欧元) | +| ------------------ | ----------- | ---------- | ---------------- | -------------------- | +| Scaleway ARM64-2GB | 62m 10.078s | 36,158 | 34,897.0719 | 0.17193 | +| Scaleway 1-S | 60m 56.902s | 36,725 | 36,153.5529 | 0.22128 | + +毕竟,使用多个核心能够大大加快爬虫的速度。 + +我认为,如果让一个经验丰富的程序员来优化的话,一定能够更好地利用所有的计算核心。但对于开箱即用的 Scrapy 来说,想要提高性能,使用更快的线程似乎比使用更多核心要简单得多。 + +从数量来看,Atom 处理器在更短的时间内爬取到了更多的页面。但如果从性价比角度来看,ThunderX 又是稍稍领先的。不过总的来说差距不大。 + +### 爬取结果分析 + +在爬取了 38205 个页面之后,我们可以统计到在这些页面中 “ass” 出现了 24170435 次,而 “wood” 出现了 54368 次。 + +![][20] + +“wood” 的出现次数不少,但和 “ass” 比起来简直微不足道。 + +### 结论 + +从上面的数据来看,不同架构的 CPU 性能和它们的问世时间没有直接的联系,AWS Graviton 是单线程情况下性能最佳的。 + +另外在性能方面 2017 年生产的 Atom 轻松击败了 2014 年生产的 ThunderX,而 ThunderX 则在性价比方面占优。当然,如果你使用 AWS 的机器的话,还是使用 Graviton 吧。 + +总之,ARM 架构的硬件是可以用来运行爬虫程序的,而且在性能和费用方面也相当有竞争力。 + +而这种差异是否足以让你将整个技术架构迁移到 ARM 上?这就是另一回事了。当然,如果你已经是 AWS 用户,并且你的代码有很强的可移植性,那么不妨尝试一下 a1 型号的实例。 + +希望 ARM 设备在不久的将来能够在公有云上大放异彩。 + +### 源代码 + +这是我第一次使用 Python 和 Scrapy 来做一个项目,所以我的代码写得可能不是很好,例如代码中使用全局变量就有点力不从心。 + +不过我仍然会在下面开源我的代码。 + +要运行这些代码,需要预先安装 Scrapy,并且需要 [Moz 上排名前 500 的网站][21]的 csv 文件。如果要运行 `butthead.py`,还需要安装 [psutil][22] 这个库。 + +##### beavis.py + +``` +import scrapy +from scrapy.spiders import CrawlSpider, Rule +from scrapy.linkextractors import LinkExtractor +from scrapy.crawler import CrawlerProcess + +ass = 0 +wood = 0 +totalpages = 0 + +def getdomains(): + + moz500file = open('top500.domains.05.18.csv') + + domains = [] + moz500csv = moz500file.readlines() + + del moz500csv[0] + + for csvline in moz500csv: + leftquote = csvline.find('"') + rightquote = leftquote + csvline[leftquote + 1:].find('"') + domains.append(csvline[leftquote + 1:rightquote]) + + return domains + +def getstartpages(domains): + + startpages = [] + + for domain in domains: + startpages.append('http://' + domain) + + return startpages + +class AssWoodItem(scrapy.Item): + ass = scrapy.Field() + wood = scrapy.Field() + url = scrapy.Field() + +class AssWoodPipeline(object): + def __init__(self): + self.asswoodstats = [] + + def process_item(self, item, spider): + self.asswoodstats.append((item.get('url'), item.get('ass'), item.get('wood'))) + + def close_spider(self, spider): + asstally, woodtally = 0, 0 + + for asswoodcount in self.asswoodstats: + asstally += asswoodcount[1] + woodtally += asswoodcount[2] + + global ass, wood, totalpages + ass = asstally + wood = woodtally + totalpages = len(self.asswoodstats) + +class BeavisSpider(CrawlSpider): + name = "Beavis" + allowed_domains = getdomains() + start_urls = getstartpages(allowed_domains) + #start_urls = [ 'http://medium.com' ] + custom_settings = { + 'DEPTH_LIMIT': 3, + 'DOWNLOAD_DELAY': 3, + 'CONCURRENT_REQUESTS': 1500, + 'REACTOR_THREADPOOL_MAXSIZE': 60, + 'ITEM_PIPELINES': { '__main__.AssWoodPipeline': 10 }, + 'LOG_LEVEL': 'INFO', + 'RETRY_ENABLED': False, + 'DOWNLOAD_TIMEOUT': 30, + 'COOKIES_ENABLED': False, + 'AJAXCRAWL_ENABLED': True + } + + rules = ( Rule(LinkExtractor(), callback='parse_asswood'), ) + + def parse_asswood(self, response): + if isinstance(response, scrapy.http.TextResponse): + item = AssWoodItem() + item['ass'] = response.text.casefold().count('ass') + item['wood'] = response.text.casefold().count('wood') + item['url'] = response.url + yield item + + +if __name__ == '__main__': + + process = CrawlerProcess({ + 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' + }) + + process.crawl(BeavisSpider) + process.start() + + print('Uhh, that was, like, ' + str(totalpages) + ' pages crawled.') + print('Uh huhuhuhuh. It said ass ' + str(ass) + ' times.') + print('Uh huhuhuhuh. It said wood ' + str(wood) + ' times.') +``` + +##### butthead.py + +``` +import scrapy, time, psutil +from scrapy.spiders import CrawlSpider, Rule, Spider +from scrapy.linkextractors import LinkExtractor +from scrapy.crawler import CrawlerProcess +from multiprocessing import Process, Queue, cpu_count + +ass = 0 +wood = 0 +totalpages = 0 +linkcounttuples =[] + +def getdomains(): + + moz500file = open('top500.domains.05.18.csv') + + domains = [] + moz500csv = moz500file.readlines() + + del moz500csv[0] + + for csvline in moz500csv: + leftquote = csvline.find('"') + rightquote = leftquote + csvline[leftquote + 1:].find('"') + domains.append(csvline[leftquote + 1:rightquote]) + + return domains + +def getstartpages(domains): + + startpages = [] + + for domain in domains: + startpages.append('http://' + domain) + + return startpages + +class AssWoodItem(scrapy.Item): + ass = scrapy.Field() + wood = scrapy.Field() + url = scrapy.Field() + +class AssWoodPipeline(object): + def __init__(self): + self.asswoodstats = [] + + def process_item(self, item, spider): + self.asswoodstats.append((item.get('url'), item.get('ass'), item.get('wood'))) + + def close_spider(self, spider): + asstally, woodtally = 0, 0 + + for asswoodcount in self.asswoodstats: + asstally += asswoodcount[1] + woodtally += asswoodcount[2] + + global ass, wood, totalpages + ass = asstally + wood = woodtally + totalpages = len(self.asswoodstats) + + +class ButtheadSpider(CrawlSpider): + name = "Butthead" + custom_settings = { + 'DEPTH_LIMIT': 3, + 'DOWNLOAD_DELAY': 3, + 'CONCURRENT_REQUESTS': 250, + 'REACTOR_THREADPOOL_MAXSIZE': 30, + 'ITEM_PIPELINES': { '__main__.AssWoodPipeline': 10 }, + 'LOG_LEVEL': 'INFO', + 'RETRY_ENABLED': False, + 'DOWNLOAD_TIMEOUT': 30, + 'COOKIES_ENABLED': False, + 'AJAXCRAWL_ENABLED': True + } + + rules = ( Rule(LinkExtractor(), callback='parse_asswood'), ) + + + def parse_asswood(self, response): + if isinstance(response, scrapy.http.TextResponse): + item = AssWoodItem() + item['ass'] = response.text.casefold().count('ass') + item['wood'] = response.text.casefold().count('wood') + item['url'] = response.url + yield item + +def startButthead(domainslist, urlslist, asswoodqueue): + crawlprocess = CrawlerProcess({ + 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)' + }) + + crawlprocess.crawl(ButtheadSpider, allowed_domains = domainslist, start_urls = urlslist) + crawlprocess.start() + asswoodqueue.put( (ass, wood, totalpages) ) + + +if __name__ == '__main__': + asswoodqueue = Queue() + domains=getdomains() + startpages=getstartpages(domains) + processlist =[] + cores = cpu_count() + + for i in range(10): + domainsublist = domains[i * 50:(i + 1) * 50] + pagesublist = startpages[i * 50:(i + 1) * 50] + p = Process(target = startButthead, args = (domainsublist, pagesublist, asswoodqueue)) + processlist.append(p) + + for i in range(cores): + processlist[i].start() + + time.sleep(180) + + i = cores + + while i != 10: + time.sleep(60) + if psutil.cpu_percent() < 66.7: + processlist[i].start() + i += 1 + + for i in range(10): + processlist[i].join() + + for i in range(10): + asswoodtuple = asswoodqueue.get() + ass += asswoodtuple[0] + wood += asswoodtuple[1] + totalpages += asswoodtuple[2] + + print('Uhh, that was, like, ' + str(totalpages) + ' pages crawled.') + print('Uh huhuhuhuh. It said ass ' + str(ass) + ' times.') + print('Uh huhuhuhuh. It said wood ' + str(wood) + ' times.') +``` + +-------------------------------------------------------------------------------- + +via: https://blog.dxmtechsupport.com.au/speed-test-x86-vs-arm-for-web-crawling-in-python/ + +作者:[James Mawson][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://blog.dxmtechsupport.com.au/author/james-mawson/ +[b]: https://github.com/lujun9972 +[1]: https://blog.dxmtechsupport.com.au/wp-content/uploads/2019/02/quadbike-1024x683.jpg +[2]: https://scrapy.org/ +[3]: https://www.info2007.net/blog/2018/review-scaleway-arm-based-cloud-server.html +[4]: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ +[5]: https://www.computerworld.com/article/3178544/microsoft-windows/microsoft-and-arm-look-to-topple-intel-in-servers.html +[6]: https://www.datacenterknowledge.com/design/cloudflare-bets-arm-servers-it-expands-its-data-center-network +[7]: https://www.scaleway.com/ +[8]: https://aws.amazon.com/ +[9]: https://www.theregister.co.uk/2018/11/27/amazon_aws_graviton_specs/ +[10]: https://www.scaleway.com/virtual-cloud-servers/#anchor_arm +[11]: https://www.scaleway.com/virtual-cloud-servers/#anchor_starter +[12]: https://aws.amazon.com/ec2/spot/pricing/ +[13]: https://aws.amazon.com/ec2/pricing/reserved-instances/ +[14]: https://aws.amazon.com/ec2/instance-types/a1/ +[15]: https://aws.amazon.com/ec2/instance-types/t2/ +[16]: https://wiki.python.org/moin/GlobalInterpreterLock +[17]: https://docs.scrapy.org/en/latest/topics/broad-crawls.html +[18]: https://linux.die.net/man/1/top +[19]: https://linux.die.net/man/1/stress +[20]: https://blog.dxmtechsupport.com.au/wp-content/uploads/2019/02/Screenshot-from-2019-02-16-17-01-08.png +[21]: https://moz.com/top500 +[22]: https://pypi.org/project/psutil/ + From 15d3cbfebf026820fe127ada07b134f36479dd40 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Mar 2019 08:59:49 +0800 Subject: [PATCH 549/813] translated --- ...190301 How to use sudo access in winSCP.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) rename {sources => translated}/tech/20190301 How to use sudo access in winSCP.md (53%) diff --git a/sources/tech/20190301 How to use sudo access in winSCP.md b/translated/tech/20190301 How to use sudo access in winSCP.md similarity index 53% rename from sources/tech/20190301 How to use sudo access in winSCP.md rename to translated/tech/20190301 How to use sudo access in winSCP.md index a2821fefab..07af6626cc 100644 --- a/sources/tech/20190301 How to use sudo access in winSCP.md +++ b/translated/tech/20190301 How to use sudo access in winSCP.md @@ -7,41 +7,41 @@ [#]: via: (https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/) [#]: author: (kerneltalks https://kerneltalks.com) -How to use sudo access in winSCP +如何在 winSCP 中使用 sudo ====== -Learn how to use sudo access in winSCP with screenshots. +用截图了解如何在 winSCP 中使用 sudo ![How to use sudo access in winSCP][1]sudo access in winSCP -First of all you need to check where is your SFTP server binary located on server you are trying to connect with winSCP. +首先你需要检查你尝试使用 winSCP 连接的 sftp 服务器的二进制文件的位置。 -You can check SFTP server binary location with below command – +你可以使用以下命令检查 SFTP 服务器二进制文件位置: ``` [root@kerneltalks ~]# cat /etc/ssh/sshd_config |grep -i sftp-server Subsystem sftp /usr/libexec/openssh/sftp-server ``` -Here you can see sftp server binary is located at `/usr/libexec/openssh/sftp-server` +你可以看到 sftp 服务器的二进制文件位于 `/usr/libexec/openssh/sftp-server`。 -Now open winSCP and click `Advanced` button to open up advanced settings. +打开 winSCP 并单击“高级”按钮打开高级设置。 ![winSCP advance settings][2] -winSCP advance settings +winSCP 高级设置 -It will open up advanced setting window like one below. Here select `SFTP `under `Environment` on left hand side panel. You will be presented with option on right hand side. +它将打开如下高级设置窗口。在左侧面板上选择`环境`下的 `SFTP`。你会在右侧看到选项。 -Now, add SFTP server value here with command `sudo su -c` here as displayed in screenshot below – +现在,使用命令 `sudo su -c` 在这里添加 SFTP 服务器值,如下截图所示: ![SFTP server setting in winSCP][3] -SFTP server setting in winSCP +winSCP 中的 SFTP 服务器设置 -So we added `sudo su -c /usr/libexec/openssh/sftp-server` in settings here. Now click Ok and connect to server as you normally do. +所以我们在设置中添加了 `sudo su -c /usr/libexec/openssh/sftp-server`。单击“确定”并像平常一样连接到服务器。 -After connection you will be able to transfer files from directory where you normally need sudo permission to access. +连接之后,你将可以从需要 sudo 权限的目录传输文件了。 -That’s it! You logged to server using winSCP and sudo access. +完成了!你已经使用 winSCP 使用 sudo 登录服务器了。 -------------------------------------------------------------------------------- @@ -49,7 +49,7 @@ via: https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/ 作者:[kerneltalks][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5cf6775fd6637719dd73aa5f73c089750de1ce45 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Mar 2019 09:04:46 +0800 Subject: [PATCH 550/813] translating --- ... To Check Password Complexity-Strength And Score In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md index 59b18f8a87..8085fe4a0e 100644 --- a/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md +++ b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2575eb8c192948509b487ec0bef68193f597ba0e Mon Sep 17 00:00:00 2001 From: cycoe Date: Tue, 12 Mar 2019 09:33:01 +0800 Subject: [PATCH 551/813] translated by cycoe --- ...ain- How to add one to your Python game.md | 277 ------------------ ...ain- How to add one to your Python game.md | 275 +++++++++++++++++ 2 files changed, 275 insertions(+), 277 deletions(-) delete mode 100644 sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md create mode 100644 translated/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md diff --git a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md b/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md deleted file mode 100644 index 52b46c1adb..0000000000 --- a/sources/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md +++ /dev/null @@ -1,277 +0,0 @@ -Translating by cycoe -Cycoe 翻译中 -What's a hero without a villain? How to add one to your Python game -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z) - -In the previous articles in this series (see [part 1][1], [part 2][2], [part 3][3], and [part 4][4]), you learned how to use Pygame and Python to spawn a playable character in an as-yet empty video game world. But, what's a hero without a villain? - -It would make for a pretty boring game if you had no enemies, so in this article, you'll add an enemy to your game and construct a framework for building levels. - -It might seem strange to jump ahead to enemies when there's still more to be done to make the player sprite fully functional, but you've learned a lot already, and creating villains is very similar to creating a player sprite. So relax, use the knowledge you already have, and see what it takes to stir up some trouble. - -For this exercise, you can download some pre-built assets from [Open Game Art][5]. Here are some of the assets I use: - - -+ Inca tileset -+ Some invaders -+ Sprites, characters, objects, and effects - - -### Creating the enemy sprite - -Yes, whether you realize it or not, you basically already know how to implement enemies. The process is very similar to creating a player sprite: - - 1. Make a class so enemies can spawn. - 2. Create an `update` function so enemies can detect collisions. - 3. Create a `move` function so your enemy can roam around. - - - -Start with the class. Conceptually, it's mostly the same as your Player class. You set an image or series of images, and you set the sprite's starting position. - -Before continuing, make sure you have a graphic for your enemy, even if it's just a temporary one. Place the graphic in your game project's `images` directory (the same directory where you placed your player image). - -A game looks a lot better if everything alive is animated. Animating an enemy sprite is done the same way as animating a player sprite. For now, though, keep it simple, and use a non-animated sprite. - -At the top of the `objects` section of your code, create a class called Enemy with this code: -``` -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 - -``` - -If you want to animate your enemy, do it the [same way][4] you animated your player. - -### Spawning an enemy - -You can make the class useful for spawning more than just one enemy by allowing yourself to tell the class which image to use for the sprite and where in the world the sprite should appear. This means you can use this same enemy class to generate any number of enemy sprites anywhere in the game world. All you have to do is make a call to the class, and tell it which image to use and the X and Y coordinates of your desired spawn point. - -Again, this is similar in principle to spawning a player sprite. In the `setup` section of your script, add this code: -``` -enemy   = Enemy(20,200,'yeti.png')# spawn enemy - -enemy_list = pygame.sprite.Group()   # create enemy group - -enemy_list.add(enemy)                # add enemy to group - -``` - -In that sample code, `20` is the X position and `200` is the Y position. You might need to adjust these numbers, depending on how big your enemy sprite is, but try to get it to spawn in a place so that you can reach it with your player sprite. `Yeti.png` is the image used for the enemy. - -Next, draw all enemies in the enemy group to the screen. Right now, you have only one enemy, but you can add more later if you want. As long as you add an enemy to the enemies group, it will be drawn to the screen during the main loop. The middle line is the new line you need to add: -``` -    player_list.draw(world) - -    enemy_list.draw(world)  # refresh enemies - -    pygame.display.flip() - -``` - -Launch your game. Your enemy appears in the game world at whatever X and Y coordinate you chose. - -### Level one - -Your game is in its infancy, but you will probably want to add another level. It's important to plan ahead when you program so your game can grow as you learn more about programming. Even though you don't even have one complete level yet, you should code as if you plan on having many levels. - -Think about what a "level" is. How do you know you are at a certain level in a game? - -You can think of a level as a collection of items. In a platformer, such as the one you are building here, a level consists of a specific arrangement of platforms, placement of enemies and loot, and so on. You can build a class that builds a level around your player. Eventually, when you create more than one level, you can use this class to generate the next level when your player reaches a specific goal. - -Move the code you wrote to create an enemy and its group into a new function that will be called along with each new level. It requires some modification so that each time you create a new level, you can create several enemies: -``` -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 - -``` - -The `return` statement ensures that when you use the `Level.bad` function, you're left with an `enemy_list` containing each enemy you defined. - -Since you are creating enemies as part of each level now, your `setup` section needs to change, too. Instead of creating an enemy, you must define where the enemy will spawn and what level it belongs to. -``` -eloc = [] - -eloc = [200,20] - -enemy_list = Level.bad( 1, eloc ) - -``` - -Run the game again to confirm your level is generating correctly. You should see your player, as usual, and the enemy you added in this chapter. - -### Hitting the enemy - -An enemy isn't much of an enemy if it has no effect on the player. It's common for enemies to cause damage when a player collides with them. - -Since you probably want to track the player's health, the collision check happens in the Player class rather than in the Enemy class. You can track the enemy's health, too, if you want. The logic and code are pretty much the same, but, for now, just track the player's health. - -To track player health, you must first establish a variable for the player's health. The first line in this code sample is for context, so add the second line to your Player class: -``` -        self.frame  = 0 - -        self.health = 10 - -``` - -In the `update` function of your Player class, add this code block: -``` -        hit_list = pygame.sprite.spritecollide(self, enemy_list, False) - -        for enemy in hit_list: - -            self.health -= 1 - -            print(self.health) - -``` - -This code establishes a collision detector using the Pygame function `sprite.spritecollide`, called `enemy_hit`. This collision detector sends out a signal any time the hitbox of its parent sprite (the player sprite, where this detector has been created) touches the hitbox of any sprite in `enemy_list`. The `for` loop is triggered when such a signal is received and deducts a point from the player's health. - -Since this code appears in the `update` function of your player class and `update` is called in your main loop, Pygame checks for this collision once every clock tick. - -### Moving the enemy - -An enemy that stands still is useful if you want, for instance, spikes or traps that can harm your player, but the game is more of a challenge if the enemies move around a little. - -Unlike a player sprite, the enemy sprite is not controlled by the user. Its movements must be automated. - -Eventually, your game world will scroll, so how do you get an enemy to move back and forth within the game world when the game world itself is moving? - -You tell your enemy sprite to take, for example, 10 paces to the right, then 10 paces to the left. An enemy sprite can't count, so you have to create a variable to keep track of how many paces your enemy has moved and program your enemy to move either right or left depending on the value of your counting variable. - -First, create the counter variable in your Enemy class. Add the last line in this code sample: -``` -        self.rect = self.image.get_rect() - -        self.rect.x = x - -        self.rect.y = y - -        self.counter = 0 # counter variable - -``` - -Next, create a `move` function in your Enemy class. Use an if-else loop to create what is called an infinite loop: - - * Move right if the counter is on any number from 0 to 100. - * Move left if the counter is on any number from 100 to 200. - * Reset the counter back to 0 if the counter is greater than 200. - - - -An infinite loop has no end; it loops forever because nothing in the loop is ever untrue. The counter, in this case, is always either between 0 and 100 or 100 and 200, so the enemy sprite walks right to left and right to left forever. - -The actual numbers you use for how far the enemy will move in either direction depending on your screen size, and possibly, eventually, the size of the platform your enemy is walking on. Start small and work your way up as you get used to the results. Try this first: -``` -    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 - - - -        self.counter += 1 - -``` - -You can adjust the distance and speed as needed. - -Will this code work if you launch your game now? - -Of course not, and you probably know why. You must call the `move` function in your main loop. The first line in this sample code is for context, so add the last two lines: -``` -    enemy_list.draw(world) #refresh enemy - -    for e in enemy_list: - -        e.move() - -``` - -Launch your game and see what happens when you hit your enemy. You might have to adjust where the sprites spawn so that your player and your enemy sprite can collide. When they do collide, look in the console of [IDLE][6] or [Ninja-IDE][7] to see the health points being deducted. - -![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/yeti.png?itok=4_GsDGor) - -You may notice that health is deducted for every moment your player and enemy are touching. That's a problem, but it's a problem you'll solve later, after you've had more practice with Python. - -For now, try adding some more enemies. Remember to add each enemy to the `enemy_list`. As an exercise, see if you can think of how you can change how far different enemy sprites move. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/pygame-enemy - -作者:[Seth Kenlon][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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 -[1]:https://opensource.com/article/17/10/python-101 -[2]:https://opensource.com/article/17/12/game-framework-python -[3]:https://opensource.com/article/17/12/game-python-add-a-player -[4]:https://opensource.com/article/17/12/game-python-moving-player -[5]:https://opengameart.org -[6]:https://docs.python.org/3/library/idle.html -[7]:http://ninja-ide.org/ diff --git a/translated/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md b/translated/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md new file mode 100644 index 0000000000..a4a2138136 --- /dev/null +++ b/translated/tech/20180518 What-s a hero without a villain- How to add one to your Python game.md @@ -0,0 +1,275 @@ +没有恶棍,英雄又将如何?如何向你的 Python 游戏中添加一个敌人 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z) + +在本系列的前几篇文章中(参见 [第一部分][1]、[第二部分][2]、[第三部分][3] 以及 [第四部分][4]),你已经学习了如何使用 Pygame 和 Python 在一个空白的视频游戏世界中生成一个可玩的角色。但没有恶棍,英雄又将如何? + +如果你没有敌人,那将会是一个非常无聊的游戏。所以在此篇文章中,你将为你的游戏添加一个敌人并构建一个用于创建关卡的框架。 + +在对玩家妖精实现全部功能仍有许多事情可做之前,跳向敌人似乎就很奇怪。但你已经学到了很多东西,创造恶棍与与创造玩家妖精非常相似。所以放轻松,使用你已经掌握的知识,看看能挑起怎样一些麻烦。 + +针对本次训练,你能够从 [Open Game Art][5] 下载一些预创建的素材。此处是我使用的一些素材: + + ++ 印加花砖(译注:游戏中使用的花砖贴图) ++ 一些侵略者 ++ 妖精、角色、物体以及特效 + + +### 创造敌方妖精 + +是的,不管你意识到与否,你其实已经知道如何去实现敌人。这个过程与创造一个玩家妖精非常相似: + + 1. 创建一个类用于敌人生成 + 2. 创建 `update` 方法使得敌人能够检测碰撞 + 3. 创建 `move` 方法使得敌人能够四处游荡 + + + +从类入手。从概念上看,它与你的 Player 类大体相同。你设置一张或者一组图片,然后设置妖精的初始位置。 + +在继续下一步之前,确保你有一张你的敌人的图像,即使只是一张临时图像。将图像放在你的游戏项目的 `images` 目录(你放置你的玩家图像的相同目录)。 + +如果所有的活物都拥有动画,那么游戏看起来会好得多。为敌方妖精设置动画与为玩家妖精设置动画具有相同的方式。但现在,为了保持简单,我们使用一个没有动画的妖精。 + +在你代码 `objects` 节的顶部,使用以下代码创建一个叫做 `Enemy` 的类: +``` +class Enemy(pygame.sprite.Sprite): + +    ''' + + 生成一个敌人 + +    ''' + +    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 + +``` + +如果你想让你的敌人动起来,使用让你的玩家拥有动画的 [相同方式][4]。 + +### 生成一个敌人 + +你能够通过告诉类,妖精应使用哪张图像,应出现在世界上的什么地方,来生成不只一个敌人。这意味着,你能够使用相同的敌人类,在游戏世界的任意地方生成任意数量的敌方妖精。你需要做的仅仅是调用这个类,并告诉它应使用哪张图像,以及你期望生成点的 X 和 Y 坐标。 + +再次,这从原则上与生成一个玩家精灵相似。在你脚本的 `setup` 节添加如下代码: +``` +enemy   = Enemy(20,200,'yeti.png') # 生成敌人 + +enemy_list = pygame.sprite.Group() # 创建敌人组 + +enemy_list.add(enemy)              # 将敌人加入敌人组 + +``` + +在示例代码中,X 坐标为 20,Y 坐标为 200。你可能需要根据你的敌方妖精的大小,来调整这些数字,但尽量生成在一个地方,使得你的玩家妖精能够到它。`Yeti.png` 是用于敌人的图像。 + +接下来,将敌人组的所有敌人绘制在屏幕上。现在,你只有一个敌人,如果你想要更多你可以稍后添加。一但你将一个敌人加入敌人组,它就会在主循环中被绘制在屏幕上。中间这一行是你需要添加的新行: +``` +    player_list.draw(world) + +    enemy_list.draw(world)  # 刷新敌人 + +    pygame.display.flip() + +``` + +启动你的游戏,你的敌人会出现在游戏世界中你选择的 X 和 Y 坐标处。 + +### 关卡一 + +你的游戏仍处在襁褓期,但你可能想要为它添加另一个关卡。为你的程序做好未来规划非常重要,因为随着你学会更多的编程技巧,你的程序也会随之成长。即使你现在仍没有一个完整的关卡,你也应该按照假设会有很多关卡来编程。 + +思考一下“关卡”是什么。你如何知道你是在游戏中的一个特定关卡中呢? + +你可以把关卡想成一系列项目的集合。就像你刚刚创建的这个平台中,一个关卡,包含了平台、敌人放置、赃物等的一个特定排列。你可以创建一个类,用来在你的玩家附近创建关卡。最终,当你创建了超过一个关卡,你就可以在你的玩家达到特定目标时,使用这个类生成下一个关卡。 + +将你写的用于生成敌人及其群组的代码,移动到一个每次生成新关卡时都会被调用的新函数中。你需要做一些修改,使得每次你创建新关卡时,你都能够创建一些敌人。 +``` +class Level(): + +    def bad(lvl,eloc): + +        if lvl == 1: + +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # 生成敌人 + +            enemy_list = pygame.sprite.Group() # 生成敌人组 + +            enemy_list.add(enemy)              # 将敌人加入敌人组 + +        if lvl == 2: + +            print("Level " + str(lvl) ) + + + +        return enemy_list + +``` + +`return` 语句确保了当你调用 `Level.bad` 方法时,你将会得到一个 `enemy_list` 变量包含了所有你定义的敌人。 + +因为你现在将创造敌人作为每个关卡的一部分,你的 `setup` 部分也需要做些更改。不同于创造一个敌人,取而代之的是你必须去定义敌人在那里生成,以及敌人属于哪个关卡。 +``` +eloc = [] + +eloc = [200,20] + +enemy_list = Level.bad( 1, eloc ) + +``` + +再次运行游戏来确认你的关卡生成正确。与往常一样,你应该会看到你的玩家,并且能看到你在本章节中添加的敌人。 + +### 痛击敌人 + +一个敌人如果对玩家没有效果,那么它不太算得上是一个敌人。当玩家与敌人发生碰撞时,他们通常会对玩家造成伤害。 + +因为你可能想要去跟踪玩家的生命值,因此碰撞检测发生在 Player 类,而不是 Enemy 类中。当然如果你想,你也可以跟踪敌人的生命值。它们之间的逻辑与代码大体相似,现在,我们只需要跟踪玩家的生命值。 + +为了跟踪玩家的生命值,你必须为它确定一个变量。代码示例中的第一行是上下文提示,那么将第二行代码添加到你的 Player 类中: +``` +        self.frame  = 0 + +        self.health = 10 + +``` + +在你 Player 类的 `update` 方法中,添加如下代码块: +``` +        hit_list = pygame.sprite.spritecollide(self, enemy_list, False) + +        for enemy in hit_list: + +            self.health -= 1 + +            print(self.health) + +``` + +这段代码使用 Pygame 的 `sprite.spritecollide` 方法,建立了一个碰撞检测器,称作 `enemy_hit`。每当它的父类妖精(生成检测器的玩家妖精)的碰撞区触碰到 `enemy_list` 中的任一妖精的碰撞区时,碰撞检测器都会发出一个信号。当这个信号被接收,`for` 循环就会被触发,同时扣除一点玩家生命值。 + +一旦这段代码出现在你 Player 类的 `update` 方法,并且 `update` 方法在你的主循环中被调用,Pygame 会在每个时钟 tick 检测一次碰撞。 + +### 移动敌人 + +如果你愿意,静止不动的敌人也可以很有用,比如能够对你的玩家造成伤害的尖刺和陷阱。但如果敌人能够四处徘徊,那么游戏将更富有挑战。 + +与玩家妖精不同,敌方妖精不是由玩家控制,因此它必须自动移动。 + +最终,你的游戏世界将会滚动。那么,如何在游戏世界自身滚动的情况下,使游戏世界中的敌人前后移动呢? + +举个例子,你告诉你的敌方妖精向右移动 10 步,向左移动 10 步。但敌方妖精不会计数,因此你需要创建一个变量来跟踪你的敌人已经移动了多少步,并根据计数变量的值来向左或向右移动你的敌人。 + +首先,在你的 Enemy 类中创建计数变量。添加以下代码示例中的最后一行代码: +``` +        self.rect = self.image.get_rect() + +        self.rect.x = x + +        self.rect.y = y + +        self.counter = 0 # 计数变量 + +``` + +然后,在你的 Enemy 类中创建一个 `move` 方法。使用 if-else 循环来创建一个所谓的死循环: + + * 如果计数在 0 到 100 之间,向右移动; + * 如果计数在 100 到 200 之间,向左移动; + * 如果计数大于 200,则将计数重置为 0。 + + + +死循环没有终点,因为循环判断条件永远为真,所以它将永远循环下去。在此情况下,计数器总是介于 0 到 100 或 100 到 200 之间,因此敌人会永远地从左向右再从右向左移动。 + +你用于敌人在每个方向上移动距离的具体值,取决于你的屏幕尺寸,更确切地说,取决于你的敌人移动的平台大小。从较小的值开始,依据习惯逐步提高数值。首先进行如下尝试: +``` +    def move(self): + +        ''' + + 敌人移动 + +        ''' + +        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 + + + +        self.counter += 1 + +``` + +你可以根据需要调整距离和速度。 + +当你现在启动游戏,这段代码有效果吗? + +当然不,你应该也知道原因。你必须在主循环中调用 `move` 方法。如下示例代码中的第一行是上下文提示,那么添加最后两行代码: +``` +    enemy_list.draw(world) #refresh enemy + +    for e in enemy_list: + +        e.move() + +``` + +启动你的游戏看看当你打击敌人时发生了什么。你可能需要调整妖精的生成地点,使得你的玩家和敌人能够碰撞。当他们发生碰撞时,查看 [IDLE][6] 或 [Ninja-IDE][7] 的控制台,你可以看到生命值正在被扣除。 + +![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/yeti.png?itok=4_GsDGor) + +你应该已经注意到,在你的玩家和敌人接触时,生命值在时刻被扣除。这是一个问题,但你将在对 Python 进行更多练习以后解决它。 + +现在,尝试添加更多敌人。记得将每个敌人加入 `enemy_list`。作为一个练习,看看你能否想到如何改变不同敌方妖精的移动距离。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/pygame-enemy + +作者:[Seth Kenlon][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[cycoe](https://github.com/cycoe) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[1]:https://opensource.com/article/17/10/python-101 +[2]:https://opensource.com/article/17/12/game-framework-python +[3]:https://opensource.com/article/17/12/game-python-add-a-player +[4]:https://opensource.com/article/17/12/game-python-moving-player +[5]:https://opengameart.org +[6]:https://docs.python.org/3/library/idle.html +[7]:http://ninja-ide.org/ From 442b71c420eef20e653a555effb382aaef89e035 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Mar 2019 10:43:47 +0800 Subject: [PATCH 552/813] PRF:20170519 zsh shell inside Emacs on Windows.md @lujun9972 --- ...70519 zsh shell inside Emacs on Windows.md | 58 ++++++++----------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/translated/tech/20170519 zsh shell inside Emacs on Windows.md b/translated/tech/20170519 zsh shell inside Emacs on Windows.md index 82b3394812..e2f05a23d8 100644 --- a/translated/tech/20170519 zsh shell inside Emacs on Windows.md +++ b/translated/tech/20170519 zsh shell inside Emacs on Windows.md @@ -1,22 +1,22 @@ -[#]:collector:(lujun9972) -[#]:translator:(lujun9972) -[#]:reviewer:( ) -[#]:publisher:( ) -[#]:url:( ) -[#]:subject:(zsh shell inside Emacs on Windows) -[#]:via:(https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) -[#]:author:(Peter Mosmans https://www.onwebsecurity.com/) +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (zsh shell inside Emacs on Windows) +[#]: via: (https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) +[#]: author: (Peter Mosmans https://www.onwebsecurity.com/) Windows 下 Emacs 中的 zsh shell ====== ![zsh shell inside Emacs on Windows][5] -运行跨平台 shell( 例如 Bash 或 zsh) 的最大优势在于你能在多平台上使用同样的语法和脚本。在 Windows 上设置 (替换) shells 挺麻烦的,但所获得的回报远远超出这小小的付出。 +运行跨平台 shell(例如 Bash 或 zsh)的最大优势在于你能在多平台上使用同样的语法和脚本。在 Windows 上设置(替换)shell 挺麻烦的,但所获得的回报远远超出这小小的付出。 MSYS2 子系统允许你在 Windows 上运行 Bash 或 zsh 之类的 shell。使用 MSYS2 很重要的一点在于确保搜索路径都指向 MSYS2 子系统本身:存在太多依赖关系了。 -MSYS2 安装后默认的 shell 就是 Bash; zsh 则可以通过包管理器进行安装: +MSYS2 安装后默认的 shell 就是 Bash;zsh 则可以通过包管理器进行安装: ``` pacman -Sy zsh @@ -30,25 +30,19 @@ mkpasswd -c | sed -e 's/bash/zsh/' | tee -a /etc/passwd 这会将默认 shell 从 bash 改成 zsh。 -要在 Windows 上的 Emacs 运行 zsh 需要修改 ` shell-file-name` 变量,将它指向 MSYS2 子系统中的 zsh 二进制文件。该二进制 shell 文件在 Emacs ` exec-path` 变量中的某个地方。 +要在 Windows 上的 Emacs 中运行 zsh ,需要修改 `shell-file-name` 变量,将它指向 MSYS2 子系统中的 zsh 二进制文件。该二进制 shell 文件在 Emacs `exec-path` 变量中的某个地方。 ``` (setq shell-file-name (executable-find "zsh.exe")) ``` -不要忘了修改 Emacs 的 PATH 环境变量,因为 MSYS2 路径应该先于 Windows 路径。接上一个例子,假设 MSYS2 安装在 - -``` -c:\programs\msys2 -``` - -中,那么执行: +不要忘了修改 Emacs 的 `PATH` 环境变量,因为 MSYS2 路径应该先于 Windows 路径。接上一个例子,假设 MSYS2 安装在 `c:\programs\msys2` 中,那么执行: ``` (setenv "PATH" "C:\\programs\\msys2\\mingw64\\bin;C:\\programs\\msys2\\usr\\local\\bin;C:\\programs\\msys2\\usr\\bin;C:\\Windows\\System32;C:\\Windows") ``` -在 Emacs 配置文件中设置好这两个变量后,在 Emacs 中运行 +在 Emacs 配置文件中设置好这两个变量后,在 Emacs 中运行: ``` M-x shell @@ -56,42 +50,38 @@ M-x shell 应该就能看到熟悉的 zsh 提示符了。 -Emacs' 的终端设置 (eterm) 与 MSYS2 的标准终端设置 (xterm-256color) 不一样。这意味着某些插件和主题(标识符)可能不能正常工作 - 尤其在使用 oh-my-zsh 时。 +Emacs 的终端设置(eterm)与 MSYS2 的标准终端设置(xterm-256color)不一样。这意味着某些插件和主题(提示符)可能不能正常工作 - 尤其在使用 oh-my-zsh 时。 -检测 zsh 否则在 Emacs 中运行很简单,使用变量 +检测 zsh 否则在 Emacs 中运行很简单,使用变量 `$INSIDE_EMACS`。 -``` -$INSIDE_EMACS -``` - -. 下面这段代码片段取自 `.zshrc`( 当以交互式 shell 模式启动时会被加载),它会在 zsh 在 Emacs 中运行时启动 git 插件并更改主题 +下面这段代码片段取自 `.zshrc`(当以交互式 shell 模式启动时会被加载),它会在 zsh 在 Emacs 中运行时启动 git 插件并更改主题: ``` # Disable some plugins while running in Emacs if [[ -n "$INSIDE_EMACS" ]]; then - plugins=(git) - ZSH_THEME="simple" + plugins=(git) + ZSH_THEME="simple" else - ZSH_THEME="compact-grey" + ZSH_THEME="compact-grey" fi ``` -通过在本地 `~/.ssh/config` 文件中将 `INSIDE_EMACS` 变量设置为 `SendEnv` 变量。.。 +通过在本地 `~/.ssh/config` 文件中将 `INSIDE_EMACS` 变量设置为 `SendEnv` 变量…… ``` Host myhost SendEnv INSIDE_EMACS ``` -.。. 同时在 ssh 服务器的 `/etc/ssh/sshd_config` 中设置为 `AcceptEnv` 变量 .。。 +……同时在 ssh 服务器的 `/etc/ssh/sshd_config` 中设置为 `AcceptEnv` 变量…… ``` AcceptEnv LANG LC_* INSIDE_EMACS ``` -.。. 这使得在 Emacs shell 会话中通过 ssh 登录另一个运行着 zsh 的 ssh 服务器也能工作的很好。当在 Windows 下的 Emacs 中的 zsh 上通过 ssh 远程登录时,记得使用参数 `-t` `-t` 参数会强制分配伪终端(之所以需要这样,时因为 Windows 下的 Emacs 并没有真正的 tty)。 +……这使得在 Emacs shell 会话中通过 ssh 登录另一个运行着 zsh 的 ssh 服务器也能工作的很好。当在 Windows 下的 Emacs 中的 zsh 上通过 ssh 远程登录时,记得使用参数 `-t`,`-t` 参数会强制分配伪终端(之所以需要这样,时因为 Windows 下的 Emacs 并没有真正的 tty)。 -跨平台,开源真是个好东西。.。 +跨平台,开源真是个好东西…… -------------------------------------------------------------------------------- @@ -100,7 +90,7 @@ via: https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windo 作者:[Peter Mosmans][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 845d3fab9727ec61ffb273707516b7828f1f291c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Mar 2019 10:45:06 +0800 Subject: [PATCH 553/813] PUB:20170519 zsh shell inside Emacs on Windows.md @lujun9972 https://linux.cn/article-10610-1.html --- .../20170519 zsh shell inside Emacs on Windows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20170519 zsh shell inside Emacs on Windows.md (98%) diff --git a/translated/tech/20170519 zsh shell inside Emacs on Windows.md b/published/20170519 zsh shell inside Emacs on Windows.md similarity index 98% rename from translated/tech/20170519 zsh shell inside Emacs on Windows.md rename to published/20170519 zsh shell inside Emacs on Windows.md index e2f05a23d8..894c924416 100644 --- a/translated/tech/20170519 zsh shell inside Emacs on Windows.md +++ b/published/20170519 zsh shell inside Emacs on Windows.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10610-1.html) [#]: subject: (zsh shell inside Emacs on Windows) [#]: via: (https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) [#]: author: (Peter Mosmans https://www.onwebsecurity.com/) From 2c21aae963551329c50469c881d8f8d820278bb5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Mar 2019 10:58:49 +0800 Subject: [PATCH 554/813] PRF:20190301 Which Raspberry Pi should you choose.md @qhwdw --- ...90301 Which Raspberry Pi should you choose.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20190301 Which Raspberry Pi should you choose.md b/translated/tech/20190301 Which Raspberry Pi should you choose.md index 53b500e65e..93701ca7a3 100644 --- a/translated/tech/20190301 Which Raspberry Pi should you choose.md +++ b/translated/tech/20190301 Which Raspberry Pi should you choose.md @@ -1,15 +1,17 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Which Raspberry Pi should you choose?) [#]: via: (https://opensource.com/article/19/3/which-raspberry-pi-choose) [#]: author: (Anderson Silva https://opensource.com/users/ansilva) -你应该选择哪种树莓派? +树莓派使用入门:你应该选择哪种树莓派? ====== -在我们的《树莓派使用入门》系列的第一篇文章中,我们将学习选择符合你要求的树莓派型号的三个标准。 + +> 在我们的《树莓派使用入门》系列的第一篇文章中,我们将学习选择符合你要求的树莓派型号的三个标准。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) 本文是《14 天学会[树莓派][1]使用》系列文章的第一篇。虽然本系列文章主要面向没有使用过树莓派或 Linux 或没有编程经验的人群,但是肯定有些东西还是需要有经验的读者的,我希望这些读者能够留下他们有益的评论、提示和补充。如果每个人都能贡献,这将会让本系列文章对初学者、其它有经验的读者、甚至是我更受益! @@ -20,11 +22,9 @@ 关于选择一个新的树莓派,我有三个主要的标准: - * **成本:** 不能只考虑树莓派板的成本,还需要考虑到你使用它时外围附件的成本。在美国,树莓派的成本区间是从 5 美元(树莓派 Zero)到 35 美元(树莓派 3 B 和 3 B+)。但是,如果你选择 `Zero`,那么你或许还需要一个 `USB hub` 去连接你的鼠标、键盘、无线网卡、以及某种显示适配器。不论你想使用树莓派做什么,除非你已经有了(假如不是全部)大部分的外设,那么你一定要把这些外设考虑到预算之中。此外,在一些国家,对于许多学生和老师,树莓派(即便没有任何外设)的购置成本也或许是一个不少的成本负担。 - + * **成本:** 不能只考虑树莓派板的成本,还需要考虑到你使用它时外围附件的成本。在美国,树莓派的成本区间是从 5 美元(树莓派 Zero)到 35 美元(树莓派 3 B 和 3 B+)。但是,如果你选择 Zero,那么你或许还需要一个 USB hub 去连接你的鼠标、键盘、无线网卡、以及某种显示适配器。不论你想使用树莓派做什么,除非你已经有了(假如不是全部)大部分的外设,那么你一定要把这些外设考虑到预算之中。此外,在一些国家,对于许多学生和老师,树莓派(即便没有任何外设)的购置成本也或许是一个不少的成本负担。 * **可获得性:** 根据你所在地去查找你想要的树莓派,因为在一些国家得到某些版本的树莓派可能很容易(或很困难)。在新型号刚发布后,可获得性可能是个很大的问题,在你的市场上获得最新版本的树莓派可能需要几天或几周的时间。 - - * **用途:** 所在地和成本可能并不会影响每个人,但每个购买者必须要考虑的是买树莓派做什么。因内存、CPU 核心、CPU 速度、物理尺寸、网络连接、外设扩展等不同衍生出八个不同的型号。比如,如果你需要一个拥有更大的“马力”时鲁棒性更好的解决方案,那么你或许应该选择树莓派 3 B+,它有更大的内存、最快的 CPU、以及更多的核心数。如果你的解决方案并不需要网络连接,并不用于 CPU 密集型的工作,并且需要将它隐藏在一个非常小的空间中,那么一个树莓派 Zero 将是你的最佳选择。 + * **用途:** 所在地和成本可能并不会影响每个人,但每个购买者必须要考虑的是买树莓派做什么。因内存、CPU 核心、CPU 速度、物理尺寸、网络连接、外设扩展等不同衍生出八个不同的型号。比如,如果你需要一个拥有更大的“马力”时健壮性更好的解决方案,那么你或许应该选择树莓派 3 B+,它有更大的内存、最快的 CPU、以及更多的核心数。如果你的解决方案并不需要网络连接,并不用于 CPU 密集型的工作,并且需要将它隐藏在一个非常小的空间中,那么一个树莓派 Zero 将是你的最佳选择。 [维基百科的树莓派规格表][2] 是比较八种树莓派型号的好办法。 @@ -37,7 +37,7 @@ via: https://opensource.com/article/19/3/which-raspberry-pi-choose 作者:[Anderson Silva][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5203ac93608fdabdf3124013d0729b4d46171354 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 12 Mar 2019 11:01:11 +0800 Subject: [PATCH 555/813] PUB:20190301 Which Raspberry Pi should you choose.md @qhwdw https://linux.cn/article-10611-1.html --- .../20190301 Which Raspberry Pi should you choose.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190301 Which Raspberry Pi should you choose.md (98%) diff --git a/translated/tech/20190301 Which Raspberry Pi should you choose.md b/published/20190301 Which Raspberry Pi should you choose.md similarity index 98% rename from translated/tech/20190301 Which Raspberry Pi should you choose.md rename to published/20190301 Which Raspberry Pi should you choose.md index 93701ca7a3..f0aefd5dea 100644 --- a/translated/tech/20190301 Which Raspberry Pi should you choose.md +++ b/published/20190301 Which Raspberry Pi should you choose.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10611-1.html) [#]: subject: (Which Raspberry Pi should you choose?) [#]: via: (https://opensource.com/article/19/3/which-raspberry-pi-choose) [#]: author: (Anderson Silva https://opensource.com/users/ansilva) From 50e97edafdc3688b7499348cdd97e1c26e118800 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 12 Mar 2019 11:02:09 +0800 Subject: [PATCH 556/813] hankchow translating --- sources/tech/20190226 All about -Curly Braces- in Bash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190226 All about -Curly Braces- in Bash.md b/sources/tech/20190226 All about -Curly Braces- in Bash.md index 42d37abdec..277e2159de 100644 --- a/sources/tech/20190226 All about -Curly Braces- in Bash.md +++ b/sources/tech/20190226 All about -Curly Braces- in Bash.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0ea98e51527f6ecfde756296681e37e706a6c755 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 12 Mar 2019 14:15:50 +0800 Subject: [PATCH 557/813] Translating by MjSeven --- ...0190218 Emoji-Log- A new way to write Git commit messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md b/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md index e821337a60..5f16c51d3e 100644 --- a/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md +++ b/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bce00d2298666b0577d7fcb5ccf3ba489f0ff65a Mon Sep 17 00:00:00 2001 From: leommxj Date: Tue, 12 Mar 2019 22:34:43 +0800 Subject: [PATCH 558/813] translating --- ... To Generate A Random-Strong Password In Linux Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md b/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md index 0f12c53e56..4458722bbc 100644 --- a/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md +++ b/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (leommxj) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -350,7 +350,7 @@ via: https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-lin 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[leommx](https://github.com/leommxj) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 09a0829bf870613d4c9a14ce6be6f911792ccded Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 Mar 2019 08:51:34 +0800 Subject: [PATCH 559/813] translated --- ...IP phone directly to an Asterisk server.md | 75 ------------------- ...IP phone directly to an Asterisk server.md | 75 +++++++++++++++++++ 2 files changed, 75 insertions(+), 75 deletions(-) delete mode 100644 sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md create mode 100644 translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md diff --git a/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md deleted file mode 100644 index 07027a097d..0000000000 --- a/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Connecting a VoIP phone directly to an Asterisk server) -[#]: via: (https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/) -[#]: author: (François Marier https://fmarier.org/) - -Connecting a VoIP phone directly to an Asterisk server -====== - -On my [Asterisk][1] server, I happen to have two on-board ethernet boards. Since I only used one of these, I decided to move my VoIP phone from the local network switch to being connected directly to the Asterisk server. - -The main advantage is that this phone, running proprietary software of unknown quality, is no longer available on my general home network. Most importantly though, it no longer has access to the Internet, without my having to firewall it manually. - -Here's how I configured everything. - -### Private network configuration - -On the server, I started by giving the second network interface a static IP address in `/etc/network/interfaces`: - -``` -auto eth1 -iface eth1 inet static - address 192.168.2.2 - netmask 255.255.255.0 -``` - -On the VoIP phone itself, I set the static IP address to `192.168.2.3` and the DNS server to `192.168.2.2`. I then updated the SIP registrar IP address to `192.168.2.2`. - -The DNS server actually refers to an [unbound daemon][2] running on the Asterisk server. The only configuration change I had to make was to listen on the second interface and allow the VoIP phone in: - -``` -server: - interface: 127.0.0.1 - interface: 192.168.2.2 - access-control: 0.0.0.0/0 refuse - access-control: 127.0.0.1/32 allow - access-control: 192.168.2.3/32 allow -``` - -Finally, I opened the right ports on the server's firewall in `/etc/network/iptables.up.rules`: - -``` --A INPUT -s 192.168.2.3/32 -p udp --dport 5060 -j ACCEPT --A INPUT -s 192.168.2.3/32 -p udp --dport 10000:20000 -j ACCEPT -``` - -### Accessing the admin page - -Now that the VoIP phone is no longer available on the local network, it's not possible to access its admin page. That's a good thing from a security point of view, but it's somewhat inconvenient. - -Therefore I put the following in my `~/.ssh/config` to make the admin page available on `http://localhost:8081` after I connect to the Asterisk server via ssh: - -``` -Host asterisk - LocalForward 8081 192.168.2.3:80 -``` - --------------------------------------------------------------------------------- - -via: https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/ - -作者:[François Marier][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fmarier.org/ -[b]: https://github.com/lujun9972 -[1]: https://www.asterisk.org/ -[2]: https://feeding.cloud.geek.nz/posts/setting-up-your-own-dnssec-aware/ diff --git a/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md new file mode 100644 index 0000000000..a7ec705338 --- /dev/null +++ b/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Connecting a VoIP phone directly to an Asterisk server) +[#]: via: (https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/) +[#]: author: (François Marier https://fmarier.org/) + +将 VoIP 电话直接连接到 Asterisk 服务器 +====== + +在我的 [Asterisk][1] 服务器上正好有张以太网卡。由于我只用了其中一个,因此我决定将我的 VoIP 电话从本地网络交换机换成连接到 Asterisk 服务器。 + +主要的好处是这台运行着未知质量专有软件的电话,在我的一般家庭网络中不再可用。最重要的是,它不再能访问互联网,因此无需手动配置防火墙。 + +以下是我配置的方式。 + +### 私有网络配置 + +在服务器上,我在 `/etc/network/interfaces` 中给第二块网卡分配了一个静态 IP: + +``` +auto eth1 +iface eth1 inet static + address 192.168.2.2 + netmask 255.255.255.0 +``` + +在 VoIP 电话上,我将静态 IP 设置成 `192.168.2.3`,DNS 服务器设置成 `192.168.2.2`。我接着将 SIP 注册 IP 地址设置成 `192.168.2.2`。 + +DNS 服务器实际上是一个在 Asterisk 服务器上运行的 [unbound 守护进程][2]。我唯一需要更改的配置是监听第二张网卡,并允许 VoIP 电话进入: + +``` +server: + interface: 127.0.0.1 + interface: 192.168.2.2 + access-control: 0.0.0.0/0 refuse + access-control: 127.0.0.1/32 allow + access-control: 192.168.2.3/32 allow +``` + +最后,我在 `/etc/network/iptables.up.rules` 中打开了服务器防火墙上的正确端口: + +``` +-A INPUT -s 192.168.2.3/32 -p udp --dport 5060 -j ACCEPT +-A INPUT -s 192.168.2.3/32 -p udp --dport 10000:20000 -j ACCEPT +``` + +### 访问管理页面 + +现在 VoIP 电话在本地网络上不再可用,因此无法访问其管理页面。从安全的角度来看,这是一件好事,但它有点不方便。 + +因此,在通过 ssh 连接到 Asterisk 服务器之后,我将以下内容放在我的 `~/.ssh/config` 中以便通过 `http://localhost:8081` 访问管理页面: + +``` +Host asterisk + LocalForward 8081 192.168.2.3:80 +``` + +-------------------------------------------------------------------------------- + +via: https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/ + +作者:[François Marier][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://fmarier.org/ +[b]: https://github.com/lujun9972 +[1]: https://www.asterisk.org/ +[2]: https://feeding.cloud.geek.nz/posts/setting-up-your-own-dnssec-aware/ From e0547f174abb7b9fd70bd0c0c6f0ac245acaf9e3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 Mar 2019 09:01:02 +0800 Subject: [PATCH 560/813] translating --- ...rity- Cmd provides visibility, control over user activity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md index 952e76f1f3..2a1dc8ff53 100644 --- a/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md +++ b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 65e9036cd2a81e96647f3ba36e3fc41945d3b9d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Mar 2019 11:07:38 +0800 Subject: [PATCH 561/813] PRF:20190128 Top Hex Editors for Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zero-MK 这篇不够仔细,使用谷歌翻译辅助之后,自己需要全文审定一下。 --- .../20190128 Top Hex Editors for Linux.md | 87 ++++++++++--------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/translated/tech/20190128 Top Hex Editors for Linux.md b/translated/tech/20190128 Top Hex Editors for Linux.md index ed3eba4c9f..6934b248c0 100644 --- a/translated/tech/20190128 Top Hex Editors for Linux.md +++ b/translated/tech/20190128 Top Hex Editors for Linux.md @@ -1,98 +1,95 @@ [#]: collector: "lujun9972" -[#]: translator: "zero-mk " -[#]: reviewer: " " +[#]: translator: "zero-mk" +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Top Hex Editors for Linux" [#]: via: "https://itsfoss.com/hex-editors-linux" [#]: author: "Ankush Das https://itsfoss.com/author/ankush/" -Top Hex Editors for Linux +Linux 上最好的十进制编辑器 ====== 十六进制编辑器可以让你以十六进制的形式查看/编辑文件的二进制数据,因此其被命名为“十六进制”编辑器。说实话,并不是每个人都需要它。只有必须处理二进制数据的特定用户组才会使用到它。 -如果您不知道,它是什么,让我举个例子。假设您拥有游戏的配置文件,您可以使用十六进制编辑器打开它们并更改某些值以获得更多的弹药/分数等等。 想要了解有关Hex编辑器的更多信息,你可以参阅 [Wikipedia page][1]。 +如果你不知道它是什么,让我来举个例子。假设你拥有一个游戏的配置文件,你可以使用十六进制编辑器打开它们并更改某些值以获得更多的弹药/分数等等。想要了解有关十六进制编辑器的更多信息,你可以参阅 [Wikipedia 页面][1]。 -如果你已经知道它用来干什么了 —— 让我们来看看Linux最好的Hex编辑器。 +如果你已经知道它用来干什么了 —— 让我们来看看 Linux 上最好的十六进制编辑器。 -### 5个最好的十六进制编辑器 +### 5 个最好的十六进制编辑器 ![Best Hex Editors for Linux][2] -**注意:**提到的十六进制编辑器没有特定的排名顺序。 +**注意:**这里提到的十六进制编辑器没有特定的排名顺序。 -#### 1\. Bless Hex Editor +#### 1、Bless Hex Editor ![bless hex editor][3] **主要特点:** - * 编辑裸设备(Raw disk ) + * 编辑裸设备(Raw disk) * 多级撤消/重做操作 - * 多个标签 + * 多个标签页 * 转换表 * 支持插件扩展功能 +Bless 是 Linux 上最流行的十六进制编辑器之一。你可以在应用中心或软件中心中找到它。否则,你可以查看它们的 [GitHub 页面][4] 获取构建和相关的说明。 +它可以轻松处理编辑大文件而不会降低速度 —— 因此它是一个快速的十六进制编辑器。 -Bless是Linux上最流行的Hex编辑器之一。您可以在AppCenter或软件中心中找到它。 如果不是这种情况,您可以查看他们的 [GitHub page][4] 获取构建和相关的说明。 +- [GitHub 项目](https://github.com/bwrsandman/Bless) -它可以轻松处理编辑大文件而不会降低速度——因此它是一个快速的十六进制编辑器。 - -#### 2\. GNOME Hex Editor +#### 2、GNOME Hex Editor ![gnome hex editor][5] **主要特点:** - * 以 十六进制/Ascii格式 查看/编辑 - + * 以十六进制/ASCII 格式查看/编辑 * 编辑大文件 - * +另一个神奇的十六进制编辑器 —— 专门为 GNOME 量身定做的。我个人用的是 Elementary OS, 所以我可以在应用中心找到它。你也可以在软件中心找到它。否则请参考 [GitHub 页面][6] 获取源代码。 +你可以使用此编辑器以十六进制或 ASCII 格式查看/编辑文件。用户界面非常简单 —— 正如你在上面的图像中看到的那样。 -另一个神奇的十六进制编辑器-专门为GNOME量身定做的。 我个人用的是 Elementary OS, 所以我可以在 软件中心(AppCenter)找到它.。您也可以在软件中心找到它。如果没有,请参考 [GitHub page][6] 获取源代码。 +- [官方网站](https://wiki.gnome.org/Apps/Ghex) -您可以使用此编辑器以十六进制或ASCII格式 查看/编辑 文件。用户界面非常简单——正如您在上面的图像中看到的那样。 - -#### 3\. Okteta +#### 3、Okteta ![okteta][7] **主要特点:** * 可自定义的数据视图 - * 多个选项卡 - * 字符编码:支持Qt、EBCDIC的所有8位编码 + * 多个标签页 + * 字符编码:支持 Qt、EBCDIC 的所有 8 位编码 * 解码表列出常见的简单数据类型 +Okteta 是一个简单的十六进制编辑器,没有那么奇特的功能。虽然它可以处理大部分任务。它有一个单独的模块,你可以使用它嵌入其他程序来查看/编辑文件。 +与上述所有编辑器类似,你也可以在应用中心和软件中心上找到列出的编辑器。 -Okteta是一个简单的十六进制编辑器,没有那么奇特的功能。虽然它可以处理大部分任务。它有一个单独的模块,你可以使用它嵌入其他程序来查看/编辑文件。 +- [官方网站](https://www.kde.org/applications/utilities/okteta/) - -与上述所有编辑器类似,您也可以在应用中心(App Center)和软件中心(Software Center)上找到列出的编辑器。 - -#### 4\. wxHexEditor +#### 4、wxHexEditor ![wxhexeditor][8] -**主要特点:** +**主要特点:** * 轻松处理大文件 - * 支持x86反汇编 - * **** Sector Indication **** on Disk devices + * 支持 x86 反汇编 + * 对磁盘设备可以显示扇区指示 * 支持自定义十六进制面板格式和颜色 +这很有趣。它主要是一个十六进制编辑器,但你也可以将其用作低级磁盘编辑器。例如,如果你的硬盘有问题,可以使用此编辑器以 RAW 格式编辑原始数据以修复它。 +你可以在你的应用中心和软件中心找到它。否则,可以去看看 [Sourceforge][9]。 -这很有趣。它主要是一个十六进制编辑器,但您也可以将其用作低级磁盘编辑器。例如,如果您的硬盘有问题,可以使用此编辑器编辑RAW格式原始数据镜像文件,在十六进制中的扇区并修复它。 +- [官方网站](http://www.wxhexeditor.org/home.php) -你可以在你的应用中心(App Center)和软件中心(Software Center)找到它。 如果不是, [Sourceforge][9] 是个正确的选择。 - -#### 5\. Hexedit (命令行工具) +#### 5、Hexedit (命令行工具) ![hexedit][10] @@ -101,9 +98,7 @@ Okteta是一个简单的十六进制编辑器,没有那么奇特的功能。 * 运行在命令行终端上 * 它又快又简单 - - -如果您想在终端上工作,可以继续通过控制台安装hexedit。它是我最喜欢的命令行Linux十六进制编辑器。 +如果你想在终端上工作,可以继续通过控制台安装 hexedit。它是我最喜欢的 Linux 命令行的十六进制编辑器。 当你启动它时,你必须指定要打开的文件的位置,然后它会为你打开它。 @@ -119,7 +114,19 @@ sudo apt install hexedit 你认为十六进制编辑器的有用性如何?你用哪一个?我们没有列出你最喜欢的吗?请在评论中告诉我们! -![][11] +### 额外福利 + +译者注:要我说,以上这些十六进制编辑器都太丑了。如果你只是想美美的查看查看一下十六进制输出,那么下面的这个查看器十分值得看看。虽然在功能上还有些不够成熟,但至少在美颜方面可以将上面在座的各位都视作垃圾。 + +它就是 hexyl,是一个面向终端的简单的十六进制查看器。它使用颜色来区分不同的字节类型(NULL、可打印的 ASCII 字符、ASCII 空白字符、其它 ASCII 字符和非 ASCII 字符)。 + +上图: + +![](https://camo.githubusercontent.com/1f71ee7031e1962b23f21c8cc89cb837e1201238/68747470733a2f2f692e696d6775722e636f6d2f4d574f3975534c2e706e67) + +![](https://camo.githubusercontent.com/2c7114d1b3159fc91e6c1e289e23b79d1186c6d5/68747470733a2f2f692e696d6775722e636f6d2f447037576e637a2e706e67) + +它不仅支持各种 Linux 发行版,还支持 MacOS、FreeBSD、Windows,请自行去其[项目页](https://github.com/sharkdp/hexyl)选用, -------------------------------------------------------------------------------- @@ -128,7 +135,7 @@ via: https://itsfoss.com/hex-editors-linux 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[zero-mk](https://github.com/zero-mk) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e93aaf87e212c4db459a4fd778b53a633dd5de7b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Mar 2019 11:08:53 +0800 Subject: [PATCH 562/813] PUB:20190128 Top Hex Editors for Linux.md @zero-MK https://linux.cn/article-10614-1.html --- .../tech => published}/20190128 Top Hex Editors for Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190128 Top Hex Editors for Linux.md (98%) diff --git a/translated/tech/20190128 Top Hex Editors for Linux.md b/published/20190128 Top Hex Editors for Linux.md similarity index 98% rename from translated/tech/20190128 Top Hex Editors for Linux.md rename to published/20190128 Top Hex Editors for Linux.md index 6934b248c0..b2db0ad8f1 100644 --- a/translated/tech/20190128 Top Hex Editors for Linux.md +++ b/published/20190128 Top Hex Editors for Linux.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "zero-mk" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10614-1.html" [#]: subject: "Top Hex Editors for Linux" [#]: via: "https://itsfoss.com/hex-editors-linux" [#]: author: "Ankush Das https://itsfoss.com/author/ankush/" From 2ad00e79a1721a4f333407ec35cab4c3af6d3edb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Mar 2019 11:27:47 +0800 Subject: [PATCH 563/813] PRF:20190302 How to buy a Raspberry Pi.md @qhwdw --- .../tech/20190302 How to buy a Raspberry Pi.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/translated/tech/20190302 How to buy a Raspberry Pi.md b/translated/tech/20190302 How to buy a Raspberry Pi.md index e1c3583f52..561e8611be 100644 --- a/translated/tech/20190302 How to buy a Raspberry Pi.md +++ b/translated/tech/20190302 How to buy a Raspberry Pi.md @@ -1,21 +1,22 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How to buy a Raspberry Pi" [#]: via: "https://opensource.com/article/19/3/how-buy-raspberry-pi" [#]: author: "Anderson Silva https://opensource.com/users/ansilva" -如何购买一个树莓派 +树莓派使用入门:如何购买一个树莓派 ====== -在我们的《树莓派入门指南》系列文章的第二篇中,我们将介绍获取树莓派的最佳途径。 + +> 在我们的《树莓派使用入门》系列文章的第二篇中,我们将介绍获取树莓派的最佳途径。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) 在本系列指南的第一篇文章中,我们提供了一个关于 [你应该购买哪个版本的树莓派][1] 的一些建议。哪个版本才是你想要的,你应该有了主意了,现在,我们来看一下如何获得它。 -最显而易见的方式— 并且也或许是最安全最简单的方式 —非[树莓派的官方网站][2] 莫属了。如果你从官网主页上点击“Buy a Raspberry Pi”,它将跳转到官方的 [在线商店][3],在那里,它可以给你提供你的国家所在地的授权销售商。如果你的国家没有在清单中,还有一个“其它”选项,它可以提供国际订购。 +最显而易见的方式 —— 并且也或许是最安全最简单的方式 —— 非 [树莓派的官方网站][2] 莫属了。如果你从官网主页上点击 “Buy a Raspberry Pi”,它将跳转到官方的 [在线商店][3],在那里,它可以给你提供你的国家所在地的授权销售商。如果你的国家没有在清单中,还有一个“其它”选项,它可以提供国际订购。 第二,查看亚马逊或在你的国家里允许销售新的或二手商品的其它主流技术类零售商。鉴于树莓派比较便宜并且尺寸很小,一些小商家基于转售目的的进出口它,应该是非常容易的。在你下订单时,一定要关注对卖家的评价。 @@ -23,11 +24,11 @@ ### 不要忘了外设 -最后一个建设是:不要忘了外设,你将需要一些外设去配置和操作你的树莓派。至少你会用到键盘、一个 HDMI 线缆去连接显示器、一个 Micro SD 卡去安装操作系统,一个供电线、以及一个好用的鼠标。 +最后一个建设是:不要忘了外设,你将需要一些外设去配置和操作你的树莓派。至少你会用到键盘、一个 HDMI 线缆去连接显示器、一个 Micro SD 卡去安装操作系统,一个电源线、以及一个好用的鼠标。 ![](https://opensource.com/sites/default/files/uploads/raspberrypi_2a_pi0w-kit.jpg) -如果你没有准备好这些东西,试着从朋友那儿借用,或与树莓派一起购买。你可以从授权的树莓派销售商那儿考虑订购一个起步套装 — 它可以让你避免查找的麻烦而一次性搞定。 +如果你没有准备好这些东西,试着从朋友那儿借用,或与树莓派一起购买。你可以从授权的树莓派销售商那儿考虑订购一个起步套装 —— 它可以让你避免查找的麻烦而一次性搞定。 ![](https://opensource.com/sites/default/files/uploads/raspberrypi_2b_pi3b.jpg) @@ -40,12 +41,12 @@ via: https://opensource.com/article/19/3/how-buy-raspberry-pi 作者:[Anderson Silva][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者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/ansilva [b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/19/2/which-raspberry-pi-should-you-get +[1]: https://linux.cn/article-10611-1.html [2]: https://www.raspberrypi.org/ [3]: https://www.raspberrypi.org/products/ From 615f0cd72da973c6331be640ae442eb3e185c98f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Mar 2019 11:28:47 +0800 Subject: [PATCH 564/813] PUB:20190302 How to buy a Raspberry Pi.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qhwdw https://linux.cn/article-10615-1.html @lujun9972 这个第三篇没做选题么? --- .../tech => published}/20190302 How to buy a Raspberry Pi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190302 How to buy a Raspberry Pi.md (97%) diff --git a/translated/tech/20190302 How to buy a Raspberry Pi.md b/published/20190302 How to buy a Raspberry Pi.md similarity index 97% rename from translated/tech/20190302 How to buy a Raspberry Pi.md rename to published/20190302 How to buy a Raspberry Pi.md index 561e8611be..12e6359a9c 100644 --- a/translated/tech/20190302 How to buy a Raspberry Pi.md +++ b/published/20190302 How to buy a Raspberry Pi.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "qhwdw" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10615-1.html" [#]: subject: "How to buy a Raspberry Pi" [#]: via: "https://opensource.com/article/19/3/how-buy-raspberry-pi" [#]: author: "Anderson Silva https://opensource.com/users/ansilva" From a32dce147c33a2e61483d2980c1586ec1a1eb553 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Mar 2019 11:54:48 +0800 Subject: [PATCH 565/813] PRF:20190301 How to use sudo access in winSCP.md @geekpi --- ...190301 How to use sudo access in winSCP.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190301 How to use sudo access in winSCP.md b/translated/tech/20190301 How to use sudo access in winSCP.md index 07af6626cc..ef095b7f46 100644 --- a/translated/tech/20190301 How to use sudo access in winSCP.md +++ b/translated/tech/20190301 How to use sudo access in winSCP.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to use sudo access in winSCP) @@ -10,9 +10,11 @@ 如何在 winSCP 中使用 sudo ====== -用截图了解如何在 winSCP 中使用 sudo +> 用截图了解如何在 winSCP 中使用 sudo。 -![How to use sudo access in winSCP][1]sudo access in winSCP +![How to use sudo access in winSCP][1] + +*sudo access in winSCP* 首先你需要检查你尝试使用 winSCP 连接的 sftp 服务器的二进制文件的位置。 @@ -28,18 +30,20 @@ Subsystem sftp /usr/libexec/openssh/sftp-server 打开 winSCP 并单击“高级”按钮打开高级设置。 ![winSCP advance settings][2] -winSCP 高级设置 -它将打开如下高级设置窗口。在左侧面板上选择`环境`下的 `SFTP`。你会在右侧看到选项。 +*winSCP 高级设置* + +它将打开如下高级设置窗口。在左侧面板上选择“Environment”下的 “SFTP”。你会在右侧看到选项。 现在,使用命令 `sudo su -c` 在这里添加 SFTP 服务器值,如下截图所示: ![SFTP server setting in winSCP][3] -winSCP 中的 SFTP 服务器设置 -所以我们在设置中添加了 `sudo su -c /usr/libexec/openssh/sftp-server`。单击“确定”并像平常一样连接到服务器。 +*winSCP 中的 SFTP 服务器设置* -连接之后,你将可以从需要 sudo 权限的目录传输文件了。 +所以我们在设置中添加了 `sudo su -c /usr/libexec/openssh/sftp-server`。单击“Ok”并像平常一样连接到服务器。 + +连接之后,你将可以从你以前需要 sudo 权限的目录传输文件了。 完成了!你已经使用 winSCP 使用 sudo 登录服务器了。 @@ -50,7 +54,7 @@ via: https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/ 作者:[kerneltalks][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 54c62eb097cbeb883f9e49af46475a6b433fe937 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Mar 2019 11:55:21 +0800 Subject: [PATCH 566/813] PUB:20190301 How to use sudo access in winSCP.md @geekpi https://linux.cn/article-10616-1.html --- .../20190301 How to use sudo access in winSCP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190301 How to use sudo access in winSCP.md (96%) diff --git a/translated/tech/20190301 How to use sudo access in winSCP.md b/published/20190301 How to use sudo access in winSCP.md similarity index 96% rename from translated/tech/20190301 How to use sudo access in winSCP.md rename to published/20190301 How to use sudo access in winSCP.md index ef095b7f46..17f2e5ede9 100644 --- a/translated/tech/20190301 How to use sudo access in winSCP.md +++ b/published/20190301 How to use sudo access in winSCP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10616-1.html) [#]: subject: (How to use sudo access in winSCP) [#]: via: (https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/) [#]: author: (kerneltalks https://kerneltalks.com) From 39376e4daf4646de3b3d1dcfa7dc557f01e9f2c3 Mon Sep 17 00:00:00 2001 From: MK <36980619+zero-MK@users.noreply.github.com> Date: Wed, 13 Mar 2019 11:56:11 +0800 Subject: [PATCH 567/813] translating by zero-MK --- ...213 How To Install, Configure And Use Fish Shell In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md b/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md index a03335c6b6..cf2e212441 100644 --- a/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md +++ b/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zero-MK) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a8bea10f4ad3519d33faaf2e7e8d7b43bf26f137 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 12:56:32 +0800 Subject: [PATCH 568/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Get=20?= =?UTF-8?q?started=20with=20Freeplane,=20an=20open=20source=20mind=20mappi?= =?UTF-8?q?ng=20application=20sources/tech/20190125=20Get=20started=20with?= =?UTF-8?q?=20Freeplane,=20an=20open=20source=20mind=20mapping=20applicati?= =?UTF-8?q?on.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...an open source mind mapping application.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md diff --git a/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md b/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md new file mode 100644 index 0000000000..cefca12303 --- /dev/null +++ b/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Freeplane, an open source mind mapping application) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-freeplane) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Freeplane, an open source mind mapping application +====== + +Map your brainstorming sessions with Freeplane, the 13th in our series on open source tools that will make you more productive in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_data.png?itok=RH6NA32X) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 13th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Freeplane + +[Mind maps][1] are one of the more valuable tools I've used for quickly brainstorming ideas and capturing data. Mind mapping is a versatile process that helps show how things are related and can be used to quickly organize interrelated information. From a planning perspective, mind mapping allows you to quickly perform a brain dump around a single concept, idea, or technology. + +![](https://opensource.com/sites/default/files/uploads/freeplane-1.png) + +[Freeplane][2] is a desktop application that makes it easy to create, view, edit, and share mind maps. It is a redesign of [FreeMind][3], which was the go-to mind-mapping application for quite some time. + +Installing Freeplane is pretty easy. It is a [Java][4] application and distributed as a ZIP file with scripts to start the application on Linux, Windows, and MacOS. At its first startup, its main window includes an example mind map with links to documentation about all the different things you can do with Freeplane. + +![](https://opensource.com/sites/default/files/uploads/freeplane-2.png) + +You have a choice of templates when you create a new mind map. The standard template (likely at the bottom of the list) works for most cases. Just start typing the idea or phrase you want to start with, and your text will replace the center text. Pressing the Insert key will add a branch (or node) off the center with a blank field where you can fill in something associated with the idea. Pressing Insert again will add another node connected to the first one. Pressing Enter on a node will add a node parallel to that one. + +![](https://opensource.com/sites/default/files/uploads/freeplane-3.png) + +As you add nodes, you may come up with another thought or idea related to the main topic. Using either the mouse or the Arrow keys, go back to the center of the map and press Insert. A new node will be created off the main topic. + +If you want to go beyond Freeplane's base functionality, right-click on any of the nodes to bring up a Properties menu for that node. The Tool pane (activated under the View–>Controls menu) contains customization options galore, including line shape and thickness, border shapes, colors, and much, much more. The Calendar tab allows you to insert dates into the nodes and set reminders for when nodes are due. (Note that reminders work only when Freeplane is running.) Mind maps can be exported to several formats, including common images, XML, Microsoft Project, Markdown, and OPML. + +![](https://opensource.com/sites/default/files/uploads/freeplane-4.png) + +Freeplane gives you all the tools you'll need to create vibrant and useful mind maps, getting your ideas out of your head and into a place where you can take action on them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-freeplane + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Mind_map +[2]: https://www.freeplane.org/wiki/index.php/Home +[3]: https://sourceforge.net/projects/freemind/ +[4]: https://java.com From 5e18ac26c9b5710dc37494a062c49f806ad50376 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 12:58:48 +0800 Subject: [PATCH 569/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190117=20Get=20?= =?UTF-8?q?started=20with=20CryptPad,=20an=20open=20source=20collaborative?= =?UTF-8?q?=20document=20editor=20sources/tech/20190117=20Get=20started=20?= =?UTF-8?q?with=20CryptPad,=20an=20open=20source=20collaborative=20documen?= =?UTF-8?q?t=20editor.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...en source collaborative document editor.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md diff --git a/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md new file mode 100644 index 0000000000..2da6274e42 --- /dev/null +++ b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with CryptPad, an open source collaborative document editor) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-cryptpad) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with CryptPad, an open source collaborative document editor +====== +Securely share your notes, documents, kanban boards, and more with CryptPad, the fifth in our series on open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the fifth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### CryptPad + +We already talked about [Joplin][1], which is good for keeping your own notes but—as you may have noticed—doesn't have any sharing or collaboration features. + +[CryptPad][2] is a secure, shareable note-taking app and document editor that allows for secure, collaborative editing. Unlike Joplin, it is a NodeJS app, which means you can run it on your desktop or a server elsewhere and access it with any modern web browser. Out of the box, it supports rich text, Markdown, polls, whiteboards, kanban, and presentations. + +![](https://opensource.com/sites/default/files/uploads/cryptpad-1.png) + +The different document types are robust and fully featured. The rich text editor covers all the bases you'd expect from a good editor and allows you to export files to HTML. The Markdown editor is on par with Joplin, and the kanban board, though not as full-featured as [Wekan][3], is really well done. The rest of the supported document types and editors are also very polished and have the features you'd expect from similar apps, although polls feel a little clunky. + +![](https://opensource.com/sites/default/files/uploads/cryptpad-2.png) + +CryptPad's real power, though, comes in its sharing and collaboration features. Sharing a document is as simple as getting the sharable URL from the "share" option, and CryptPad supports embedding documents in iFrame tags on other websites. Documents can be shared in Edit or View mode with a password and with links that expire. The built-in chat allows editors to talk to each other (note that people with View access can also see the chat but can't comment). + +![](https://opensource.com/sites/default/files/pictures/cryptpad-3.png) + +All files are stored encrypted with the user's password. Server administrators can't read the documents, which also means if you forget or lose your password, the files are unrecoverable. So make sure you keep the password in a secure place, like a [password vault][4]. + +![](https://opensource.com/sites/default/files/uploads/cryptpad-4.png) + +When it's run locally, CryptPad is a robust app for creating and editing documents. When run on a server, it becomes an excellent collaboration platform for multi-user document creation and editing. Installation took less than five minutes on my laptop, and it just worked out of the box. The developers also include instructions for running CryptPad in Docker, and there is a community-maintained Ansible role for ease of deployment. CryptPad does not support any third-party authentication methods, so users must create their own accounts. CryptPad also has a community-supported hosted version if you don't want to run your own server. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-cryptpad + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-joplin +[2]: https://cryptpad.fr/index.html +[3]: https://opensource.com/article/19/1/productivity-tool-wekan +[4]: https://opensource.com/article/18/4/3-password-managers-linux-command-line From 2a3cfd6d003e15c320540b104cfb4fd594025dc3 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 13:00:24 +0800 Subject: [PATCH 570/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Get=20?= =?UTF-8?q?started=20with=20Cypht,=20an=20open=20source=20email=20client?= =?UTF-8?q?=20sources/tech/20190116=20Get=20started=20with=20Cypht,=20an?= =?UTF-8?q?=20open=20source=20email=20client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...with Cypht, an open source email client.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20190116 Get started with Cypht, an open source email client.md diff --git a/sources/tech/20190116 Get started with Cypht, an open source email client.md b/sources/tech/20190116 Get started with Cypht, an open source email client.md new file mode 100644 index 0000000000..64be2e4a02 --- /dev/null +++ b/sources/tech/20190116 Get started with Cypht, an open source email client.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Cypht, an open source email client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-cypht-email) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Cypht, an open source email client +====== +Integrate your email and news feeds into one view with Cypht, the fourth in our series on 19 open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_mail_box_envelope_send_blue.jpg?itok=6Epj47H6) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the fourth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Cypht + +We spend a lot of time dealing with email, and effectively [managing your email][1] can make a huge impact on your productivity. Programs like Thunderbird, Kontact/KMail, and Evolution all seem to have one thing in common: they seek to duplicate the functionality of Microsoft Outlook, which hasn't really changed in the last 10 years or so. Even the [console standard-bearers][2] like Mutt and Cone haven't changed much in the last decade. + +![](https://opensource.com/sites/default/files/uploads/cypht-1.png) + +[Cypht][3] is a simple, lightweight, and modern webmail client that aggregates several accounts into a single view. Along with email accounts, it includes Atom/RSS feeds. It makes reading items from these different sources very simple by using an "Everything" screen that shows not just the mail from your inbox, but also the newest articles from your news feeds. + +![](https://opensource.com/sites/default/files/uploads/cypht-2.png) + +It uses a simplified version of HTML messages to display mail or you can set it to view a plain-text version. Since Cypht doesn't load images from remote sources (to help maintain security), HTML rendering can be a little rough, but it does enough to get the job done. You'll get plain-text views with most rich-text mail—meaning lots of links and hard to read. I don't fault Cypht, since this is really the email senders' doing, but it does detract a little from the reading experience. Reading news feeds is about the same, but having them integrated with your email accounts makes it much easier to keep up with them (something I sometimes have issues with). + +![](https://opensource.com/sites/default/files/uploads/cypht-3.png) + +Users can use a preconfigured mail server and add any additional servers they use. Cypht's customization options include plain-text vs. HTML mail display, support for multiple profiles, and the ability to change the theme (and make your own). You have to remember to click the "Save" button on the left navigation bar, though, or your custom settings will disappear after that session. If you log out and back in without saving, all your changes will be lost and you'll end up with the settings you started with. This does make it easy to experiment, and if you need to reset things, simply logging out without saving will bring back the previous setup when you log back in. + +![](https://opensource.com/sites/default/files/pictures/cypht-4.png) + +[Installing Cypht][4] locally is very easy. While it is not in a container or similar technology, the setup instructions were very clear and easy to follow and didn't require any changes on my part. On my laptop, it took about 10 minutes from starting the installation to logging in for the first time. A shared installation on a server uses the same steps, so it should be about the same. + +In the end, Cypht is a fantastic alternative to desktop and web-based email clients with a simple interface to help you handle your email quickly and efficiently. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-cypht-email + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/7/email-alternatives-thunderbird +[2]: https://opensource.com/life/15/8/top-4-open-source-command-line-email-clients +[3]: https://cypht.org/ +[4]: https://cypht.org/install.html From 4655756aa53d68838535c0fa250ff547b3cfca66 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 13:04:03 +0800 Subject: [PATCH 571/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20Do=20a?= =?UTF-8?q?dvanced=20math=20with=20Mathematica=20on=20the=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190312=20Do=20advanced=20math=20with=20Mathem?= =?UTF-8?q?atica=20on=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...th with Mathematica on the Raspberry Pi.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md diff --git a/sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md b/sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md new file mode 100644 index 0000000000..c39b7dc7e5 --- /dev/null +++ b/sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Do advanced math with Mathematica on the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/do-math-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Do advanced math with Mathematica on the Raspberry Pi +====== +Wolfram bundles a version of Mathematica with Raspbian. Learn how to use it in the 12th article in our series on getting started with Raspberry Pi. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/edu_math_formulas.png?itok=B59mYTG3) + +In the mid-'90s, I started college as a math major, and, even though I graduated with a computer science degree, I had taken enough classes to graduate with a minor—and only two classes short of a double-major—in math. At the time, I was introduced to an application called [Mathematica][1] by [Wolfram][2], where we would take many of our algebraic and differential equations from the blackboard into the computer. I spent a few hours a month in the lab learning the Wolfram Language and solving integrals and such on Mathematica. + +Mathematica was closed source and expensive for a college student, so it was a nice surprise to see almost 20 years later Wolfram bundling a version of Mathematica with Raspbian and the Raspberry Pi. If you decide to use another Debian-based distribution, you can [download it][3] on your Pi. Note that this version is free for non-commercial use only. + +The Raspberry Pi Foundation's [introduction to Mathematica][4] covers some basic concepts such as variables and loops, solving some math problems, creating graphs, doing linear algebra, and even interacting with the GPIO pins through the application. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_12_mathematica_batman-plot.png) + +To dive deeper into Mathematica, check out the [Wolfram Language documentation][5]. If you just want to solve some basic calculus problems, [check out its functions][6]. And read this tutorial if you want to [plot some 2D and 3D graphs][7]. + +Or, if you want to stick with open source tools while doing math, check out the command-line tools **expr** , **factor** , and **bc**. (Remember to use the [**man** command][8] to read up on these utilities.) And if you want to graph something, [Gnuplot][9] is a great option. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/do-math-raspberry-pi + +作者:[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://en.wikipedia.org/wiki/Wolfram_Mathematica +[2]: https://wolfram.com/ +[3]: https://www.wolfram.com/raspberry-pi/ +[4]: https://projects.raspberrypi.org/en/projects/getting-started-with-mathematica/ +[5]: https://www.wolfram.com/language/ +[6]: https://reference.wolfram.com/language/guide/Calculus.html +[7]: https://reference.wolfram.com/language/howto/PlotAGraph.html +[8]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[9]: http://gnuplot.info/ From 4207622368056638b0e6782165dd5435eb2e8c44 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 13:08:53 +0800 Subject: [PATCH 572/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20Star?= =?UTF-8?q?=20LabTop=20Mk=20III=20Open=20Source=20Edition:=20An=20Interest?= =?UTF-8?q?ing=20Laptop=20sources/tech/20190312=20Star=20LabTop=20Mk=20III?= =?UTF-8?q?=20Open=20Source=20Edition-=20An=20Interesting=20Laptop.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n Source Edition- An Interesting Laptop.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20190312 Star LabTop Mk III Open Source Edition- An Interesting Laptop.md diff --git a/sources/tech/20190312 Star LabTop Mk III Open Source Edition- An Interesting Laptop.md b/sources/tech/20190312 Star LabTop Mk III Open Source Edition- An Interesting Laptop.md new file mode 100644 index 0000000000..2e4b8f098a --- /dev/null +++ b/sources/tech/20190312 Star LabTop Mk III Open Source Edition- An Interesting Laptop.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Star LabTop Mk III Open Source Edition: An Interesting Laptop) +[#]: via: (https://itsfoss.com/star-labtop-open-source-edition) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Star LabTop Mk III Open Source Edition: An Interesting Laptop +====== + +[Star Labs Systems][1] have been producing Laptops tailored for Linux for some time. While you can purchase other variants available on their website, they have recently launched a [Kickstarter campaign][2] for their upcoming ‘Open Source Edition’ laptop that incorporates more features as per the requests by the users or reviewers. + +It may not be the best laptop you’ve ever come across for around a **1000 Euros** – but it certainly is interesting for some specific features. + +In this article, we will talk about what makes it an interesting deal and whether or not it’s worth investing for. + +![star labtop mk III][3] + +### Key Highlight: Open-source Coreboot Firmware + +Normally, you will observe proprietary firmware (BIOS) on computers, American Megatrends Inc, for example. + +But, here, Star Labs have tailored the [coreboot firmware][4] (a.k.a known as the LinuxBIOS) which is an open source alternative to proprietary solutions for this laptop. + +Not just open source but it is also a lighter firmware for better control over your laptop. With [TianoCore EDK II][5], it ensures that you get the maximum compatibility for most of the major Operating Systems. + +### Other Features of Star LabTop Mk III + +![sat labtop mk III][6] + +In addition to the open source firmware, the laptop features an **8th-gen i7 chipse** t ( **i7-8550u** ) coupled with **16 Gigs of LPDDR4 RAM** clocked at **2400 MHz**. + +The GPU being the integrated **Intel UHD Graphics 620** should be enough for professional tasks – except video editing and gaming. It will be rocking a **Full HD 13.3-inch IPS** panel as the display. + +The storage option includes **480 GB or 960 GB of PCIe SSD** – which is impressive as well. In addition to all this, it comes with the **USB Type-C** support. + +Interestingly, the **BIOS, Embedded Controller and SSD** will be receiving automatic [firmware updates][7] via the [LVFS][8] (the Mk III standard edition has this feature already). + +You should also check out a review video of [Star LabTob Mk III][9] to get an idea of how the open source edition could look like: + +If you are curious about the detailed tech specs, you should check out the [Kickstarter page][2]. + + + +### Our Opinion + +![star labtop mk III][10] + +The inclusion of coreboot firmware and being something tailored for various Linux distributions originally is the reason why it is being termed as the “ **Open Source Edition”**. + +The price for the ultimate bundle on Kickstarter is **1087 Euros**. + +Can you get better laptop deals at this price? **Yes** , definitely. But, it really comes down to your preference and your passion for open source – of what you require. + +However, if you want a performance-driven laptop specifically tailored for Linux, yes, this is an option you might want to consider with something new to offer (and potentially considering your requests for their future builds). + +Of course, you cannot consider this for video editing and gaming – for obvious reasons. So, they should considering adding a dedicated GPU to make it a complete package for computing, gaming, video editing and much more. Maybe even a bigger screen, say 15.6-inch? + +### Wrapping Up + +For what it is worth, if you are a Linux and open source enthusiast and want a performance-driven laptop, this could be an option to go with and back this up on Kickstarter right now. + +What do you think about it? Will you be interested in a laptop like this? If not, why? + +Let us know your thoughts in the comments below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/star-labtop-open-source-edition + +作者:[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://starlabs.systems +[2]: https://www.kickstarter.com/projects/starlabs/star-labtop-mk-iii-open-source-edition +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/star-labtop-mkiii-2.jpg?resize=800%2C450&ssl=1 +[4]: https://en.wikipedia.org/wiki/Coreboot +[5]: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/star-labtop-mkiii-1.jpg?ssl=1 +[7]: https://itsfoss.com/update-firmware-ubuntu/ +[8]: https://fwupd.org/ +[9]: https://starlabs.systems/pages/star-labtop +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/star-labtop-mkiii.jpg?resize=800%2C435&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/star-labtop-mkiii-2.jpg?fit=800%2C450&ssl=1 From f1fd1279179eed3d00d3ea359530aefc02e7bf9d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:21:57 +0800 Subject: [PATCH 573/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190303=20How=20?= =?UTF-8?q?to=20boot=20up=20a=20new=20Raspberry=20Pi=20sources/tech/201903?= =?UTF-8?q?03=20How=20to=20boot=20up=20a=20new=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90303 How to boot up a new Raspberry Pi.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20190303 How to boot up a new Raspberry Pi.md diff --git a/sources/tech/20190303 How to boot up a new Raspberry Pi.md b/sources/tech/20190303 How to boot up a new Raspberry Pi.md new file mode 100644 index 0000000000..87ab3ea268 --- /dev/null +++ b/sources/tech/20190303 How to boot up a new Raspberry Pi.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to boot up a new Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/how-boot-new-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to boot up a new Raspberry Pi +====== +Learn how to install a Linux operating system, in the third article in our guide to getting started with Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +If you've been following along in this series, you've [chosen][1] and [bought][2] your Raspberry Pi board and peripherals and now you're ready to start using it. Here, in the third article, let's look at what you need to do to boot it up. + +Unlike your laptop, desktop, smartphone, or tablet, the Raspberry Pi doesn't come with built-in storage. Instead, it uses a Micro SD card to store the operating system and your files. The great thing about this is it gives you the flexibility to carry your files (even if you don't have your Raspberry Pi with you). The downside is it may also increase the risk of losing or damaging the card—and thus losing your files. Just protect your Micro SD card, and you should be fine. + +You should also know that SD cards aren't as fast as mechanical or solid state drives, so booting, reading, and writing from your Pi will not be as speedy as you would expect from other devices. + +### How to install Raspbian + +The first thing you need to do when you get a new Raspberry Pi is to install its operating system on a Micro SD card. Even though there are other operating systems (both Linux- and non-Linux-based) available for the Raspberry Pi, this series focuses on [Raspbian][3] , Raspberry Pi's official Linux version. + +![](https://opensource.com/sites/default/files/uploads/raspbian.png) + +The easiest way to install Raspbian is with [NOOBS][4], which stands for "New Out Of Box Software." Raspberry Pi offers great [documentation for NOOBS][5], so I won't repeat the installation instructions here. + +NOOBS gives you the choice of installing the following operating systems: + ++ [Raspbian][6] ++ [LibreELEC][7] ++ [OSMC][8] ++ [Recalbox][9] ++ [Lakka][10] ++ [RISC OS][11] ++ [Screenly OSE][12] ++ [Windows 10 IoT Core][13] ++ [TLXOS][14] + +Again, Raspbian is the operating system we'll use in this series, so go ahead, grab your Micro SD and follow the NOOBS documentation to install it. I'll meet you in the fourth article in this series, where we'll look at how to use Linux, including some of the main commands you'll need to know. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-boot-new-raspberry-pi + +作者:[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/article/19/3/which-raspberry-pi-choose +[2]: https://opensource.com/article/19/2/how-buy-raspberry-pi +[3]: https://www.raspbian.org/RaspbianFAQ +[4]: https://www.raspberrypi.org/downloads/noobs/ +[5]: https://www.raspberrypi.org/documentation/installation/noobs.md +[6]: https://www.raspbian.org/RaspbianFAQ +[7]: https://libreelec.tv/ +[8]: https://osmc.tv/ +[9]: https://www.recalbox.com/ +[10]: http://www.lakka.tv/ +[11]: https://www.riscosopen.org/wiki/documentation/show/Welcome%20to%20RISC%20OS%20Pi +[12]: https://www.screenly.io/ose/ +[13]: https://developer.microsoft.com/en-us/windows/iot +[14]: https://thinlinx.com/ From ccbd0dc1208be84a162543bb5546d9df8b78a571 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:23:55 +0800 Subject: [PATCH 574/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=203=20po?= =?UTF-8?q?pular=20programming=20languages=20you=20can=20learn=20with=20Ra?= =?UTF-8?q?spberry=20Pi=20sources/tech/20190306=203=20popular=20programmin?= =?UTF-8?q?g=20languages=20you=20can=20learn=20with=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nguages you can learn with Raspberry Pi.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md diff --git a/sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md b/sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md new file mode 100644 index 0000000000..33670e525a --- /dev/null +++ b/sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 popular programming languages you can learn with Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/programming-languages-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +3 popular programming languages you can learn with Raspberry Pi +====== +Become more valuable on the job market by learning to program with the Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_language_c.png?itok=mPwqDAD9) + +In the last article in this series, I shared some ways to [teach kids to program with Raspberry Pi][1]. In theory, there is absolutely nothing stopping an adult from using resources designed for kids, but you might be better served by learning the programming languages that are in demand in the job market. + +Here are three programming languages you can learn with the Raspberry Pi. + +### Python + +[Python][2] has become one of the [most popular programming languages][3] in the open source world. Its interpreter has been packaged and made available in every popular Linux distribution. If you install Raspbian on your Raspberry Pi, you will see an app called [Thonny][4], which is a Python integrated development environment (IDE) for beginners. In a nutshell, an IDE is an application that provides all you need to get your code executed, often including things like debuggers, documentation, auto-completion, and emulators. Here is a [great little tutorial][5] to get you started using Thonny and Python on the Raspberry Pi. + +![](https://opensource.com/sites/default/files/uploads/thonny.png) + +### Java + +Although arguably not as attractive as it once was, [Java][6] remains heavily used in universities around the world and deeply embedded in the enterprise. So, even though some will disagree that I'm recommending it as a beginner's language, I am compelled to do so; for one thing, it still very popular, and for another, there are a lot of books, classes, and other information available for you to learn Java. Get started on the Raspberry Pi by using the [BlueJ][7] Java IDE. + +![](https://opensource.com/sites/default/files/uploads/bluejayide.png) + +### JavaScript + +"Back in my day…" [JavaScript][8] was a client-side language that basically allowed people to streamline and automate user events in a browser and modify HTML elements. Today, JavaScript has escaped the browser and is available for other types of clients like mobile apps and even server-side programming. [Node.js][9] is a popular runtime environment that allows developers to code beyond the client-browser paradigm. To learn more about running Node.js on the Raspberry Pi, check out [W3Schools tutorial][10]. + +### Other languages + +If there's another language you want to learn, don't despair. 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. + +Microsoft's [Visual Studio Code][11] also [runs on the Raspberry Pi][12]. It's an open source code editor from Microsoft that supports several markup and programming languages. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/programming-languages-raspberry-pi + +作者:[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/article/19/2/teach-kids-program-raspberry-pi +[2]: https://opensource.com/resources/python +[3]: https://www.economist.com/graphic-detail/2018/07/26/python-is-becoming-the-worlds-most-popular-coding-language +[4]: https://thonny.org/ +[5]: https://raspberrypihq.com/getting-started-with-python-programming-and-the-raspberry-pi/ +[6]: https://opensource.com/resources/java +[7]: https://www.bluej.org/raspberrypi/ +[8]: https://developer.mozilla.org/en-US/docs/Web/JavaScript +[9]: https://nodejs.org/en/ +[10]: https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp +[11]: https://code.visualstudio.com/ +[12]: https://pimylifeup.com/raspberry-pi-visual-studio-code/ From f92832b55402b0a0eb7753c07b9209c79a895fe7 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:28:46 +0800 Subject: [PATCH 575/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Buildi?= =?UTF-8?q?ng=20the=20virtualization=20stack=20of=20the=20future=20with=20?= =?UTF-8?q?rust-vmm=20sources/tech/20190311=20Building=20the=20virtualizat?= =?UTF-8?q?ion=20stack=20of=20the=20future=20with=20rust-vmm.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ation stack of the future with rust-vmm.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md diff --git a/sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md b/sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md new file mode 100644 index 0000000000..b1e7fbf046 --- /dev/null +++ b/sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building the virtualization stack of the future with rust-vmm) +[#]: via: (https://opensource.com/article/19/3/rust-virtual-machine) +[#]: author: (Andreea Florescu ) + +Building the virtualization stack of the future with rust-vmm +====== +rust-vmm facilitates sharing core virtualization components between Rust Virtual Machine Monitors. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_stack_blue_disks.png?itok=3hKDtK20) + +More than a year ago we started developing [Firecracker][1], a virtual machine monitor (VMM) that runs on top of KVM (the kernel-based virtual machine). We wanted to create a lightweight VMM that starts virtual machines (VMs) in a fraction of a second, with a low memory footprint, to enable high-density cloud environments. + +We started out developing Firecracker by forking the Chrome OS VMM ([CrosVM][2]), but we diverged shortly after because we targeted different customer use cases. CrosVM provides Linux application isolation in ChromeOS, while Firecracker is used for running multi-tenant workloads at scale. Even though we now walk different paths, we still have common virtualization components, such as wrappers over KVM input/output controls (ioctls), a minimal kernel loader, and use of the [Virtio][3] device models. + +With this in mind, we started thinking about the best approach for sharing the common code. Having a shared codebase raises the security and quality bar for both projects. Currently, fixing security bugs requires duplicated work in terms of porting the changes from one project to the other and going through different review processes for merging the changes. After open sourcing Firecracker, we've received requests for adding features including GPU support and booting [bzImage][4] files. Some of the requests didn't align with Firecracker's goals, but were otherwise valid use cases that just haven't found the right place for an implementation. + +### The rust-vmm project + +The [rust-vmm][5] project came to life in December 2018 when Amazon, Google, Intel, and Red Hat employees started talking about the best way of sharing virtualization packages. More contributors have joined this initiative along the way. We are still at the beginning of this journey, with only one component published to [Crates.io][6] (Rust's package registry) and several others (such as Virtio devices, Linux kernel loaders, and KVM ioctls wrappers) being developed. With two VMMs written in Rust under active development and growing interest in building other specialized VMMs, rust-vmm was born as the host for sharing core virtualization components. + +The goal of rust-vmm is to enable the community to create custom VMMs that import just the required building blocks for their use case. We decided to organize rust-vmm as a multi-repository project, where each repository corresponds to an independent virtualization component. Each individual building block is published on Crates.io. + +### Creating custom VMMs with rust-vmm + +The components discussed below are currently under development. + +![](https://opensource.com/sites/default/files/uploads/custom_vmm.png) + +Each box on the right side of the diagram is a GitHub repository corresponding to one package, which in Rust is called a crate. The functionality of one crate can be further split into modules, for example virtio-devices. Let's have a look at these components and some of their potential use cases. + + * **KVM interface:** Creating our VMM on top of KVM requires an interface that can invoke KVM functionality from Rust. The kvm-bindings crate represents the Rust Foreign Function Interface (FFI) to KVM kernel headers. Because headers only include structures and defines, we also have wrappers over the KVM ioctls (kvm-ioctls) that we use for opening dev/kvm, creating a VM, creating vCPUs, and so on. + + * **Virtio devices and rate limiting:** Virtio has a frontend-backend architecture. Currently in rust-vmm, the frontend is implemented in the virtio-devices crate, and the backend lies in the vhost package. Vhost has support for both user-land and kernel-land drivers, but users can also plug virtio-devices to their custom backend. The virtio-bindings are the bindings for Virtio devices generated using the Virtio Linux headers. All devices in the virtio-devices crate are exported independently as modules using conditional compilation. Some devices, such as block, net, and vsock support rate limiting in terms of I/O per second and bandwidth. This can be achieved by using the functionality provided in the rate-limiter crate. + + * The kernel-loader is responsible for loading the contents of an [ELF][7] kernel image in guest memory. + + + + +For example, let's say we want to build a custom VMM that allows users to create and configure a single VM running on top of KVM. As part of the configuration, users will be able to specify the kernel image file, the root file system, the number of vCPUs, and the memory size. Creating and configuring the resources of the VM can be implemented using the kvm-ioctls crate. The kernel image can be loaded in guest memory with kernel-loader, and specifying a root filesystem can be achieved with the virtio-devices block module. The last thing needed for our VMM is writing VMM Glue, the code that takes care of integrating rust-vmm components with the VMM user interface, which allows users to create and manage VMs. + +### How you can help + +This is the beginning of an exciting journey, and we are looking forward to getting more people interested in VMMs, Rust, and the place where you can find both: [rust-vmm][5]. + +We currently have [sync meetings][8] every two weeks to discuss the future of the rust-vmm organization. The meetings are open to anyone willing to participate. If you have any questions, please open an issue in the [community repository][9] or send an email to the rust-vmm [mailing list][10] (you can also [subscribe][11]). We also have a [Slack channel][12] and encourage you to join, if you are interested. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/rust-virtual-machine + +作者:[Andreea Florescu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://github.com/firecracker-microvm/firecracker +[2]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ +[3]: https://www.linux-kvm.org/page/Virtio +[4]: https://en.wikipedia.org/wiki/Vmlinux#bzImage +[5]: https://github.com/rust-vmm +[6]: https://crates.io/ +[7]: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format +[8]: http://lists.opendev.org/pipermail/rust-vmm/2019-January/000103.html +[9]: https://github.com/rust-vmm/community +[10]: mailto:rust-vmm@lists.opendev.org +[11]: http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm +[12]: https://join.slack.com/t/rust-vmm/shared_invite/enQtNTI3NDM2NjA5MzMzLTJiZjUxOGEwMTJkZDVkYTcxYjhjMWU3YzVhOGQ0M2Y5NmU5MzExMjg5NGE3NjlmNzNhZDlhMmY4ZjVhYTQ4ZmQ From 23bb900f2d2a858288629f09e303d8c80c3808c4 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:30:30 +0800 Subject: [PATCH 576/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20How=20?= =?UTF-8?q?to=20keep=20your=20Raspberry=20Pi=20updated=20sources/tech/2019?= =?UTF-8?q?0307=20How=20to=20keep=20your=20Raspberry=20Pi=20updated.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7 How to keep your Raspberry Pi updated.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/tech/20190307 How to keep your Raspberry Pi updated.md diff --git a/sources/tech/20190307 How to keep your Raspberry Pi updated.md b/sources/tech/20190307 How to keep your Raspberry Pi updated.md new file mode 100644 index 0000000000..65218c64c9 --- /dev/null +++ b/sources/tech/20190307 How to keep your Raspberry Pi updated.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to keep your Raspberry Pi updated) +[#]: via: (https://opensource.com/article/19/3/how-raspberry-pi-update) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to keep your Raspberry Pi updated +====== +Learn how to keep your Raspberry Pi patched and working well in the seventh article in our guide to getting started with the Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_happy_sad_developer_programming.png?itok=72nkfSQ_) + +Just like your tablet, cellphone, and laptop, you need to keep your Raspberry Pi updated. Not only will the latest enhancements keep your Pi running smoothly, they will also keep you safer, especially if you are connected to a network. The seventh article in our guide to getting started with the Raspberry Pi shares two pieces of advice on keeping your Pi working well. + +### Update Raspbian + +Updating your Raspbian installation is a [two-step process][1]: + + 1. In your terminal type: **sudo apt-get update** +The command **sudo** allows you to run **apt-get update** as admin (aka root). Note that **apt-get update** will not install anything new on your system; rather it will update the list of packages and dependencies that need to be updated. + + + 2. Then type: **sudo apt-get dist-upgrade** +From the documentation: "Generally speaking, doing this regularly will keep your installation up to date, in that it will be equivalent to the latest released image available from [raspberrypi.org/downloads][2]." + +![](https://opensource.com/sites/default/files/uploads/update_sudo_rpi.png) + +### Be careful with rpi-update + +Raspbian comes with another little update utility called [rpi-update][3]. This utility can be used to upgrade your Pi to the latest firmware which may or may not be broken/buggy. You may find information explaining how to use it, but as of late it is recommended never to use this application unless you have a really good reason to do so. + +Bottom line: Keep your systems updated! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-raspberry-pi-update + +作者:[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://www.raspberrypi.org/documentation/raspbian/updating.md +[2]: https://www.raspberrypi.org/downloads/ +[3]: https://github.com/Hexxeh/rpi-update From a2cdb3b2ce09ef418300e9f0e48d2bdfab5d976b Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:31:35 +0800 Subject: [PATCH 577/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190308=20How=20?= =?UTF-8?q?to=20use=20your=20Raspberry=20Pi=20for=20entertainment=20source?= =?UTF-8?q?s/tech/20190308=20How=20to=20use=20your=20Raspberry=20Pi=20for?= =?UTF-8?q?=20entertainment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...use your Raspberry Pi for entertainment.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20190308 How to use your Raspberry Pi for entertainment.md diff --git a/sources/tech/20190308 How to use your Raspberry Pi for entertainment.md b/sources/tech/20190308 How to use your Raspberry Pi for entertainment.md new file mode 100644 index 0000000000..039b0b4598 --- /dev/null +++ b/sources/tech/20190308 How to use your Raspberry Pi for entertainment.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use your Raspberry Pi for entertainment) +[#]: via: (https://opensource.com/article/19/3/raspberry-pi-entertainment) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to use your Raspberry Pi for entertainment +====== +Learn how to watch Netflix and listen to music on your Raspberry Pi, in the eighth article in our guide to getting started with Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My) + +So far, this series has focused on more serious topics—how to [choose][1], [buy][2], [set up][3], and [update][4] your Raspberry Pi, and different things [kids][5] and [adults][6] can learn with it (including [Linux][7]). But now it's time to change up the subject and have some fun! Today we'll look at ways to use your Raspberry Pi for entertainment, and tomorrow we'll continue the fun with gaming. + +### Watch TV and movies + +You can use your Raspberry Pi and the [Open Source Media Center][8] (OSMC) to [watch Netflix][9]! The OSMC is a system based on the [Kodi][10] project that allows you to play back media from your local network, attached storage, and the internet. It's also known for having the best feature set and community among media center applications. + +NOOBS (which we talked about in the [third article][11] in this series) allows you to [install OSMC][12] on your Raspberry Pi as easily as possible. NOOBS also offers another media center system based on Kodi called [LibreELEC][13]. + +### Listen to music + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_8_pimusicbox.png) + +You can also stream music on your network via attached storage or services like Spotify on your Raspberry Pi with the [Pi Music Box][14] project. I [wrote about it][15] a while ago, but you can find newer instructions, including how to's and DIY projects, on the [Pi Music Box website][16]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/raspberry-pi-entertainment + +作者:[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/article/19/3/which-raspberry-pi-choose +[2]: https://opensource.com/article/19/2/how-buy-raspberry-pi +[3]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi +[4]: https://opensource.com/article/19/2/how-keep-your-raspberry-pi-updated-and-patched +[5]: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi +[6]: https://opensource.com/article/19/2/3-popular-programming-languages-you-can-learn-raspberry-pi +[7]: https://opensource.com/article/19/2/learn-linux-raspberry-pi +[8]: https://osmc.tv/ +[9]: https://www.dailydot.com/upstream/netflix-raspberry-pi/ +[10]: http://kodi.tv/ +[11]: https://opensource.com/article/19/3/how-boot-new-raspberry-pi +[12]: https://www.raspberrypi.org/documentation/usage/kodi/ +[13]: https://libreelec.tv/ +[14]: https://github.com/pimusicbox/pimusicbox/tree/master +[15]: https://opensource.com/life/15/3/pi-musicbox-guide +[16]: https://www.pimusicbox.com/ From 959113109f4cb7715dfca9f9fd56cd062a5d0c97 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:33:07 +0800 Subject: [PATCH 578/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190309=20Emulat?= =?UTF-8?q?ors=20and=20Native=20Linux=20games=20on=20the=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190309=20Emulators=20and=20Native=20Linux=20g?= =?UTF-8?q?ames=20on=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Native Linux games on the Raspberry Pi.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md diff --git a/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md b/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md new file mode 100644 index 0000000000..91670b7015 --- /dev/null +++ b/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emulators and Native Linux games on the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/play-games-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Emulators and Native Linux games on the Raspberry Pi +====== +The Raspberry Pi is a great platform for gaming; learn how in the ninth article in our series on getting started with the Raspberry Pi. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_minecraft_copy.png?itok=iz4RF7f8) + +Back in the [fifth article][1] in our series on getting started with the Raspberry Pi, I mentioned Minecraft as a way to teach kids to program using a gaming platform. Today we'll talk about other ways you can play games on your Raspberry Pi, as it's a great platform for gaming—with and without emulators. + +### Gaming with emulators + +Emulators are software that allow you to play games from different systems and different decades on your Raspberry Pi. Of the many emulators available today, the most popular for the Raspberry Pi is [RetroPi][2]. You can use it to play games from systems such as Apple II, Amiga, Atari 2600, Commodore 64, Game Boy Advance, and [many others][3]. + +If RetroPi sounds interesting, check out [these instructions][4] on how to get started, and start having fun today! + +### Native Linux games + +There are also plenty of native Linux games available on Raspbian, Raspberry Pi's operating system. Make Use Of has a great article on [how to play 10 old favorites][5] like Doom and Nuke Dukem 3D on the Raspberry Pi. + +You can also use your Raspberry Pi as a [game server][6]. For example, you can set up Terraria, Minecraft, and QuakeWorld servers on the Raspberry Pi. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/play-games-raspberry-pi + +作者:[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/article/19/3/teach-kids-program-raspberry-pi +[2]: https://retropie.org.uk/ +[3]: https://retropie.org.uk/about/systems +[4]: https://opensource.com/article/19/1/retropie +[5]: https://www.makeuseof.com/tag/classic-games-raspberry-pi-without-emulators/ +[6]: https://www.makeuseof.com/tag/raspberry-pi-game-servers/ From 6d1abf6d1749ff63f955b757b5c5845e529ce121 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:34:11 +0800 Subject: [PATCH 579/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190310=20Let's?= =?UTF-8?q?=20get=20physical:=20How=20to=20use=20GPIO=20pins=20on=20the=20?= =?UTF-8?q?Raspberry=20Pi=20sources/tech/20190310=20Let-s=20get=20physical?= =?UTF-8?q?-=20How=20to=20use=20GPIO=20pins=20on=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ow to use GPIO pins on the Raspberry Pi.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md diff --git a/sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md b/sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md new file mode 100644 index 0000000000..d22887e15f --- /dev/null +++ b/sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let's get physical: How to use GPIO pins on the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/gpio-pins-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Let's get physical: How to use GPIO pins on the Raspberry Pi +====== +The 10th article in our series on getting started with Raspberry Pi explains how the GPIO pins work. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspbery_pi_zero_wireless_hardware.jpg?itok=9YFzdxFQ) + +Until now, this series has focused on the Raspberry Pi's software side, but today we'll get into the hardware. The availability of [general-purpose input/output][1] (GPIO) pins was one of the main features that interested me in the Pi when it first came out. GPIO allows you to programmatically interact with the physical world by attaching sensors, relays, and other types of circuitry to the Raspberry Pi. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_10_gpio-pins-pi2.jpg) + +Each pin on the board either has a predefined function or is designated as general purpose. Also, different Raspberry Pi models have either 26 or 40 pins for you to use at your discretion. Wikipedia has a [good overview of each pin][2] and its functionality. + +You can do many things with the Pi's GPIO pins. I've written some other articles about using the GPIOs, including a trio of articles ([Part I][3], [Part II][4], and [Part III][5]) about controlling holiday lights with the Raspberry Pi while using open source software to pair the lights with music. + +The Raspberry Pi community has done a great job in creating libraries in different programming languages, so you should be able to interact with the pins using [C][6], [Python][7], [Scratch][8], and other languages. + +Also, if you want the ultimate experience to interact with the physical world, pick up a [Raspberry Pi Sense Hat][9]. It is an affordable expansion board for the Pi that plugs into the GPIO pins so you can programmatically interact with LEDs, joysticks, and barometric pressure, temperature, humidity, gyroscope, accelerometer, and magnetometer sensors. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/gpio-pins-raspberry-pi + +作者:[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://www.raspberrypi.org/documentation/usage/gpio/ +[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#General_purpose_input-output_(GPIO)_connector +[3]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi +[4]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi +[5]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi +[6]: https://www.bigmessowires.com/2018/05/26/raspberry-pi-gpio-programming-in-c/ +[7]: https://www.raspberrypi.org/documentation/usage/gpio/python/README.md +[8]: https://www.raspberrypi.org/documentation/usage/gpio/scratch2/README.md +[9]: https://opensource.com/life/16/4/experimenting-raspberry-pi-sense-hat From 56fbee5512f1ef5a4b2c3c7d8605c6c0cb1fa0b0 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:34:59 +0800 Subject: [PATCH 580/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Learn?= =?UTF-8?q?=20about=20computer=20security=20with=20the=20Raspberry=20Pi=20?= =?UTF-8?q?and=20Kali=20Linux=20sources/tech/20190311=20Learn=20about=20co?= =?UTF-8?q?mputer=20security=20with=20the=20Raspberry=20Pi=20and=20Kali=20?= =?UTF-8?q?Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ty with the Raspberry Pi and Kali Linux.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md diff --git a/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md b/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md new file mode 100644 index 0000000000..bb57fb2857 --- /dev/null +++ b/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn about computer security with the Raspberry Pi and Kali Linux) +[#]: via: (https://opensource.com/article/19/3/computer-security-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Learn about computer security with the Raspberry Pi and Kali Linux +====== +Raspberry Pi is a great way to learn about computer security. Learn how in the 11th article in our getting-started series. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +Is there a hotter topic in technology than securing your computer? Some experts will tell you that there is no such thing as perfect security. They joke that if you want your server or application to be truly secure, then turn off your server, unplug it from the network, and put it in a safe somewhere. The problem with that should be obvious: What good is an app or server that nobody can use? + +That's the conundrum around security. How can we make something secure enough and still usable and valuable? I am not a security expert by any means, although I hope to be one day. With that in mind, I thought it would make sense to share some ideas about what you can do with a Raspberry Pi to learn more about security. + +I should note that, like the other articles in this series dedicated to Raspberry Pi beginners, my goal is not to dive in deep, rather to light a fire of interest for you to learn more about these topics. + +### Kali Linux + +When it comes to "doing security things," one of the Linux distributions that comes to mind is [Kali Linux][1]. Kali's development is primarily focused on forensics and penetration testing. It has more than 600 preinstalled [penetration-testing programs][2] to test your computer's security, and a [forensics mode][3], which prevents it from touching the internal hard drive or swap space of the system being examined. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_11_kali.png) + +Like Raspbian, Kali Linux is based on the Debian distribution, and you can find directions on installing it on the Raspberry Pi in its main [documentation portal][4]. If you installed Raspbian or another Linux distribution on your Raspberry Pi, you should have no problem installing Kali. Kali Linux's creators have even put together [training, workshops, and certifications][5] to help boost your career in the security field. + +### Other Linux distros + +Most standard Linux distributions, like Raspbian, Ubuntu, and Fedora, also have [many security tools available][6] in their repositories. Some great tools to explore include [Nmap][7], [Wireshark][8], [auditctl][9], and [SELinux][10]. + +### Projects + +There are many other security-related projects you can run on your Raspberry Pi, such as [Honeypots][11], [Ad blockers][12], and [USB sanitizers][13]. Take some time and learn about them! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/computer-security-raspberry-pi + +作者:[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://www.kali.org/ +[2]: https://en.wikipedia.org/wiki/Kali_Linux#Development +[3]: https://docs.kali.org/general-use/kali-linux-forensics-mode +[4]: https://docs.kali.org/kali-on-arm/install-kali-linux-arm-raspberry-pi +[5]: https://www.kali.org/penetration-testing-with-kali-linux/ +[6]: https://linuxblog.darkduck.com/2019/02/9-best-linux-based-security-tools.html +[7]: https://nmap.org/ +[8]: https://www.wireshark.org/ +[9]: https://linux.die.net/man/8/auditctl +[10]: https://opensource.com/article/18/7/sysadmin-guide-selinux +[11]: https://trustfoundry.net/honeypi-easy-honeypot-raspberry-pi/ +[12]: https://pi-hole.net/ +[13]: https://www.circl.lu/projects/CIRCLean/ From f31ba9330fcb3e1262a4724396c7bad3522051c6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:36:58 +0800 Subject: [PATCH 581/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Discus?= =?UTF-8?q?s=20everything=20Fedora=20sources/talk/20190311=20Discuss=20eve?= =?UTF-8?q?rything=20Fedora.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190311 Discuss everything Fedora.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sources/talk/20190311 Discuss everything Fedora.md diff --git a/sources/talk/20190311 Discuss everything Fedora.md b/sources/talk/20190311 Discuss everything Fedora.md new file mode 100644 index 0000000000..5795fbf3f7 --- /dev/null +++ b/sources/talk/20190311 Discuss everything Fedora.md @@ -0,0 +1,45 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Discuss everything Fedora) +[#]: via: (https://fedoramagazine.org/discuss-everything-fedora/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) + +Discuss everything Fedora +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/03/fedora-discussion-816x345.jpg) + +Are you interested in how Fedora is being developed? Do you want to get involved, or see what goes into making a release? You want to check out [Fedora Discussion][1]. It is a relatively new place where members of the Fedora Community meet to discuss, ask questions, and interact. Keep reading for more information. + +Note that the Fedora Discussion system is mainly aimed at contributors. If you have questions on using Fedora, check out [Ask Fedora][2] (which is being migrated in the future). + +![][3] + +Fedora Discussion is a forum and discussion site that uses the [Discourse open source discussion platform][4]. + +There are already several categories useful for Fedora users, including [Desktop][5] (covering Fedora Workstation, Fedora Silverblue, KDE, XFCE, and more) and the [Server, Cloud, and IoT][6] category . Additionally, some of the [Fedora Special Interest Groups (SIGs) have discussions as well][7]. Finally, the [Fedora Friends][8] category helps you connect with other Fedora users and Community members by providing discussions about upcoming meetups and hackfests. + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/discuss-everything-fedora/ + +作者:[Ryan Lerch][a] +选题:[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/introducing-flatpak/ +[b]: https://github.com/lujun9972 +[1]: https://discussion.fedoraproject.org/ +[2]: https://ask.fedoraproject.org +[3]: https://fedoramagazine.org/wp-content/uploads/2019/03/discussion-screenshot-1024x663.png +[4]: https://www.discourse.org/about +[5]: https://discussion.fedoraproject.org/c/desktop +[6]: https://discussion.fedoraproject.org/c/server +[7]: https://discussion.fedoraproject.org/c/sigs +[8]: https://discussion.fedoraproject.org/c/friends From 895d96f4ad8ed142468f0fc84f6284b8703fd633 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:49:45 +0800 Subject: [PATCH 582/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190718=203=20Em?= =?UTF-8?q?acs=20modes=20for=20taking=20notes=20sources/tech/20190718=203?= =?UTF-8?q?=20Emacs=20modes=20for=20taking=20notes.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190718 3 Emacs modes for taking notes.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20190718 3 Emacs modes for taking notes.md diff --git a/sources/tech/20190718 3 Emacs modes for taking notes.md b/sources/tech/20190718 3 Emacs modes for taking notes.md new file mode 100644 index 0000000000..2627357182 --- /dev/null +++ b/sources/tech/20190718 3 Emacs modes for taking notes.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Emacs modes for taking notes) +[#]: via: (https://opensource.com/article/18/7/emacs-modes-note-taking) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +3 Emacs modes for taking notes +====== +Keep track of information easily with these Emacs modes. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_) + +No matter what line of work you're in, it's inevitable you have to take a few notes. Often, more than a few. If you're like many people in this day and age, you take your notes digitally. + +Open source enthusiasts have a variety of options for jotting down their ideas, thoughts, and research in electronic format. You might use a [web-based tool][1]. You might go for a [desktop application][2]. Or, you might [turn to the command line][3]. + +If you use [Emacs][4], that wonderful operating system disguised as a text editor, there are modes that can help you take notes more efficiently. Let's look at three of them. + +### Deft +![](https://opensource.com/sites/default/files/uploads/deft.png) + +On those rare occasions I'm forced to use a Mac, there's one tool I can't do without: the [nvALT][5] note-taking application. [Deft mode][6] brings the nvALT experience to Emacs. + +Deft stores your notes as text files in a single folder on your computer. When you enter Deft mode, it displays a list of your notes along with a short summary. The summary is taken from the first line of the text file. If you add, say, Markdown, LaTeX, or even Emacs Org mode formatting to the first line, Deft ignores the formatting and displays only the text. + +To open a note, just scroll down to it and press Enter. Deft does a bit more, though. According to Deft's developer, Jason Blevins, its _primary operation is searching and filtering_. Deft does that simply but efficiently. Type a keyword and Deft displays only the notes that have that keyword in their title. That's useful if you have a lot of notes and want to find one quickly. + +### Org mode +![](https://opensource.com/sites/default/files/uploads/orgmode.png) + +There would be a couple or three people who would have jumped all over me if I didn't include [Org mode][7] in this article. Why? It's arguably the most flexible and the most widely used Emacs mode for taking notes. Used in the right way, Org mode can supercharge your note-taking. + +Org mode's main strength is how it organizes your notes. In Org mode, a note file is set up as a large outline. Each section is a node in the outline, which you can expand and collapse. Those sections can have subsections, which also expand and collapse. That not only lets you focus on one section at a time, but it also gives you an at-a-glance overview of the information you have. + +You can [link][8] between sections of your notes, quickly move sections without cutting and pasting, and [attach files][9] to your notes. Org mode supports character formatting and tables. If you need to convert your notes to something else, Org mode has a number of [export options][10]. + +### Howm + +![](https://opensource.com/sites/default/files/uploads/howm.png) + +When I started using Emacs regularly, [howm][11] quickly became one of the modes I leaned heavily on. And even though I'm deep into using Org mode, I still have a soft spot for howm. + +Howm acts like a small wiki. You can create notes and task lists and link between them. By typing or clicking a link, you can jump between notes. If you need to, you can also tag your notes with a keyword. On top of that, you can search, sort, and concatenate your notes. + +Howm isn't the prettiest Emacs mode, and it doesn't have the best UX. It takes a bit of getting used to. Once you do, taking and maneuvering around notes is a breeze. + +Do you have a favorite Emacs mode for taking notes? Feel free to share it by leaving a comment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/emacs-modes-note-taking + +作者:[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/alternatives/evernote +[2]: https://opensource.com/life/16/9/4-desktop-note-taking-applications +[3]: https://opensource.com/article/18/3/command-line-note-taking-applications +[4]: https://www.gnu.org/software/emacs/ +[5]: http://brettterpstra.com/projects/nvalt/ +[6]: https://jblevins.org/projects/deft/ +[7]: https://orgmode.org/ +[8]: https://orgmode.org/org.html#Hyperlinks +[9]: https://orgmode.org/org.html#Attachments +[10]: https://orgmode.org/org.html#Exporting +[11]: https://howm.osdn.jp/ From 000611dc28117e12303a4f612e25ad2265b8a072 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:51:10 +0800 Subject: [PATCH 583/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=207=20re?= =?UTF-8?q?sources=20for=20learning=20to=20use=20your=20Raspberry=20Pi=20s?= =?UTF-8?q?ources/tech/20190311=207=20resources=20for=20learning=20to=20us?= =?UTF-8?q?e=20your=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s for learning to use your Raspberry Pi.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md diff --git a/sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md b/sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md new file mode 100644 index 0000000000..4ee4fdf8c8 --- /dev/null +++ b/sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 resources for learning to use your Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/resources-raspberry-pi) +[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) + +7 resources for learning to use your Raspberry Pi +====== +Books, courses, and websites to shorten your Raspberry Pi learning curve. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/reading_book_stars_list.png?itok=Iwa1oBOl) + +The [Raspberry Pi][1] is a small, single-board computer originally intended for teaching and learning programming and computer science. But today it's so much more. It is affordable, low-energy computing power that people can use for all kinds of things—from home entertainment over server applications to Internet of Things (IoT) projects. + +There are so many resources on the topic and so many different projects you can do, it's hard to know where to begin. Following are some resources that will help you get started with the Raspberry Pi. Have fun browsing through it, but don't stop here. By looking left and right you will find a lot to discover and get deeper into the rabbit hole of the Raspberry Pi wonderland. + +### Books + +There are many books available in different languages about the Raspberry Pi. These two will help you start—then dive deep—into Raspberry Pi topics. + +#### Raspberry Pi Cookbook: Software and Hardware Problems and Solutions by Simon Monk + +Simon Monk is a software engineer and was a hobbyist maker for years. He was first attracted to the Arduino as an easy-to-use board for electronics development and later published a [book][2] about it. Later, he moved on to the Raspberry Pi and wrote [Raspberry Pi Cookbook: Software and Hardware Problems and Solutions][3]. In the book, you can find a lot of best practices for Raspberry Pi projects and solutions for all kinds of challenges you may face. + +#### Programming the Raspberry Pi: Getting Started with Python by Simon Monk + +Python has evolved as the go-to programming language for getting started with Raspberry Pi projects, as it is easy to learn and use, even if you don't have any programming experience. Also, a lot of its libraries help you focus on what makes your project special instead of implementing protocols to communicate with your sensors again and again. Monk wrote two chapters about Python programming in the Raspberry Pi Cookbook, but [Programming the Raspberry Pi: Getting Started with Python][4] is a more thorough quickstart. It introduces you to Python and shows you some projects you can create with it on the Raspberry Pi. + +### Online course + +There are many online courses and tutorials new Raspberry Pi users can choose from, including this introductory class. + +#### Raspberry Pi Class + +Instructables' free [Raspberry Pi Class][5] online course offers you an all-around introduction to the Raspberry Pi. It starts with Raspberry Pi and Linux operating basics, then gets into Python programming and GPIO communication. This makes it a good top-to-bottom Raspberry Pi guide if you are new to the topic and want to get started quickly. + +### Websites + +The web is rife with excellent information about Raspberry Pi, but these four sites should be on the top of any new user's list. + +#### RaspberryPi.org + +The official [Raspberry Pi][6] website is one of the best places to get started. Many articles about specific projects link to the site for the basics like installing Raspbian onto the Raspberry Pi. (This is what I tend to do, instead of repeating the instructions in every how-to.) You can also find [sample projects][7] and courses on [teaching][8] tech topics to students. + +#### Opensource.com + +On Opensource.com, you can find a number of different Raspberry Pi project how-to's, getting started guides, success stories, updates, and more. Take a look at the [Raspberry Pi topic page][9] to find out what people are doing with Raspberry Pi. + +#### Instructables and Hackaday + +Do you want to build your own retro arcade gaming console? Or for your mirror to display weather information, the time, and the first event on the day's calendar? Are you looking to create a word clock or maybe a photo booth for a party? Chances are good that you will find instructions on how to do all of this (and more!) with a Raspberry Pi on sites like [Instructables][10] and [Hackaday][11]. If you're not sure if you should get a Raspberry Pi, browse these sites, and you'll find plenty of reasons to buy one. + +What are your favorite Raspberry Pi resources? Please share them in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/resources-raspberry-pi + +作者:[Manuel Dewald][a] +选题:[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/ntlx +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/raspberry-pi +[2]: http://simonmonk.org/progardui2ed/ +[3]: http://simonmonk.org/raspberry-pi-cookbook-ed2/ +[4]: http://simonmonk.org/programming-raspberry-pi-ed2/ +[5]: https://www.instructables.com/class/Raspberry-Pi-Class/ +[6]: https://raspberrypi.org +[7]: https://projects.raspberrypi.org/ +[8]: https://www.raspberrypi.org/training/online +[9]: https://opensource.com/tags/raspberry-pi +[10]: https://www.instructables.com/technology/raspberry-pi/ +[11]: https://hackaday.io/projects?tag=raspberry%20pi From 042384c2a92b2895c73d854156bc85278863d0f5 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:01:39 +0800 Subject: [PATCH 584/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020181218=20Using?= =?UTF-8?q?=20Pygame=20to=20move=20your=20game=20character=20around=20sour?= =?UTF-8?q?ces/tech/20181218=20Using=20Pygame=20to=20move=20your=20game=20?= =?UTF-8?q?character=20around.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...game to move your game character around.md | 353 ++++++++++++++++++ 1 file changed, 353 insertions(+) create mode 100644 sources/tech/20181218 Using Pygame to move your game character around.md diff --git a/sources/tech/20181218 Using Pygame to move your game character around.md b/sources/tech/20181218 Using Pygame to move your game character around.md new file mode 100644 index 0000000000..96daf8da7d --- /dev/null +++ b/sources/tech/20181218 Using Pygame to move your game character around.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Pygame to move your game character around) +[#]: via: (https://opensource.com/article/17/12/game-python-moving-player) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Using Pygame to move your game character around +====== +In the fourth part of this series, learn how to code the controls needed to move a game character. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python4-game.png?itok=tXFHaLdt) + +In the first article in this series, I explained how to use Python to create a simple, [text-based dice game][1]. In the second part, we began building a game from scratch, starting with [creating the game's environment][2]. And, in the third installment, we [created a player sprite][3] and made it spawn in your (rather empty) game world. As you've probably noticed, a game isn't much fun if you can't move your character around. In this article, we'll use Pygame to add keyboard controls so you can direct your character's movement. + +There are functions in Pygame to add other kinds of controls, but since you certainly have a keyboard if you're typing out Python code, that's what we'll use. Once you understand keyboard controls, you can explore other options on your own. + +You created a key to quit your game in the second article in this series, and the principle is the same for movement. However, getting your character to move is a little more complex. + +Let's start with the easy part: setting up the controller keys. + +### Setting up keys for controlling your player sprite + +Open your Python game script in IDLE, Ninja-IDE, or a text editor. + +Since the game must constantly "listen" for keyboard events, you'll be writing code that needs to run continuously. Can you figure out where to put code that needs to run constantly for the duration of the game? + +If you answered "in the main loop," you're correct! Remember that unless code is in a loop, it will run (at most) only once—and it may not run at all if it's hidden away in a class or function that never gets used. + +To make Python monitor for incoming key presses, add this code to the main loop. There's no code to make anything happen yet, so use `print` statements to signal success. This is a common debugging technique. + +``` +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') +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print('right') +            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'): +                print('left stop') +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print('right stop') +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False     +``` + +Some people prefer to control player characters with the keyboard characters W, A, S, and D, and others prefer to use arrow keys. Be sure to include both options. + +**Note: **It's vital that you consider all of your users when programming. If you write code that works only for you, it's very likely that you'll be the only one who uses your application. More importantly, if you seek out a job writing code for money, you are expected to write code that works for everyone. Giving your users choices, such as the option to use either arrow keys or WASD, is a sign of a good programmer. + +Launch your game using Python, and watch the console window for output as you press the right, left, and up arrows, or the A, D, and W keys. + +``` +$ python ./your-name_game.py +  left +  left stop +  right +  right stop +  jump +``` + +This confirms that Pygame detects key presses correctly. Now it's time to do the hard work of making the sprite move. + +### Coding the player movement function + +To make your sprite move, you must create a property for your sprite that represents movement. When your sprite is not moving, this variable is set to `0`. + +If you are animating your sprite, or should you decide to animate it in the future, you also must track frames to enable the walk cycle to stay on track. + +Create the variables in the Player class. The first two lines are for context (you already have them in your code, if you've been following along), so add only the last three: + +``` +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 # move along X +        self.movey = 0 # move along Y +        self.frame = 0 # count frames +``` + +With those variables set, it's time to code the sprite's movement. + +The player sprite doesn't need to respond to control all the time; sometimes it will not be moving. The code that controls the sprite, therefore, is only one small part of all the things the player sprite will do. When you want to make an object in Python do something independent of the rest of its code, you place your new code in a function. Python functions start with the keyword `def`, which stands for define. + +Make a function in your Player class to add some number of pixels to your sprite's position on screen. Don't worry about how many pixels you add yet; that will be decided in later code. + +``` +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +``` + +To move a sprite in Pygame, you have to tell Python to redraw the sprite in its new location—and where that new location is. + +Since the Player sprite isn't always moving, the updates need to be only one function within the Player class. Add this function after the `control` function you created earlier. + +To make it appear that the sprite is walking (or flying, or whatever it is your sprite is supposed to do), you need to change its position on screen when the appropriate key is pressed. To get it to move across the screen, you redefine its position, designated by the `self.rect.x` and `self.rect.y` properties, to its current position plus whatever amount of `movex` or `movey` is applied. (The number of pixels the move requires is set later.) + +``` +    def update(self): +        ''' +        Update sprite position +        ''' +        self.rect.x = self.rect.x + self.movex         +``` + +Do the same thing for the Y position: + +``` +        self.rect.y = self.rect.y + self.movey +``` + +For animation, advance the animation frames whenever your sprite is moving, and use the corresponding animation frame as the player image: + +``` +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > 3*ani: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > 3*ani: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] +``` + +Tell the code how many pixels to add to your sprite's position by setting a variable, then use that variable when triggering the functions of your Player sprite. + +First, create the variable in your setup section. In this code, the first two lines are for context, so just add the third line to your script: + +``` +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10  # how many pixels to move +``` + +Now that you have the appropriate function and variable, use your key presses to trigger the function and send the variable to your sprite. + +Do this by replacing the `print` statements in your main loop with the Player sprite's name (player), the function (.control), and how many steps along the X axis and Y axis you want the player sprite to move with each loop. + +``` +        if event.type == pygame.KEYDOWN: +            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 == ord('q'): +                pygame.quit() +                sys.exit() +                main = False +``` + +Remember, `steps` is a variable representing how many pixels your sprite moves when a key is pressed. If you add 10 pixels to the location of your player sprite when you press D or the right arrow, then when you stop pressing that key you must subtract 10 (`-steps`) to return your sprite's momentum back to 0. + +Try your game now. Warning: it won't do what you expect. + +Why doesn't your sprite move yet? Because the main loop doesn't call the `update` function. + +Add code to your main loop to tell Python to update the position of your player sprite. Add the line with the comment: + +``` +    player.update()  # update player position +    player_list.draw(world) +    pygame.display.flip() +    clock.tick(fps) +``` + +Launch your game again to witness your player sprite move across the screen at your bidding. There's no vertical movement yet because those functions will be controlled by gravity, but that's another lesson for another article. + +In the meantime, if you have access to a joystick, try reading Pygame's documentation for its [joystick][4] module and see if you can make your sprite move that way. Alternately, see if you can get the [mouse][5] to interact with your sprite. + +Most importantly, have fun! + +### All the code used in this tutorial + +For your reference, here is all the code used in this series of articles so far. + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement + +# 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 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.images = [] + for i in range(1,5): + 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 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 > 3*ani: + self.frame = 0 + self.image = self.images[self.frame//ani] + + # moving right + if self.movex > 0: + self.frame += 1 + if self.frame > 3*ani: + self.frame = 0 + self.image = self.images[(self.frame//ani)+4] + + +''' +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 # how fast to move + +''' +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'): + 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 == ord('q'): + pygame.quit() + sys.exit() + main = False + +# world.fill(BLACK) + world.blit(backdrop, backdropbox) + player.update() + player_list.draw(world) #refresh player position + pygame.display.flip() + clock.tick(fps) +``` + +You've come far and learned much, but there's a lot more to do. In the next few articles, you'll add enemy sprites, emulated gravity, and lots more. In the mean time, practice with Python! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/game-python-moving-player + +作者:[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/article/17/10/python-101 +[2]: https://opensource.com/article/17/12/program-game-python-part-2-creating-game-world +[3]: https://opensource.com/article/17/12/program-game-python-part-3-spawning-player +[4]: http://pygame.org/docs/ref/joystick.html +[5]: http://pygame.org/docs/ref/mouse.html#module-pygame.mouse From 5438586a1c4eea4ce7851a67b00aa982263e8ff9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:03:53 +0800 Subject: [PATCH 585/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190309=20How=20?= =?UTF-8?q?To=20Fix=20=E2=80=9CNetwork=20Protocol=20Error=E2=80=9D=20On=20?= =?UTF-8?q?Mozilla=20Firefox=20sources/tech/20190309=20How=20To=20Fix=20-N?= =?UTF-8?q?etwork=20Protocol=20Error-=20On=20Mozilla=20Firefox.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...work Protocol Error- On Mozilla Firefox.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md diff --git a/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md new file mode 100644 index 0000000000..da752b07ee --- /dev/null +++ b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Fix “Network Protocol Error” On Mozilla Firefox) +[#]: via: (https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Fix “Network Protocol Error” On Mozilla Firefox +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-logo-1-720x340.png) + +Mozilla Firefox is my default web browser for years. I have been using it for my day to day web activities, such as accessing my mails, browsing favorite websites etc. Today, I experienced a strange error while using Firefox. I tried to share one of our guide on Reddit platform and got the following error message. + +``` +Network Protocol Error + +Firefox has experienced a network protocol violation that cannot be repaired. + +The page you are trying to view cannot be shown because an error in the network protocol was detected. + +Please contact the website owners to inform them of this problem. +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox.png) + +To be honest, I panicked a bit and thought my system might be affected with some kind of malware. LOL! I was wrong! I am using latest Firefox version on my Arch Linux desktop. I opened the same link in Chromium browser. It’s working fine! I guessed it is Firefox related error. After Googling a bit, I fixed this issue as described below. + +This kind of problems occurs mostly because of the **browser’s cache**. If you’ve encountered these kind of errors, such as “Network Protocol Error” or “Corrupted Content Error”, follow any one of these methods. + +**Method 1:** + +To fix “Network Protocol Error” or “Corrupted Content Error”, you need to reload the webpage while bypassing the cache. To do so, Press **Ctrl + F5** or **Ctrl + Shift + R** keys. It will reload the webpage fresh from the server, not from the Firefox cache. Now the web page should work just fine. + +**Method 2:** + +If the method1 doesn’t work, please try this method. + +Go to **Edit - > Preferences**. From the Preferences window, navigate to **Privacy & Security** tab on the left pane. Now clear the Firefox cache by clicking on **“Clear Data”** option. +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-1.png) + +Make sure you have checked both “Cookies and Site Data” and “Cached Web Content” options and click **“Clear”**. + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-2.png) + +Done! Now the cookies and offline content will be removed. Please note that Firefox may sign you out of the logged-in websites. You can re-login to those websites later. Finally, close the Firefox browser and restart your system. Now the webpage will load without any issues. + +Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/ + +作者:[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 From 50cfb027028254d295c64cc543a05ef29a0abd1f Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:07:05 +0800 Subject: [PATCH 586/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171214=20Build?= =?UTF-8?q?=20a=20game=20framework=20with=20Python=20using=20the=20module?= =?UTF-8?q?=20Pygame=20sources/tech/20171214=20Build=20a=20game=20framewor?= =?UTF-8?q?k=20with=20Python=20using=20the=20module=20Pygame.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ork with Python using the module Pygame.md | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 sources/tech/20171214 Build a game framework with Python using the module Pygame.md diff --git a/sources/tech/20171214 Build a game framework with Python using the module Pygame.md b/sources/tech/20171214 Build a game framework with Python using the module Pygame.md new file mode 100644 index 0000000000..704c74e042 --- /dev/null +++ b/sources/tech/20171214 Build a game framework with Python using the module Pygame.md @@ -0,0 +1,283 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a game framework with Python using the module Pygame) +[#]: via: (https://opensource.com/article/17/12/game-framework-python) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Build a game framework with Python using the module Pygame +====== +The first part of this series explored Python by creating a simple dice game. Now it's time to make your own game from scratch. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python2-header.png?itok=tEvOVo4A) + +In my [first article in this series][1], I explained how to use Python to create a simple, text-based dice game. This time, I'll demonstrate how to use the Python module Pygame to create a graphical game. It will take several articles to get a game that actually does anything, but by the end of the series, you will have a better understanding of how to find and learn new Python modules and how to build an application from the ground up. + +Before you start, you must install [Pygame][2]. + +### Installing new Python modules + +There are several ways to install Python modules, but the two most common are: + + * From your distribution's software repository + * Using the Python package manager, pip + + + +Both methods work well, and each has its own set of advantages. If you're developing on Linux or BSD, leveraging your distribution's software repository ensures automated and timely updates. + +However, using Python's built-in package manager gives you control over when modules are updated. Also, it is not OS-specific, meaning you can use it even when you're not on your usual development machine. Another advantage of pip is that it allows local installs of modules, which is helpful if you don't have administrative rights to a computer you're using. + +### Using pip + +If you have both Python and Python3 installed on your system, the command you want to use is probably `pip3`, which differentiates it from Python 2.x's `pip` command. If you're unsure, try `pip3` first. + +The `pip` command works a lot like most Linux package managers. You can search for Python modules with `search`, then install them with `install`. If you don't have permission to install software on the computer you're using, you can use the `--user` option to just install the module into your home directory. + +``` +$ pip3 search pygame +[...] +Pygame (1.9.3)                 - Python Game Development +sge-pygame (1.5)               - A 2-D game engine for Python +pygame_camera (0.1.1)          - A Camera lib for PyGame +pygame_cffi (0.2.1)            - A cffi-based SDL wrapper that copies the pygame API. +[...] +$ pip3 install Pygame --user +``` + +Pygame is a Python module, which means that it's just a set of libraries that can be used in your Python programs. In other words, it's not a program that you launch, like [IDLE][3] or [Ninja-IDE][4] are. + +### Getting started with Pygame + +A video game needs a setting; a world in which it takes place. In Python, there are two different ways to create your setting: + + * Set a background color + * Set a background image + + + +Your background is only an image or a color. Your video game characters can't interact with things in the background, so don't put anything too important back there. It's just set dressing. + +### Setting up your Pygame script + +To start a new Pygame project, create a folder on your computer. All your game files go into this directory. It's vitally important that you keep all the files needed to run your game inside of your project folder. + +![](https://opensource.com/sites/default/files/u128651/project.jpg) + +A Python script starts with the file type, your name, and the license you want to use. Use an open source license so your friends can improve your game and share their changes with you: + +``` +#!/usr/bin/env python3 +# by Seth Kenlon + +## GPLv3 +# 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 3 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, see . +``` + +Then you tell Python what modules you want to use. Some of the modules are common Python libraries, and of course, you want to include the one you just installed, Pygame. + +``` +import pygame  # load pygame keywords +import sys     # let  python use your file system +import os      # help python identify your OS +``` + +Since you'll be working a lot with this script file, it helps to make sections within the file so you know where to put stuff. You do this with block comments, which are comments that are visible only when looking at your source code. Create three blocks in your code. + +``` +''' +Objects +''' + +# put Python classes and functions here + +''' +Setup +''' + +# put run-once code here + +''' +Main Loop +''' + +# put game loop here +``` + +Next, set the window size for your game. Keep in mind that not everyone has a big computer screen, so it's best to use a screen size that fits on most people's computers. + +There is a way to toggle full-screen mode, the way many modern video games do, but since you're just starting out, keep it simple and just set one size. + +``` +''' +Setup +''' +worldx = 960 +worldy = 720 +``` + +The Pygame engine requires some basic setup before you can use it in a script. You must set the frame rate, start its internal clock, and start (`init`) Pygame. + +``` +fps   = 40  # frame rate +ani   = 4   # animation cycles +clock = pygame.time.Clock() +pygame.init() +``` + +Now you can set your background. + +### Setting the background + +Before you continue, open a graphics application and create a background for your game world. Save it as `stage.png` inside a folder called `images` in your project directory. + +There are several free graphics applications you can use. + + * [Krita][5] is a professional-level paint materials emulator that can be used to create beautiful images. If you're very interested in creating art for video games, you can even purchase a series of online [game art tutorials][6]. + * [Pinta][7] is a basic, easy to learn paint application. + * [Inkscape][8] is a vector graphics application. Use it to draw with shapes, lines, splines, and Bézier curves. + + + +Your graphic doesn't have to be complex, and you can always go back and change it later. Once you have it, add this code in the setup section of your file: + +``` +world    = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png').convert()) +backdropbox = world.get_rect() +``` + +If you're just going to fill the background of your game world with a color, all you need is: + +``` +world = pygame.display.set_mode([worldx,worldy]) +``` + +You also must define a color to use. In your setup section, create some color definitions using values for red, green, and blue (RGB). + +``` +''' +Setup +''' + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +``` + +At this point, you could theoretically start your game. The problem is, it would only last for a millisecond. + +To prove this, save your file as `your-name_game.py` (replace `your-name` with your actual name). Then launch your game. + +If you are using IDLE, run your game by selecting `Run Module` from the Run menu. + +If you are using Ninja, click the `Run file` button in the left button bar. + +![](https://opensource.com/sites/default/files/u128651/ninja_run_0.png) + +You can also run a Python script straight from a Unix terminal or a Windows command prompt. + +``` +$ python3 ./your-name_game.py +``` + +If you're using Windows, use this command: + +``` +py.exe your-name_game.py +``` + +However you launch it, don't expect much, because your game only lasts a few milliseconds right now. You can fix that in the next section. + +### Looping + +Unless told otherwise, a Python script runs once and only once. Computers are very fast these days, so your Python script runs in less than a second. + +To force your game to stay open and active long enough for someone to see it (let alone play it), use a `while` loop. To make your game remain open, you can set a variable to some value, then tell a `while` loop to keep looping for as long as the variable remains unchanged. + +This is often called a "main loop," and you can use the term `main` as your variable. Add this anywhere in your setup section: + +``` +main = True +``` + +During the main loop, use Pygame keywords to detect if keys on the keyboard have been pressed or released. Add this to your main loop section: + +``` +''' +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 == ord('q'): +                pygame.quit() +                sys.exit() +                main = False +``` + +Also in your main loop, refresh your world's background. + +If you are using an image for the background: + +``` +world.blit(backdrop, backdropbox) +``` + +If you are using a color for the background: + +``` +world.fill(BLUE) +``` + +Finally, tell Pygame to refresh everything on the screen and advance the game's internal clock. + +``` +    pygame.display.flip() +    clock.tick(fps) +``` + +Save your file, and run it again to see the most boring game ever created. + +To quit the game, press `q` on your keyboard. + +In the [next article][9] of this series, I'll show you how to add to your currently empty game world, so go ahead and start creating some graphics to use! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/game-framework-python + +作者:[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/article/17/10/python-101 +[2]: http://www.pygame.org/wiki/about +[3]: https://en.wikipedia.org/wiki/IDLE +[4]: http://ninja-ide.org/ +[5]: http://krita.org +[6]: https://gumroad.com/l/krita-game-art-tutorial-1 +[7]: https://pinta-project.com/pintaproject/pinta/releases +[8]: http://inkscape.org +[9]: https://opensource.com/article/17/12/program-game-python-part-3-spawning-player From 610d5d8d96df15065646ccb3cfa88f1389a6db4a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:10:15 +0800 Subject: [PATCH 587/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171215=20How=20?= =?UTF-8?q?to=20add=20a=20player=20to=20your=20Python=20game=20sources/tec?= =?UTF-8?q?h/20171215=20How=20to=20add=20a=20player=20to=20your=20Python?= =?UTF-8?q?=20game.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to add a player to your Python game.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20171215 How to add a player to your Python game.md diff --git a/sources/tech/20171215 How to add a player to your Python game.md b/sources/tech/20171215 How to add a player to your Python game.md new file mode 100644 index 0000000000..caa1e4754e --- /dev/null +++ b/sources/tech/20171215 How to add a player to your Python game.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to add a player to your Python game) +[#]: via: (https://opensource.com/article/17/12/game-python-add-a-player) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to add a player to your Python game +====== +Part three of a series on building a game from scratch with Python. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3) + +In the [first article of this series][1], I explained how to use Python to create a simple, text-based dice game. In the second part, I showed you how to build a game from scratch, starting with [creating the game's environment][2]. But every game needs a player, and every player needs a playable character, so that's what we'll do next in the third part of the series. + +In Pygame, the icon or avatar that a player controls is called a sprite. If you don't have any graphics to use for a player sprite yet, create something for yourself using [Krita][3] or [Inkscape][4]. If you lack confidence in your artistic skills, you can also search [OpenClipArt.org][5] or [OpenGameArt.org][6] for something pre-generated. Then, if you didn't already do so in the previous article, create a directory called `images` alongside your Python project directory. Put the images you want to use in your game into the `images` folder. + +To make your game truly exciting, you ought to use an animated sprite for your hero. It means you have to draw more assets, but it makes a big difference. The most common animation is a walk cycle, a series of drawings that make it look like your sprite is walking. The quick and dirty version of a walk cycle requires four drawings. + +![](https://opensource.com/sites/default/files/u128651/walk-cycle-poses.jpg) + +Note: The code samples in this article allow for both a static player sprite and an animated one. + +Name your player sprite `hero.png`. If you're creating an animated sprite, append a digit after the name, starting with `hero1.png`. + +### Create a Python class + +In Python, when you create an object that you want to appear on screen, you create a class. + +Near the top of your Python script, add the code to create a player. In the code sample below, the first three lines are already in the Python script that you're working on: + +``` +import pygame +import sys +import os # new code below + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.images = [] +    img = pygame.image.load(os.path.join('images','hero.png')).convert() +    self.images.append(img) +    self.image = self.images[0] +    self.rect  = self.image.get_rect() +``` + +If you have a walk cycle for your playable character, save each drawing as an individual file called `hero1.png` to `hero4.png` in the `images` folder. + +Use a loop to tell Python to cycle through each file. + +``` +''' +Objects +''' + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.images = [] +        for i in range(1,5): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() +``` + +### Bring the player into the game world + +Now that a Player class exists, you must use it to spawn a player sprite in your game world. If you never call on the Player class, it never runs, and there will be no player. You can test this out by running your game now. The game will run just as well as it did at the end of the previous article, with the exact same results: an empty game world. + +To bring a player sprite into your world, you must call the Player class to generate a sprite and then add it to a Pygame sprite group. In this code sample, the first three lines are existing code, so add the lines afterwards: + +``` +world       = pygame.display.set_mode([worldx,worldy]) +backdrop    = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = screen.get_rect() + +# new code below + +player = Player()   # spawn player +player.rect.x = 0   # go to x +player.rect.y = 0   # go to y +player_list = pygame.sprite.Group() +player_list.add(player) +``` + +Try launching your game to see what happens. Warning: it won't do what you expect. When you launch your project, the player sprite doesn't spawn. Actually, it spawns, but only for a millisecond. How do you fix something that only happens for a millisecond? You might recall from the previous article that you need to add something to the main loop. To make the player spawn for longer than a millisecond, tell Python to draw it once per loop. + +Change the bottom clause of your loop to look like this: + +``` +    world.blit(backdrop, backdropbox) +    player_list.draw(screen) # draw player +    pygame.display.flip() +    clock.tick(fps) +``` + +Launch your game now. Your player spawns! + +### Setting the alpha channel + +Depending on how you created your player sprite, it may have a colored block around it. What you are seeing is the space that ought to be occupied by an alpha channel. It's meant to be the "color" of invisibility, but Python doesn't know to make it invisible yet. What you are seeing, then, is the space within the bounding box (or "hit box," in modern gaming terms) around the sprite. + +![](https://opensource.com/sites/default/files/u128651/greenscreen.jpg) + +You can tell Python what color to make invisible by setting an alpha channel and using RGB values. If you don't know the RGB values your drawing uses as alpha, open your drawing in Krita or Inkscape and fill the empty space around your drawing with a unique color, like #00ff00 (more or less a "greenscreen green"). Take note of the color's hex value (#00ff00, for greenscreen green) and use that in your Python script as the alpha channel. + +Using alpha requires the addition of two lines in your Sprite creation code. Some version of the first line is already in your code. Add the other two lines: + +``` +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha()     # optimise alpha +            img.set_colorkey(ALPHA) # set alpha +``` + +Python doesn't know what to use as alpha unless you tell it. In the setup area of your code, add some more color definitions. Add this variable definition anywhere in your setup section: + +``` +ALPHA = (0, 255, 0) +``` + +In this example code, **0,255,0** is used, which is the same value in RGB as #00ff00 is in hex. You can get all of these color values from a good graphics application like [GIMP][7], Krita, or Inkscape. Alternately, you can also detect color values with a good system-wide color chooser, like [KColorChooser][8]. + +![](https://opensource.com/sites/default/files/u128651/kcolor.png) + +If your graphics application is rendering your sprite's background as some other value, adjust the values of your alpha variable as needed. No matter what you set your alpha value, it will be made "invisible." RGB values are very strict, so if you need to use 000 for alpha, but you need 000 for the black lines of your drawing, just change the lines of your drawing to 111, which is close enough to black that nobody but a computer can tell the difference. + +Launch your game to see the results. + +![](https://opensource.com/sites/default/files/u128651/alpha.jpg) + +In the [fourth part of this series][9], I'll show you how to make your sprite move. How exciting! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/game-python-add-a-player + +作者:[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/article/17/10/python-101 +[2]: https://opensource.com/article/17/12/program-game-python-part-2-creating-game-world +[3]: http://krita.org +[4]: http://inkscape.org +[5]: http://openclipart.org +[6]: https://opengameart.org/ +[7]: http://gimp.org +[8]: https://github.com/KDE/kcolorchooser +[9]: https://opensource.com/article/17/12/program-game-python-part-4-moving-your-sprite From 0d2a82f4592029f7141490f2c1a72adc4175e9b9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:16:15 +0800 Subject: [PATCH 588/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180725=20Put=20?= =?UTF-8?q?platforms=20in=20a=20Python=20game=20with=20Pygame=20sources/te?= =?UTF-8?q?ch/20180725=20Put=20platforms=20in=20a=20Python=20game=20with?= =?UTF-8?q?=20Pygame.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... platforms in a Python game with Pygame.md | 590 ++++++++++++++++++ 1 file changed, 590 insertions(+) create mode 100644 sources/tech/20180725 Put platforms in a Python game with Pygame.md diff --git a/sources/tech/20180725 Put platforms in a Python game with Pygame.md b/sources/tech/20180725 Put platforms in a Python game with Pygame.md new file mode 100644 index 0000000000..759bfc01df --- /dev/null +++ b/sources/tech/20180725 Put platforms in a Python game with Pygame.md @@ -0,0 +1,590 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Put platforms in a Python game with Pygame) +[#]: via: (https://opensource.com/article/18/7/put-platforms-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Put platforms in a Python game with Pygame +====== +In part six of this series on building a Python game from scratch, create some platforms for your characters to travel. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/header.png?itok=iq8HFoEJ) + +This is part 6 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][24] ++ [Build a game framework with Python using the Pygame module][25] ++ [How to add a player to your Python game][26] ++ [Using Pygame to move your game character around][27] ++ [What's a hero without a villain? How to add one to your Python game][28] + + +A platformer game needs platforms. + +In [Pygame][1], the platforms themselves are sprites, just like your playable sprite. That's important because having platforms that are objects makes it a lot easier for your player sprite to interact with them. + +There are two major steps in creating platforms. First, you must code the objects, and then you must map out where you want the objects to appear. + +### Coding platform objects + +To build a platform object, you create a class called `Platform`. It's a sprite, just like your [`Player`][2] [sprite][2], with many of the same properties. + +Your `Platform` class needs to know a lot of information about what kind of platform you want, where it should appear in the game world, and what image it should contain. A lot of that information might not even exist yet, depending on how much you have planned out your game, but that's all right. Just as you didn't tell your Player sprite how fast to move until the end of the [Movement article][3], you don't have to tell `Platform` everything upfront. + +Near the top of the script you've been writing in this series, create a new class. The first three lines in this code sample are for context, so add the code below the comment: + +``` +import pygame +import sys +import os +## new code below: + +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.image.set_colorkey(ALPHA) +    self.rect = self.image.get_rect() +    self.rect.y = yloc +    self.rect.x = xloc +``` + +When called, this class creates an object onscreen in some X and Y location, with some width and height, using some image file for texture. It's very similar to how players or enemies are drawn onscreen. + +### Types of platforms + +The next step is to map out where all your platforms need to appear. + +#### The tile method + +There are a few different ways to implement a platform game world. In the original side-scroller games, such as Mario Super Bros. and Sonic the Hedgehog, the technique was to use "tiles," meaning that there were a few blocks to represent the ground and various platforms, and these blocks were used and reused to make a level. You have only eight or 12 different kinds of blocks, and you line them up onscreen to create the ground, floating platforms, and whatever else your game needs. Some people find this the easier way to make a game since you just have to make (or download) a small set of level assets to create many different levels. The code, however, requires a little more math. + +![Supertux, a tile-based video game][5] + +[SuperTux][6], a tile-based video game. + +#### The hand-painted method + +Another method is to make each and every asset as one whole image. If you enjoy creating assets for your game world, this is a great excuse to spend time in a graphics application, building each and every part of your game world. This method requires less math, because all the platforms are whole, complete objects, and you tell [Python][7] where to place them onscreen. + +Each method has advantages and disadvantages, and the code you must use is slightly different depending on the method you choose. I'll cover both so you can use one or the other, or even a mix of both, in your project. + +### Level mapping + +Mapping out your game world is a vital part of level design and game programming in general. It does involve math, but nothing too difficult, and Python is good at math so it can help some. + +You might find it helpful to design on paper first. Get a sheet of paper and draw a box to represent your game window. Draw platforms in the box, labeling each with its X and Y coordinates, as well as its intended width and height. The actual positions in the box don't have to be exact, as long as you keep the numbers realistic. For instance, if your screen is 720 pixels wide, then you can't fit eight platforms at 100 pixels each all on one screen. + +Of course, not all platforms in your game have to fit in one screen-sized box, because your game will scroll as your player walks through it. So keep drawing your game world to the right of the first screen until the end of the level. + +If you prefer a little more precision, you can use graph paper. This is especially helpful when designing a game with tiles because each grid square can represent one tile. + +![Example of a level map][9] + +Example of a level map. + +#### Coordinates + +You may have learned in school about the [Cartesian coordinate system][10]. What you learned applies to Pygame, except that in Pygame, your game world's coordinates place `0,0` in the top-left corner of your screen instead of in the middle, which is probably what you're used to from Geometry class. + +![Example of coordinates in Pygame][12] + +Example of coordinates in Pygame. + +The X axis starts at 0 on the far left and increases infinitely to the right. The Y axis starts at 0 at the top of the screen and extends down. + +#### Image sizes + +Mapping out a game world is meaningless if you don't know how big your players, enemies, and platforms are. You can find the dimensions of your platforms or tiles in a graphics program. In [Krita][13], for example, click on the **Image** menu and select **Properties**. You can find the dimensions at the very top of the **Properties** window. + +Alternately, you can create a simple Python script to tell you the dimensions of an image. Open a new text file and type this code into it: + +``` +#!/usr/bin/env python3 + +from PIL import Image +import os.path +import sys + +if len(sys.argv) > 1: +    print(sys.argv[1]) +else: +    sys.exit('Syntax: identify.py [filename]') + +pic = sys.argv[1] +dim = Image.open(pic) +X   = dim.size[0] +Y   = dim.size[1] + +print(X,Y) +``` + +Save the text file as `identify.py`. + +To set up this script, you must install an extra set of Python modules that contain the new keywords used in the script: + +``` +$ pip3 install Pillow --user +``` + +Once that is installed, run your script from within your game project directory: + +``` +$ python3 ./identify.py images/ground.png +(1080, 97) +``` + +The image size of the ground platform in this example is 1080 pixels wide and 97 high. + +### Platform blocks + +If you choose to draw each asset individually, you must create several platforms and any other elements you want to insert into your game world, each within its own file. In other words, you should have one file per asset, like this: + +![One image file per object][15] + +One image file per object. + +You can reuse each platform as many times as you want, just make sure that each file only contains one platform. You cannot use a file that contains everything, like this: + +![Your level cannot be one image file][17] + +Your level cannot be one image file. + +You might want your game to look like that when you've finished, but if you create your level in one big file, there is no way to distinguish a platform from the background, so either paint your objects in their own file or crop them from a large file and save individual copies. + +**Note:** As with your other assets, you can use [GIMP][18], Krita, [MyPaint][19], or [Inkscape][20] to create your game assets. + +Platforms appear on the screen at the start of each level, so you must add a `platform` function in your `Level` class. The special case here is the ground platform, which is important enough to be treated as its own platform group. By treating the ground as its own special kind of platform, you can choose whether it scrolls or whether it stands still while other platforms float over the top of it. It's up to you. + +Add these two functions to your `Level` class: + +``` +def ground(lvl,x,y,w,h): +    ground_list = pygame.sprite.Group() +    if lvl == 1: +        ground = Platform(x,y,w,h,'block-ground.png') +        ground_list.add(ground) + +    if lvl == 2: +        print("Level " + str(lvl) ) + +    return ground_list + +def platform( lvl ): +    plat_list = pygame.sprite.Group() +    if lvl == 1: +        plat = Platform(200, worldy-97-128, 285,67,'block-big.png') +        plat_list.add(plat) +        plat = Platform(500, worldy-97-320, 197,54,'block-small.png') +        plat_list.add(plat) +    if lvl == 2: +        print("Level " + str(lvl) ) +        +    return plat_list +``` + +The `ground` function requires an X and Y location so Pygame knows where to place the ground platform. It also requires the width and height of the platform so Pygame knows how far the ground extends in each direction. The function uses your `Platform` class to generate an object onscreen, and then adds that object to the `ground_list` group. + +The `platform` function is essentially the same, except that there are more platforms to list. In this example, there are only two, but you can have as many as you like. After entering one platform, you must add it to the `plat_list` before listing another. If you don't add a platform to the group, then it won't appear in your game. + +> **Tip:** It can be difficult to think of your game world with 0 at the top, since the opposite is what happens in the real world; when figuring out how tall you are, you don't measure yourself from the sky down, you measure yourself from your feet to the top of your head. +> +> If it's easier for you to build your game world from the "ground" up, it might help to express Y-axis values as negatives. For instance, you know that the bottom of your game world is the value of `worldy`. So `worldy` minus the height of the ground (97, in this example) is where your player is normally standing. If your character is 64 pixels tall, then the ground minus 128 is exactly twice as tall as your player. Effectively, a platform placed at 128 pixels is about two stories tall, relative to your player. A platform at -320 is three more stories. And so on. + +As you probably know by now, none of your classes and functions are worth much if you don't use them. Add this code to your setup section (the first line is just for context, so add the last two lines): + +``` +enemy_list  = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,0,worldy-97,1080,97 ) +plat_list   = Level.platform( 1 ) +``` + +And add these lines to your main loop (again, the first line is just for context): + +``` +enemy_list.draw(world)  # refresh enemies +ground_list.draw(world)  # refresh ground +plat_list.draw(world)  # refresh platforms +``` + +### Tiled platforms + +Tiled game worlds are considered easier to make because you just have to draw a few blocks upfront and can use them over and over to create every platform in the game. There are even sets of tiles for you to use on sites like [OpenGameArt.org][21]. + +The `Platform` class is the same as the one provided in the previous sections. + +The `ground` and `platform` in the `Level` class, however, must use loops to calculate how many blocks to use to create each platform. + +If you intend to have one solid ground in your game world, the ground is simple. You just "clone" your ground tile across the whole window. For instance, you could create a list of X and Y values to dictate where each tile should be placed, and then use a loop to take each value and draw one tile. This is just an example, so don't add this to your code: + +``` +# Do not add this to your code +gloc = [0,656,64,656,128,656,192,656,256,656,320,656,384,656] +``` + +If you look carefully, though, you can see all the Y values are always the same, and the X values increase steadily in increments of 64, which is the size of the tiles. That kind of repetition is exactly what computers are good at, so you can use a little bit of math logic to have the computer do all the calculations for you: + +Add this to the setup part of your script: + +``` +gloc = [] +tx   = 64 +ty   = 64 + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +ground_list = Level.ground( 1,gloc,tx,ty ) +``` + +Now, regardless of the size of your window, Python divides the width of the game world by the width of the tile and creates an array listing each X value. This doesn't calculate the Y value, but that never changes on flat ground anyway. + +To use the array in a function, use a `while` loop that looks at each entry and adds a ground tile at the appropriate location: + +``` +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,'tile-ground.png') +            ground_list.add(ground) +            i=i+1 + +    if lvl == 2: +        print("Level " + str(lvl) ) + +    return ground_list +``` + +This is nearly the same code as the `ground` function for the block-style platformer, provided in a previous section above, aside from the `while` loop. + +For moving platforms, the principle is similar, but there are some tricks you can use to make your life easier. + +Rather than mapping every platform by pixels, you can define a platform by its starting pixel (its X value), the height from the ground (its Y value), and how many tiles to draw. That way, you don't have to worry about the width and height of every platform. + +The logic for this trick is a little more complex, so copy this code carefully. There is a `while` loop inside of another `while` loop because this function must look at all three values within each array entry to successfully construct a full platform. In this example, there are only three platforms defined as `ploc.append` statements, but your game probably needs more, so define as many as you need. Of course, some won't appear yet because they're far offscreen, but they'll come into view once you implement scrolling. + +``` +def platform(lvl,tx,ty): +    plat_list = pygame.sprite.Group() +    ploc = [] +    i=0 +    if lvl == 1: +        ploc.append((200,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,'tile.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 +``` + +To get the platforms to appear in your game world, they must be in your main loop. If you haven't already done so, add these lines to your main loop (again, the first line is just for context): + +``` +        enemy_list.draw(world)  # refresh enemies +        ground_list.draw(world) # refresh ground +        plat_list.draw(world)   # refresh platforms +``` + +Launch your game, and adjust the placement of your platforms as needed. Don't worry that you can't see the platforms that are spawned offscreen; you'll fix that soon. + +Here is the game so far in a picture and in code: + +![Pygame game][23] + +Our Pygame 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 + +# 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.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 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) + +        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 + +        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 + +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): +                print("blockgen:" + str(i)) +                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 + +''' +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 # how fast to move + +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 +    print("block: " + str(i)) + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,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'): +                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 == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +#    world.fill(BLACK) +    world.blit(backdrop, backdropbox) +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/put-platforms-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://www.pygame.org/news +[2]: https://opensource.com/article/17/12/game-python-add-a-player +[3]: https://opensource.com/article/17/12/game-python-moving-player +[4]: /file/403841 +[5]: https://opensource.com/sites/default/files/uploads/supertux.png (Supertux, a tile-based video game) +[6]: https://www.supertux.org/ +[7]: https://www.python.org/ +[8]: /file/403861 +[9]: https://opensource.com/sites/default/files/uploads/layout.png (Example of a level map) +[10]: https://en.wikipedia.org/wiki/Cartesian_coordinate_system +[11]: /file/403871 +[12]: https://opensource.com/sites/default/files/uploads/pygame_coordinates.png (Example of coordinates in Pygame) +[13]: https://krita.org/en/ +[14]: /file/403876 +[15]: https://opensource.com/sites/default/files/uploads/pygame_floating.png (One image file per object) +[16]: /file/403881 +[17]: https://opensource.com/sites/default/files/uploads/pygame_flattened.png (Your level cannot be one image file) +[18]: https://www.gimp.org/ +[19]: http://mypaint.org/about/ +[20]: https://inkscape.org/en/ +[21]: https://opengameart.org/content/simplified-platformer-pack +[22]: /file/403886 +[23]: https://opensource.com/sites/default/files/uploads/pygame_platforms.jpg (Pygame game) +[24]: Learn how to program in Python by building a simple dice game +[25]: https://opensource.com/article/17/12/game-framework-python +[26]: https://opensource.com/article/17/12/game-python-add-a-player +[27]: https://opensource.com/article/17/12/game-python-moving-player +[28]: https://opensource.com/article/18/5/pygame-enemy + From 27416f498bc734b31ac8063ee381203e47a25c13 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:22:22 +0800 Subject: [PATCH 589/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Gettin?= =?UTF-8?q?g=20started=20with=20the=20Geany=20text=20editor=20sources/tech?= =?UTF-8?q?/20190306=20Getting=20started=20with=20the=20Geany=20text=20edi?= =?UTF-8?q?tor.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ting started with the Geany text editor.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20190306 Getting started with the Geany text editor.md diff --git a/sources/tech/20190306 Getting started with the Geany text editor.md b/sources/tech/20190306 Getting started with the Geany text editor.md new file mode 100644 index 0000000000..7da5f95686 --- /dev/null +++ b/sources/tech/20190306 Getting started with the Geany text editor.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the Geany text editor) +[#]: via: (https://opensource.com/article/19/3/getting-started-geany-text-editor) +[#]: author: (James Mawson https://opensource.com/users/dxmjames) + +Getting started with the Geany text editor +====== +Geany is a light and swift text editor with IDE features. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +I have to admit, it took me a rather embarrassingly long time to really get into Linux as a daily driver. One thing I recall from these years in the wilderness was how strange it was to watch open source types get so worked up about text editors. + +It wasn't just that opinions differed. Disagreements were intense. And you'd see them again and again. + +I mean, I suppose it makes some sense. Doing dev or admin work means you're spending a lot of time with a text editor. And when it gets in the way or won't do quite what you want? In that exact moment, that's the most frustrating thing in the world. + +And I know what it means to really hate a text editor. I learned this many years ago in the computer labs at university trying to figure out Emacs. I was quite shocked that a piece of software could have so many sadomasochistic overtones. People were doing that to each other deliberately! + +So perhaps it's a rite of passage that now I have one I very much like. It's called [Geany][1], it's on GPL, and it's [in the repositories][2] of most popular distributions. + +Here's why it works for me. + +### I'm into simplicity + +The main thing I want from a text editor is just to edit text. I don't think there should be any kind of learning curve in the way. I should be able to open it and use it. + +For that reason, I've generally used whatever is included with an operating system. On Windows 10, I used Notepad far longer than I should have. When I finally replaced it, it was with Notepad++. In the Linux terminal, I like Nano. + +I was perfectly aware I was missing out on a lot of useful functionality. But it was never enough of a pain point to make a change. And it's not that I've never tried anything more elaborate. I did some of my first real programming on Visual Basic and Borland Delphi. + +These development environments gave you a graphical interface to design your windows visually, various windows where you could configure properties and settings, a text interface to write your functions, and various odds and ends for debugging. This was a great way to build desktop applications, so long as you used it the way it was intended. + +But if you wanted to do something the authors didn't anticipate, all these extra moving parts suddenly got in the way. As software became more and more about the web and the internet, this situation started happening all the time. + +In the past, I used HTML editing suites like Macromedia Dreamweaver (as it was back then) and FirstPage for static websites. Again, I found the features could get in the way as much as they helped. These applications had their own ideas about how to organize your project, and if you had a different view, it was an awful bother. + +More recently, after a long break from programming, I started learning the people's language: [Python][3]. I bought a book of introductory tutorials, which said to install [IDLE][4], so I did. I think I got about five minutes into it before ditching it to run the interpreter from the command line. It had way too many moving parts to deal with. Especially for HelloWorld.py. + +But I always went back to Notepad++ and Nano whenever I could get away with it. + +So what changed? Well, a few months ago I [ditched Windows 10][5] completely (hooray!). Sticking with what I knew, I used Nano as my main text editor for a few weeks. + +I learned that Nano is great when you're already on the command line and you need to launch a Navy SEAL mission. You know what I mean. A lightning-fast raid. Get in, complete the objective, and get out. + +It's less ideal for long campaigns—or even moderately short ones. Even just adding a new page to a static website turns out to involve many repetitive keystrokes. As much as anything else, I really missed being able to navigate and select text with the mouse. + +### Introducing Geany + +The Geany project began in 2005 and is still actively developed. + +It has minimal dependencies: just the [GTK Toolkit][6] and the libraries that GTK depends on. If you have any kind of desktop environment installed, you almost certainly have GTK on your machine. + +I'm using it on Xfce, but thanks to these minimal dependencies, Geany is portable across desktop environments. + +Geany is fast and light. Installing Geany from the package manager took mere moments, and it uses only 3.1MB of space on my machine. + +So far, I've used it for HTML, CSS, and Python and to edit configuration files. It also recognizes C, Java, JavaScript, Perl, and [more][7]. + +### No-compromise simplicity + +Geany has a lot of great features that make life easier. Just listing them would miss the best bit, which is this: Geany makes sense right out of the box. As soon as it's installed, you can start editing files straightaway, and it just works. + +For all the IDE functionality, none of it gets in the way. The default settings are set intelligently, and the menus are laid out nicely enough that it's no hassle to change them. + +It doesn't try to organize your project for you, and it doesn't have strong opinions about how you should do anything. + +### Handles whitespace beautifully + +By default, every time you press Enter, Geany preserves the indentation on the new line. In addition to saving a few tedious keystrokes, it avoids the inconsistent use of tabs and spaces, which can sometimes sneak in when your mind's elsewhere and make your code hard to follow for anyone with a different text editor. + +But what if you're editing a file that's already suffered this treatment? For example, I needed to edit an HTML file that was indented with a mix of tabs and spaces, making it a nightmare to figure out how the tags were nested. + +With Geany, it took just seconds to hunt through the menus to change the tab length from four spaces to eight. Even better was the option to convert those tabs to spaces. Problem solved! + +### Clever shortcuts and automation + +How often do you write the correct code on the wrong line? I do it all the time. + +Geany makes it easy to move lines of code up and down using Alt+PgUp and Alt+PgDn. This is a little nicer than just a regular cut and paste—instead of needing four or five key presses, you only need one. + +When coding HTML, Geany automatically closes tags for you. As well as saving time, this avoids a lot of annoying bugs. When you forget to close a tag, you can spend ages scouring the document looking for something far more complex. + +It gets even better in Python, where indentation is crucial. Whenever you end a line with a colon, Geany automatically indents it for you. + +One nice little side effect is that when you forget to include the colon—something I do with embarrassing regularity—you realize it immediately when you don't get the automatic indentation you expected. + +The default indentation is a single tab, while I prefer two spaces. Because Geany's menus are very well laid out, it took me only a few seconds to figure out how to change it. + +You, of course, get syntax highlighting too. In addition, it tracks your [variable scope][8] and offers useful autocompletion. + +### Large plugin library + +Geany has a [big library of plugins][9], but so far I haven't needed to try any. Even so, I still feel like I benefit from them. How? Well, it means that my editor isn't crammed with functionality I don't use. + +I reckon this attitude of adding extra functionality into a big library of plugins is a great ethos—no matter your specific needs, you get to have all the stuff you want and none of what you don't. + +### Remote file editing + +One thing that's really nice about terminal text editors is that it's no problem to use them in a remote shell. + +Geany handles this beautifully, as well. You can open remote files anywhere you have SSH access as easily as you can open files on your own machine. + +One frustration I had at first was I only seemed to be able to authenticate with a username and password, which was annoying, because certificates are so much nicer. It turned out that this was just me being a noob by keeping certificates in my home directory rather than in ~/.ssh. + +When editing Python scripts remotely, autocompletion doesn't work when you use packages installed on the server and not on your local machine. This isn't really that big a deal for me, but it's there. + +### In summary + +Text editors are such a personal preference that the right one will be different for different people. + +Geany is excellent if you already know what you want to write and want to just get on with it while enjoying plenty of useful shortcuts to speed up the menial parts. + +Geany is a great way to have your cake and eat it too. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/getting-started-geany-text-editor + +作者:[James Mawson][a] +选题:[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/dxmjames +[b]: https://github.com/lujun9972 +[1]: https://www.geany.org/ +[2]: https://www.geany.org/Download/ThirdPartyPackages +[3]: https://opensource.com/resources/python +[4]: https://en.wikipedia.org/wiki/IDLE +[5]: https://blog.dxmtechsupport.com.au/linux-on-the-desktop-are-we-nearly-there-yet/ +[6]: https://www.gtk.org/ +[7]: https://www.geany.org/Main/AllFiletypes +[8]: https://cscircles.cemc.uwaterloo.ca/11b-how-functions-work/ +[9]: https://plugins.geany.org/ From c5bb21412a9aec9885f0f5a3b49983b2be09471d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:26:04 +0800 Subject: [PATCH 590/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190308=20Virtua?= =?UTF-8?q?l=20filesystems=20in=20Linux:=20Why=20we=20need=20them=20and=20?= =?UTF-8?q?how=20they=20work=20sources/tech/20190308=20Virtual=20filesyste?= =?UTF-8?q?ms=20in=20Linux-=20Why=20we=20need=20them=20and=20how=20they=20?= =?UTF-8?q?work.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nux- Why we need them and how they work.md | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md diff --git a/sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md b/sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md new file mode 100644 index 0000000000..1114863bf7 --- /dev/null +++ b/sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Virtual filesystems in Linux: Why we need them and how they work) +[#]: via: (https://opensource.com/article/19/3/virtual-filesystems-linux) +[#]: author: (Alison Chariken ) + +Virtual filesystems in Linux: Why we need them and how they work +====== +Virtual filesystems are the magic abstraction that makes the "everything is a file" philosophy of Linux possible. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/documents_papers_file_storage_work.png?itok=YlXpAqAJ) + +What is a filesystem? According to early Linux contributor and author [Robert Love][1], "A filesystem is a hierarchical storage of data adhering to a specific structure." However, this description applies equally well to VFAT (Virtual File Allocation Table), Git, and [Cassandra][2] (a [NoSQL database][3]). So what distinguishes a filesystem? + +### Filesystem basics + +The Linux kernel requires that for an entity to be a filesystem, it must also implement the **open()** , **read()** , and **write()** methods on persistent objects that have names associated with them. From the point of view of [object-oriented programming][4], the kernel treats the generic filesystem as an abstract interface, and these big-three functions are "virtual," with no default definition. Accordingly, the kernel's default filesystem implementation is called a virtual filesystem (VFS). + + +![][5] +If we can open(), read(), and write(), it is a file as this console session shows. + +VFS underlies the famous observation that in Unix-like systems "everything is a file." Consider how weird it is that the tiny demo above featuring the character device /dev/console actually works. The image shows an interactive Bash session on a virtual teletype (tty). Sending a string into the virtual console device makes it appear on the virtual screen. VFS has other, even odder properties. For example, it's [possible to seek in them][6]. + +The familiar filesystems like ext4, NFS, and /proc all provide definitions of the big-three functions in a C-language data structure called [file_operations][7] . In addition, particular filesystems extend and override the VFS functions in the familiar object-oriented way. As Robert Love points out, the abstraction of VFS enables Linux users to blithely copy files to and from foreign operating systems or abstract entities like pipes without worrying about their internal data format. On behalf of userspace, via a system call, a process can copy from a file into the kernel's data structures with the read() method of one filesystem, then use the write() method of another kind of filesystem to output the data. + +The function definitions that belong to the VFS base type itself are found in the [fs/*.c files][8] in kernel source, while the subdirectories of fs/ contain the specific filesystems. The kernel also contains filesystem-like entities such as cgroups, /dev, and tmpfs, which are needed early in the boot process and are therefore defined in the kernel's init/ subdirectory. Note that cgroups, /dev, and tmpfs do not call the file_operations big-three functions, but directly read from and write to memory instead. + +The diagram below roughly illustrates how userspace accesses various types of filesystems commonly mounted on Linux systems. Not shown are constructs like pipes, dmesg, and POSIX clocks that also implement struct file_operations and whose accesses therefore pass through the VFS layer. + +![How userspace accesses various types of filesystems][9] +VFS are a "shim layer" between system calls and implementors of specific file_operations like ext4 and procfs. The file_operations functions can then communicate either with device-specific drivers or with memory accessors. tmpfs, devtmpfs and cgroups don't make use of file_operations but access memory directly. + +VFS's existence promotes code reuse, as the basic methods associated with filesystems need not be re-implemented by every filesystem type. Code reuse is a widely accepted software engineering best practice! Alas, if the reused code [introduces serious bugs][10], then all the implementations that inherit the common methods suffer from them. + +### /tmp: A simple tip + +An easy way to find out what VFSes are present on a system is to type **mount | grep -v sd | grep -v :/** , which will list all mounted filesystems that are not resident on a disk and not NFS on most computers. One of the listed VFS mounts will assuredly be /tmp, right? + +![Man with shocked expression][11] +Everyone knows that keeping /tmp on a physical storage device is crazy! credit: + +Why is keeping /tmp on storage inadvisable? Because the files in /tmp are temporary(!), and storage devices are slower than memory, where tmpfs are created. Further, physical devices are more subject to wear from frequent writing than memory is. Last, files in /tmp may contain sensitive information, so having them disappear at every reboot is a feature. + +Unfortunately, installation scripts for some Linux distros still create /tmp on a storage device by default. Do not despair should this be the case with your system. Follow simple instructions on the always excellent [Arch Wiki][12] to fix the problem, keeping in mind that memory allocated to tmpfs is not available for other purposes. In other words, a system with a gigantic tmpfs with large files in it can run out of memory and crash. Another tip: when editing the /etc/fstab file, be sure to end it with a newline, as your system will not boot otherwise. (Guess how I know.) + +### /proc and /sys + +Besides /tmp, the VFSes with which most Linux users are most familiar are /proc and /sys. (/dev relies on shared memory and has no file_operations). Why two flavors? Let's have a look in more detail. + +The procfs offers a snapshot into the instantaneous state of the kernel and the processes that it controls for userspace. In /proc, the kernel publishes information about the facilities it provides, like interrupts, virtual memory, and the scheduler. In addition, /proc/sys is where the settings that are configurable via the [sysctl command][13] are accessible to userspace. Status and statistics on individual processes are reported in /proc/ directories. + +![Console][14] +/proc/meminfo is an empty file that nonetheless contains valuable information. + +The behavior of /proc files illustrates how unlike on-disk filesystems VFS can be. On the one hand, /proc/meminfo contains the information presented by the command **free**. On the other hand, it's also empty! How can this be? The situation is reminiscent of a famous article written by Cornell University physicist N. David Mermin in 1985 called "[Is the moon there when nobody looks?][15] Reality and the quantum theory." The truth is that the kernel gathers statistics about memory when a process requests them from /proc, and there actually is nothing in the files in /proc when no one is looking. As [Mermin said][16], "It is a fundamental quantum doctrine that a measurement does not, in general, reveal a preexisting value of the measured property." (The answer to the question about the moon is left as an exercise.) + +![Full moon][17] +The files in /proc are empty when no process accesses them. ([Source][18]) + +The apparent emptiness of procfs makes sense, as the information available there is dynamic. The situation with sysfs is different. Let's compare how many files of at least one byte in size there are in /proc versus /sys. + +![](https://opensource.com/sites/default/files/uploads/virtualfilesystems_6-filesize.png) + +Procfs has precisely one, namely the exported kernel configuration, which is an exception since it needs to be generated only once per boot. On the other hand, /sys has lots of larger files, most of which comprise one page of memory. Typically, sysfs files contain exactly one number or string, in contrast to the tables of information produced by reading files like /proc/meminfo. + +The purpose of sysfs is to expose the readable and writable properties of what the kernel calls "kobjects" to userspace. The only purpose of kobjects is reference-counting: when the last reference to a kobject is deleted, the system will reclaim the resources associated with it. Yet, /sys constitutes most of the kernel's famous "[stable ABI to userspace][19]" which [no one may ever, under any circumstances, "break."][20] That doesn't mean the files in sysfs are static, which would be contrary to reference-counting of volatile objects. + +The kernel's stable ABI instead constrains what can appear in /sys, not what is actually present at any given instant. Listing the permissions on files in sysfs gives an idea of how the configurable, tunable parameters of devices, modules, filesystems, etc. can be set or read. Logic compels the conclusion that procfs is also part of the kernel's stable ABI, although the kernel's [documentation][19] doesn't state so explicitly. + +![Console][21] +Files in sysfs describe exactly one property each for an entity and may be readable, writable or both. The "0" in the file reveals that the SSD is not removable. + +### Snooping on VFS with eBPF and bcc tools + +The easiest way to learn how the kernel manages sysfs files is to watch it in action, and the simplest way to watch on ARM64 or x86_64 is to use eBPF. eBPF (extended Berkeley Packet Filter) consists of a [virtual machine running inside the kernel][22] that privileged users can query from the command line. Kernel source tells the reader what the kernel can do; running eBPF tools on a booted system shows instead what the kernel actually does. + +Happily, getting started with eBPF is pretty easy via the [bcc][23] tools, which are available as [packages from major Linux distros][24] and have been [amply documented][25] by Brendan Gregg. The bcc tools are Python scripts with small embedded snippets of C, meaning anyone who is comfortable with either language can readily modify them. At this count, [there are 80 Python scripts in bcc/tools][26], making it highly likely that a system administrator or developer will find an existing one relevant to her/his needs. + +To get a very crude idea about what work VFSes are performing on a running system, try the simple [vfscount][27] or [vfsstat][28], which show that dozens of calls to vfs_open() and its friends occur every second. + +![Console - vfsstat.py][29] +vfsstat.py is a Python script with an embedded C snippet that simply counts VFS function calls. + +For a less trivial example, let's watch what happens in sysfs when a USB stick is inserted on a running system. + +![Console when USB is inserted][30] +Watch with eBPF what happens in /sys when a USB stick is inserted, with simple and complex examples. + +In the first simple example above, the [trace.py][31] bcc tools script prints out a message whenever the sysfs_create_files() command runs. We see that sysfs_create_files() was started by a kworker thread in response to the USB stick insertion, but what file was created? The second example illustrates the full power of eBPF. Here, trace.py is printing the kernel backtrace (-K option) plus the name of the file created by sysfs_create_files(). The snippet inside the single quotes is some C source code, including an easily recognizable format string, that the provided Python script [induces a LLVM just-in-time compiler][32] to compile and execute inside an in-kernel virtual machine. The full sysfs_create_files() function signature must be reproduced in the second command so that the format string can refer to one of the parameters. Making mistakes in this C snippet results in recognizable C-compiler errors. For example, if the **-I** parameter is omitted, the result is "Failed to compile BPF text." Developers who are conversant with either C or Python will find the bcc tools easy to extend and modify. + +When the USB stick is inserted, the kernel backtrace appears showing that PID 7711 is a kworker thread that created a file called "events" in sysfs. A corresponding invocation with sysfs_remove_files() shows that removal of the USB stick results in removal of the events file, in keeping with the idea of reference counting. Watching sysfs_create_link() with eBPF during USB stick insertion (not shown) reveals that no fewer than 48 symbolic links are created. + +What is the purpose of the events file anyway? Using [cscope][33] to find the function [__device_add_disk()][34] reveals that it calls disk_add_events(), and either "media_change" or "eject_request" may be written to the events file. Here, the kernel's block layer is informing userspace about the appearance and disappearance of the "disk." Consider how quickly informative this method of investigating how USB stick insertion works is compared to trying to figure out the process solely from the source. + +### Read-only root filesystems make embedded devices possible + +Assuredly, no one shuts down a server or desktop system by pulling out the power plug. Why? Because mounted filesystems on the physical storage devices may have pending writes, and the data structures that record their state may become out of sync with what is written on the storage. When that happens, system owners will have to wait at next boot for the [fsck filesystem-recovery tool][35] to run and, in the worst case, will actually lose data. + +Yet, aficionados will have heard that many IoT and embedded devices like routers, thermostats, and automobiles now run Linux. Many of these devices almost entirely lack a user interface, and there's no way to "unboot" them cleanly. Consider jump-starting a car with a dead battery where the power to the [Linux-running head unit][36] goes up and down repeatedly. How is it that the system boots without a long fsck when the engine finally starts running? The answer is that embedded devices rely on [a read-only root fileystem][37] (ro-rootfs for short). + +![Photograph of a console][38] +ro-rootfs are why embedded systems don't frequently need to fsck. Credit (with permission): + +A ro-rootfs offers many advantages that are less obvious than incorruptibility. One is that malware cannot write to /usr or /lib if no Linux process can write there. Another is that a largely immutable filesystem is critical for field support of remote devices, as support personnel possess local systems that are nominally identical to those in the field. Perhaps the most important (but also most subtle) advantage is that ro-rootfs forces developers to decide during a project's design phase which system objects will be immutable. Dealing with ro-rootfs may often be inconvenient or even painful, as [const variables in programming languages][39] often are, but the benefits easily repay the extra overhead. + +Creating a read-only rootfs does require some additional amount of effort for embedded developers, and that's where VFS comes in. Linux needs files in /var to be writable, and in addition, many popular applications that embedded systems run will try to create configuration dot-files in $HOME. One solution for configuration files in the home directory is typically to pregenerate them and build them into the rootfs. For /var, one approach is to mount it on a separate writable partition while / itself is mounted as read-only. Using bind or overlay mounts is another popular alternative. + +### Bind and overlay mounts and their use by containers + +Running **[man mount][40]** is the best place to learn about bind and overlay mounts, which give embedded developers and system administrators the power to create a filesystem in one path location and then provide it to applications at a second one. For embedded systems, the implication is that it's possible to store the files in /var on an unwritable flash device but overlay- or bind-mount a path in a tmpfs onto the /var path at boot so that applications can scrawl there to their heart's delight. At next power-on, the changes in /var will be gone. Overlay mounts provide a union between the tmpfs and the underlying filesystem and allow apparent modification to an existing file in a ro-rootfs, while bind mounts can make new empty tmpfs directories show up as writable at ro-rootfs paths. While overlayfs is a proper filesystem type, bind mounts are implemented by the [VFS namespace facility][41]. + +Based on the description of overlay and bind mounts, no one will be surprised that [Linux containers][42] make heavy use of them. Let's spy on what happens when we employ [systemd-nspawn][43] to start up a container by running bcc's mountsnoop tool: + +![Console - system-nspawn invocation][44] +The system-nspawn invocation fires up the container while mountsnoop.py runs. + +And let's see what happened: + +![Console - Running mountsnoop][45] +Running mountsnoop during the container "boot" reveals that the container runtime relies heavily on bind mounts. (Only the beginning of the lengthy output is displayed) + +Here, systemd-nspawn is providing selected files in the host's procfs and sysfs to the container at paths in its rootfs. Besides the MS_BIND flag that sets bind-mounting, some of the other flags that the "mount" system call invokes determine the relationship between changes in the host namespace and in the container. For example, the bind-mount can either propagate changes in /proc and /sys to the container, or hide them, depending on the invocation. + +### Summary + +Understanding Linux internals can seem an impossible task, as the kernel itself contains a gigantic amount of code, leaving aside Linux userspace applications and the system-call interface in C libraries like glibc. One way to make progress is to read the source code of one kernel subsystem with an emphasis on understanding the userspace-facing system calls and headers plus major kernel internal interfaces, exemplified here by the file_operations table. The file operations are what makes "everything is a file" actually work, so getting a handle on them is particularly satisfying. The kernel C source files in the top-level fs/ directory constitute its implementation of virtual filesystems, which are the shim layer that enables broad and relatively straightforward interoperability of popular filesystems and storage devices. Bind and overlay mounts via Linux namespaces are the VFS magic that makes containers and read-only root filesystems possible. In combination with a study of source code, the eBPF kernel facility and its bcc interface makes probing the kernel simpler than ever before. + +Much thanks to [Akkana Peck][46] and [Michael Eager][47] for comments and corrections. + +Alison Chaiken will present [Virtual filesystems: why we need them and how they work][48] at the 17th annual Southern California Linux Expo ([SCaLE 17x][49]) March 7-10 in Pasadena, Calif. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/virtual-filesystems-linux + +作者:[Alison Chariken][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://www.pearson.com/us/higher-education/program/Love-Linux-Kernel-Development-3rd-Edition/PGM202532.html +[2]: http://cassandra.apache.org/ +[3]: https://en.wikipedia.org/wiki/NoSQL +[4]: http://lwn.net/Articles/444910/ +[5]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_1-console.png (Console) +[6]: https://lwn.net/Articles/22355/ +[7]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/fs.h +[8]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs +[9]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_2-shim-layer.png (How userspace accesses various types of filesystems) +[10]: https://lwn.net/Articles/774114/ +[11]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_3-crazy.jpg (Man with shocked expression) +[12]: https://wiki.archlinux.org/index.php/Tmpfs +[13]: http://man7.org/linux/man-pages/man8/sysctl.8.html +[14]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_4-proc-meminfo.png (Console) +[15]: http://www-f1.ijs.si/~ramsak/km1/mermin.moon.pdf +[16]: https://en.wikiquote.org/wiki/David_Mermin +[17]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_5-moon.jpg (Full moon) +[18]: https://commons.wikimedia.org/wiki/Moon#/media/File:Full_Moon_Luc_Viatour.jpg +[19]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/stable +[20]: https://lkml.org/lkml/2012/12/23/75 +[21]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_7-sysfs.png (Console) +[22]: https://events.linuxfoundation.org/sites/events/files/slides/bpf_collabsummit_2015feb20.pdf +[23]: https://github.com/iovisor/bcc +[24]: https://github.com/iovisor/bcc/blob/master/INSTALL.md +[25]: http://brendangregg.com/ebpf.html +[26]: https://github.com/iovisor/bcc/tree/master/tools +[27]: https://github.com/iovisor/bcc/blob/master/tools/vfscount_example.txt +[28]: https://github.com/iovisor/bcc/blob/master/tools/vfsstat.py +[29]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_8-vfsstat.png (Console - vfsstat.py) +[30]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_9-ebpf.png (Console when USB is inserted) +[31]: https://github.com/iovisor/bcc/blob/master/tools/trace_example.txt +[32]: https://events.static.linuxfound.org/sites/events/files/slides/bpf_collabsummit_2015feb20.pdf +[33]: http://northstar-www.dartmouth.edu/doc/solaris-forte/manuals/c/user_guide/cscope.html +[34]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/block/genhd.c#n665 +[35]: http://www.man7.org/linux/man-pages/man8/fsck.8.html +[36]: https://wiki.automotivelinux.org/_media/eg-rhsa/agl_referencehardwarespec_v0.1.0_20171018.pdf +[37]: https://elinux.org/images/1/1f/Read-only_rootfs.pdf +[38]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_10-code.jpg (Photograph of a console) +[39]: https://www.meetup.com/ACCU-Bay-Area/events/drpmvfytlbqb/ +[40]: http://man7.org/linux/man-pages/man8/mount.8.html +[41]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/sharedsubtree.txt +[42]: https://coreos.com/os/docs/latest/kernel-modules.html +[43]: https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html +[44]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_11-system-nspawn.png (Console - system-nspawn invocation) +[45]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_12-mountsnoop.png (Console - Running mountsnoop) +[46]: http://shallowsky.com/ +[47]: http://eagercon.com/ +[48]: https://www.socallinuxexpo.org/scale/17x/presentations/virtual-filesystems-why-we-need-them-and-how-they-work +[49]: https://www.socallinuxexpo.org/ From 3c4deaf60d256a8cd7fccabc3dbb9a507dc6d34e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:29:03 +0800 Subject: [PATCH 591/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Cluste?= =?UTF-8?q?rShell=20=E2=80=93=20A=20Nifty=20Tool=20To=20Run=20Commands=20O?= =?UTF-8?q?n=20Cluster=20Nodes=20In=20Parallel=20sources/tech/20190306=20C?= =?UTF-8?q?lusterShell=20-=20A=20Nifty=20Tool=20To=20Run=20Commands=20On?= =?UTF-8?q?=20Cluster=20Nodes=20In=20Parallel.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n Commands On Cluster Nodes In Parallel.md | 309 ++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md diff --git a/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md b/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md new file mode 100644 index 0000000000..8f69143d36 --- /dev/null +++ b/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md @@ -0,0 +1,309 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel) +[#]: via: (https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel +====== + +We had written two articles in the past to run commands on multiple remote server in parallel. + +These are **[Parallel SSH (PSSH)][1]** or **[Distributed Shell (DSH)][2]**. + +Today also, we are going to discuss about the same kind of topic but it allows us to perform the same on cluster nodes as well. + +You may think, i can write a small shell script to archive this instead of installing these third party packages. + +Of course you are right and if you are going to run some commands in 10-15 remote systems then you don’t need to use this. + +However, the scripts take some time to complete this task as it’s running in a sequential order. + +Think about if you would like to run some commands on 1000+ servers what will be the options? + +In this case your script won’t help you. Also, it would take good amount of time to complete a task. + +So, to overcome this kind of issue and situation. We need to run the command in parallel on remote machines. + +For that, we need use in one of the Parallel applications. I hope this explanation might fulfilled your doubts about parallel utilities. + +### What Is ClusterShell? + +clush stands for [ClusterShell][3]. ClusterShell is an event-driven open source Python library, designed to run local or distant commands in parallel on server farms or on large Linux clusters. + +It will take care of common issues encountered on HPC clusters, such as operating on groups of nodes, running distributed commands using optimized execution algorithms, as well as gathering results and merging identical outputs, or retrieving return codes. + +ClusterShell takes advantage of existing remote shell facilities already installed on your systems, like SSH. + +ClusterShell’s primary goal is to improve the administration of high- performance clusters by providing a lightweight but scalable Python API for developers. It also provides clush, clubak and cluset/nodeset, convenient command-line tools that allow traditional shell scripts to benefit from some of the library features. + +ClusterShell’s written in Python and it requires Python (v2.6+ or v3.4+) to run on your system. + +### How To Install ClusterShell On Linux? + +ClusterShell package is available in most of the distribution official package manager. So, use the distribution package manager tool to install it. + +For **`Fedora`** system, use **[DNF Command][4]** to install clustershell. + +``` +$ sudo dnf install clustershell +``` + +Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on Fedora System. + +``` +$ sudo dnf install python3-clustershell +``` + +Make sure you should have enabled the **[EPEL repository][5]** on your system before performing clustershell installation. + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install clustershell. + +``` +$ sudo yum install clustershell +``` + +Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on CentOS/RHEL System. + +``` +$ sudo yum install python34-clustershell +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install clustershell. + +``` +$ sudo zypper install clustershell +``` + +Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on OpenSUSE System. + +``` +$ sudo zypper install python3-clustershell +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][8]** or **[APT Command][9]** to install clustershell. + +``` +$ sudo apt install clustershell +``` + +### How To Install ClusterShell In Linux Using PIP? + +Use PIP to install ClusterShell because it’s written in Python. + +Make sure you should have enabled the **[Python][10]** and **[PIP][11]** on your system before performing clustershell installation. + +``` +$ sudo pip install ClusterShell +``` + +### How To Use ClusterShell On Linux? + +It’s straight forward and awesome tool compared with other utilities such as pssh and dsh. It has so many options to perform the remote execution in parallel. + +Make sure you should have enabled the **[password less login][12]** on your system before start using clustershell. + +The following configuration file defines system-wide default values. You no need to modify anything here. + +``` +$ cat /etc/clustershell/clush.conf +``` + +If you would like to create a servers group. Here you can go. By default some examples were available so, do the same for your requirements. + +``` +$ cat /etc/clustershell/groups.d/local.cfg +``` + +Just run the clustershell command in the following format to get the information from the given nodes. + +``` +$ clush -w 192.168.1.4,192.168.1.9 cat /proc/version +192.168.1.9: Linux version 4.15.0-45-generic ([email protected]) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 +192.168.1.4: Linux version 3.10.0-957.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018 +``` + +**Option:** + + * **`-w:`** nodes where to run the command. + + + +You can use the regular expressions instead of using full hostname and IPs. + +``` +$ clush -w 192.168.1.[4,9] uname -r +192.168.1.9: 4.15.0-45-generic +192.168.1.4: 3.10.0-957.el7.x86_64 +``` + +Alternatively you can use the following format if you have the servers in the same IP series. + +``` +$ clush -w 192.168.1.[4-9] date +192.168.1.6: Mon Mar 4 21:08:29 IST 2019 +192.168.1.7: Mon Mar 4 21:08:29 IST 2019 +192.168.1.8: Mon Mar 4 21:08:29 IST 2019 +192.168.1.5: Mon Mar 4 09:16:30 CST 2019 +192.168.1.9: Mon Mar 4 21:08:29 IST 2019 +192.168.1.4: Mon Mar 4 09:16:30 CST 2019 +``` + +clustershell allow us to run the command in batch mode. Use the following format to achieve this. + +``` +$ clush -w 192.168.1.4,192.168.1.9 -b +Enter 'quit' to leave this interactive mode +Working with nodes: 192.168.1.[4,9] +clush> hostnamectl +--------------- +192.168.1.4 +--------------- + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: f9b37a073c534dec8b236885e754cb56 + 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 +--------------- +192.168.1.9 +--------------- + Static hostname: Ubuntu18 + Icon name: computer-vm + Chassis: vm + Machine ID: 27f6c2febda84dc881f28fd145077187 + Boot ID: f176f2eb45524d4f906d12e2b5716649 + Virtualization: oracle + Operating System: Ubuntu 18.04.2 LTS + Kernel: Linux 4.15.0-45-generic + Architecture: x86-64 +clush> free -m +--------------- +192.168.1.4 +--------------- + total used free shared buff/cache available +Mem: 1838 641 217 19 978 969 +Swap: 2047 0 2047 +--------------- +192.168.1.9 +--------------- + total used free shared buff/cache available +Mem: 1993 352 1067 1 573 1473 +Swap: 1425 0 1425 +clush> w +--------------- +192.168.1.4 +--------------- + 09:21:14 up 3:21, 3 users, load average: 0.00, 0.01, 0.05 +USER TTY FROM [email protected] IDLE JCPU PCPU WHAT +daygeek :0 :0 06:02 ?xdm? 1:28 0.30s /usr/libexec/gnome-session-binary --session gnome-classic +daygeek pts/0 :0 06:03 3:17m 0.06s 0.06s bash +daygeek pts/1 192.168.1.6 06:03 52:26 0.10s 0.10s -bash +--------------- +192.168.1.9 +--------------- + 21:13:12 up 3:12, 1 user, load average: 0.08, 0.03, 0.00 +USER TTY FROM [email protected] IDLE JCPU PCPU WHAT +daygeek pts/0 192.168.1.6 20:42 29:41 0.05s 0.05s -bash +clush> quit +``` + +If you would like to run the command on a group of nodes then use the following format. + +``` +$ clush -w @dev uptime +or +$ clush -g dev uptime +or +$ clush --group=dev uptime + +192.168.1.9: 21:10:10 up 3:09, 1 user, load average: 0.09, 0.03, 0.01 +192.168.1.4: 09:18:12 up 3:18, 3 users, load average: 0.01, 0.02, 0.05 +``` + +If you would like to run the command on more than one group of nodes then use the following format. + +``` +$ clush -w @dev,@uat uptime +or +$ clush -g dev,uat uptime +or +$ clush --group=dev,uat uptime + +192.168.1.7: 07:57:19 up 59 min, 1 user, load average: 0.08, 0.03, 0.00 +192.168.1.9: 20:27:20 up 1:00, 1 user, load average: 0.00, 0.00, 0.00 +192.168.1.5: 08:57:21 up 59 min, 1 user, load average: 0.00, 0.01, 0.05 +``` + +clustershell allow us to copy a file to remote machines. To copy local file or directory to the remote nodes in the same location. + +``` +$ clush -w 192.168.1.[4,9] --copy /home/daygeek/passwd-up.sh +``` + +We can verify the same by running the following command. + +``` +$ clush -w 192.168.1.[4,9] ls -lh /home/daygeek/passwd-up.sh +192.168.1.4: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 4 09:00 /home/daygeek/passwd-up.sh +192.168.1.9: -rwxr-xr-x 1 daygeek daygeek 159 Mar 4 20:52 /home/daygeek/passwd-up.sh +``` + +To copy local file or directory to the remote nodes in the different location. + +``` +$ clush -g uat --copy /home/daygeek/passwd-up.sh --dest /tmp +``` + +We can verify the same by running the following command. + +``` +$ clush --group=uat ls -lh /tmp/passwd-up.sh +192.168.1.7: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 6 07:44 /tmp/passwd-up.sh +``` + +To copy file or directory from remote nodes to local system. + +``` +$ clush -w 192.168.1.7 --rcopy /home/daygeek/Documents/magi.txt --dest /tmp +``` + +We can verify the same by running the following command. + +``` +$ ls -lh /tmp/magi.txt.192.168.1.7 +-rw-r--r-- 1 daygeek daygeek 35 Mar 6 20:24 /tmp/magi.txt.192.168.1.7 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-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/pssh-parallel-ssh-run-execute-commands-on-multiple-linux-servers/ +[2]: https://www.2daygeek.com/dsh-run-execute-shell-commands-on-multiple-linux-servers-at-once/ +[3]: https://cea-hpc.github.io/clustershell/ +[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[5]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[10]: https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-centos-6-system/ +[11]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[12]: https://www.2daygeek.com/linux-passwordless-ssh-login-using-ssh-keygen/ From 5e43b6ac4bd7d5d20451b964804cfef3113f5ffa Mon Sep 17 00:00:00 2001 From: GraveAccent Date: Wed, 13 Mar 2019 19:51:47 +0800 Subject: [PATCH 592/813] GraveAccent reserved 20180220JSON vs XML vs TOML vs CSON vs YAML.md --- sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md b/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md index eeb290c82b..bb723b75e6 100644 --- a/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md +++ b/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (GraveAccent) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fb859552560de7bd5ceb5c6a227e2d43c279b41b Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 Mar 2019 08:54:04 +0800 Subject: [PATCH 593/813] translated --- ...SH Into A Particular Directory On Linux.md | 114 ----------------- ...SH Into A Particular Directory On Linux.md | 116 ++++++++++++++++++ 2 files changed, 116 insertions(+), 114 deletions(-) delete mode 100644 sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md create mode 100644 translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md diff --git a/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md deleted file mode 100644 index 6dea8d9f24..0000000000 --- a/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md +++ /dev/null @@ -1,114 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To SSH Into A Particular Directory On Linux) -[#]: via: (https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To SSH Into A Particular Directory On Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/SSH-Into-A-Particular-Directory-720x340.png) - -Have you ever been in a situation where you want to SSH to a remote server and immediately cd into a directory and continue work interactively? You’re on the right track! This brief tutorial describes how to directly SSH into a particular directory of a remote Linux system. Not just SSH into a specific directory, you can run any command immediately right after connecting to an SSH server as described in this guide. It is not that difficult as you might think. Read on. - -### SSH Into A Particular Directory Of A Remote System - -Before I knew this method, I would usually first SSH to the remote remote system using command: - -``` -$ ssh user@remote-system -``` - -And then cd into a directory like below: - -``` -$ cd -``` - -However, you need not to use two separate commands. You can combine these commands and simplify the task with one command. - -Have a look at the following example. - -``` -$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; bash' -``` - -The above command will SSH into a remote system (192.168.225.22) and immediately cd into a directory named **‘/home/sk/ostechnix/’** directory and leave yourself at the prompt. - -Here, the **-t** flag is used to force pseudo-terminal allocation, which is necessary or an interactive shell. - -Here is the sample output of the above command: - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/ssh-1.gif) - -You can also use this command as well. - -``` -$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; exec bash' -``` - -Or, - -``` -$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec bash -l' -``` - -Here, the **-l** flag sets the bash as login shell. - -In the above example, I have used **bash** in the last argument. It is the default shell in my remote system. If you don’t know the shell type on the remote system, use the following command: - -``` -$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec $SHELL' -``` - -Like I already said, this is not just for cd into directory after connecting to an remote system. You can use this trick to run other commands as well. For example, the following command will land you inside ‘/home/sk/ostechnix/’ directory and then execute ‘uname -a’ command. - -``` -$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && uname -a && exec $SHELL' -``` - -Alternatively, you can add the command(s) you wanted to run after connecting to an SSH server on the remote system’s **.bash_profile** file. - -Edit **.bash_profile** file: - -``` -$ nano ~/.bash_profile -``` - -Add the command(s) one by one. In my case, I am adding the following line: - -``` -cd /home/sk/ostechnix >& /dev/null -``` - -Save and close the file. Finally, run the following command to update the changes. - -``` -$ source ~/.bash_profile -``` - -Please note that you should add this line on the remote system’s **.bash_profile** or **.bashrc** file, not in your local system’s. From now on, whenever you login (whether by SSH or direct), the cd command will execute and you will be automatically landed inside “/home/sk/ostechnix/” directory. - - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ - -作者:[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 diff --git a/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md new file mode 100644 index 0000000000..b096ad8bbc --- /dev/null +++ b/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To SSH Into A Particular Directory On Linux) +[#]: via: (https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在 Linux 上 SSH 登录到特定目录 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/SSH-Into-A-Particular-Directory-720x340.png) + +你是否遇到过需要 SSH 登录到远程服务器并立即 cd 到一个目录来继续交互式作业?你找对地方了!这个简短的教程描述了如何直接 SSH 登录到远程 Linux 系统的特定目录。而且不仅是SSH 登录到特定目录,你还可以在连接到 SSH 服务器后立即运行任何命令。这些没有你想的那么难。请继续阅读。 + +### SSH 登录到远程系统的特定目录 + +在我知道这个方法之前,我通常首先使用以下命令SSH 登录到远程系统: + +``` +$ ssh user@remote-system +``` + +然后如下 cd 进入某个目录: + +``` +$ cd +``` + +然而,你不需要使用两个单独的命令。你可以用一条命令组合并简化这个任务。 + +看看下面的例子。 + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; bash' +``` + +上面的命令将通过 SSH 连接到远程系统 (192.168.225.22) 并立即进入名为 **“/home/sk/ostechnix/”** 的目录,并停留在提示符中。 + +这里,**-t** 标志用于强制分配伪终端,这是一个必要的交互式 shell。 + +以下是上面命令的输出: + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/ssh-1.gif) + +你也可以使用此命令。 + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; exec bash' +``` + +或者, + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec bash -l' +``` + +这里,**-l** 标志将 bash 设置为登录 shell。 + +在上面的例子中,我在最后一个参数中使用了 **bash**。它是我的远程系统中的默认 shell。如果你不知道远程系统上的 shell 类型,请使用以下命令: + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec $SHELL' +``` + +Like I already said, this is not just for cd into directory after connecting to an remote system. You can use this trick to run other commands as well. For example, the following command will land you inside ‘/home/sk/ostechnix/’ directory and then execute ‘uname -a’ command. +就像我已经说过的,它不仅仅是连接到远程系统后 cd 进入目录。你也可以使用此技巧运行其他命令。例如,以下命令将进入 “/home/sk/ostechnix/”,然后执行命令 “uname -a” 。 + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && uname -a && exec $SHELL' +``` + +或者,你可以在远程系统上的 **.bash_profile** 文件中添加你想在 SSH 登录后执行的命令。 + + +编辑 **.bash_profile** 文件: + +``` +$ nano ~/.bash_profile +``` + +每个命令一行。在我的例子中,我添加了下面这行: + +``` +cd /home/sk/ostechnix >& /dev/null +``` + +保存并关闭文件。最后,运行以下命令更新修改。 + +``` +$ source ~/.bash_profile +``` + +请注意,你应该在远程系统的 **.bash_profile** 或 **.bashrc** 文件中添加此行,而不是在本地系统中。从现在开始,无论何时登录(无论是通过 SSH 还是直接登录),cd 命令都将执行,你将自动进入 “/home/sk/ostechnix/” 目录。 + + +就是这些了。希望这篇文章有用。还有更多好东西。敬请关注! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ + +作者:[SK][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 From 10e8a9e2246a7ac938eb0dac53c3ed6672536ae8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 Mar 2019 08:57:52 +0800 Subject: [PATCH 594/813] translating --- ...4 ODrive (Open Drive) - Google Drive GUI Client For Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md b/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md index 71a91ec3d8..65787015dd 100644 --- a/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md +++ b/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fb53ea89684f3c716a8a1a2782e822f8cbbe01b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Mar 2019 10:56:18 +0800 Subject: [PATCH 595/813] PRF:20180314 Pi Day- 12 fun facts and ways to celebrate.md @wwhio --- ...Day- 12 fun facts and ways to celebrate.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md b/translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md index 67a7f37675..4c03a28074 100644 --- a/translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md +++ b/translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md @@ -1,45 +1,43 @@ -关于圆周率日:12个有趣的事实与庆祝方式 +关于圆周率日的趣事与庆祝方式 ====== +> 技术团队喜欢 3 月 14 日的圆周率日:你是否知道这也是阿尔伯特·爱因斯坦的生日和 Linux 内核1.0.0 发布周年纪念日?来看一些树莓派的趣事和 DIY 项目。 + ![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/cio_piday.png?itok=kTht0qV9) -今天,全世界的技术团队都会为一个数字庆祝。3 月 14 日是圆周率日,人们会在这一天举行吃派比赛、披萨舞会,玩数学梗math puns。如果数学领域中重要的常数不足以让 3 月 14 日成为一个节日的话,加上爱因斯坦的生日、Linux 内核 1.0.0 发布的周年纪念日,莱伊·惠特尼在这一天申请了轧花机的专利这些原因,应该足够了吧。 -(LCTT译注:[轧花机](https://zh.wikipedia.org/wiki/%E8%BB%8B%E6%A3%89%E6%A9%9F)是一种快速而且简单地分开棉花纤维和种子的机器,生产力比人手分离高得多。) +今天,全世界的技术团队都会为一个数字庆祝。3 月 14 日是圆周率日Pi Day,人们会在这一天举行吃派比赛、披萨舞会,玩数学梗math puns。如果这个数学领域中的重要常数不足以让 3 月 14 日成为一个节日的话,再加上爱因斯坦的生日、Linux 内核 1.0.0 发布的周年纪念日,莱伊·惠特尼在这一天申请了轧花机的专利这些原因,应该足够了吧。(LCTT译注:[轧花机](https://zh.wikipedia.org/wiki/%E8%BB%8B%E6%A3%89%E6%A9%9F)是一种快速而且简单地分开棉花纤维和种子的机器,生产力比人手分离高得多。) -很荣幸,我门能在这一天一起了解有关它的有趣的事实和与π相关的活动。来吧,和你的团队一起庆祝圆周率日:找一两个点子来进行团队建设,用新兴技术做一个项目。如果你有庆祝为被大家所喜爱的无限小数的独特方式,请在评论区与大家分享。 +很荣幸,我们能在这一个特殊的日子里一起了解有关它的趣事和与 π 相关的好玩的活动。来吧,和你的团队一起庆祝圆周率日:找一两个点子来进行团队建设,或用新兴技术做一个项目。如果你有为这个大家所喜爱的无限小数庆祝的独特方式,请在评论区与大家分享。 ### 圆周率日的庆祝方法: - * 今天是圆周率日的第 30 次周年纪念。第一次为它庆祝是在旧金山的探索博物馆Exploratorium由物理学家Larry Shaw 举行。“在第 1 次周年纪念日当天,工作人员带来了水果派和茶壶来庆祝它。在 1 点 59 分,圆周率中紧接着 3.14,Shaw 在博物馆外领着队伍环馆一周。队伍中用扩音器播放着‘Pomp and Circumstance’。” 直到 21 年后,在 2009 年 3 月,圆周率正式成为了美国的法定假日。 - * 虽然它起源于旧金山,可规模最大的庆祝活动是在普林斯顿举行的,小镇举办了为期五天的[数字活动][2],包括爱因斯坦模仿比赛、投掷派比赛,圆周率背诵比赛等等。其中的某些活动甚至会给获胜者提供高达 314.5 美元的奖金。 - * 麻省理工的斯隆管理学院MIT Sloan School of Management正在庆祝圆周率日。他们在 Twitter 上分享着关于圆周率日有趣的事实,详情请关注推特话题Twitter hashtag #PiVersusPie 。 - -(LCTT译注:本文写于 2018 年的圆周率日,故在细节上存在出入。例如今天(2019 年 3 月 14 日)是圆周率日的第 31 次周年纪念。) + * 今天是圆周率日的第 31 次周年纪念(LCTT 译注:本文写于 2018 年的圆周率日,故在细节上存在出入。例如今天(2019 年 3 月 14 日)是圆周率日的第 31 次周年纪念)。第一次为它庆祝是在旧金山的探索博物馆Exploratorium由物理学家 Larry Shaw 举行。“在[第 1 次周年纪念日][1]当天,工作人员带来了水果派和茶壶来庆祝它。在 1 点 59 分(圆周率中紧接着 3.14 的数字),Shaw 在博物馆外领着队伍环馆一周。队伍中用扩音器播放着‘Pomp and Circumstance’。” 直到 21 年后,在 2009 年 3 月,圆周率正式成为了美国的法定假日。 + * 虽然该纪念日起源于旧金山,可规模最大的庆祝活动却是在普林斯顿举行的,这个小镇举办了为期五天的[许多活动][2],包括爱因斯坦模仿比赛、掷派比赛,圆周率背诵比赛等等。其中的某些活动甚至会给获胜者提供价值 314.5 美元的奖金。 + * 麻省理工的斯隆管理学院MIT Sloan School of Management正在庆祝圆周率日。他们在 Twitter 上分享着关于 π 和派的圆周率日趣事,详情请关注推特话题Twitter hashtag #PiVersusPie 。 ### 与圆周率有关的项目与活动: - * 如果你像锻炼你的数学技能,美国国家航空航天局NASA, National Aeronautics and Space Administration喷气推进实验室JPL, Jet Propulsion Lab发布了[一系列数学问题][4],希望通过这些问题展现如何把圆周率用于空间探索。这也是美国国家航天局面向学生举办的第五届圆周率日挑战。 - * 想要领略圆周率日的精神,最好的方法也许就是开展一个[树莓派][5]项目了,无论是和你的孩子还是和你的团队一起完成,都没有什么明显的缺点。树莓派作为一项从 2012 年开启的项目,现在已经有数百万块的基本电脑板被出售。事实上,它已经在[通用计算机畅销榜上排名第三][6]了。这里列举一些可能会吸引你的树莓派项目或活动: - * 来自谷歌的自己做AIAIY (AI-Yourself)项目让你自己创造一个[语音控制的数字助手][7]或者[一个图像识别设备][8]。 + * 如果你想锻炼你的数学技能,美国国家航空航天局National Aeronautics and Space Administration(NASA)的喷气推进实验室Jet Propulsion Lab(JPL)发布了[一系列新的数学问题][4],希望通过这些问题展现如何把圆周率用于空间探索。这也是美国国家航天局面向学生举办的第五届圆周率日挑战。 + * 想要领略圆周率日的精神,最好的方法也许就是开展一个[树莓派][5]项目了,无论是和你的孩子还是和你的团队一起完成,都是不错的。树莓派作为一项从 2012 年开启的项目,现在已经售出了数百万块的基本型的电脑主板。事实上,它已经在[通用计算机畅销榜上排名第三][6]了。这里列举一些可能会吸引你的树莓派项目或活动: + * 来自谷歌的自己做 AIAI-Yourself(AIY)项目让你自己创造一个[语音控制的数字助手][7]或者[一个图像识别设备][8]。 * 在树莓派上[使用 Kubernets][9]。 - * 目标:拯救桃子公主!组装一台[怀旧游戏系统][10]。 - * 和你的团队举办一场[树莓派 Jam][11]。树莓派基金会发布了[GitBook][12]来帮助大家顺利举办。根据网页内容,树莓派 Jam 旨在“给所有年龄的人在数字创作中提供支持,全世界的有着相同想法的人集中起来讨论并分享他们的项目,举办讲习班,讨论和圆周率相关的一切。” + * 组装一台[怀旧游戏系统][10],目标:拯救桃子公主! + * 和你的团队举办一场[树莓派 Jam][11]。树莓派基金会发布了一个帮助大家顺利举办活动的[指导手册][12]。据该网站说明,树莓派 Jam 旨在“给数字创作中所有年龄段的人提供支持,让世界各地志同道合的人们汇聚起来讨论和分享他们的最新项目,举办讲习班,讨论和派相关的一切。” -### 其他有关圆周率的事实: +### 其他有关圆周率的事情: * 当前背诵圆周率的[世界纪录保持者][13]是 Suresh Kumar Sharma,他在 2015 年 10 月花了 17 小时零 14 分钟背出了 70,030 位数字。然而,[非官方记录][14]的保持者 Akira Haraguchi 声称他可以背出 111,700 位数字。 * 现在,已知的圆周率数字的长度比以往都要多。在 2016 年 11 月,R&D 科学家 Peter Trueb 计算出了 22,459,157,718,361 位圆周率数字,比 2013 年的世界记录多了 [9 万亿数字][15]。据新科学家New Scientist所述,“最终文件包含了圆周率的 22 万亿位数字,大小接近 9 TB。如果将其打印出来,能用数百万本 1000 页的书装满一整个图书馆。” 祝你圆周率日快乐! - -------------------------------------------------------------------------------- via: https://enterprisersproject.com/article/2018/3/pi-day-12-fun-facts-and-ways-celebrate 作者:[Carla Rudder][a] 译者:[wwhio](https://github.com/wwhio) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 56a84a7f6ea6233612f5cfbdd9e9b18c8fc2a451 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Mar 2019 10:57:17 +0800 Subject: [PATCH 596/813] PUB:20180314 Pi Day- 12 fun facts and ways to celebrate.md @wwhio https://linux.cn/article-10617-1.html --- .../20180314 Pi Day- 12 fun facts and ways to celebrate.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180314 Pi Day- 12 fun facts and ways to celebrate.md (100%) diff --git a/translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md b/published/20180314 Pi Day- 12 fun facts and ways to celebrate.md similarity index 100% rename from translated/talk/20180314 Pi Day- 12 fun facts and ways to celebrate.md rename to published/20180314 Pi Day- 12 fun facts and ways to celebrate.md From 88d83eea79159faf1e1f0edf16e86665d3c6da06 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Mar 2019 11:17:12 +0800 Subject: [PATCH 597/813] PRF:20190226 How To SSH Into A Particular Directory On Linux.md @geekpi --- ...SH Into A Particular Directory On Linux.md | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md index b096ad8bbc..f492f95837 100644 --- a/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md +++ b/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To SSH Into A Particular Directory On Linux) [#]: via: (https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -如何在 Linux 上 SSH 登录到特定目录 +如何 SSH 登录到 Linux 上的特定目录 ====== ![](https://www.ostechnix.com/wp-content/uploads/2019/02/SSH-Into-A-Particular-Directory-720x340.png) -你是否遇到过需要 SSH 登录到远程服务器并立即 cd 到一个目录来继续交互式作业?你找对地方了!这个简短的教程描述了如何直接 SSH 登录到远程 Linux 系统的特定目录。而且不仅是SSH 登录到特定目录,你还可以在连接到 SSH 服务器后立即运行任何命令。这些没有你想的那么难。请继续阅读。 +你是否遇到过需要 SSH 登录到远程服务器并立即 `cd` 到一个目录来继续交互式作业?你找对地方了!这个简短的教程描述了如何直接 SSH 登录到远程 Linux 系统的特定目录。而且不仅是 SSH 登录到特定目录,你还可以在连接到 SSH 服务器后立即运行任何命令。这些没有你想的那么难。请继续阅读。 ### SSH 登录到远程系统的特定目录 -在我知道这个方法之前,我通常首先使用以下命令SSH 登录到远程系统: +在我知道这个方法之前,我通常首先使用以下命令 SSH 登录到远程系统: ``` $ ssh user@remote-system ``` -然后如下 cd 进入某个目录: +然后如下 `cd` 进入某个目录: ``` $ cd @@ -36,15 +36,15 @@ $ cd $ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; bash' ``` -上面的命令将通过 SSH 连接到远程系统 (192.168.225.22) 并立即进入名为 **“/home/sk/ostechnix/”** 的目录,并停留在提示符中。 +上面的命令将通过 SSH 连接到远程系统 (192.168.225.22) 并立即进入名为 `/home/sk/ostechnix/` 的目录,并停留在提示符中。 -这里,**-t** 标志用于强制分配伪终端,这是一个必要的交互式 shell。 +这里,`-t` 标志用于强制分配伪终端,这是一个必要的交互式 shell。 以下是上面命令的输出: ![](https://www.ostechnix.com/wp-content/uploads/2019/02/ssh-1.gif) -你也可以使用此命令。 +你也可以使用此命令: ``` $ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; exec bash' @@ -56,25 +56,23 @@ $ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; exec bash' $ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec bash -l' ``` -这里,**-l** 标志将 bash 设置为登录 shell。 +这里,`-l` 标志将 bash 设置为登录 shell。 -在上面的例子中,我在最后一个参数中使用了 **bash**。它是我的远程系统中的默认 shell。如果你不知道远程系统上的 shell 类型,请使用以下命令: +在上面的例子中,我在最后一个参数中使用了 `bash`。它是我的远程系统中的默认 shell。如果你不知道远程系统上的 shell 类型,请使用以下命令: ``` $ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec $SHELL' ``` -Like I already said, this is not just for cd into directory after connecting to an remote system. You can use this trick to run other commands as well. For example, the following command will land you inside ‘/home/sk/ostechnix/’ directory and then execute ‘uname -a’ command. -就像我已经说过的,它不仅仅是连接到远程系统后 cd 进入目录。你也可以使用此技巧运行其他命令。例如,以下命令将进入 “/home/sk/ostechnix/”,然后执行命令 “uname -a” 。 +就像我已经说过的,它不仅仅是连接到远程系统后 `cd` 进入目录。你也可以使用此技巧运行其他命令。例如,以下命令将进入 `/home/sk/ostechnix/`,然后执行命令 `uname -a` 。 ``` $ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && uname -a && exec $SHELL' ``` -或者,你可以在远程系统上的 **.bash_profile** 文件中添加你想在 SSH 登录后执行的命令。 +或者,你可以在远程系统上的 `.bash_profile` 文件中添加你想在 SSH 登录后执行的命令。 - -编辑 **.bash_profile** 文件: +编辑 `.bash_profile` 文件: ``` $ nano ~/.bash_profile @@ -92,15 +90,12 @@ cd /home/sk/ostechnix >& /dev/null $ source ~/.bash_profile ``` -请注意,你应该在远程系统的 **.bash_profile** 或 **.bashrc** 文件中添加此行,而不是在本地系统中。从现在开始,无论何时登录(无论是通过 SSH 还是直接登录),cd 命令都将执行,你将自动进入 “/home/sk/ostechnix/” 目录。 - +请注意,你应该在远程系统的 `.bash_profile` 或 `.bashrc` 文件中添加此行,而不是在本地系统中。从现在开始,无论何时登录(无论是通过 SSH 还是直接登录),`cd` 命令都将执行,你将自动进入 `/home/sk/ostechnix/` 目录。 就是这些了。希望这篇文章有用。还有更多好东西。敬请关注! 干杯! - - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ @@ -108,7 +103,7 @@ via: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ 作者:[SK][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 96e94e953b3dffcc94a5edc70f911c2d45874d92 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Mar 2019 11:18:36 +0800 Subject: [PATCH 598/813] PUB:20190226 How To SSH Into A Particular Directory On Linux.md @geekpi https://linux.cn/article-10618-1.html --- ...0190226 How To SSH Into A Particular Directory On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190226 How To SSH Into A Particular Directory On Linux.md (98%) diff --git a/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/published/20190226 How To SSH Into A Particular Directory On Linux.md similarity index 98% rename from translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md rename to published/20190226 How To SSH Into A Particular Directory On Linux.md index f492f95837..2706735314 100644 --- a/translated/tech/20190226 How To SSH Into A Particular Directory On Linux.md +++ b/published/20190226 How To SSH Into A Particular Directory On Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10618-1.html) [#]: subject: (How To SSH Into A Particular Directory On Linux) [#]: via: (https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 4bf35325fd577b1259988cea57460b1c8b46f800 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Mar 2019 11:50:18 +0800 Subject: [PATCH 599/813] PRF:20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md @geekpi --- ...ith Proprietary Nvidia Graphics Drivers.md | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md b/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md index 33b8b8e530..9c95bb2b81 100644 --- a/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md +++ b/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers) @@ -9,9 +9,12 @@ 如何使得支持 OpenGL 的 Flatpak 应用和游戏在专有 Nvidia 图形驱动下工作 ====== -**一些支持 OpenGL 并打包为 Flatpak 的应用和游戏无法使用专有 Nvidia 驱动启动。本文将介绍如何在不安装开源驱动(Nouveau)的情况下启动这些 Flatpak 应用或游戏。** +> 一些支持 OpenGL 并打包为 Flatpak 的应用和游戏无法使用专有 Nvidia 驱动启动。本文将介绍如何在不安装开源驱动(Nouveau)的情况下启动这些 Flatpak 应用或游戏。 + +![](https://2.bp.blogspot.com/-A6PQn0xS7t8/WzYZDH6L_cI/AAAAAAAAAyE/ZBHroHnrY1scqo-dhSRV3YapO4OeBJlOQCLcBGAs/s1600/flatpak.png) + +这有个例子。我在我的 Ubuntu 18.04 桌面上使用专有的 Nvidia 驱动程序 (`nvidia-driver-390`),当我尝试启动以 Flatpak 形式安装的最新版本 [Krita 4.1][2] (构建了 OpenGL 支持)时,显示了如下错误: -这有个例子。我在我的 Ubuntu 18.04 桌面上使用专有的 Nvidia 驱动程序 (`nvidia-driver-390`),当我尝试启动最新版本时: ``` $ /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=krita --file-forwarding org.kde.krita Gtk-Message: Failed to load module "canberra-gtk-module" @@ -19,89 +22,85 @@ Gtk-Message: Failed to load module "canberra-gtk-module" libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast Could not initialize GLX - ``` -要修复使用 OpenGL 和专有 Nvidia 图形驱动时无法启动的 Flatpak 游戏和应用,你需要为已安装的专有驱动安装运行时。以下是步骤。 +[Winepak][3] 游戏(以 Flatpak 方式打包的绑定了 Wine 的 Windows 游戏)似乎也受到了这个问题的影响,这个问题从 2016 年出现至今。 -**1\. 如果尚未添加 FlatHub 仓库,请添加它。你可以在[此处][1]找到针对 Linux 发行版的说明。** +要修复使用 OpenGL 和专有 Nvidia 图形驱动时无法启动的 Flatpak 游戏和应用的问题,你需要为已安装的专有驱动安装一个运行时环境。以下是步骤。 -**2. 现在,你需要确定系统上安装的专有 Nvidia 驱动的确切版本。** +1、如果尚未添加 FlatHub 仓库,请添加它。你可以在[此处][1]找到针对 Linux 发行版的说明。 -_这一步取决于你使用的 Linux 发行版,我无法涵盖所有​​情况。下面的说明是面向 Ubuntu(以及 Ubuntu 风格的版本),但希望你可以自己弄清楚系统上安装的 Nvidia 驱动版本._ +2、现在,你需要确定系统上安装的专有 Nvidia 驱动的确切版本。 -要在 Ubuntu 中执行此操作,请打开 `Software&Updates`,切换到 `Additional Drivers` 选项卡并记下 Nvidia 驱动包的名称。 +_这一步取决于你使用的 Linux 发行版,我无法涵盖所有​​情况。下面的说明是面向 Ubuntu(以及 Ubuntu 风格的版本),但希望你可以自己弄清楚系统上安装的 Nvidia 驱动版本。_ -比如,你可以看到我的是 `nvidia-driver-390`: +要在 Ubuntu 中执行此操作,请打开 “软件与更新”,切换到 “附加驱动” 选项卡并记下 Nvidia 驱动包的名称。 + +比如,你可以看到我的是 “nvidia-driver-390”: ![](https://1.bp.blogspot.com/-FAfjtGNeUJc/WzYXMYTFBcI/AAAAAAAAAx0/xUhIO83IAjMuK4Hn0jFUYKJhSKw8y559QCLcBGAs/s1600/additional-drivers-nvidia-ubuntu.png) 这里还没完成。我们只是找到了 Nvidia 驱动的主要版本,但我们还需要知道次要版本。要获得我们下一步所需的确切 Nvidia 驱动版本,请运行此命令(应该适用于任何基于 Debian 的 Linux 发行版,如 Ubuntu、Linux Mint 等): + ``` apt-cache policy NVIDIA-PACKAGE-NAME - ``` -NVIDIA-PACKAGE-NAME 是 `Software & Updates` 中列出的 Nvidia 驱动包名称。例如,要查看 `nvidia-driver-390` 包的确切安装版本,请运行以下命令: +这里的 “NVIDIA-PACKAGE-NAME” 是 “软件与更新” 中列出的 Nvidia 驱动包名称。例如,要查看 “nvidia-driver-390” 包的确切安装版本,请运行以下命令: + ``` $ apt-cache policy nvidia-driver-390 nvidia-driver-390: - Installed: 390.48-0ubuntu3 - Candidate: 390.48-0ubuntu3 - Version table: - * 390.48-0ubuntu3 500 - 500 http://ro.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages - 100 /var/lib/dpkg/status - + Installed: 390.48-0ubuntu3 + Candidate: 390.48-0ubuntu3 + Version table: + *** 390.48-0ubuntu3 500 + 500 http://ro.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages + 100 /var/lib/dpkg/status ``` -在这个命令的输出中,查找 `Installed` 部分并记下版本号(不包括 `-0ubuntu3` 之类)。现在我们知道了已安装的 Nvidia 驱动的确切版本(我例子中的是 `390.48`)。记住它,因为下一步我们需要。 +在这个命令的输出中,查找 “Installed” 部分并记下版本号(不包括 “-0ubuntu3” 之类)。现在我们知道了已安装的 Nvidia 驱动的确切版本(我例子中的是 “390.48”)。记住它,因为下一步我们需要。 -**3\. 最后,你可以从 FlatHub 为你已安装的专有 Nvidia 图形驱动安装运行时。** +3、最后,你可以从 FlatHub 为你已安装的专有 Nvidia 图形驱动安装运行时环境。 要列出 FlatHub 上所有可用的 Nvidia 运行时包,你可以使用以下命令: + ``` flatpak remote-ls flathub | grep nvidia - ``` -幸运地是 FlatHub 上提供这个 Nvidia 驱动的运行时。你现在可以使用以下命令继续安装运行时: - - * 针对 64 位系统: +幸运地是 FlatHub 上提供这个 Nvidia 驱动的运行时环境。你现在可以使用以下命令继续安装运行时: +针对 64 位系统: ``` flatpak install flathub org.freedesktop.Platform.GL.nvidia-MAJORVERSION-MINORVERSION - ``` -将 MAJORVERSION 替换为 Nvidia 驱动的主要版本(在上面的示例中为 390),将 MINORVERSION 替换为次要版本(步骤2,我例子中的为 48)。 +将 “MAJORVERSION” 替换为 Nvidia 驱动的主要版本(在上面的示例中为 390),将 “MINORVERSION” 替换为次要版本(步骤2,我例子中的为 48)。 例如,要为 Nvidia 图形驱动版本 390.48 安装运行时,你必须使用以下命令: + ``` flatpak install flathub org.freedesktop.Platform.GL.nvidia-390-48 - ``` - * 对于 32 位系统(或能够在 64 位上运行 32 位的应用或游戏),使用以下命令安装 32 位运行时: - +对于 32 位系统(或能够在 64 位上运行 32 位的应用或游戏),使用以下命令安装 32 位运行时: ``` flatpak install flathub org.freedesktop.Platform.GL32.nvidia-MAJORVERSION-MINORVERSION - ``` -再说一次,将 MAJORVERSION 替换为 Nvidia 驱动的主要版本(在上面的示例中为 390),将 MINORVERSION 替换为次要版本(步骤2,我例子中的为 48)。 +再说一次,将 “MAJORVERSION” 替换为 Nvidia 驱动的主要版本(在上面的示例中为 390),将 “MINORVERSION” 替换为次要版本(步骤2,我例子中的为 48)。 比如,要为 Nvidia 图形驱动版本 390.48 安装 32 位运行时,你需要使用以下命令: + ``` flatpak install flathub org.freedesktop.Platform.GL32.nvidia-390-48 - ``` 以上就是你要运行支持 OpenGL 的 Flatpak 的应用或游戏的方法。 - -------------------------------------------------------------------------------- via: https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-built.html @@ -109,7 +108,7 @@ via: https://www.linuxuprising.com/2018/06/how-to-get-flatpak-apps-and-games-bui 作者:[Logix][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[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 c8cae31a18401e9e11c9a5d4d07278f27a36d531 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Mar 2019 11:50:58 +0800 Subject: [PATCH 600/813] PUB:20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md @geekpi https://linux.cn/article-10619-1.html --- ...ith OpenGL To Work With Proprietary Nvidia Graphics Drivers.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md (100%) diff --git a/translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md b/published/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md similarity index 100% rename from translated/tech/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md rename to published/20180629 How To Get Flatpak Apps And Games Built With OpenGL To Work With Proprietary Nvidia Graphics Drivers.md From 676f2d74c1e8d746e37168a33b751ca15e3b8572 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:02:17 +0800 Subject: [PATCH 601/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190313=20Game?= =?UTF-8?q?=20Review:=20Steel=20Rats=20is=20an=20Enjoyable=20Bike-Combat?= =?UTF-8?q?=20Game=20sources/tech/20190313=20Game=20Review-=20Steel=20Rats?= =?UTF-8?q?=20is=20an=20Enjoyable=20Bike-Combat=20Game.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...l Rats is an Enjoyable Bike-Combat Game.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/tech/20190313 Game Review- Steel Rats is an Enjoyable Bike-Combat Game.md diff --git a/sources/tech/20190313 Game Review- Steel Rats is an Enjoyable Bike-Combat Game.md b/sources/tech/20190313 Game Review- Steel Rats is an Enjoyable Bike-Combat Game.md new file mode 100644 index 0000000000..5af0ae30d3 --- /dev/null +++ b/sources/tech/20190313 Game Review- Steel Rats is an Enjoyable Bike-Combat Game.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Game Review: Steel Rats is an Enjoyable Bike-Combat Game) +[#]: via: (https://itsfoss.com/steel-rats) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Game Review: Steel Rats is an Enjoyable Bike-Combat Game +====== + +Steel Rats is a quite impressive 2.5D motorbike combat game with exciting stunts involved. It was already available for Windows on [Steam][1] – however, recently it has been made available for Linux and Mac as well. + +In case you didn’t know, you can easily [install Steam on Ubuntu][2] or other distributions and [enable Steam Play feature to run some Windows games on Linux][3]. + +So, in this article, we shall take a look at what the game is all about and if it is a good purchase for you. + +This game is neither free nor open source. We have covered it here because the game developers made an effort to port it to Linux. + +### Story Overview + +![steel rats][4] + +You belong to a biker gang – “ **Steel Rats** ” – who stepped up to protect their city from alien robots invasion. The alien robots aren’t just any tiny toys that you can easily defeat but with deadly weapons and abilities. + +The games features the setting as an alternative version of 1940’s USA – with the retro theme in place. You have to use your bike as the ultimate weapon to go against waves of alien robot and boss fights as well. + +You will encounter 4 different characters with unique abilities to switch from after progressing through a couple of rounds. + +You will start playing as “ **Toshi** ” and unlock other characters as you progress. **Toshi** is a genius and will be using a drone as his gadget to fight the alien robots. **James** – is the leader with the hammer attack as his special ability. **Lisa** would be the one utilizing fire to burn the junk robots. And, **Randall** will have his harpoon ready to destroy aerial robots with ease. + +### Gameplay + +![][5] + +Honestly, I am not a fan of 2.5 D (or 2D games). But, games like [Unravel][6] will be the exception – which is still not available for Linux, such a shame – EA. + +In this case, I did end up enjoying “ **Steel Rats** ” as one of the few 2D games I play. + +There is really no rocket science for this game – you just have to get good with the controls. No matter whether you use a controller or a keyboard, it is definitely challenging to get comfortable with the controls. + +You do not need to plan ahead in order to save your health or nitro boost because you will always have it when needed while also having checkpoints to resume your progress. + +You just need to keep the right pace and the perfect jump while hitting every enemy to get the best score in the leader boards. Once you do that, the game ends up being an easy and fun experience. + +If you’re curious about the gameplay, we recommend watching this video: + + Date: Thu, 14 Mar 2019 12:04:15 +0800 Subject: [PATCH 602/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20BackBo?= =?UTF-8?q?x=20Linux=20for=20Penetration=20Testing=20sources/tech/20190312?= =?UTF-8?q?=20BackBox=20Linux=20for=20Penetration=20Testing.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2 BackBox Linux for Penetration Testing.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20190312 BackBox Linux for Penetration Testing.md diff --git a/sources/tech/20190312 BackBox Linux for Penetration Testing.md b/sources/tech/20190312 BackBox Linux for Penetration Testing.md new file mode 100644 index 0000000000..b79a4a5cee --- /dev/null +++ b/sources/tech/20190312 BackBox Linux for Penetration Testing.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (BackBox Linux for Penetration Testing) +[#]: via: (https://www.linux.com/blog/learn/2019/3/backbox-linux-penetration-testing) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +BackBox Linux for Penetration Testing +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/security-2688911_1920.jpg?itok=yZ9TjAXu) + +Any given task can succeed or fail depending upon the tools at hand. For security engineers in particular, building just the right toolkit can make life exponentially easier. Luckily, with open source, you have a wide range of applications and environments at your disposal, ranging from simple commands to complicated and integrated tools. + +The problem with the piecemeal approach, however, is that you might wind up missing out on something that can make or break a job… or you waste a lot of time hunting down the right tools for the job. To that end, it’s always good to consider an operating system geared specifically for penetration testing (aka pentesting). + +Within the world of open source, the most popular pentesting distribution is [Kali Linux][1]. It is, however, not the only tool in the shop. In fact, there’s another flavor of Linux, aimed specifically at pentesting, called [BackBox][2]. BackBox is based on Ubuntu Linux, which also means you have easy access to a host of other outstanding applications besides those that are included, out of the box. + +### What Makes BackBox Special? + +BackBox includes a suite of ethical hacking tools, geared specifically toward pentesting. These testing tools include the likes of: + + * Web application analysis + + * Exploitation testing + + * Network analysis + + * Stress testing + + * Privilege escalation + + * Vulnerability assessment + + * Computer forensic analysis and exploitation + + * And much more + + + + +Out of the box, one of the most significant differences between Kali Linux and BackBox is the number of installed tools. Whereas Kali Linux ships with hundreds of tools pre-installed, BackBox significantly limits that number to around 70. Nonetheless, BackBox includes many of the tools necessary to get the job done, such as: + + * Ettercap + + * Msfconsole + + * Wireshark + + * ZAP + + * Zenmap + + * BeEF Browser Exploitation + + * Sqlmap + + * Driftnet + + * Tcpdump + + * Cryptcat + + * Weevely + + * Siege + + * Autopsy + + + + +BackBox is in active development, the latest version (5.3) was released February 18, 2019. But how is BackBox as a usable tool? Let’s install and find out. + +### Installation + +If you’ve installed one Linux distribution, you’ve installed them all … with only slight variation. BackBox is pretty much the same as any other installation. [Download the ISO][3], burn the ISO onto a USB drive, boot from the USB drive, and click the Install icon. + +The installer (Figure 1) will be instantly familiar to anyone who has installed a Ubuntu or Debian derivative. Just because BackBox is a distribution geared specifically toward security administrators, doesn’t mean the operating system is a challenge to get up and running. In fact, BackBox is a point-and-click affair that anyone, regardless of skills, can install. + +![installation][5] + +Figure 1: The installation of BackBox will be immediately familiar to anyone. + +[Used with permission][6] + +The trickiest section of the installation is the Installation Type. As you can see (Figure 2), even this step is quite simple. + +![BackBox][8] + +Figure 2: Selecting the type of installation for BackBox. + +[Used with permission][6] + +Once you’ve installed BackBox, reboot the system, remove the USB drive, and wait for it to land on the login screen. Log into the desktop and you’re ready to go (Figure 3). + +![desktop][10] + +Figure 3: The BackBox Linux desktop, running as a VirtualBox virtual machine. + +[Used with permission][6] + +### Using BackBox + +Thanks to the [Xfce desktop environment][11], BackBox is easy enough for a Linux newbie to navigate. Click on the menu button in the top left corner to reveal the menu (Figure 4). + +![desktop menu][13] + +Figure 4: The BackBox desktop menu in action. + +[Used with permission][6] + +From the desktop menu, click on any one of the favorites (in the left pane) or click on a category to reveal the related tools (Figure 5). + +![Auditing][15] + +Figure 5: The Auditing category in the BackBox menu. + +[Used with permission][6] + +The menu entries you’ll most likely be interested in are: + + * Anonymous - allows you to start an anonymous networking session. + + * Auditing - the majority of the pentesting tools are found in here. + + * Services - allows you to start/stop services such as Apache, Bluetooth, Logkeys, Networking, Polipo, SSH, and Tor. + + + + +Before you run any of the testing tools, I would recommend you first making sure to update and upgrade BackBox. This can be done via a GUI or the command line. If you opt to go the GUI route, click on the desktop menu, click System, and click Software Updater. When the updater completes its check for updates, it will prompt you if any are available, or if (after an upgrade) a reboot is necessary (Figure 6). + +![reboot][17] + +Figure 6: Time to reboot after an upgrade. + +[Used with permission][6] + +Should you opt to go the manual route, open a terminal window and issue the following two commands: + +``` +sudo apt-get update + +sudo apt-get upgrade -y +``` + +Many of the BackBox pentesting tools do require a solid understanding of how each tool works, so before you attempt to use any given tool, make sure you know how to use said tool. Some tools (such as Metasploit) are made a bit easier to work with, thanks to BackBox. To run Metasploit, click on the desktop menu button and click msfconsole from the favorites (left pane). When the tool opens for the first time, you’ll be asked to configure a few options. Simply select each default given by clicking your keyboard Enter key when prompted. Once you see the Metasploit prompt, you can run commands like: + +``` +db_nmap 192.168.0/24 +``` + +The above command will list out all discovered ports on a 192.168.1.x network scheme (Figure 7). + +![Metasploit][19] + +Figure 7: Open port discovery made simple with Metasploit on BackBox. + +[Used with permission][6] + +Even often-challenging tools like Metasploit are made far easier than they are with other distributions (partially because you don’t have to bother with installing the tools). That alone is worth the price of entry for BackBox (which is, of course, free). + +### The Conclusion + +Although BackBox usage may not be as widespread as Kali Linux, it still deserves your attention. For anyone looking to do pentesting on their various environments, BackBox makes the task far easier than so many other operating systems. Give this Linux distribution a go and see if it doesn’t aid you in your journey to security nirvana. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/3/backbox-linux-penetration-testing + +作者:[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.kali.org/ +[2]: https://linux.backbox.org/ +[3]: https://www.backbox.org/download/ +[4]: /files/images/backbox1jpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_1.jpg?itok=pn4fQVp7 (installation) +[6]: /licenses/category/used-permission +[7]: /files/images/backbox2jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_2.jpg?itok=tf-1zo8Z (BackBox) +[9]: /files/images/backbox3jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_3.jpg?itok=GLowoAUb (desktop) +[11]: https://www.xfce.org/ +[12]: /files/images/backbox4jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_4.jpg?itok=VmQXtuZL (desktop menu) +[14]: /files/images/backbox5jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_5.jpg?itok=UnfM_OxG (Auditing) +[16]: /files/images/backbox6jpg +[17]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/backbox_6.jpg?itok=2t1BiKPn (reboot) +[18]: /files/images/backbox7jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_7.jpg?itok=Vw_GEub3 (Metasploit) From 65afaf82a9694f63297c7a6cc6a6de4aadfabfd8 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:05:38 +0800 Subject: [PATCH 603/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20When?= =?UTF-8?q?=20the=20web=20grew=20up:=20A=20browser=20story=20sources/talk/?= =?UTF-8?q?20190312=20When=20the=20web=20grew=20up-=20A=20browser=20story.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2 When the web grew up- A browser story.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/talk/20190312 When the web grew up- A browser story.md diff --git a/sources/talk/20190312 When the web grew up- A browser story.md b/sources/talk/20190312 When the web grew up- A browser story.md new file mode 100644 index 0000000000..6a168939ad --- /dev/null +++ b/sources/talk/20190312 When the web grew up- A browser story.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (When the web grew up: A browser story) +[#]: via: (https://opensource.com/article/19/3/when-web-grew) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +When the web grew up: A browser story +====== +A personal story of when the internet came of age. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Internet_Sign.png?itok=5MFGKs14) + +Recently, I [shared how][1] upon leaving university in 1994 with a degree in English literature and theology, I somehow managed to land a job running a web server in a world where people didn't really know what a web server was yet. And by "in a world," I don't just mean within the organisation in which I worked, but the world in general. The web was new—really new—and people were still trying to get their heads around it. + +That's not to suggest that the place where I was working—an academic publisher—particularly "got it" either. This was a world in which a large percentage of the people visiting their website were still running 28k8 modems. I remember my excitement in getting a 33k6 modem. At least we were past the days of asymmetric upload/download speeds,1 where 1200/300 seemed like an eminently sensible bandwidth description. This meant that the high-design, high-colour, high-resolution documents created by the print people (with whom I shared a floor) were completely impossible on the web. I wouldn't allow anything bigger than a 40k GIF on the front page of the website, and that was pushing it for many of our visitors. Anything larger than 60k or so would be explicitly linked as a standalone image from a thumbnail on the referring page. + +To say that the marketing department didn't like this was an understatement. Even worse was the question of layout. "Browsers decide how to lay out documents," I explained, time after time, "you can use headers or paragraphs, but how documents appear on the page isn't defined by the document, but by the renderer!" They wanted control. They wanted different coloured backgrounds. After a while, they got that. I went to what I believe was the first W3C meeting at which the idea of Cascading Style Sheets (CSS) was discussed. And argued vehemently against them. The suggestion that document writers should control layout was anathema.2 It took some while for CSS to be adopted, and in the meantime, those who cared about such issues adopted the security trainwreck that was Portable Document Format (PDF). + +How documents were rendered wasn't the only issue. Being a publisher of actual physical books, the whole point of having a web presence, as far as the marketing department was concerned, was to allow customers—or potential customers—to know not only what a book was about, but also how much it was going to cost them to buy. This, however, presented a problem. You see, the internet—in which I include the rapidly growing World Wide Web—was an open, free-for-all libertarian sort of place where nobody was interested in money; in fact, where talk of money was to be shunned and avoided. + +I took the mainstream "Netizen" view that there was no place for pricing information online. My boss—and, indeed, pretty much everybody else in the organisation—took a contrary view. They felt that customers should be able to see how much books would cost them. They also felt that my bank manager would like to see how much money was coming into my bank account on a monthly basis, which might be significantly reduced if I didn't come round to their view. + +Luckily, by the time I'd climbed down from my high horse and got over myself a bit—probably only a few weeks after I'd started digging my heels in—the web had changed, and there were other people putting pricing information up about their products. These newcomers were generally looked down upon by the old schoolers who'd been running web servers since the early days,3 but it was clear which way the wind was blowing. This didn't mean that the battle was won for our website, however. As an academic publisher, we shared an academic IP name ("ac.uk") with the University. The University was less than convinced that publishing pricing information was appropriate until some senior folks at the publisher pointed out that Princeton University Press was doing it, and wouldn't we look a bit silly if…? + +The fun didn't stop there, either. A few months into my tenure as webmaster ("webmaster@…"), we started to see a worrying trend, as did lots of other websites. Certain visitors were single-handedly bringing our webserver to its knees. These visitors were running a new web browser: Netscape. Netscape was badly behaved. Netscape was multi-threaded. + +Why was this an issue? Well, before Netscape, all web browsers had been single-threaded. They would open one connection at a time, so even if you had, say five GIFs on a page,4 they would request the HTML base file, parse that, then download the first GIF, complete that, then the second, complete that, and so on. In fact, they often did the GIFs in the wrong order, which made for very odd page loading, but still, that was the general idea. The rude people at Netscape decided that they could open multiple connections to the webserver at a time to request all the GIFs at the same time, for example! And why was this a problem? Well, the problem was that most webservers were single-threaded. They weren't designed to have multiple connections open at any one time. Certainly, the HTTP server that we ran (MacHTTP) was single-threaded. Even though we had paid for it (it was originally shareware), the version we had couldn't cope with multiple requests at a time. + +The debate raged across the internet. Who did these Netscape people think they were, changing how the world worked? How it was supposed to work? The world settled into different camps, and as with all technical arguments, heated words were exchanged on both sides. The problem was that not only was Netscape multi-threaded, it was also just better than the alternatives. Lots of web server code maintainers, MacHTTP author Chuck Shotton among them, sat down and did some serious coding to produce multi-threaded beta versions of their existing code. Everyone moved almost immediately to the beta versions, they got stable, and in the end, single-threaded browsers either adapted and became multi-threaded themselves, or just went the way of all outmoded products and died a quiet death.6 + +This, for me, is when the web really grew up. It wasn't prices on webpages nor designers being able to define what you'd see on a page,8 but rather when browsers became easier to use and when the network effect of thousands of viewers moving to many millions tipped the balance in favour of the consumer, not the producer. There were more steps in my journey—which I'll save for another time—but from around this point, my employers started looking at our monthly, then weekly, then daily logs, and realising that this was actually going to be something big and that they'd better start paying some real attention. + +1\. How did they come back, again? + +2\. It may not surprise you to discover that I'm still happiest at the command line. + +3\. About six months before. + +4\. Reckless, true, but it was beginning to happen.5 + +5\. Oh, and no—it was GIFs or BMP. JPEG was still a bright idea that hadn't yet taken off. + +6\. It's never actually quiet: there are always a few diehard enthusiasts who insist that their preferred solution is technically superior and bemoan the fact that the rest of the internet has gone to the devil.7 + +7\. I'm not one to talk: I still use Lynx from time to time. + +8\. Creating major and ongoing problems for those with different accessibility needs, I would point out. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/when-web-grew + +作者:[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/article/18/11/how-web-was-won From 35c54b2a47e027c97f3ad382451a65a025bc93b7 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:13:43 +0800 Subject: [PATCH 604/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020160301=20How=20?= =?UTF-8?q?To=20Set=20Password=20Policies=20In=20Linux=20sources/tech/2016?= =?UTF-8?q?0301=20How=20To=20Set=20Password=20Policies=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 How To Set Password Policies In Linux.md | 356 ++++++++++++++++++ 1 file changed, 356 insertions(+) create mode 100644 sources/tech/20160301 How To Set Password Policies In Linux.md diff --git a/sources/tech/20160301 How To Set Password Policies In Linux.md b/sources/tech/20160301 How To Set Password Policies In Linux.md new file mode 100644 index 0000000000..bad7c279bc --- /dev/null +++ b/sources/tech/20160301 How To Set Password Policies In Linux.md @@ -0,0 +1,356 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Set Password Policies In Linux) +[#]: via: (https://www.ostechnix.com/how-to-set-password-policies-in-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Set Password Policies In Linux +====== +![](https://www.ostechnix.com/wp-content/uploads/2016/03/How-To-Set-Password-Policies-In-Linux-720x340.jpg) + +Even though Linux is secure by design, there are many chances for the security breach. One of them is weak passwords. As a System administrator, you must provide a strong password for the users. Because, mostly system breaches are happening due to weak passwords. This tutorial describes how to set password policies such as **password length** , **password complexity** , **password** **expiration period** etc., in DEB based systems like Debian, Ubuntu, Linux Mint, and RPM based systems like RHEL, CentOS, Scientific Linux. + +### Set password length in DEB based systems + +By default, all Linux operating systems requires **password length of minimum 6 characters** for the users. I strongly advice you not to go below this limit. Also, don’t use your real name, parents/spouse/kids name, or your date of birth as a password. Even a novice hacker can easily break such kind of passwords in minutes. The good password must always contains more than 6 characters including a number, a capital letter, and a special character. + +Usually, the password and authentication-related configuration files will be stored in **/etc/pam.d/** location in DEB based operating systems. + +To set minimum password length, edit**/etc/pam.d/common-password** file; + +``` +$ sudo nano /etc/pam.d/common-password +``` + +Find the following line: + +``` +password [success=2 default=ignore] pam_unix.so obscure sha512 +``` + +![][2] + +And add an extra word: **minlen=8** at the end. Here I set the minimum password length as **8**. + +``` +password [success=2 default=ignore] pam_unix.so obscure sha512 minlen=8 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_002-3-1.jpg) + +Save and close the file. So, now the users can’t use less than 8 characters for their password. + +### Set password length in RPM based systems + +**In RHEL, CentOS, Scientific Linux 7.x** systems, run the following command as root user to set password length. + +``` +# authconfig --passminlen=8 --update +``` + +To view the minimum password length, run: + +``` +# grep "^minlen" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +minlen = 8 +``` + +**In RHEL, CentOS, Scientific Linux 6.x** systems, edit **/etc/pam.d/system-auth** file: + +``` +# nano /etc/pam.d/system-auth +``` + +Find the following line and add the following at the end of the line: + +``` +password requisite pam_cracklib.so try_first_pass retry=3 type= minlen=8 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/root@server_003-3.jpg) + +As per the above setting, the minimum password length is **8** characters. + +### Set password complexity in DEB based systems + +This setting enforces how many classes, i.e upper-case, lower-case, and other characters, should be in a password. + +First install password quality checking library using command: + +``` +$ sudo apt-get install libpam-pwquality +``` + +Then, edit **/etc/pam.d/common-password** file: + +``` +$ sudo nano /etc/pam.d/common-password +``` + +To set at least one **upper-case** letters in the password, add a word **‘ucredit=-1’** at the end of the following line. + +``` +password requisite pam_pwquality.so retry=3 ucredit=-1 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_001-7.jpg) + +Set at least one **lower-case** letters in the password as shown below. + +``` +password requisite pam_pwquality.so retry=3 dcredit=-1 +``` + +Set at least **other** letters in the password as shown below. + +``` +password requisite pam_pwquality.so retry=3 ocredit=-1 +``` + +As you see in the above examples, we have set at least (minimum) one upper-case, lower-case, and a special character in the password. You can set any number of maximum allowed upper-case, lower-case, and other letters in your password. + +You can also set the minimum/maximum number of allowed classes in the password. + +The following example shows the minimum number of required classes of characters for the new password: + +``` +password requisite pam_pwquality.so retry=3 minclass=2 +``` + +### Set password complexity in RPM based systems + +**In RHEL 7.x / CentOS 7.x / Scientific Linux 7.x:** + +To set at least one lower-case letter in the password, run: + +``` +# authconfig --enablereqlower --update +``` + +To view the settings, run: + +``` +# grep "^lcredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +lcredit = -1 +``` + +Similarly, set at least one upper-case letter in the password using command: + +``` +# authconfig --enablerequpper --update +``` + +To view the settings: + +``` +# grep "^ucredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +ucredit = -1 +``` + +To set at least one digit in the password, run: + +``` +# authconfig --enablereqdigit --update +``` + +To view the setting, run: + +``` +# grep "^dcredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +dcredit = -1 +``` + +To set at least one other character in the password, run: + +``` +# authconfig --enablereqother --update +``` + +To view the setting, run: + +``` +# grep "^ocredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +ocredit = -1 +``` + +In **RHEL 6.x / CentOS 6.x / Scientific Linux 6.x systems** , edit **/etc/pam.d/system-auth** file as root user: + +``` +# nano /etc/pam.d/system-auth +``` + +Find the following line and add the following at the end of the line: + +``` +password requisite pam_cracklib.so try_first_pass retry=3 type= minlen=8 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1 +``` + +As per the above setting, the password must have at least 8 characters. In addtion, the password should also have at least one upper-case letter, one lower-case letter, one digit, and one other characters. + +### Set password expiration period in DEB based systems + +Now, We are going to set the following policies. + + 1. Maximum number of days a password may be used. + 2. Minimum number of days allowed between password changes. + 3. Number of days warning given before a password expires. + + + +To set this policy, edit: + +``` +$ sudo nano /etc/login.defs +``` + +Set the values as per your requirement. + +``` +PASS_MAX_DAYS 100 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_002-8.jpg) + +As you see in the above example, the user should change the password once in every **100** days and the warning message will appear **7** days before password expiration. + +Be mindful that these settings will impact the newly created users. + +To set maximum number of days between password change to existing users, you must run the following command: + +``` +$ sudo chage -M +``` + +To set minimum number of days between password change, run: + +``` +$ sudo chage -m +``` + +To set warning before password expires, run: + +``` +$ sudo chage -W +``` + +To display the password for the existing users, run: + +``` +$ sudo chage -l sk +``` + +Here, **sk** is my username. + +**Sample output:** + +``` +Last password change : Feb 24, 2017 +Password expires : never +Password inactive : never +Account expires : never +Minimum number of days between password change : 0 +Maximum number of days between password change : 99999 +Number of days of warning before password expires : 7 +``` + +As you see in the above output, the password never expires. + +To change the password expiration period of an existing user, + +``` +$ sudo chage -E 24/06/2018 -m 5 -M 90 -I 10 -W 10 sk +``` + +The above command will set password of the user **‘sk’** to expire on **24/06/2018**. Also the the minimum number days between password change is set 5 days and the maximum number of days between password changes is set to **90** days. The user account will be locked automatically after **10 days** and It will display a warning message for **10 days** before password expiration. + +### Set password expiration period in RPM based systems + +This is same as DEB based systems. + +### Forbid previously used passwords in DEB based systems + +You can limit the users to set a password which is already used in the past. To put this in layman terms, the users can’t use the same password again. + +To do so, edit**/etc/pam.d/common-password** file: + +``` +$ sudo nano /etc/pam.d/common-password +``` + +Find the following line and add the word **‘remember=5’** at the end: + +``` +password        [success=2 default=ignore]      pam_unix.so obscure use_authtok try_first_pass sha512 remember=5 +``` + +The above policy will prevent the users to use the last 5 used passwords. + +### Forbid previously used passwords in RPM based systems + +This is same for both RHEL 6.x and RHEL 7.x and it’s clone systems like CentOS, Scientific Linux. + +Edit **/etc/pam.d/system-auth** file as root user, + +``` +# vi /etc/pam.d/system-auth +``` + +Find the following line, and add **remember=5** at the end. + +``` +password     sufficient     pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=5 +``` + +You know now what is password policies in Linux, and how to set different password policies in DEB and RPM based systems. + +That’s all for now. I will be here soon with another interesting and useful article. Until then stay tuned with OSTechNix. If you find this tutorial helpful, share it on your social, professional networks and support us. + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-set-password-policies-in-linux/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_003-2-1.jpg From a7a717f3d00e5bfdfa8365cba2f79df76b65caab Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:15:21 +0800 Subject: [PATCH 605/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20Small?= =?UTF-8?q?=20Scale=20Scrum=20vs.=20Large=20Scale=20Scrum=20sources/talk/2?= =?UTF-8?q?0190307=20Small=20Scale=20Scrum=20vs.=20Large=20Scale=20Scrum.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Small Scale Scrum vs. Large Scale Scrum.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md diff --git a/sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md b/sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md new file mode 100644 index 0000000000..7da83306a5 --- /dev/null +++ b/sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Small Scale Scrum vs. Large Scale Scrum) +[#]: via: (https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum) +[#]: author: (Agnieszka Gancarczyk https://opensource.com/users/agagancarczyk) + +Small Scale Scrum vs. Large Scale Scrum +====== +We surveyed individual members of small and large scrum teams. Here are some key findings. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_crowdvsopen.png?itok=AFjno_8v) + +Following the publication of the [Small Scale Scrum framework][1], we wanted to collect feedback on how teams in our target demographic (consultants, open source developers, and students) work and what they value. With this first opportunity to inspect, adapt, and help shape the next stage of Small Scale Scrum, we decided to create a survey to capture some data points and begin to validate some of our assumptions and hypotheses. + +**[[Download the Introduction to Small Scale Scrum guide]][2]** + +Our reasons for using the survey were multifold, but chief among them were the global distribution of teams, the small local data sample available in our office, access to customers, and the industry’s utilization of surveys (e.g., the [Stack Overflow Developer Survey 2018][3], [HackerRank 2018 Developer Skills Report][4], and [GitLab 2018 Global Developer Report][5]). + +The scrum’s iterative process was used to facilitate the creation of the survey shown below: + +![](https://opensource.com/sites/default/files/uploads/survey_process.png) + +[The survey][6], which we invite you to complete, consisted of 59 questions and was distributed at a local college ([Waterford Institute of Technology][7]) and to Red Hat's consultancy and engineering teams. Our initial data was gathered from the responses of 54 individuals spread across small and large scrum teams, who were asked about their experiences with agile within their teams. + +Here are the main results and initial findings of the survey: + + * A full 96% of survey participants practice a form of agile, work in distributed teams, think scrum principles help them reduce development complexity, and believe agile contributes to the success of their projects. + + * Only 8% of survey participants belong to small (one- to three-person) teams, and 10 out of 51 describe their typical project as short-lived (three months or less). + + * The majority of survey participants were software engineers, but quality engineers (QE), project managers (PM), product owners (PO), and scrum masters were also represented. + + * Scrum master, PO, and team member are typical roles in projects. + + * Nearly half of survey respondents work on, or are assigned to, more than one project at the same time. + + * Almost half of projects are customer/value-generating vs. improvement/not directly value-generating or unclassified. + + * Almost half of survey participants said that their work is clarified sometimes or most of the time and estimated before development with extensions available sometimes or most of the time. They said asking for clarification of work items is the team’s responsibility. + + * Almost half of survey respondents said they write tests for their code, and they adhere to best coding practices, document their code, and get their code reviewed before merging. + + * Almost all survey participants introduce bugs to the codebase, which are prioritized by them, the team, PM, PO, team lead, or the scrum master. + + * Participants ask for help and mentoring when a task is complex. They also take on additional roles on their projects when needed, including business analyst, PM, QE, and architect, and they sometimes find changing roles difficult. + + * When changing roles on a daily basis, individuals feel they lose one to two hours on average, but they still complete their work on time most of the time. + + * Most survey participants use scrum (65%), followed by hybrid (18%) and Kanban (12%). This is consistent with results of [VersionOne’s State of Agile Report][8]. + + * The daily standup, sprint, sprint planning and estimating, backlog grooming, and sprint retrospective are among the top scrum ceremonies and principles followed, and team members do preparation work before meetings. + + * The majority of sprints (62%) are three weeks long, followed by two-week sprints (26%), one-week sprints (6%), and four-week sprints (4%). Two percent of participants are not using sprints due to strict release and update timings, with all activities organized and planned around those dates. + + * Teams use [planning poker][9] to estimate (storypoint) user stories. User stories contain acceptance criteria. + + * Teams create and use a [Definition of Done][10] mainly in respect to features and determining completion of user stories. + + * The majority of teams don’t have or use a [Definition of Ready][11] to ensure that user stories are actionable, testable, and clear. + + * Unit, integration, functional, automated, performance/load, and acceptance tests are commonly used. + + * Overall collaboration between team members is considered high, and team members use various communication channels. + + * The majority of survey participants spend more than four hours weekly in meetings, including face-to-face meetings, web conferences, and email communication. + + * The majority of customers are considered large, and half of them understand and follow scrum principles. + + * Customers respect “no deadlines” most of the time and sometimes help create user stories and participate in sprint planning, sprint review and demonstration, sprint retrospective, and backlog review and refinement. + + * Only 27% of survey participants know their customers have a high level of satisfaction with the adoption of agile, while the majority (58%) don’t know this information at all. + + + + +These survey results will inform the next stage of our data-gathering exercise. We will apply Small Scale Scrum to real-world projects, and the guidance obtained from the survey will help us gather key data points as we move toward version 2.0 of Small Scale Scrum. If you want to help, take our [survey][6]. If you have a project to which you'd like to apply Small Scale Scrum, please get in touch. + +[Download the Introduction to Small Scale Scrum guide][2] + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum + +作者:[Agnieszka Gancarczyk][a] +选题:[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/agagancarczyk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/small-scale-scrum-framework +[2]: https://opensource.com/downloads/small-scale-scrum +[3]: https://insights.stackoverflow.com/survey/2018/ +[4]: https://research.hackerrank.com/developer-skills/2018/ +[5]: https://about.gitlab.com/developer-survey/2018/ +[6]: https://docs.google.com/forms/d/e/1FAIpQLScAXf52KMEiEzS68OOIsjLtwZJto_XT7A3b9aB0RhasnE_dEw/viewform?c=0&w=1 +[7]: https://www.wit.ie/ +[8]: https://explore.versionone.com/state-of-agile/versionone-12th-annual-state-of-agile-report +[9]: https://en.wikipedia.org/wiki/Planning_poker +[10]: https://www.scruminc.com/definition-of-done/ +[11]: https://www.scruminc.com/definition-of-ready/ From b4d37cb2cc442f0eeb94878ffb2273129e09fb85 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:17:48 +0800 Subject: [PATCH 606/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=2013=20o?= =?UTF-8?q?pen=20source=20backup=20solutions=20sources/tech/20190307=2013?= =?UTF-8?q?=20open=20source=20backup=20solutions.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0190307 13 open source backup solutions.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20190307 13 open source backup solutions.md diff --git a/sources/tech/20190307 13 open source backup solutions.md b/sources/tech/20190307 13 open source backup solutions.md new file mode 100644 index 0000000000..86c5547e8b --- /dev/null +++ b/sources/tech/20190307 13 open source backup solutions.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (13 open source backup solutions) +[#]: via: (https://opensource.com/article/19/3/backup-solutions) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +13 open source backup solutions +====== +Readers suggest more than a dozen of their favorite solutions for protecting data. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8) + +Recently, we published a [poll][1] that asked readers to vote on their favorite open source backup solution. We offered six solutions recommended by our [moderator community][2]—Cronopete, Deja Dup, Rclone, Rdiff-backup, Restic, and Rsync—and invited readers to share other options in the comments. And you came through, offering 13 other solutions (so far) that we either hadn't considered or hadn't even heard of. + +By far the most popular suggestion was [BorgBackup][3]. It is a deduplicating backup solution that features compression and encryption. It is supported on Linux, MacOS, and BSD and has a BSD License. + +Second was [UrBackup][4], which does full and incremental image and file backups; you can save whole partitions or single directories. It has clients for Windows, Linux, and MacOS and has a GNU Affero Public License. + +Third was [LuckyBackup][5]; according to its website, "it is simple to use, fast (transfers over only changes made and not all data), safe (keeps your data safe by checking all declared directories before proceeding in any data manipulation), reliable, and fully customizable." It carries a GNU Public License. + +[Casync][6] is content-addressable synchronization—it's designed for backup and synchronizing and stores and retrieves multiple related versions of large file systems. It is licensed with the GNU Lesser Public License. + +[Syncthing][7] synchronizes files between two computers. It is licensed with the Mozilla Public License and, according to its website, is secure and private. It works on MacOS, Windows, Linux, FreeBSD, Solaris, and OpenBSD. + +[Duplicati][8] is a free backup solution that works on Windows, MacOS, and Linux and a variety of standard protocols, such as FTP, SSH, and WebDAV, and cloud services. It features strong encryption and is licensed with the GPL. + +[Dirvish][9] is a disk-based virtual image backup system licensed under OSL-3.0. It also requires Rsync, Perl5, and SSH to be installed. + +[Bacula][10]'s website says it "is a set of computer programs that permits the system administrator to manage backup, recovery, and verification of computer data across a network of computers of different kinds." It is supported on Linux, FreeBSD, Windows, MacOS, OpenBSD, and Solaris and the bulk of its source code is licensed under AGPLv3. + +[BackupPC][11] "is a high-performance, enterprise-grade system for backing up Linux, Windows, and MacOS PCs and laptops to a server's disk," according to its website. It is licensed under the GPLv3. + +[Amanda][12] is a backup system written in C and Perl that allows a system administrator to back up an entire network of client machines to a single server using tape, disk, or cloud-based systems. It was developed and copyrighted in 1991 at the University of Maryland and has a BSD-style license. + +[Back in Time][13] is a simple backup utility designed for Linux. It provides a command line client and a GUI, both written in Python. To do a backup, just specify where to store snapshots, what folders to back up, and the frequency of the backups. BackInTime is licensed with GPLv2. + +[Timeshift][14] is a backup utility for Linux that is similar to System Restore for Windows and Time Capsule for MacOS. According to its GitHub repository, "Timeshift protects your system by taking incremental snapshots of the file system at regular intervals. These snapshots can be restored at a later date to undo all changes to the system." + +[Kup][15] is a backup solution that was created to help users back up their files to a USB drive, but it can also be used to perform network backups. According to its GitHub repository, "When you plug in your external hard drive, Kup will automatically start copying your latest changes." + +Thanks for sharing your favorite open source backup solutions in our poll! If there are still others that haven't been mentioned yet, please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/backup-solutions + +作者:[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/article/19/2/linux-backup-solutions +[2]: https://opensource.com/opensourcecom-team +[3]: https://www.borgbackup.org/ +[4]: https://www.urbackup.org/ +[5]: http://luckybackup.sourceforge.net/ +[6]: http://0pointer.net/blog/casync-a-tool-for-distributing-file-system-images.html +[7]: https://syncthing.net/ +[8]: https://www.duplicati.com/ +[9]: http://dirvish.org/ +[10]: https://www.bacula.org/ +[11]: https://backuppc.github.io/backuppc/ +[12]: http://www.amanda.org/ +[13]: https://github.com/bit-team/backintime +[14]: https://github.com/teejee2008/timeshift +[15]: https://github.com/spersson/Kup From 6194ac3348dbdf653226b22ab3ff794702dc8e32 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:48:16 +0800 Subject: [PATCH 607/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20How=20?= =?UTF-8?q?to=20Restart=20a=20Network=20in=20Ubuntu=20[Beginner=E2=80=99s?= =?UTF-8?q?=20Tip]=20sources/tech/20190307=20How=20to=20Restart=20a=20Netw?= =?UTF-8?q?ork=20in=20Ubuntu=20-Beginner-s=20Tip.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...art a Network in Ubuntu -Beginner-s Tip.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md diff --git a/sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md b/sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md new file mode 100644 index 0000000000..44d5531d83 --- /dev/null +++ b/sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Restart a Network in Ubuntu [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/restart-network-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Restart a Network in Ubuntu [Beginner’s Tip] +====== + +You’re [using an Ubuntu-based system and you just can’t seem to connect to your network][1]? You’d be surprised how many problems can a simple restart fix. + +In this article, I’ll go over multiple ways you can restart network in Ubuntu and other Linux distributions, so you can use whatever suits your needs. The methods are basically divided into two parts: + +![Ubuntu Restart Network][2] + +### Restart network in Ubuntu using command line + +If you are using Ubuntu server edition, you are already in the terminal. If you are using the desktop edition, you can access the terminal using Ctrl+Alt+T [keyboard shortcut in Ubuntu][3]. + +Now you have several commands at your disposal to restart network in Ubuntu. Some (or perhaps most) commands mentioned here should be applicable for restarting network in Debian and other Linux distributions as well. + +#### 1\. network manager service + +This is the easiest way to restart your network using the command line. It’s equivalent to the graphical way of doing it (restarts the Network-Manager service). + +``` +sudo service network-manager restart +``` + +The network icon should disappear for a moment and then reappear. + +#### 2\. systemd + +The **service** command is just a wrapper for this method (and also for init.d scripts and Upstart commands). The **systemctl** command is much more versatile than **service**. This is what I usually prefer. + +``` +sudo systemctl restart NetworkManager.service +``` + +The network icon (again) should disappear for a moment. To check out other **systemctl** options, you can refer to its man page. + +#### 3\. nmcli + +This is yet another tool for handling networks on a Linux machine. It is a pretty powerful tool that I find very practical. Many sysadmins prefer it since it is easy to use. + +There are two steps to this method: turning the network off, and then turning it back on. + +``` +sudo nmcli networking off +``` + +The network will shut down and the icon will disappear. To turn it back on: + +``` +sudo nmcli networking on +``` + +You can check out the man page of nmcli for more options. + +#### 4\. ifup & ifdown + +This commands handle a network interface directly, changing it’s state to one in which it either can or can not transmit and receive data. It’s one of the [must know networking commands in Linux][4]. + +To shut down all network interfaces, use ifdown and then use ifup to turn all network interfaces back on. + +A good practice would be to combine both of these commands: + +``` +sudo ifdown -a && sudo ifup -a +``` + +**Note:** This method will not make the network icon in your systray disappear, and yet you won’t be able to have a connection of any sort. + +**Bonus tool: nmtui (click to expand)** + +This is another method often used by system administrators. It is a text menu for managing networks right in your terminal. + +``` +nmtui +``` + +This should open up the following menu: + +![nmtui Menu][5] + +**Note** that in **nmtui** , you can select another option by using the **up** and **down arrow keys**. + +Select **Activate a connection** : + +![nmtui Menu Select "Activate a connection"][6] + +Press **Enter**. This should now open the **connections** menu. + +![nmtui Connections Menu][7] + +Here, go ahead and select the network with a **star (*)** next to it. In my case, it’s MGEO72. + +![Select your connection in the nmtui connections menu.][8] + +Press **Enter**. This should **deactivate** your connection. + +![nmtui Connections Menu with no active connection][9] + +Select the connection you want to activate: + +![Select the connection you want in the nmtui connections menu.][10] + +Press **Enter**. This should reactivate the selected connection. + +![nmtui Connections Menu][11] + +Press **Tab** twice to select **Back** : + +![Select "Back" in the nmtui connections menu.][12] + +Press **Enter**. This should bring you back to the **nmtui** main menu. + +![nmtui Main Menu][13] + +Select **Quit** : + +![nmtui Quit Main Menu][14] + +This should exit the application and bring you back to your terminal. + +That’s it! You have successfully restarted your network + +### Restart network in Ubuntu graphically + +This is, of course, the easiest way of restarting the network for Ubuntu desktop users. If this one doesn’t work, you can of course check the command line options mentioned in the previous section. + +NM-applet is the system tray applet indicator for [NetworkManager][15]. That’s what we’re going to use to restart our network. + +First of all, check out your top panel. You should find a network icon in your system tray (in my case, it is a Wi-Fi icon, since that’s what I use). + +Go ahead and click on that icon (or the sound or battery icon). This will open up the menu. Select “Turn Off” here. + +![Restart network in Ubuntu][16]Turn off your network + +The network icon should now disappear from the top panel. This means the network has been successfully turned off. + +Click again on your systray to reopen the menu. Select “Turn On”. + +![Restarting network in Ubuntu][17]Turn the network back on + +Congratulations! You have now restarted your network. + +#### Bonus Tip: Refresh available network list + +Suppose you are connected to a network already but you want to connect to another network. How do you refresh the WiFi to see what other networks are available? Let me show you that. + +Ubuntu doesn’t have a ‘refresh wifi networks’ option directly. It’s sort of hidden. + +You’ll have to open the setting menu again and this time, click on “Select Network”. + +![Refresh wifi network list in Ubuntu][18]Select Network to change your WiFi connection + +Now, you won’t see the list of available wireless networks immediately. When you open the networks list, it takes around 5 seconds to refresh and show up other available wireless networks. + +![Select another wifi network in Ubuntu][19]Wait for around 5- seconds to see other available networks + +And here, you can select the network of your choice and click connect. That’s it. + +**Wrapping Up** + +Restarting your network or connection is something that every Linux user has to go through at some point in their experience. + +We hope that we helped you with plenty of methods for handling such issues! + +What do you use to restart/handle your network? Is there something we missed? Leave us a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/restart-network-ubuntu + +作者:[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/fix-no-wireless-network-ubuntu/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu-restart-network.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://itsfoss.com/basic-linux-networking-commands/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmtui_menu.png?fit=800%2C602&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmtui_menu_select_option.png?fit=800%2C579&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_on.png?fit=800%2C585&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_select_connection_on.png?fit=800%2C576&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_off.png?fit=800%2C572&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_select_connection_off.png?fit=800%2C566&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_on-1.png?fit=800%2C585&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_back.png?fit=800%2C585&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmtui_menu_select_option-1.png?fit=800%2C579&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_menu_quit.png?fit=800%2C580&ssl=1 +[15]: https://wiki.gnome.org/Projects/NetworkManager +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/restart-network-ubuntu-1.jpg?resize=800%2C400&ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/restart-network-ubuntu-2.jpg?resize=800%2C400&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/select-wifi-network-ubuntu.jpg?resize=800%2C400&ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/select-wifi-network-ubuntu-1.jpg?resize=800%2C400&ssl=1 +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu-restart-network.png?fit=800%2C450&ssl=1 From b60368e283b1f88cf46675893ee4ed477f0951ee Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:49:19 +0800 Subject: [PATCH 608/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20How=20?= =?UTF-8?q?to=20pack=20an=20IT=20travel=20kit=20sources/talk/20190306=20Ho?= =?UTF-8?q?w=20to=20pack=20an=20IT=20travel=20kit.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190306 How to pack an IT travel kit.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/talk/20190306 How to pack an IT travel kit.md diff --git a/sources/talk/20190306 How to pack an IT travel kit.md b/sources/talk/20190306 How to pack an IT travel kit.md new file mode 100644 index 0000000000..b05ee460b7 --- /dev/null +++ b/sources/talk/20190306 How to pack an IT travel kit.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to pack an IT travel kit) +[#]: via: (https://opensource.com/article/19/3/it-toolkit-remote) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +How to pack an IT travel kit +====== +Before you travel, make sure you're ready for challenges in hardware, infrastructure, and software. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) + +I've had several opportunities to do IT work in less-developed and remote areas, where internet coverage and technology access aren't at the high level we have in our first-world cities. Many people heading off to undeveloped areas ask me for advice on preparing for the local technology landscape. Since conditions vary greatly around this big world, it's impossible to give specific advice for most areas, but I do have some general suggestions based on my experience that may help you. + +Also, before you leave home, do as much research as you can about the general IT and telecom environment where you are traveling so you're a little better prepared for what you may encounter there. + +### Planning for the local hardware and infrastructure + + * Even in many cities, internet connections tend to be expensive, slow, and not reliable for large downloads. Don't forget that internet coverage, speeds, and cost in cities are unlikely to be matched in more remote areas. + + + * The electricity supply may be unreliable with inconsistent voltage. If you are taking your computer, bring some surge protection—although in my experience, the electricity voltage is more likely to drop than to spike. + + + * It is always useful to have a small selection of hand tools, such as screwdrivers and needle-nose pliers, for repairing computer hardware. A lack of spare parts can limit opportunities for much beyond basic troubleshooting, although stripping usable components from dead computers can be worthwhile. + + + +### Planning for the software you'll find + + * You can assume that most of the computer systems you'll find will be some incarnation of Microsoft Windows. You can expect that many will not be officially licensed, not be getting updates nor security patches, and are infected by multiple viruses and other malware. + + + * You can also expect that most application software will be proprietary and much of it will be unlicensed and lag behind the latest release versions. These conditions are depressing for open source enthusiasts, but this is the world as it is, rather than the world we would like it to be. + + + * It is wise to view any Windows system you do not control as potentially infected with viruses and malware. It's good practice to reserve a USB thumb drive for files you'll use with these Windows systems; this means that if (or more likely when) that thumb drive becomes infected, you can just reformat it at no cost. + + + * Bring copies of free antivirus software such as [AVG][1] and [Avast][2], including recent virus definition files for them, as well as virus removal and repair tools such as [Sophos][3] and [Hirens Boot CD][4]. + + + * Trying to keep software current on machines that have no or infrequent access to the internet is a challenge. This is particularly true with web browsers, which tend to go through rapid release cycles. My preferred web browser is Mozilla Firefox and having a copy of the latest release is useful. + + + * Bring repair discs for a selection of recent Microsoft operating systems, and make sure that includes service packs for Windows and Microsoft Office. + + + +### Planning for the software you'll bring + +There's no better way to convey the advantages of open source software than by showing it to people. Here are some recommendations along that line. + + * When gathering software to take with you, make sure you get the full offline installation option. Often, the most prominently displayed download links on websites are stubs that require internet access to download the components. They won't work if you're in an area with poor (or no) internet service. + + + * Also, make sure to get the 32-bit and 64-bit versions of the software. While 32-bit machines are becoming less common, you may encounter them and it's best to be prepared. + + + * Having a [bootable version of Linux][5] is vital for two reasons. First, it can be used to rescue data from a seriously damaged Windows machine. Second, it's an easy way to show off Linux without installing it on someone's machine. [Linux Mint][6] is my favorite distro for this purpose, because the graphical interface (GUI) is similar enough to Windows to appear non-threatening and it includes a good range of application software. + + + * Bring the widest selection of open source applications you can—you can't count on being able to download something from the internet. + + + * When possible, bring your open source software library as portable applications that will run without installing them. One of the many ways to mess up those Windows machines is to install and uninstall a lot of software, and using portable apps gets around this problem. Many open source applications, including Libre Office, GIMP, Blender, and Inkscape, have portable app versions for Windows. + + + * It's smart to bring a supply of blank disks so you can give away copies of your open source software stash on media that is a bit more secure than a USB thumb drive. + + + * Don't forget to bring programs and resources related to projects you will be working on. (For example, most of my overseas work involves tuition, mentoring, and skills transfer, so I usually add a selection of open source software tools for creating learning resources.) + + + +### Your turn + +There are many variables and surprises when doing IT work in undeveloped areas. If you have suggestions—for programs I've missed or tips that I didn't cover—please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/it-toolkit-remote + +作者:[Peter Cheer][a] +选题:[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/petercheer +[b]: https://github.com/lujun9972 +[1]: https://www.avg.com/en-gb/free-antivirus-download +[2]: https://www.avast.com/en-gb/free-antivirus-download +[3]: https://www.sophos.com/en-us/products/free-tools/virus-removal-tool.aspx +[4]: https://www.hiren.info/ +[5]: https://opensource.com/article/18/7/getting-started-etcherio +[6]: https://linuxmint.com/ From 2e8694207d205c6fb6a81f1e0c0a9563136dabc0 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:54:20 +0800 Subject: [PATCH 609/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Get=20?= =?UTF-8?q?cooking=20with=20GNOME=20Recipes=20on=20Fedora=20sources/tech/2?= =?UTF-8?q?0190306=20Get=20cooking=20with=20GNOME=20Recipes=20on=20Fedora.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...et cooking with GNOME Recipes on Fedora.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md diff --git a/sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md b/sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md new file mode 100644 index 0000000000..0c2eabdcdf --- /dev/null +++ b/sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get cooking with GNOME Recipes on Fedora) +[#]: via: (https://fedoramagazine.org/get-cooking-with-gnome-recipes-on-fedora/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) + +Get cooking with GNOME Recipes on Fedora +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/03/gnome-recipes-816x345.jpg) + +Do you love to cook? Looking for a better way to manage your recipes using Fedora? GNOME Recipes is an awesome application available to install in Fedora to store and organize your recipe collection. + +![][1] + +GNOME Recipes is an recipe management tool from the GNOME project. It has the visual style of a modern GNOME style application, and feels similar to GNOME Software, but for food. + +### Installing GNOME Recipes + +Recipes is available to install from the 3rd party Flathub repositories. If you have never installed an application from Flathub before, set it up using the following guide: + +[Install Flathub apps on Fedora](https://fedoramagazine.org/install-flathub-apps-fedora/) + +After correctly setting up Flathub as a software source, you will be able to search for and install Recipes via GNOME Software. + +### Recipe management + +Recipes allows you to manually add your own collection of recipes, including photos, ingredients, directions, as well as extra metadata like preparation time, cuisine style, and spiciness. + +![][2] + +When entering in a new item, GNOME Recipes there are a range of different measurement units to choose from, as well as special tags for items like temperature, allowing you to easily switch units. + +### Community recipes + +In addition to manually entering in your favourite dishes for your own use, it also allows you to find, use, and contribute recipes to the community. Additionally, you can mark your favourites, and search the collection by the myriad of metadata available for each recipe. + +![][3] + +### Step by step guidance + +One of the awesome little features in GNOME Recipes is the step by step fullscreen mode. When you are ready to cook, simply activate this mode, move you laptop to the kitchen, and you will have a full screen display of the current step in the cooking method. Futhermore, you can set up the recipes to have timers displayed on this mode when something is in the oven. + +![][4] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/get-cooking-with-gnome-recipes-on-fedora/ + +作者:[Ryan Lerch][a] +选题:[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/introducing-flatpak/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-from-2019-03-06-19-45-06-1024x727.png +[2]: https://fedoramagazine.org/wp-content/uploads/2019/03/gnome-recipes1-1024x727.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-from-2019-03-06-20-08-45-1024x725.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-from-2019-03-06-20-39-44-1024x640.png From 1139a896112a166e247a2c5fb6c04de6bd4d5c74 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:55:37 +0800 Subject: [PATCH 610/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Blockc?= =?UTF-8?q?hain=202.0:=20An=20Introduction=20[Part=201]=20sources/tech/201?= =?UTF-8?q?90301=20Blockchain=202.0-=20An=20Introduction=20-Part=201.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Blockchain 2.0- An Introduction -Part 1.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md diff --git a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md new file mode 100644 index 0000000000..e8922aa789 --- /dev/null +++ b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: An Introduction [Part 1]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: An Introduction [Part 1] +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/blockchain-introduction-720x340.png) + +### Blockchain 2.0 – The next paradigm of computing + +The **Blockchain** is now easily distinguishable as a transformational technology poised to bring in revolutionary changes in the way people use the internet. The present series of posts will explore the upcoming wave of Blockchain 2.0 based technologies and applications. The Blockchain is here to stay as evidenced by the tremendous interest in it shown by different stakeholders. + +Staying on top of what it is and how it works is paramount to anyone who plans on using the internet for literally anything. Even if all you do is just stare at your friends’ morning breakfast pics on Instagram or looking for the next best clip to watch, you need to know what this technology can do to all of that. + +Even though the basic concept behind the Blockchain was first talked about in academia in the **1990s** , its prominence to being a trending buzzword among netizens is owed to the rise of payment platforms such as **Bitcoins** and **Ethers**. + +Bitcoin started off as a decentralized digital currency. Its advent meant that you could basically pay people over the internet being totally anonymous, safe and secure. What lay beneath the simple financial token system that was bitcoin though was the BLOCKCHAIN. You can think of Bitcoin technology or any cryptocurrency for that matter as being built up from 3 layers. There’s the foundational Blockchain tech that verifies, records and confirms transactions, on top of the foundation rests the protocol, basically, a rule or an online etiquette to honor, record and confirm transactions and of course, on top of it all is the cryptocurrency token commonly called Bitcoin. A token is generated by the Blockchain once a transaction respecting the protocol is recorded on it. + +While most people only saw the top layer, the coins or tokens being representative of what bitcoin really was, few ventured deep enough to understand that financial transactions were just one of many such possibilities that could be accomplished with the help of the Blockchain foundation. These possibilities are now being explored to generate and develop new standards for decentralizing all manners of transactions. + +At its very basic level, the Blockchain can be thought of as an all-encompassing ledger of records and transactions. This in effect means that all kinds of records can theoretically be handled by the Blockchain. Developments in this area will possibly in the future result in all kinds of hard (Such as real estate deeds, physical keys, etc.) and soft intangible assets (Such as identity records, patents, trademarks, reservations etc.) can be encoded as digital assets to be protected and transferred via the blockchain. + +For the uninitiated, transactions on the Blockchain are inherently thought of and designed to be unbiased, permanent records. This is possible because of a **“consensus system”** that is built into the protocol. All transactions are confirmed, vetted and recorded by the participants of the system, in the case of the Bitcoin cryptocurrency platform, this role is taken care of by **miners** and exchanges. This can vary from platform to platform or from blockchain to blockchain. The protocol stack on which the platform is built is by definition supposed to be open-source and free for anyone with the technical know-how to verify. Transparency is woven into the system unlike much of the other platforms that the internet currently runs on. + +Once transactions are recorded and coded into the Blockchain, they will be seen through. Participants are bound to honor their transactions and contracts the way they were originally intended to be executed. The execution itself will be automatically taken care of by the platform since it’s hardcoded into it, unless of course if the original terms forbid it. This resilience of the Blockchain platform toward attempts of tampering with records, permanency of the records etc., are hitherto unheard of for something working over the internet. This is the added layer of trust that is often talked about while supporters of the technology claim its rising significance. + +These features are not recently discovered hidden potentials of the platform, these were envisioned from the start. In a communique, **Satoshi Nakamoto** , the fabled creator(s) of Bitcoin mentioned, **“the design supports a tremendous variety of possible transaction types that I designed years ago… If Bitcoin catches on in a big way, these are things we’ll want to explore in the future… but they all had to be designed at the beginning to make sure they would be possible later.”**. Cementing the fact that these features are designed and baked into the already existing protocols. The key idea being that the decentralized transaction ledger like the functionality of the Blockchain could be used to transfer, deploy and execute all manner of contracts. + +Leading institutions are currently exploring the possibility of re-inventing financial instruments such as stocks, pensions, and derivatives, while governments all over the world are concerned more with the tamper-proof permanent record keeping potential of the Blockchain. Supporters of the platform claim that once development reaches a critical threshold, everything from your hotel key cards to copyrights and patents will from then on be recorded and implemented via the use of Blockchains. + +An almost full list of items and particulars that could theoretically be implemented via a Blockchain model is compiled and maintained on [**this**][1] page by **Ledra Capital**. A thought experiment to actually realize how much of our lives the Blockchain might effect is a daunting task, but a look at that list will reiterate the importance of doing so. + +Now, all of the bureaucratic and commercial uses mentioned above might lead you to believe that a technology such as this will be solely in the domain of Governments and Large private corporations. However, the truth is far from that. Given the fact that the vast potentials of the system make it attractive for such uses, there are other possibilities and features harbored by Blockchains. There are other more intricate concepts related to the technology such as **DApps** , **DAOs** , **DACs** , **DASs** etc., more of which will be covered in depth in this series of articles. + +Basically, development is going on in full swing and its early for anyone to comment on definitions, standards, and capabilities of such Blockchain based systems for a wider roll-out, but the possibilities and its imminent effects are doubtless. There are even talks about Blockchain based smartphones and polling during elections. + +This was just a brief birds-eye view of what the platform is capable of. We’ll look at the distinct possibilities through a series of such detailed posts and articles. Keep an eye out for the [**next post of the series**][2], which will explore how the Blockchain is revolutionizing transactions and contracts. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-an-introduction/ + +作者:[EDITOR][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 +[1]: http://ledracapital.com/blog/2014/3/11/bitcoin-series-24-the-mega-master-blockchain-list +[2]: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ From 640b5249da7b407ca64ecc902e57f2125b1733c6 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:56:41 +0800 Subject: [PATCH 611/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Blockc?= =?UTF-8?q?hain=202.0:=20Revolutionizing=20The=20Financial=20System=20[Par?= =?UTF-8?q?t=202]=20sources/tech/20190306=20Blockchain=202.0-=20Revolution?= =?UTF-8?q?izing=20The=20Financial=20System=20-Part=202.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...utionizing The Financial System -Part 2.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md diff --git a/sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md b/sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md new file mode 100644 index 0000000000..59389e2ca3 --- /dev/null +++ b/sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: Revolutionizing The Financial System [Part 2]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: Revolutionizing The Financial System [Part 2] +====== + +This is the second part of our [**Blockchain 2.0**][1] series. The blockchain can transform how individuals and institutions deal with their finances. This post looks at how the existing monetary system evolved and how new blockchain systems are bringing in change as the next crucial step in the evolution of money. + +Two key ideas will lay the foundation for this article. **PayPal** , when it was launched, was revolutionary in terms of its operation. The company would gather, process and confirm massive amounts of consumer data to facilitate online transactions of all kinds, virtually allowing platforms such as eBay to grow into trustful sources for commerce, and laying the benchmark for digital payment systems worldwide. The second, albeit much more important key idea to be highlighted here, is a somewhat existential question. We all use money or rather currency for our day-to-day needs. A ten-dollar bill will get you a cup or two from your favorite coffee shop and get you a head start on your day for instance. We depend on our respective national currencies for virtually everything. + +Sure, mankind has come a long way since the **barter system** ruled what you ate for breakfast, but still, what exactly is currency? Who or what gives it it’s a value? And as the popular rumor suggests, does going to a bank and giving them a dollar bill actually get you the true value of whatever that currency “token” stands for? + +The answer to most of those questions doesn’t exist. If they do, they’ll to be undependably vague and subjective at best. Back in the day when civilization started off establishing small cities and towns, the local currency deemed legal by the guy who ruled over them, was almost always made of something precious to that community. Indians are thought to have transacted in peppercorns while ancient Greeks and Romans in **salt** [1]. Gradually most of these little prehistoric civilizations adopted precious metals and stones as their tokens to transact. Gold coins, silver heirlooms, and rubies became eponymous with “value”. With the industrial revolution, people started printing these tokens of transaction and we finally seemed to have found our calling in paper currencies. They were dependable and cheap to produce and as long as a nation-state guaranteed its users that the piece of paper, they were holding was just a token for an amount of “value” they had and as long as they were able to show them that this value when demanded could be supported with precious substances such as gold or hard assets, people were happy to use them. However, if you still believe that the currency note you hold in your hand right now has the same guarantee, you’re wrong. We currently live in an age where almost all the major currencies in circulation around the globe are what economists would call a **fiat currency** [2]. Value-less pieces of paper that are only backed by the guarantees of the nation-state you’re residing in. The exact nature of fiat currencies and why they may possibly be a flawed system falls into the domain of economics and we won’t get into that now. + +In fact, the only takeaway from all of this history that is relevant to this post is that civilizations started using tokens that hinted or represented value for trading goods and services rather than the non-practical barter system. Tokens. Naturally, this is the crucial concept behind cryptocurrencies as well. They don’t have any inherent value attached to them. Their value is tied to the number of people adopting that particular platform, the trust the adopters have on the system, and of course if released by a supervising entity, the background of the entity itself. The high price and market cap of **Bitcoin (BTC)** isn’t a coincidence, they were among the first in business and had a lot of early adopters. This ultimate truth behind cryptocurrencies is what makes it so important yet so unforgivingly complex to understand. It’s the natural next step in the evolution of “money”. Some understand this and some still like to think of the solid currency concept where “real” money is always backed by something of inherent value.[3] Though there have been countless debates and studies on this dilemma, there is no looking back from a blockchain powered future. + +For instance, the country of **Ecuador** made headlines in 2015 for its purported plans to develop and release **its own national cryptocurrency** [4]. Albeit the attempt officially was to aid and support their existing currency system. Since then other countries and their regulatory bodies have or are drafting up papers to control the “epidemic” that is cryptocurrency with some already having published frameworks to the extent of creating a roadmap for blockchain and crypto development. **Germany** is thought to be investing in a long term blockchain project to streamline its taxation and financial systems[5]. Banks in developing countries are joining in on something called a Bank chain, cooperating in creating a **private blockchain** to increase efficiency in and optimize their operations + +Now is when we tie both the ends of the stories together, remember the first mention of PayPal before the casual history lesson? Experts have compared Bitcoin’s (BTC) adoption rate with that of PayPal when it was launched. Initial consumer hesitation, where only a few early adopters are ready to jump into using the said product and then all a wider adoption gradually becoming a benchmark for similar platforms. Bitcoin (BTC) is already a benchmark for similar cryptocurrency platforms with major coins such as **Ethereum (ETH)** and **Ripple (XRP)** [6]. Adoption is steadily increasing, legal and regulatory frameworks being made to support it, and active research and development being done on the front as well. And not unlike PayPal, experts believe that cryptocurrencies and platforms utilizing blockchain tech for their digital infrastructure will soon become the standard norm rather than the exception. + +Although the rise in cryptocurrency prices in 2018 can be termed as an economic bubble, companies and governments have continued to invest as much or more into the development of their own blockchain platforms and financial tokens. To counteract and prevent such an incident in the future while still looking forward to investing in the area, an alternative to traditional cryptocurrencies called **stablecoins** have made the rounds recently. + +Financial behemoth **JP Morgan** came out with their own enterprise ready blockchain solution called **Quorum** handling their stablecoin called **JPM Coin** [7]. Each such JPM coin is tied to 1 USD and their value is guaranteed by the parent organization under supporting legal frameworks, in this case, JP Morgan. Platforms such as this one make it easier for large financial transactions to the tunes of millions or billions of dollars to be transferred instantaneously over the internet without having to rely on conventional banking systems such as SWIFT which involve lengthy procedures and are themselves decades old. + +In the same spirit of making the niceties of the blockchain available for everyone, The Ethereum platform allows 3rd parties to utilize their blockchain or derive from it to create and administer their own takes on the triad of the **Blockchain-protocol-token** system thereby leading to wider adoption of the standard with lesser work on its foundations. + +The blockchain allows for digital versions of existing financial instruments to be created, recorded, and traded quickly over a network without the need for third-party monitoring. The inherent safety and security features of the system makes the entire process totally safe and immune to fraud and tampering, basically the only reason why third-party monitoring was required in the sector. Another area where governmental and regulatory bodies presided over when it came to financial services and instruments were in regards to transparency and auditing. With blockchain banks and other financial institutes will be able to maintain a fully transparent, layered, almost permanent and tamper-proof record of all their transactions rendering auditing tasks near useless. Much needed developments and changes to the current financial system and services industry can be made possible by exploiting blockchains. The platform being distributed, tamper-proof, near permanent, and quick to execute is highly valuable to bankers and government regulators alike and their investments in this regard seem to be well placed[8]. + +In the next article of the series, we see how companies are using blockchains to deliver the next generation of financial services. Looking at individual firms creating ripples in the industry, we explore how the future of a blockchain backed economy would look like. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ + +作者:[EDITOR][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ From 7d200791d418f4aca71b412f9ea62f66c599be8d Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 13:00:48 +0800 Subject: [PATCH 612/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=20How=20?= =?UTF-8?q?rootless=20Buildah=20works:=20Building=20containers=20in=20unpr?= =?UTF-8?q?ivileged=20environments=20sources/tech/20190305=20How=20rootles?= =?UTF-8?q?s=20Buildah=20works-=20Building=20containers=20in=20unprivilege?= =?UTF-8?q?d=20environments.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...containers in unprivileged environments.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md diff --git a/sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md b/sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md new file mode 100644 index 0000000000..cf046ec1b3 --- /dev/null +++ b/sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How rootless Buildah works: Building containers in unprivileged environments) +[#]: via: (https://opensource.com/article/19/3/tips-tricks-rootless-buildah) +[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) + +How rootless Buildah works: Building containers in unprivileged environments +====== +Buildah is a tool and library for building Open Container Initiative (OCI) container images. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_2015-1-osdc-lead.png?itok=VEB4zwza) + +In previous articles, including [How does rootless Podman work?][1], I talked about [Podman][2], a tool that enables users to manage pods, containers, and container images. + +[Buildah][3] is a tool and library for building Open Container Initiative ([OCI][4]) container images that is complementary to Podman. (Both projects are maintained by the [containers][5] organization, of which I'm a member.) In this article, I will talk about rootless Buildah, including the differences between it and Podman. + +Our goal with Buildah was to build a low-level tool that could be used either directly or vendored into other tools to build container images. + +### Why Buildah? + +Here is how I describe a container image: It is basically a rootfs directory that contains the code needed to run your container. This directory is called a rootfs because it usually looks like **/ (root)** on a Linux machine, meaning you are likely to find directories in a rootfs like **/etc** , **/usr** , **/bin** , etc. + +The second part of a container image is a JSON file that describes the contents of the rootfs. It contains fields like the command to run the container, the entrypoint, the environment variables required to run the container, the working directory of the container, etc. Basically this JSON file allows the developer of the container image to describe how the container image is expected to be used. The fields in this JSON file have been standardized in the [OCI Image Format specification][6] + +The rootfs and the JSON file then get tar'd together to create an image bundle that is stored in a container registry. To create a layered image, you install more software into the rootfs and modify the JSON file. Then you tar up the differences of the new and the old rootfs and store that in another image tarball. The second JSON file refers back to the first JSON file via a checksum. + +Many years ago, Docker introduced Dockerfile, a simplified scripting language for building container images. Dockerfile was great and really took off, but it has many shortcomings that users have complained about. For example: + + * Dockerfile encourages the inclusion of tools used to build containers inside the container image. Container images do not need to include yum/dnf/apt, but most contain one of them and all their dependencies. + + * Each line causes a layer to be created. Because of this, secrets can mistakenly get added to container images. If you create a secret in one line of the Dockerfile and delete it in the next, the secret is still in the image. + + + + +One of my biggest complaints about the "container revolution" is that six years since it started, the only way to build a container image was still with Dockerfiles. Lots of tools other than **docker build** have appeared besides Buildah, but most still deal only with Dockerfile. So users continue hacking around the problems with Dockerfile. + +Note that [umoci][7] is an alternative to **docker build** that allows you to build container images without Dockerfile. + +Our goal with Buildah was to build a simple tool that could just create a rootfs directory on disk and allow other tools to populate the directory, then create the JSON file. Finally, Buildah would create the OCI image and push it to a container registry where it could be used by any container engine, like [Docker][8], Podman, [CRI-O][9], or another Buildah. + +Buildah also supports Dockerfile, since we know the bulk of people building containers have created Dockerfiles. + +### Using Buildah directly + +Lots of people use Buildah directly. A cool feature of Buildah is that you can script up the container build directly in Bash. + +The example below creates a Bash script called **myapp.sh** , which uses Buildah to pull down the Fedora image, and then uses **dnf** and **make** on a machine to install software into the container image rootfs, **$mnt**. It then adds some fields to the JSON file using **buildah config** and commits the container to a container image **myapp**. Finally, it pushes the container image to a container registry, **quay.io**. (It could push it to any container registry.) Now this OCI image can be used by any container engine or Kubernetes. + +``` +cat myapp.sh +#!/bin/sh +ctr=$(buildah from fedora) +mnt=($buildah mount $ctr) +dnf -y install --installroot $mnt httpd +make install DESTDIR=$mnt myapp +rm -rf $mnt/var/cache $mnt/var/log/* +buildah config --command /usr/bin/myapp -env foo=bar --working-dir=/root $ctr +buildah commit $ctr myapp +buildah push myapp http://quay.io/username/myapp +``` + +To create really small images, you could replace **fedora** in the script above with **scratch** , and Buildah will build a container image that only has the requirements for the **httpd** package inside the container image. No need for Python or DNF. + +### Podman's relationship to Buildah + +With Buildah, we have a low-level tool for building container images. Buildah also provides a library for other tools to build container images. Podman was designed to replace the Docker command line interface (CLI). One of the Docker CLI commands is **docker build**. We needed to have **podman build** to support building container images with Dockerfiles. Podman vendored in the Buildah library to allow it to do **podman build**. Any time you do a **podman build** , you are executing Buildah code to build your container images. If you are only going to use Dockerfiles to build container images, we recommend you only use Podman; there's no need for Buildah at all. + +### Other tools using the Buildah library + +Podman is not the only tool to take advantage of the Buildah library. [OpenShift 4 Source-to-Image][10] (S2I) will also use Buildah to build container images. OpenShift S2I allows developers using OpenShift to use Git commands to modify source code; when they push the changes for their source code to the Git repository, OpenShift kicks off a job to compile the source changes and create a container image. It also uses Buildah under the covers to build this image. + +[Ansible-Bender][11] is a new project to build container images via an Ansible playbook. For those familiar with Ansible, Ansible-Bender makes it easy to describe the contents of the container image and then uses Buildah to package up the container image and send it to a container registry. + +We would love to see other tools and languages for describing and building a container image and would welcome others use Buildah to do the conversion. + +### Problems with rootless + +Buildah works fine in rootless mode. It uses user namespace the same way Podman does. If you execute + +``` +$ buildah bud --tag myapp -f Dockerfile . +$ buildah push myapp http://quay.io/username/myapp +``` + +in your home directory, everything works great. + +However, if you execute the script described above, it will fail! + +The problem is that, when running the **buildah mount** command in rootless mode, the **buildah** command must put itself inside the user namespace and create a new mount namespace. Rootless users are not allowed to mount filesystems when not running in a user namespace. + +When the Buildah executable exits, the user namespace and mount namespace disappear, so the mount point no longer exists. This means the commands after **buildah mount** that attempt to write to **$mnt** will fail since **$mnt** is no longer mounted. + +How can we make the script work in rootless mode? + +#### Buildah unshare + +Buildah has a special command, **buildah unshare** , that allows you to enter the user namespace. If you execute it with no commands, it will launch a shell in the user namespace, and your shell will seem like it is running as root and all the contents of the home directory will seem like they are owned by root. If you look at the owner or files in **/usr** , it will list them as owned by **nfsnobody** (or nobody). This is because your user ID (UID) is now root inside the user namespace and real root (UID=0) is not mapped into the user namespace. The kernel represents all files owned by UIDs not mapped into the user namespace as the NFSNOBODY user. When you exit the shell, you will exit the user namespace, you will be back to your normal UID, and the home directory will be owned by your UID again. + +If you want to execute the **myapp.sh** command defined above, you can execute **buildah unshare myapp.sh** and the script will now run correctly. + +#### Conclusion + +Building and running containers in unprivileged environments is now possible and quite useable. There is little reason for developers to develop containers as root. + +If you want to use a traditional container engine, and use Dockerfile's for builds, then you should probably just use Podman. But if you want to experiment with building container images in new ways without using Dockerfile, then you should really take a look at Buildah. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/tips-tricks-rootless-buildah + +作者:[Daniel J Walsh][a] +选题:[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/rhatdan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/how-does-rootless-podman-work +[2]: https://podman.io/ +[3]: https://github.com/containers/buildah +[4]: https://www.opencontainers.org/ +[5]: https://github.com/containers +[6]: https://github.com/opencontainers/image-spec +[7]: https://github.com/openSUSE/umoci +[8]: https://github.com/docker +[9]: https://cri-o.io/ +[10]: https://github.com/openshift/source-to-image +[11]: https://github.com/TomasTomecek/ansible-bender From 8feacc1a005301df2f1b1390961fe3dbca5989d6 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 13:02:04 +0800 Subject: [PATCH 613/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Blockc?= =?UTF-8?q?hain=202.0:=20Redefining=20Financial=20Services=20[Part=203]=20?= =?UTF-8?q?sources/tech/20190311=20Blockchain=202.0-=20Redefining=20Financ?= =?UTF-8?q?ial=20Services=20-Part=203.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- Redefining Financial Services -Part 3.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md diff --git a/sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md b/sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md new file mode 100644 index 0000000000..5f82bc87ff --- /dev/null +++ b/sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: Redefining Financial Services [Part 3]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-redefining-financial-services/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: Redefining Financial Services [Part 3] +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/Financial-Services-1-720x340.png) + +The [**previous article of this series**][1] focused on building context to bring forth why moving our existing monetary system to a futuristic [**blockchain**][2] system is the next natural step in the evolution of “money”. We looked at the features of a blockchain platform which would aid in such a move. However, the financial markets are far more complex and composed of numerous other instruments that people trade rather than just a currency. + +This part will explore the features of blockchain which will enable institutions to transform and interlace traditional banking and financing systems with it. As previously discussed, and proved, if enough people participate in a given blockchain n­­etwork and support the protocols for transactions, the nominal value that can be attributed to the “token” increases and becomes more stable. Take, for instance, Bitcoin (BTC). Like the simple paper currency, we’re all used to, cryptocurrencies such as Bitcoin and Ether can be utilized for all the former’s purposes from buying food to ships and from loaning money to insurance. + +Chances are you are already involved with a bank or any other financial institution that makes use of blockchain ledger technology. The most significant uses of blockchain tech in the finance industry will be in setting up payments infrastructure, fund transfer technologies, and digital identity management. The latter two have traditionally been handled by legacy systems in the financial services industry. These systems are slowly being migrated to blockchain systems owing to their efficiency in handling work like this. The blockchain also offers high-quality data analytics solutions to these firms, an aspect that is quickly gaining prominence because of recent developments in data sciences.[1] + +Considering the start-ups and projects at the cutting edge of innovation in this space first seems warranted due to their products or services already doing the rounds in the market today. + +Starting with PayPal, an online payments company started in 1998, and now among the largest of such platforms, it is considered to be a benchmark in terms of operations and technical prowess. PayPal derives largely from the existing monetary system. Its contribution to innovation came by how it collected and leveraged consumer data to provide services online at instantaneous speeds. Online transactions are taken for granted today with minimal innovation in the industry in terms of the tech that it’s based on. Having a solid foundation is a good thing, but that won’t give anyone an edge over their competition in this fast-paced IT world with new standards and technology being pioneered every other day. In 2014 PayPal subsidiary, **Braintree** announced partnerships with popular cryptocurrency payment solutions including **Coinbase** and **GoCoin** , in a bid to gradually integrate Bitcoin and other popular cryptocurrencies into its service platform. This basically gave its consumers a chance to explore and experience the side of what’s to come under the familiar umbrella cover and reliability of PayPal. In fact, ride-hailing company **Uber** had an exclusive partnership with Braintree to allow customers to pay for rides using Bitcoin.[2][3] + +**Ripple** is making it easier for people to operate between multiple blockchains. Ripple has been in the headlines for moving ahead with regional banks in the US, for instance, to facilitate transferring money bilaterally to other regional banks without the need for a 3rd party intermediary resulting in reduced cost and time overheads. Ripple’s **Codius platform** allows for interoperability between blockchains and opens the doors to smart contracts programmed into the system for minimal tampering and confusion. Built on technology that is highly advanced, secure and scalable to suit needs, Ripple’s platform currently has names such as UBS and Standard Chartered on their client’s list. Many more are expected to join in.[4][5] + +**Kraken** , a US-based cryptocurrency exchange operating in locations around the globe is known for their reliable **crypto quant** estimates even providing Bitcoin pricing data real time to the Bloomberg terminal. In 2015, they partnered with **Fidor Bank** to form what was then the world’s first Cryptocurrency Bank offering customers banking services and products which dealt with cryptocurrencies.[6] + +**Circle** , another FinTech company is currently among the largest of its sorts involved with allowing users to invest and trade in cryptocurrency derived assets, similar to traditional money market assets.[7] + +Companies such as **Wyre** and **Stellar** today have managed to bring down the lead time involved in international wire transfers from an average of 3 days to under 6 hours. Claims have been made saying that once a proper regulatory system is in place the same 6 hours can be brought down to a matter of seconds.[8] + +Now while all of the above have focused on the start-up projects involved, it has to be remembered that the reach and capabilities of the older more respectable financial institutions should not be ignored. Institutions that have existed for decades if not centuries moving billions of dollars worldwide are equally interested in leveraging the blockchain and its potential. + +As we already mentioned in the previous article, **JP Morgan** recently unveiled their plans to exploit cryptocurrencies and the underlying ledger like the functionality of the blockchain for enterprises. The project, called **Quorum** , is defined as an **“Enterprise-ready distributed ledger and smart contract platform”**. The main goal being that gradually the bulk of the bank’s operations would one day be migrated to Quorum thus cutting significant investments that firms such as JP Morgan need to make in order to guarantee privacy, security, and transparency. They’re claimed to be the only player in the industry now to have complete ownership over the whole stack of the blockchain, protocol, and token system. They also released a cryptocurrency called **JPM Coin** meant to be used in transacting high volume settlements instantaneously. JPM coin is among the first “stable coins” to be backed by a major bank such as JP Morgan. A stable coin is a cryptocurrency whose price is linked to an existing major monetary system. Quorum is also touted for its capabilities to process almost 100 transactions a second which is leaps and bounds ahead of its contemporaries.[9] + +**Barclay’s** , a British multinational financial giant is reported to have registered two blockchain-based patents supposedly with the aim of streamlining fund transfers and KYC procedures. Barclay’s proposals though are more aimed toward improving their banking operations’ efficiency. One of the application deals with creating a private blockchain network for storing KYC details of consumers. Once verified, stored and confirmed, these details are immutable and nullifies the need for further verifications down the line. If implemented the protocol will do away with the need for multiple verifications of KYC details. Developing and densely populated countries such as India where a bulk of the population is yet to be inducted into a formal banking system will find the innovative KYC system useful in reducing random errors and lead times involved in the process[10]. Barclay’s is also rumored to be exploring the capabilities of a blockchain system to address credit status ratings and insurance claims. + +Such blockchain backed systems are designed to eliminate needless maintenance costs and leverage the power of smart contracts for enterprises which operate in industries where discretion, security, and speed determine competitive advantage. Being enterprise products, they’re built on protocols that ensure complete transaction and contract privacy along with a consensus mechanism which essentially nullifies corruption and bribery. + +**PwC’s Global Fintech Report** from 2017 states that by 2020, an estimated 77% of all Fintech companies are estimated to switch to blockchain based technologies and processes concerning their operations. A whopping 90 percent of their respondents said that they were planning to adopt blockchain technology as part of an in-production system by 2020. Their judgments are not misplaced as significant cost savings and transparency gains from a regulatory point of view are guaranteed by moving to a blockchain based system.[11] + +Since regulatory capabilities are built into the blockchain platform by default the migration of firms from legacy systems to modern networks running blockchain ledgers is a welcome move for industry regulators as well. Transactions and trade movements can be verified and tracked on the fly once and for all rather than after. This, in the long run, will likely result in better regulation and risk management. Not to mention improved accountability from the part of firms and individuals alike.[11] + +While considerable investments in the space and leaping innovations are courtesy of large investments by established corporates it is misleading to think that such measures wouldn’t permeate the benefits to the end user. As banks and financial institutions start to adopt the blockchain, it will result in increased cost savings and efficiency for them which will ultimately mean good for the end consumer too. The added benefits of transparency and fraud protection will improve customer sentiments and more importantly improve the trust that people place on the banking and financial system. A much-needed revolution in the financial services industry is possible with blockchains and their integration into traditional services. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-redefining-financial-services/ + +作者:[EDITOR][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ +[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ From e64f96232b101edb92f1a6506943cdd11b29e4a1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Mar 2019 08:49:25 +0800 Subject: [PATCH 614/813] translated --- ... Complexity-Strength And Score In Linux.md | 165 ------------------ ... Complexity-Strength And Score In Linux.md | 165 ++++++++++++++++++ 2 files changed, 165 insertions(+), 165 deletions(-) delete mode 100644 sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md create mode 100644 translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md diff --git a/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md deleted file mode 100644 index 8085fe4a0e..0000000000 --- a/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md +++ /dev/null @@ -1,165 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Check Password Complexity/Strength And Score In Linux?) -[#]: via: (https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How To Check Password Complexity/Strength And Score In Linux? -====== - -We all know the password importance. It’s a best practices to use hard and guess password. - -Also, i advise you to use the different password for each services such as email, ftp, ssh, etc., - -In top of that i suggest you guys to change the password frequently to avoid an unnecessary hacking attempt. - -By default RHEL and it’s clone uses `cracklib` module to check password strength. - -We are going to teach you, how to check the password strength using cracklib module. - -If you would like to check the password score which you have created then use the `pwscore` package. - -If you would like to create a good password, basically it should have minimum 12-15 characters length. - -It should be created in the following combinations like, Alphabets (Lower case & Upper case), Numbers and Special Characters. - -There are many utilities are available in Linux to check a password complexity and we are going to discuss about `cracklib` module today. - -### How To Install cracklib module In Linux? - -The cracklib module is available in most of the distribution repository so, use the distribution official package manager to install it. - -For **`Fedora`** system, use **[DNF Command][1]** to install cracklib. - -``` -$ sudo dnf install cracklib -``` - -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install libcrack2. - -``` -$ sudo apt install libcrack2 -``` - -For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install cracklib. - -``` -$ sudo pacman -S cracklib -``` - -For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install cracklib. - -``` -$ sudo yum install cracklib -``` - -For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install cracklib. - -``` -$ sudo zypper install cracklib -``` - -### How To Use The cracklib module In Linux To Check Password Complexity? - -I have added few example in this article to make you understand better about this module. - -If you are given any words like, person name or place name or common word then you will be getting an message “it is based on a dictionary word”. - -``` -$ echo "password" | cracklib-check -password: it is based on a dictionary word -``` - -The default password length in Linux is `Seven` characters. If you give any password less than seven characters then you will be getting an message “it is WAY too short”. - -``` -$ echo "123" | cracklib-check -123: it is WAY too short -``` - -You will be getting `OK` When you give good password like us. - -``` -$ echo "ME$2w!@fgty6723" | cracklib-check -ME!@fgty6723: OK -``` - -### How To Install pwscore In Linux? - -The pwscore package is available in most of the distribution official repository so, use the distribution package manager to install it. - -For **`Fedora`** system, use **[DNF Command][1]** to install libpwquality. - -``` -$ sudo dnf install libpwquality -``` - -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install libpwquality. - -``` -$ sudo apt install libpwquality -``` - -For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install libpwquality. - -``` -$ sudo pacman -S libpwquality -``` - -For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install libpwquality. - -``` -$ sudo yum install libpwquality -``` - -For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install libpwquality. - -``` -$ sudo zypper install libpwquality -``` - -If you are given any words like, person name or place name or common word then you will be getting a message “it is based on a dictionary word”. - -``` -$ echo "password" | pwscore -Password quality check failed: - The password fails the dictionary check - it is based on a dictionary word -``` - -The default password length in Linux is `Seven` characters. If you give any password less than seven characters then you will be getting an message “it is WAY too short”. - -``` -$ echo "123" | pwscore -Password quality check failed: - The password is shorter than 8 characters -``` - -You will be getting `password score` When you give good password like us. - -``` -$ echo "ME!@fgty6723" | pwscore -90 -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-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/dnf-command-examples-manage-packages-fedora-system/ -[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ -[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ -[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ diff --git a/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md new file mode 100644 index 0000000000..b44d9c6052 --- /dev/null +++ b/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Check Password Complexity/Strength And Score In Linux?) +[#]: via: (https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 中检查密码的复杂性/强度和分数? +====== + +我们都知道密码的重要性。这是使用难以猜测密码的最佳实践。 + +另外,我建议你为每个服务使用不同的密码,如电子邮件、ftp、ssh 等。 + +最重要的是,我建议你们经常更改密码,以避免不必要的黑客攻击。 + +默认情况下,RHEL 和它的衍生版使用 `cracklib` 模块来检查密码强度。 + +我们将教你如何使用 cracklib 模块检查密码强度。 + +如果你想检查你创建的密码分数,请使用 `pwscore` 包。 + +如果你想创建一个好密码,基本上它应该至少有 12-15 个字符长度。 + +它应该在以下组合创建,如字母(小写和大写)、数字和特殊字符。 + +Linux 中有许多程序可用于检查密码复杂性,我们今天将讨论有关 `cracklib` 模块。 + +### 如何在 Linux 中安装 cracklib 模块? + +cracklib 模块在大多数发行版仓库中都有,因此,请使用发行版官方软件包管理器来安装它。 + +对于 **`Fedora`** 系统,使用 **[DNF 命令][1]**来安装 cracklib。 + +``` +$ sudo dnf install cracklib +``` + +对于 **`Debian/Ubuntu`** 系统,使用 **[APT-GET 命令][2]** 或 **[APT 命令][3]**来安装 libcrack2。 + +``` +$ sudo apt install libcrack2 +``` + +对于基于 **`Arch Linux`** 的系统,使用 **[Pacman 命令][4]**来安装 cracklib。 + +``` +$ sudo pacman -S cracklib +``` + +对于 **`RHEL/CentOS`** 系统,使用 **[YUM 命令][5]**来安装 cracklib。 + +``` +$ sudo yum install cracklib +``` + +对于 **`openSUSE Leap`** 系统,使用 **[Zypper 命令][6]**来安装 cracklib。 + +``` +$ sudo zypper install cracklib +``` + +### 如何在 Linux 中使用 cracklib 模块检查密码复杂性? + +我在本文中添加了一些示例来助你更好地了解此模块。 + +如果你提供了任何如人名或地名或常用字,那么你将看到一条消息“它存在于单词字典中”。 + +``` +$ echo "password" | cracklib-check +password: it is based on a dictionary word +``` + +Linux 中的默认密码长度为 `7` 个字符。如果你提供的密码少于 7 个字符,那么你将看到一条消息“它太短了”。 + +``` +$ echo "123" | cracklib-check +123: it is WAY too short +``` + +当你提供像我们这样的好密码时,你会看到 `OK`。 + +``` +$ echo "ME$2w!@fgty6723" | cracklib-check +ME!@fgty6723: OK +``` + +### 如何在 Linux 中安装 pwscore? + +pwscore 包在大多数发行版仓库中都有,因此,请使用发行版官方软件包管理器来安装它。 + +对于 **`Fedora`** 系统,使用 **[DNF 命令][1]**来安装 libpwquality。 + +``` +$ sudo dnf install libpwquality +``` + +对于 **`Debian/Ubuntu`** 系统,使用 **[APT-GET 命令][2]** 或 **[APT 命令][3]**来安装 libpwquality。 + +``` +$ sudo apt install libpwquality +``` + +对于基于 **`Arch Linux`** 的系统,使用 **[Pacman 命令][4]**来安装 libpwquality。 + +``` +$ sudo pacman -S libpwquality +``` + +对于 **`RHEL/CentOS`** 系统,使用 **[YUM 命令][5]**来安装 libpwquality。 + +``` +$ sudo yum install libpwquality +``` + +对于 **`openSUSE Leap`** 系统,使用 **[Zypper 命令][6]**来安装 libpwquality。 + +``` +$ sudo zypper install libpwquality +``` + +如果你提供了任何如人名或地名或常用字,那么你将看到一条消息“它存在于单词字典中”。 + +``` +$ echo "password" | pwscore +Password quality check failed: + The password fails the dictionary check - it is based on a dictionary word +``` + +Linux 中的默认密码长度为 `7` 个字符。如果你提供的密码少于 7 个字符,那么你将看到一条消息“它太短了”。 + +``` +$ echo "123" | pwscore +Password quality check failed: + The password is shorter than 8 characters +``` + +当你提供像我们这样的好密码时,你将会看到`密码分数`。 + +``` +$ echo "ME!@fgty6723" | pwscore +90 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From 822b46b1540f9fbda10015140af8c97955fe94ca Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Mar 2019 08:52:49 +0800 Subject: [PATCH 615/813] translating --- ...th CryptPad, an open source collaborative document editor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md index 2da6274e42..94e880cf41 100644 --- a/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md +++ b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4432decd2e02e31659f0b50537c8534f0f94a04c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Mar 2019 10:32:44 +0800 Subject: [PATCH 616/813] PRF:20190228 Connecting a VoIP phone directly to an Asterisk server.md @geekpi --- ...IP phone directly to an Asterisk server.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md index a7ec705338..0eecf86505 100644 --- a/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md +++ b/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Connecting a VoIP phone directly to an Asterisk server) @@ -12,7 +12,7 @@ 在我的 [Asterisk][1] 服务器上正好有张以太网卡。由于我只用了其中一个,因此我决定将我的 VoIP 电话从本地网络交换机换成连接到 Asterisk 服务器。 -主要的好处是这台运行着未知质量专有软件的电话,在我的一般家庭网络中不再可用。最重要的是,它不再能访问互联网,因此无需手动配置防火墙。 +主要的好处是这台运行着未知质量的专有软件的电话,在我的一般家庭网络中不能用了。最重要的是,它不再能访问互联网,因此无需手动配置防火墙。 以下是我配置的方式。 @@ -23,21 +23,21 @@ ``` auto eth1 iface eth1 inet static - address 192.168.2.2 - netmask 255.255.255.0 + address 192.168.2.2 + netmask 255.255.255.0 ``` -在 VoIP 电话上,我将静态 IP 设置成 `192.168.2.3`,DNS 服务器设置成 `192.168.2.2`。我接着将 SIP 注册 IP 地址设置成 `192.168.2.2`。 +在 VoIP 电话上,我将静态 IP 设置成 `192.168.2.3`,DNS 服务器设置成 `192.168.2.2`。我接着将 SIP 注册 IP 地址设置成 `192.168.2.2`。 DNS 服务器实际上是一个在 Asterisk 服务器上运行的 [unbound 守护进程][2]。我唯一需要更改的配置是监听第二张网卡,并允许 VoIP 电话进入: ``` server: - interface: 127.0.0.1 - interface: 192.168.2.2 - access-control: 0.0.0.0/0 refuse - access-control: 127.0.0.1/32 allow - access-control: 192.168.2.3/32 allow + interface: 127.0.0.1 + interface: 192.168.2.2 + access-control: 0.0.0.0/0 refuse + access-control: 127.0.0.1/32 allow + access-control: 192.168.2.3/32 allow ``` 最后,我在 `/etc/network/iptables.up.rules` 中打开了服务器防火墙上的正确端口: @@ -49,13 +49,13 @@ server: ### 访问管理页面 -现在 VoIP 电话在本地网络上不再可用,因此无法访问其管理页面。从安全的角度来看,这是一件好事,但它有点不方便。 +现在 VoIP 电话不能在本地网络上用了,因此无法访问其管理页面。从安全的角度来看,这是一件好事,但它有点不方便。 因此,在通过 ssh 连接到 Asterisk 服务器之后,我将以下内容放在我的 `~/.ssh/config` 中以便通过 `http://localhost:8081` 访问管理页面: ``` Host asterisk - LocalForward 8081 192.168.2.3:80 + LocalForward 8081 192.168.2.3:80 ``` -------------------------------------------------------------------------------- @@ -65,7 +65,7 @@ via: https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-aster 作者:[François Marier][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 c05d3ae4f6ca74001a787c1abcc241ac63655b55 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Mar 2019 10:33:18 +0800 Subject: [PATCH 617/813] PUB:20190228 Connecting a VoIP phone directly to an Asterisk server.md @geekpi https://linux.cn/article-10620-1.html --- ... Connecting a VoIP phone directly to an Asterisk server.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190228 Connecting a VoIP phone directly to an Asterisk server.md (97%) diff --git a/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/published/20190228 Connecting a VoIP phone directly to an Asterisk server.md similarity index 97% rename from translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md rename to published/20190228 Connecting a VoIP phone directly to an Asterisk server.md index 0eecf86505..e3abdb310b 100644 --- a/translated/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md +++ b/published/20190228 Connecting a VoIP phone directly to an Asterisk server.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10620-1.html) [#]: subject: (Connecting a VoIP phone directly to an Asterisk server) [#]: via: (https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/) [#]: author: (François Marier https://fmarier.org/) From 0839331dc829f6749e8b98edd7fae65adb241a0c Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Fri, 15 Mar 2019 10:40:09 +0800 Subject: [PATCH 618/813] translated --- ..., Configure And Use Fish Shell In Linux.md | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md b/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md index cf2e212441..95fb75b1b2 100644 --- a/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md +++ b/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md @@ -1,50 +1,50 @@ -[#]: collector: (lujun9972) -[#]: translator: (zero-MK) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Install, Configure And Use Fish Shell In Linux?) -[#]: via: (https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) +[#]: collector: "lujun9972" +[#]: translator: "zero-MK" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How To Install, Configure And Use Fish Shell In Linux?" +[#]: via: "https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -How To Install, Configure And Use Fish Shell In Linux? +如何在Linux中安装,配置和使用Fish Shell? ====== -Every Linux administrator might heard the word called shell. +每个 Linux 管理员都可能听到过 shell 这个词。 -Do you know what is shell? Do you know what is the role for shell in Linux? How many shell is available in Linux? +你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少 shell 可用? -A shell is a program that provides an interface between a user and kernel. +shell 是一个程序,它是提供用户和内核之间交互的接口。 -kernel is a heart of the Linux operating system that manage everything between user and operating system (OS). +内核是 Linux 操作系统的核心,它管理用户和操作系统( OS )之间的所有内容。 -Shell is available for all the users when they launch the terminal. +Shell 可供所有用户在启动终端时使用。 -Once the terminal launched then user can run any commands which is available for him. +终端启动后,用户可以运行任何可用的命令。 -When shell completes the command execution then you will be getting the output on the terminal window. +当shell完成命令执行时,您将在终端窗口上获取输出。 -Bash stands for Bourne Again Shell is the default shell which is running on most of the Linux distribution on today’s. +Bash 全称是 Bourne Again Shell 是默认的 shell ,它运行在今天的大多数 Linux 发行版上。 -It’s very popular and has a lot of features. Today we are going to discuss about the fish shell. +它非常受欢迎,并具有很多功能。今天我们将讨论 Fish Shell 。 -### What Is Fish Shell? +### 什么是 Fish Shell? -[Fish][1] stands for friendly interactive shell, is a fully-equipped, smart and user-friendly command line shell for Linux which comes with some handy features that is not available in most of the shell. +[Fish][1] 是友好的交互式 shell , 是一个功能齐全,智能且对用户友好的 Linux 命令行 shell ,它带有一些在大多数 shell 中都不具备的方便功能。 -The features are Autosuggestion, Sane Scripting, Man Page Completions, Web Based configuration and Glorious VGA Color. Are you curious to test it? if so, go ahead and install it by following the below installation steps. +这些功能包括 自动补全建议,Sane Scripting,手册页完成,基于 Web 的配置器和 Glorious VGA Color 。你对它感到好奇并想测试它吗?如果是这样,请按照以下安装步骤继续安装。 -### How To Install Fish Shell In Linux? +### 如何在 Linux 中安装 Fish Shell ? -It’s very simple to install but it doesn’t available in most of the distributions except few. However, it can be easily installed by using the following [fish repository][2]. +它的安装非常简单,但除了少数几个发行版外,它在大多数发行版中都不可用。但是,可以使用以下 [fish repository][2] 轻松安装。 -For **`Arch Linux`** based systems, use **[Pacman Command][3]** to install fish shell. +对于基于 **`Arch Linux`** 的系统, 使用 **[Pacman Command][3]** 来安装 fish shell。 ``` $ sudo pacman -S fish ``` -For **`Ubuntu 16.04/18.04`** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install fish shell. +对于 **`Ubuntu 16.04/18.04`** 系统来说,,请使用 **[APT-GET Command][4]** 或者 **[APT Command][5]** 安装 fish shell。 ``` $ sudo apt-add-repository ppa:fish-shell/release-3 @@ -52,25 +52,25 @@ $ sudo apt-get update $ sudo apt-get install fish ``` -For **`Fedora`** system, use **[DNF Command][6]** to install fish shell. +对于 **`Fedora`** 系统来说,请使用 **[DNF Command][6]** 安装 fish shell。 -For Fedora 29 System: +对于 Fedora 29 系统来说: ``` $ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_29/shells:fish:release:3.repo $ sudo dnf install fish ``` -For Fedora 28 System: +对于 Fedora 28 系统来说: ``` $ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_28/shells:fish:release:3.repo $ sudo dnf install fish ``` -For **`Debian`** systems, use **[APT-GET Command][4]** or **[APT Command][5]** to install fish shell. +对于 **`Debian`** 系统来说,,请使用 **[APT-GET Command][4]** 或者 **[APT Command][5]** 安装 fish shell。 -For Debian 9 System: +对于 Debian 9 系统来说: ``` $ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_9.0/Release.key -O Release.key @@ -80,7 +80,7 @@ $ sudo apt-get update $ sudo apt-get install fish ``` -For Debian 8 System: +对于 Debian 8 系统来说: ``` $ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_8.0/Release.key -O Release.key @@ -90,37 +90,37 @@ $ sudo apt-get update $ sudo apt-get install fish ``` -For **`RHEL/CentOS`** systems, use **[YUM Command][7]** to install fish shell. +对于 **`RHEL/CentOS`** 系统来说,请使用 **[YUM Command][7]** 安装 fish shell。 -For RHEL 7 System: +对于 RHEL 7 系统来说: ``` $ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RHEL_7/shells:fish:release:3.repo $ sudo yum install fish ``` -For RHEL 6 System: +对于 RHEL 6 系统来说: ``` $ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RedHat_RHEL-6/shells:fish:release:3.repo $ sudo yum install fish ``` -For CentOS 7 System: +对于 CentOS 7 系统来说: ``` $ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo $ sudo yum install fish ``` -For CentOS 6 System: +对于 CentOS 6 系统来说: ``` $ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_6/shells:fish:release:2.repo $ sudo yum install fish ``` -For **`openSUSE Leap`** system, use **[Zypper Command][8]** to install fish shell. +对于 **`openSUSE Leap`** 系统来说,请使用 **[Zypper Command][8]** 安装 fish shell。 ``` $ sudo zypper addrepo https://download.opensuse.org/repositories/shells:/fish:/release:/3/openSUSE_Leap_42.3/shells:fish:release:3.repo @@ -128,9 +128,9 @@ $ suod zypper refresh $ sudo zypper install fish ``` -### How To Use Fish Shell? +### 如何使用 Fish Shell ? -Once you have successfully installed the fish shell. Simply type `fish` on your terminal, which will automatically switch to the fish shell from your default bash shell. +一旦你成功安装了 fish shell 。只需在您的终端上输入 `fish` ,它将自动从默认的 bash shell 切换到 fish shell 。 ``` $ fish @@ -138,37 +138,37 @@ $ fish ![][10] -### Auto Suggestions +### 自动补全建议 -When you type any commands in the fish shell, it will auto suggest a command in a light grey color after typing few letters. +当你在 fish shell 中键入任何命令时,它会在输入几个字母后自动建议一个浅灰色的命令。 ![][11] -Once you got a suggestion then simple hit the `Left Arrow Mark` to complete it instead of typing the full command. +一旦你得到一个建议然后点击 ` Right Arrow Mark` (译者注:原文是左,错的)就能完成它而不是输入完整的命令。 ![][12] -Instantly you can access the previous history based on the command by pressing `Up Arrow Mark` after typing a few letters. It’s similar to bash shell `CTRL+r` option. +您可以在键入几个字母后立即按下 `Up Arrow Mark` 检索该命令以前的历史记录。它类似于 bash shell 的 `CTRL+r `选项。 -### Tab Completions +### Tab 补全 -If you would like to see if there are any other possibilities for the given command then simple press the `Tab` button once after typing a few letters. +如果您想查看给定命令是否还有其他可能性,那么在键入几个字母后,只需按一下 `Tab` 按钮即可。 ![][13] -Press the `Tab` button one more time to see the full lists. +再次按 `Tab` 按钮可查看完整列表。 ![][14] -### Syntax highlighting +### 语法高亮 -fish performs syntax highlighting, that you can see when you are typing any commands in the terminal. Invalid commands are colored by `RED color`. +fish 执行语法高亮显示,您可以在终端中键入任何命令时看到。 无效的命令被着色为 `RED color` 。 ![][15] -The same way valid commands are shown in a different color. Also, fish will underline valid file paths when you type and it doesn’t show the underline if the path is not valid. +同样的,有效命令以不同的颜色显示。此外,当您键入有效的文件路径时,fish会在其下面加下划线,如果路径无效,则不会显示下划线。 ![][16] -### Web based configuration +### 基于 Web 的配置器 -There is a cool feature is available in the fish shell, that allow us to set colors, prompt, functions, variables, history and bindings via web browser. +fish shell 中有一个很酷的功能,它允许我们通过网络浏览器设置颜色,提示,功能,变量,历史和绑定。 -Run the following command on your terminal to start the web configuration interface. Simply press `Ctrl+c` to exit it. +在终端上运行以下命令以启动 Web 配置界面。只需按下 `Ctrl+c` 即可退出。 ``` $ fish_config @@ -182,9 +182,9 @@ Shutting down. ### Man Page Completions -Other shells support programmable completions, but only fish generates them automatically by parsing your installed man pages. +其他 shell 支持 programmable completions, 但只有 fish 可以通过解析已安装的手册页自动生成它们。 -To do so, run the below command. +如果是这样,请运行以下命令 ``` $ fish_update_completions @@ -192,18 +192,18 @@ Parsing man pages and writing completions to /home/daygeek/.local/share/fish/gen 3466 / 3466 : zramctl.8.gz ``` -### How To Set Fish as default shell +### 如何将 Fish 设置为默认 shell If you would like to test the fish shell for some times then you can set the fish shell as your default shell instead of switching it every time. -If so, first get the fish shell location by using the below command. +如果是这样,首先使用以下命令获取 Fish Shell 的位置。 ``` $ whereis fish fish: /usr/bin/fish /etc/fish /usr/share/fish /usr/share/man/man1/fish.1.gz ``` -Change your default shell as a fish shell by running the following command. +通过运行以下命令将默认 shell 更改为 fish shell 。 ``` $ chsh -s /usr/bin/fish @@ -211,21 +211,21 @@ $ chsh -s /usr/bin/fish ![][18] -`Make note:` Just verify whether the fish shell is added into `/etc/shells` directory or not. If no, then run the following command to append it. +`Make note:` 只需验证 Fish Shell 是否已添加到 `/etc/shells` 目录中。如果不是,则运行以下命令以附加它。 ``` $ echo /usr/bin/fish | sudo tee -a /etc/shells ``` -Once you have done the testing and if you would like to come back to the bash shell permanently then use the following command. +完成测试后,如果要返回 bash shell ,请使用以下命令。 -For temporary: +暂时的: ``` $ bash ``` -For permanent: +永久性的: ``` $ chsh -s /bin/bash @@ -237,7 +237,7 @@ via: https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zero-MK](https://github.com/zero-MK) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e92a93c9d706d9a61eaf0ec75020cb0921ff687d Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 12:48:49 +0800 Subject: [PATCH 619/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=20A=20Lo?= =?UTF-8?q?ok=20Back=20at=20the=20History=20of=20Firefox=20sources/talk/20?= =?UTF-8?q?190314=20A=20Look=20Back=20at=20the=20History=20of=20Firefox.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 A Look Back at the History of Firefox.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/talk/20190314 A Look Back at the History of Firefox.md diff --git a/sources/talk/20190314 A Look Back at the History of Firefox.md b/sources/talk/20190314 A Look Back at the History of Firefox.md new file mode 100644 index 0000000000..f4118412b4 --- /dev/null +++ b/sources/talk/20190314 A Look Back at the History of Firefox.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Look Back at the History of Firefox) +[#]: via: (https://itsfoss.com/history-of-firefox) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +A Look Back at the History of Firefox +====== + +The Firefox browser has been a mainstay of the open-source community for a long time. For many years it was the default web browser on (almost) all Linux distros and the lone obstacle to Microsoft’s total dominance of the internet. This browser has roots that go back all the way to the very early days of the internet. Since this week marks the 30th anniversary of the internet, there is no better time to talk about how Firefox became the browser we all know and love. + +### Early Roots + +In the early 1990s, a young man named [Marc Andreessen][1] was working on his bachelor’s degree in computer science at the University of Illinois. While there, he started working for the [National Center for Supercomputing Applications][2]. During that time [Sir Tim Berners-Lee][3] released an early form of the web standards that we know today. Marc [was introduced][4] to a very primitive web browser named [ViolaWWW][5]. Seeing that the technology had potential, Marc and Eric Bina created an easy to install browser for Unix named [NCSA Mosaic][6]). The first alpha was released in June 1993. By September, there were ports to Windows and Macintosh. Mosaic became very popular because it was easier to use than other browsing software. + +In 1994, Marc graduated and moved to California. He was approached by Jim Clark, who had made his money selling computer hardware and software. Clark had used Mosaic and saw the financial possibilities of the internet. Clark recruited Marc and Eric to start an internet software company. The company was originally named Mosaic Communications Corporation, however, the University of Illinois did not like [their use of the name Mosaic][7]. As a result, the company name was changed to Netscape Communications Corporation. + +The company’s first project was an online gaming network for the Nintendo 64, but that fell through. The first product they released was a web browser named Mosaic Netscape 0.9, subsequently renamed Netscape Navigator. Internally, the browser project was codenamed mozilla, which stood for “Mosaic killer”. An employee created a cartoon of a [Godzilla like creature][8]. They wanted to take out the competition. + +![Early Firefox Mascot][9]Early Mozilla mascot at Netscape + +They succeed mightily. At the time, one of the biggest advantages that Netscape had was the fact that its browser looked and functioned the same on every operating system. Netscape described this as giving everyone a level playing field. + +As usage of Netscape Navigator increase, the market share of NCSA Mosaic cratered. In 1995, Netscape went public. [On the first day][10], the stock started at $28, jumped to $75 and ended the day at $58. Netscape was without any rivals. + +But that didn’t last for long. In the summer of 1994, Microsoft released Internet Explorer 1.0, which was based on Spyglass Mosaic which was based on NCSA Mosaic. The [browser wars][11] had begun. + +Over the next few years, Netscape and Microsoft competed for dominance of the internet. Each added features to compete with the other. Unfortunately, Internet Explorer had an advantage because it came bundled with Windows. On top of that, Microsoft had more programmers and money to throw at the problem. Toward the end of 1997, Netscape started to run into financial problems. + +### Going Open Source + +![Mozilla Firefox][12] + +In January 1998, Netscape open-sourced the code of the Netscape Communicator 4.0 suite. The [goal][13] was to “harness the creative power of thousands of programmers on the Internet by incorporating their best enhancements into future versions of Netscape’s software. This strategy is designed to accelerate development and free distribution by Netscape of future high-quality versions of Netscape Communicator to business customers and individuals.” + +The project was to be shepherded by the newly created Mozilla Organization. However, the code from Netscape Communicator 4.0 proved to be very difficult to work with due to its size and complexity. On top of that, several parts could not be open sourced because of licensing agreements with third parties. In the end, it was decided to rewrite the browser from scratch using the new [Gecko][14]) rendering engine. + +In November 1998, Netscape was acquired by AOL for [stock swap valued at $4.2 billion][15]. + +Starting from scratch was a major undertaking. Mozilla Firefox (initially nicknamed Phoenix) was created in June 2002 and it worked on multiple operating systems, such as Linux, Mac OS, Microsoft Windows, and Solaris. + +The following year, AOL announced that they would be shutting down browser development. The Mozilla Foundation was subsequently created to handle the Mozilla trademarks and handle the financing of the project. Initially, the Mozilla Foundation received $2 million in donations from AOL, IBM, Sun Microsystems, and Red Hat. + +In March 2003, Mozilla [announced pl][16][a][16][ns][16] to separate the suite into stand-alone applications because of creeping software bloat. The stand-alone browser was initially named Phoenix. However, the name was changed due to a trademark dispute with the BIOS manufacturer Phoenix Technologies, which had a BIOS-based browser named trademark dispute with the BIOS manufacturer Phoenix Technologies. Phoenix was renamed Firebird only to run afoul of the Firebird database server people. The browser was once more renamed to the Firefox that we all know. + +At the time, [Mozilla said][17], “We’ve learned a lot about choosing names in the past year (more than we would have liked to). We have been very careful in researching the name to ensure that we will not have any problems down the road. We have begun the process of registering our new trademark with the US Patent and Trademark office.” + +![Mozilla Firefox 1.0][18]Firefox 1.0 : [Picture Credit][19] + +The first official release of Firefox was [0.8][20] on February 8, 2004. 1.0 followed on November 9, 2004. Version 2.0 and 3.0 followed in October 2006 and June 2008 respectively. Each major release brought with it many new features and improvements. In many respects, Firefox pulled ahead of Internet Explorer in terms of features and technology, but IE still had more users. + +That changed with the release of Google’s Chrome browser. In the months before the release of Chrome in September 2008, Firefox accounted for 30% of all [browser usage][21] and IE had over 60%. According to StatCounter’s [January 2019 report][22], Firefox accounts for less than 10% of all browser usage, while Chrome has over 70%. + +Fun Fact + +Contrary to popular belief, the logo of Firefox doesn’t feature a fox. It’s actually a [Red Panda][23]. In Chinese, “fire fox” is another name for the red panda. + +### The Future + +As noted above, Firefox currently has the lowest market share in its recent history. There was a time when a bunch of browsers were based on Firefox, such as the early version of the [Flock browser][24]). Now most browsers are based on Google technology, such as Opera and Vivaldi. Even Microsoft is giving up on browser development and [joining the Chromium band wagon][25]. + +This might seem like quite a downer after the heights of the early Netscape years. But don’t forget what Firefox has accomplished. A group of developers from around the world have created the second most used browser in the world. They clawed 30% market share away from Microsoft’s monopoly, they can do it again. After all, they have us, the open source community, behind them. + +The fight against the monopoly is one of the several reasons [why I use Firefox][26]. Mozilla regained some of its lost market-share with the revamped release of [Firefox Quantum][27] and I believe that it will continue the upward path. + +What event from Linux and open source history would you like us to write about next? 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][28]. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/history-of-firefox + +作者:[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://en.wikipedia.org/wiki/Marc_Andreessen +[2]: https://en.wikipedia.org/wiki/National_Center_for_Supercomputing_Applications +[3]: https://en.wikipedia.org/wiki/Tim_Berners-Lee +[4]: https://www.w3.org/DesignIssues/TimBook-old/History.html +[5]: http://viola.org/ +[6]: https://en.wikipedia.org/wiki/Mosaic_(web_browser +[7]: http://www.computinghistory.org.uk/det/1789/Marc-Andreessen/ +[8]: http://www.davetitus.com/mozilla/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/Mozilla_boxing.jpg?ssl=1 +[10]: https://www.marketwatch.com/story/netscape-ipo-ignited-the-boom-taught-some-hard-lessons-20058518550 +[11]: https://en.wikipedia.org/wiki/Browser_wars +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/mozilla-firefox.jpg?resize=800%2C450&ssl=1 +[13]: https://web.archive.org/web/20021001071727/wp.netscape.com/newsref/pr/newsrelease558.html +[14]: https://en.wikipedia.org/wiki/Gecko_(software) +[15]: http://news.cnet.com/2100-1023-218360.html +[16]: https://web.archive.org/web/20050618000315/http://www.mozilla.org/roadmap/roadmap-02-Apr-2003.html +[17]: https://www-archive.mozilla.org/projects/firefox/firefox-name-faq.html +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/firefox-1.jpg?ssl=1 +[19]: https://www.iceni.com/blog/firefox-1-0-introduced-2004/ +[20]: https://en.wikipedia.org/wiki/Firefox_version_history +[21]: https://en.wikipedia.org/wiki/Usage_share_of_web_browsers +[22]: http://gs.statcounter.com/browser-market-share/desktop/worldwide/#monthly-201901-201901-bar +[23]: https://en.wikipedia.org/wiki/Red_panda +[24]: https://en.wikipedia.org/wiki/Flock_(web_browser +[25]: https://www.windowscentral.com/microsoft-building-chromium-powered-web-browser-windows-10 +[26]: https://itsfoss.com/why-firefox/ +[27]: https://itsfoss.com/firefox-quantum-ubuntu/ +[28]: http://reddit.com/r/linuxusersgroup +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/mozilla-firefox.jpg?fit=800%2C450&ssl=1 From 3a2c9cb1caa2a2faa3539c9ed1d86bf748c08a74 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Fri, 15 Mar 2019 13:44:11 +0800 Subject: [PATCH 620/813] translating by hopefully2333 translating by hopefully2333 --- ...ut computer security with the Raspberry Pi and Kali Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md b/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md index bb57fb2857..72c6f32baa 100644 --- a/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md +++ b/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hopefully2333) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0993364c4f2e06d08199fbbe5b24bf77c769e11e Mon Sep 17 00:00:00 2001 From: zero-mk <1558143962@qq.com> Date: Fri, 15 Mar 2019 13:57:32 +0800 Subject: [PATCH 621/813] translated --- ...90213 How To Install, Configure And Use Fish Shell In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md (100%) diff --git a/sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md b/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md similarity index 100% rename from sources/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md rename to translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md From c6d418216a384db1f2e98c96c71dfef29e1f206c Mon Sep 17 00:00:00 2001 From: MjSeven Date: Fri, 15 Mar 2019 14:30:45 +0800 Subject: [PATCH 622/813] =?UTF-8?q?20190218=20Emoji-Log=20=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... A new way to write Git commit messages.md | 176 ------------------ ... A new way to write Git commit messages.md | 169 +++++++++++++++++ 2 files changed, 169 insertions(+), 176 deletions(-) delete mode 100644 sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md create mode 100644 translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md diff --git a/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md b/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md deleted file mode 100644 index 5f16c51d3e..0000000000 --- a/sources/tech/20190218 Emoji-Log- A new way to write Git commit messages.md +++ /dev/null @@ -1,176 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Emoji-Log: A new way to write Git commit messages) -[#]: via: (https://opensource.com/article/19/2/emoji-log-git-commit-messages) -[#]: author: (Ahmad Awais https://opensource.com/users/mrahmadawais) - -Emoji-Log: A new way to write Git commit messages -====== -Add context to your commits with Emoji-Log. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji_tech_keyboard.jpg?itok=ncBNKZFl) - -I'm a full-time open source developer—or, as I like to call it, an 🎩 open sourcerer. I've been working with open source software for over a decade and [built hundreds][1] of open source software applications. - -I also am a big fan of the Don't Repeat Yourself (DRY) philosophy and believe writing better Git commit messages—ones that are contextual enough to serve as a changelog for your open source software—is an important component of DRY. One of the many workflows I've written is [Emoji-Log][2], a straightforward, open source Git commit log standard. It improves the developer experience (DX) by using emoji to create better Git commit messages. - -I've used Emoji-Log while building the [VSCode Tips & Tricks repo][3], my 🦄 [Shades of Purple VSCode theme repo][4], and even an [automatic changelog][5] that looks beautiful. - -### Emoji-Log's philosophy - -I like emoji (which is, in fact, the plural of emoji). I like 'em a lot. Programming, code, geeks/nerds, open source… all of that is inherently dull and sometimes boring. Emoji help me add colors and emotions to the mix. There's nothing wrong with wanting to attach feelings to the 2D, flat, text-based world of code. - -Instead of memorizing [hundreds of emoji][6], I've learned it's better to keep the categories small and general. Here's the philosophy that guides writing commit messages with Emoji-Log: - - 1. **Imperative** - * Make your Git commit messages imperative. - * Write commit message like you're giving an order. - * e.g., Use ✅ **Add** instead of ❌ **Added** - * e.g., Use ✅ **Create** instead of ❌ **Creating** - 2. **Rules** - * A small number of categories are easy to memorize. - * Nothing more, nothing less - * e.g. **📦 NEW** , **👌 IMPROVE** , **🐛 FIX** , **📖 DOC** , **🚀 RELEASE** , and **✅ TEST** - 3. **Actions** - * Make Git commits based on actions you take. - * Use a good editor like [VSCode][7] to commit the right files with commit messages. - - - -### Writing commit messages - -Use only the following Git commit messages. The simple and small footprint is the key to Emoji-Logo. - - 1. **📦 NEW: IMPERATIVE_MESSAGE** - * Use when you add something entirely new. - * e.g., **📦 NEW: Add Git ignore file** - 2. **👌 IMPROVE: IMPERATIVE_MESSAGE** - * Use when you improve/enhance piece of code like refactoring etc. - * e.g., **👌 IMPROVE: Remote IP API Function** - 3. **🐛 FIX: IMPERATIVE_MESSAGE** - * Use when you fix a bug. Need I say more? - * e.g., **🐛 FIX: Case converter** - 4. **📖 DOC: IMPERATIVE_MESSAGE** - * Use when you add documentation, like README.md or even inline docs. - * e.g., **📖 DOC: API Interface Tutorial** - 5. **🚀 RELEASE: IMPERATIVE_MESSAGE** - * Use when you release a new version. e.g., **🚀 RELEASE: Version 2.0.0** - 6. **✅ TEST: IMPERATIVE_MESSAGE** - * Use when you release a new version. - * e.g., **✅ TEST: Mock User Login/Logout** - - - -That's it for now. Nothing more, nothing less. - -### Emoji-Log functions - -For quick prototyping, I have made the following functions that you can add to your **.bashrc** / **.zshrc** files to use Emoji-Log quickly. - -``` -#.# Better Git Logs. - -### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log). - - - -# Git Commit, Add all and Push — in one step. - -function gcap() { -    git add . && git commit -m "$*" && git push -} - -# NEW. -function gnew() { -    gcap "📦 NEW: $@" -} - -# IMPROVE. -function gimp() { -    gcap "👌 IMPROVE: $@" -} - -# FIX. -function gfix() { -    gcap "🐛 FIX: $@" -} - -# RELEASE. -function grlz() { -    gcap "🚀 RELEASE: $@" -} - -# DOC. -function gdoc() { -    gcap "📖 DOC: $@" -} - -# TEST. -function gtst() { -    gcap "✅ TEST: $@" -} -``` - -To install these functions for the [fish shell][8], run the following commands: - -``` -function gcap; git add .; and git commit -m "$argv"; and git push; end; -function gnew; gcap "📦 NEW: $argv"; end -function gimp; gcap "👌 IMPROVE: $argv"; end; -function gfix; gcap "🐛 FIX: $argv"; end; -function grlz; gcap "🚀 RELEASE: $argv"; end; -function gdoc; gcap "📖 DOC: $argv"; end; -function gtst; gcap "✅ TEST: $argv"; end; -funcsave gcap -funcsave gnew -funcsave gimp -funcsave gfix -funcsave grlz -funcsave gdoc -funcsave gtst -``` - -If you prefer, you can paste these aliases directly in your **~/.gitconfig** file: - -``` -# Git Commit, Add all and Push — in one step. -cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f" - -# NEW. -new = "!f() { git cap \"📦 NEW: $@\"; }; f" -# IMPROVE. -imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f" -# FIX. -fix = "!f() { git cap \"🐛 FIX: $@\"; }; f" -# RELEASE. -rlz = "!f() { git cap \"🚀 RELEASE: $@\"; }; f" -# DOC. -doc = "!f() { git cap \"📖 DOC: $@\"; }; f" -# TEST. -tst = "!f() { git cap \"✅ TEST: $@\"; }; f" -``` - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/emoji-log-git-commit-messages - -作者:[Ahmad Awais][a] -选题:[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/mrahmadawais -[b]: https://github.com/lujun9972 -[1]: https://github.com/ahmadawais -[2]: https://github.com/ahmadawais/Emoji-Log/ -[3]: https://github.com/ahmadawais/VSCode-Tips-Tricks -[4]: https://github.com/ahmadawais/shades-of-purple-vscode/commits/master -[5]: https://github.com/ahmadawais/shades-of-purple-vscode/blob/master/CHANGELOG.md -[6]: https://gitmoji.carloscuesta.me/ -[7]: https://VSCode.pro -[8]: https://en.wikipedia.org/wiki/Friendly_interactive_shell diff --git a/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md b/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md new file mode 100644 index 0000000000..2b4d41ecb3 --- /dev/null +++ b/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emoji-Log: A new way to write Git commit messages) +[#]: via: (https://opensource.com/article/19/2/emoji-log-git-commit-messages) +[#]: author: (Ahmad Awais https://opensource.com/users/mrahmadawais) + +Emoji-Log:编写 Git 提交信息的新方法 +====== +使用 Emoji-Log 为你的提交添加上下文。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji_tech_keyboard.jpg?itok=ncBNKZFl) + +我是一名全职开源开发人员,我喜欢称自己为“开源者”。我从事开源软件工作已经超过十年,并[构建了数百个][1]开源软件应用程序。 + +同时我也是不要重复自己 Don't Repeat Yourself(DRY)哲学的忠实粉丝,并且相信编写更好的 Git 提交消息是 DRY 的一个重要组成部分。它们具有足够的上下文关联可以作为你开源软件的变更日志。我编写的众多工作流之一是 [Emoji-Log][2],它是一个简单易用的开源 Git 提交日志标准。它通过使用表情符号来创建更好的 Git 提交消息,从而改善了开发人员的体验(DX)。 + +我使用 Emoji-Log 构建了 [VSCode Tips & Tricks 仓库][3] 和我的 🦄 [紫色 VSCode 主题仓库][4],以及一个看起来很漂亮的[自动变更日志][5]。 + +### Emoji-Log 的哲学 + +我喜欢表情符号,我很喜欢它们。编程,代码,极客/书呆子,开源...所有这一切本质上都很枯燥,有时甚至很无聊。表情符号帮助我添加颜色和情感。想要将感受添加到 2D、平面和基于文本的代码世界并没有错。 + +相比于[数百个表情符号][6],我学会了更好的办法是保持小类别和普遍性。以下是指导使用 Emoji-Log 编写提交信息的原则: + + 1. **必要的** + * Git 提交信息是必要的。 + * 像下订单一样编写提交信息。 + * 例如,使用 ✅ **Add** 而不是 ❌ **Added** + * 例如,使用 ✅ **Create** 而不是 ❌ **Creating** + 2. **规则** + * 少数类别易于记忆。 + * 不多不也少 + * 例如 **📦 NEW** , **👌 IMPROVE** , **🐛 FIX** , **📖 DOC** , **🚀 RELEASE**, **✅ TEST** + 3. **行为** + * 让 Git 基于你所采取的操作提交 + * 使用像 [VSCode][7] 这样的编辑器来提交带有提交信息的正确文件。 + +### 编写提交信息 + +仅使用以下 Git 提交信息。简单而小巧的占地面积是 Emoji-Log 的核心。 + + 1. **📦 NEW: 必要的信息** + * 当你添加一些全新的东西时使用。 + * 例如 **📦 NEW: 添加 Git 忽略的文件** + 2. **👌 IMPROVE: 必要的信息** + * 用于改进/增强代码段,如重构等。 + * 例如 **👌 IMPROVE: 远程 IP API 函数** + 3. **🐛 FIX: 必要的信息** + * 修复 bug 时使用,不用解释了吧? + * 例如 **🐛 FIX: Case converter** + 4. **📖 DOC: 必要的信息** + * 添加文档时使用,比如 README.md 甚至是内联文档。 + * 例如 **📖 DOC: API 接口教程** + 5. **🚀 RELEASE: 必要的信息** + * 发布新版本时使用。例如, **🚀 RELEASE: Version 2.0.0** + 6. **✅ TEST: 必要的信息** + * 发布新版本时使用。 + * 例如 **✅ TEST: 模拟用户登录/注销** + +就这些了,不多不少。 + +### Emoji-Log 函数 + +为了快速构建原型,我写了以下函数,你可以将它们添加到 **.bashrc** 或者 **.zshrc** 文件中以快速使用 Emoji-Log。 + +``` +#.# Better Git Logs. + +### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log). + +# Git Commit, Add all and Push — in one step. + +function gcap() { +    git add . && git commit -m "$*" && git push +} + +# NEW. +function gnew() { +    gcap "📦 NEW: $@" +} + +# IMPROVE. +function gimp() { +    gcap "👌 IMPROVE: $@" +} + +# FIX. +function gfix() { +    gcap "🐛 FIX: $@" +} + +# RELEASE. +function grlz() { +    gcap "🚀 RELEASE: $@" +} + +# DOC. +function gdoc() { +    gcap "📖 DOC: $@" +} + +# TEST. +function gtst() { +    gcap "✅ TEST: $@" +} +``` + +要为 [fish shell][8] 安装这些函数,运行以下命令: + +``` +function gcap; git add .; and git commit -m "$argv"; and git push; end; +function gnew; gcap "📦 NEW: $argv"; end +function gimp; gcap "👌 IMPROVE: $argv"; end; +function gfix; gcap "🐛 FIX: $argv"; end; +function grlz; gcap "🚀 RELEASE: $argv"; end; +function gdoc; gcap "📖 DOC: $argv"; end; +function gtst; gcap "✅ TEST: $argv"; end; +funcsave gcap +funcsave gnew +funcsave gimp +funcsave gfix +funcsave grlz +funcsave gdoc +funcsave gtst +``` + +如果你愿意,可以将这些别名直接粘贴到 **~/.gitconfig** 文件: +``` +# Git Commit, Add all and Push — in one step. +cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f" + +# NEW. +new = "!f() { git cap \"📦 NEW: $@\"; }; f" +# IMPROVE. +imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f" +# FIX. +fix = "!f() { git cap \"🐛 FIX: $@\"; }; f" +# RELEASE. +rlz = "!f() { git cap \"🚀 RELEASE: $@\"; }; f" +# DOC. +doc = "!f() { git cap \"📖 DOC: $@\"; }; f" +# TEST. +tst = "!f() { git cap \"✅ TEST: $@\"; }; f" +``` + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/emoji-log-git-commit-messages + +作者:[Ahmad Awais][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/mrahmadawais +[b]: https://github.com/lujun9972 +[1]: https://github.com/ahmadawais +[2]: https://github.com/ahmadawais/Emoji-Log/ +[3]: https://github.com/ahmadawais/VSCode-Tips-Tricks +[4]: https://github.com/ahmadawais/shades-of-purple-vscode/commits/master +[5]: https://github.com/ahmadawais/shades-of-purple-vscode/blob/master/CHANGELOG.md +[6]: https://gitmoji.carloscuesta.me/ +[7]: https://VSCode.pro +[8]: https://en.wikipedia.org/wiki/Friendly_interactive_shell From e35de2586f2fd7d6e7f2f8a355ea20436b57f3f3 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:07:38 +0800 Subject: [PATCH 623/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190313=20Why=20?= =?UTF-8?q?is=20no=20one=20signing=20their=20emails=3F=20sources/talk/2019?= =?UTF-8?q?0313=20Why=20is=20no=20one=20signing=20their=20emails.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0313 Why is no one signing their emails.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/talk/20190313 Why is no one signing their emails.md diff --git a/sources/talk/20190313 Why is no one signing their emails.md b/sources/talk/20190313 Why is no one signing their emails.md new file mode 100644 index 0000000000..b2b862951a --- /dev/null +++ b/sources/talk/20190313 Why is no one signing their emails.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why is no one signing their emails?) +[#]: via: (https://arp242.net/weblog/signing-emails.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +Why is no one signing their emails? +====== + + +I received this email a while ago: + +> Queensland University of Technology sent you an Amazon.com Gift Card! +> +> You’ve received an Amazon.com gift card! You’ll need the claim code below to place your order. +> +> Happy shopping! + +Queensland University of Technology? Why would they send me anything? Where is that even? Australia right? That’s the other side of the world! Looks like spam! + +It did look pretty good for spam, so I took a second look. And a very close third look, and then I decided it wasn’t spam. + +I was still confused why they sent me this. A week later I remembered: half a year prior I had done an interview regarding my participation on Stack Overflow for someone’s paper; she was studying somewhere in Australia – presumably the university of Queensland. No one had ever mentioned anything about a reward or Amazon gift card so I wasn’t expecting it. It’s a nice bonus though. + +Here’s the thing: I’ve spent several years professionally developing email systems; I administered email servers; I read all the relevant RFCs. While there are certainly people who are more knowledgable, I know more about email than the vast majority of the population. And I still had to take a careful look to verify the email wasn’t a phishing attempt. + +And I’m not even a target; I’m just this guy, you know? [Ask John Podesta what it is to be targeted][1]: + +> SecureWorks concluded Fancy Bear had sent Podesta an email on March 19, 2016, that had the appearance of a Google security alert, but actually contained a misleading link—a strategy known as spear-phishing. [..] The email was initially sent to the IT department as it was suspected of being a fake but was described as “legitimate” in an e-mail sent by a department employee, who later said he meant to write “illegitimate”. + +Yikes! If I was even remotely high-profile I’d be crazy paranoid about all emails I get. + +It seems to me that there is a fairly easy solution to verify the author of an email: sign it with a digital signature; PGP is probably the best existing solution right now. I don’t even care about encryption here, just signing to prevent phishing. + +PGP has a well-deserved reputation for being hard, but that’s only for certain scenarios. A lot of the problems/difficulties stem from trying to accommodate the “random person A emails random person B” use case, but this isn’t really what I care about here. “Large company with millions of users sends thousands of emails daily” is a very different use case. + +Much of the key exchange/web-of-trust dilemma can be bypassed by shipping email clients with keys for large organisations (PayPal, Google, etc.) baked in, like browsers do with some certificates. Even just publishing your key on your website (or, if you’re a bank, in local branches etc.) is already a lot better than not signing anything at all. Right now there seems to be a catch-22 scenario: clients don’t implement better support as very few people are using PGP, while very few companies bother signing their emails with PGP because so few people can benefit from it. + +On the end-user side, things are also not very hard; we’re just conceded with validating signatures, nothing more. For this purpose PGP isn’t hard. It’s like verifying your Linux distro’s package system: all of them sign their packages (usually with PGP) and they get verified on installation, but as an end-user I never see it unless something goes wrong. + +There are many aspects of PGP that are hard to set up and manage, but verifying signatures isn’t one of them. The user-visible part of this is very limited. Remember, no one is expected to sign their own emails: just verify that the signature is correct (which the software will do). Conceptually, it’s not that different from verifying a handwritten signature. + +DKIM and SPF already exist and are useful, but limited. All both do is verify that an email which claims to be from `amazon.com` is really from `amazon.com`. If I send an email from `mail.amazon-account-security.com` or `amazonn.com` then it just verifies that it was sent from that domain, not that it was sent from the organisation Amazon. + +What I am proposing is subtly different. In my (utopian) future every serious organisation will sign their email with PGP (just like every serious organisation uses https). Then every time I get an email which claims to be from Amazon I can see it’s either not signed, or not signed by a key I know. If adoption is broad enough we can start showing warnings such as “this email wasn’t signed, do you want to trust it?” and “this signature isn’t recognized, yikes!” + +There’s also S/MIME, which has better client support and which works more or less the same as HTTPS: you get a certificate from the Certificate Authority Mafia, sign your email with it, and presto. The downside of this is that anyone can sign their emails with a valid key, which isn’t necessarily telling you much (just because haxx0r.ru has a certificate doesn’t mean it’s trustworthy). + +Is it perfect? No. I understand stuff like key exchange is hard and that baking in keys isn’t perfect. Is it better? Hell yes. Would probably have avoided Podesta and the entire Democratic Party a lot of trouble. Here’s a “[sophisticated new phishing campaign][2]” targeted at PayPal users. How “sophisticated”? Well, by not having glaring stupid spelling errors, duplicating the PayPal layout in emails, duplicating the PayPal login screen, a few forms, and getting an SSL certificate. Truly, the pinnacle of Computer Science. + +Okay sure, they spent some effort on it; but any nincompoop can do it; if this passes for “sophisticated phishing” where “it’s easy to see how users could be fooled” then the bar is pretty low. + +I can’t recall receiving a single email from any organisation that is signed (much less encrypted). Banks, financial services, utilities, immigration services, governments, tax services, voting registration, Facebook, Twitter, a zillion websites … all happily sent me emails hoping I wouldn’t consider them spam and hoping I wouldn’t confuse a phishing email for one of theirs. + +Interesting experiment: send invoices for, say, a utility bill for a local provider. Just copy the layout from the last utility bill you received. I’ll bet you’ll make more money than freelancing on UpWork if you do it right. + +I’ve been intending to write this post for years, but never quite did because “surely not everyone is stupid?” I’m not a crypto expert, so perhaps I’m missing something here, but I wouldn’t know what. Let me know if I am. + +In the meanwhile PayPal is attempting to solve the problem by publishing [articles which advise you to check for spelling errors][3]. Okay, it’s good advice, but do we really want this to be the barrier between an attacker and your money? Or Russian hacking groups and your emails? Anyone can sign any email with any key, but “unknown signature” warnings strike me as a lot better UX than “carefully look for spelling errors or misleading domain names”. + +The way forward is to make it straight-forward to implement signing in apps and then just do it as a developer, whether asked or not; just as you set up https whether you’re asked or not. I’ll write a follow-up with more technical details later, assuming no one pokes holes in this article :-) + +#### Response to some feedback + +Some response to some feedback that I couldn’t be bothered to integrate in the article’s prose: + + * “You can’t trust webmail with crypto!” +If you use webmail then you’re already trusting the email provider with everything. What’s so bad with trusting them to verify a signature, too? + +We’re not communicating state secrets over encrypted email here; we’re just verifying the signature on “PayPal sent you a message, click here to view it”-kind of emails. + + * “Isn’t this ignoring the massive problem that is key management?” +Yes, it’s hard problem; but that doesn’t mean it can’t be done. I already mentioned some possible solutions in the article. + + + + +**Footnotes** + + 1. We could make something better; PGP contians a lot of cruft. But for now PGP is “good enough”. + + + + + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/signing-emails.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/Podesta_emails#Data_theft +[2]: https://www.eset.com/us/about/newsroom/corporate-blog/paypal-users-targeted-in-sophisticated-new-phishing-campaign/ +[3]: https://www.paypal.com/cs/smarthelp/article/how-to-spot-fake,-spoof,-or-phishing-emails-faq2340 From b121d0bf36b55ce10e724356091efc863d7ba007 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:12:45 +0800 Subject: [PATCH 624/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171119=20Advanc?= =?UTF-8?q?ed=20Techniques=20for=20Reducing=20Emacs=20Startup=20Time=20sou?= =?UTF-8?q?rces/tech/20171119=20Advanced=20Techniques=20for=20Reducing=20E?= =?UTF-8?q?macs=20Startup=20Time.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hniques for Reducing Emacs Startup Time.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md diff --git a/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md b/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md new file mode 100644 index 0000000000..6a761ac7d1 --- /dev/null +++ b/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Advanced Techniques for Reducing Emacs Startup Time) +[#]: via: (https://blog.d46.us/advanced-emacs-startup/) +[#]: author: (Joe Schafer https://blog.d46.us/) + +Advanced Techniques for Reducing Emacs Startup Time +====== + +Six techniques to reduce Emacs startup time by the author of the [Emacs Start Up Profiler][1]. + +tl;dr: Do these steps: + + 1. Profile with Esup. + 2. Adjust the garbage collection threshold. + 3. Autoload **everything** with use-package. + 4. Avoid helper functions which cause eager loads. + 5. See my Emacs [config][2] for an example. + + + +### From .emacs.d Bankruptcy to Now + +I recently declared my third .emacs.d bankruptcy and finished the fourth iteration of my Emacs configuration. The evolution was: + + 1. Copy and paste elisp snippets into `~/.emacs` and hope it works. + 2. Adopt a more structured approach with `el-get` to manage dependencies. + 3. Give up and outsource to Spacemacs. + 4. Get tired of Spacemacs intricacies and rewrite with `use-package`. + + + +This article is a collection of tips collected during the 3 rewrites and from creating the Emacs Start Up Profiler. Many thanks to the teams behind Spacemacs, use-package and general. Without these dedicated voluteers, this task would be vastly more difficult. + +### But What About Daemon Mode + +Before we get started, let me acknowledge the common retort when optimizing Emacs: “Emacs is meant to run as a daemon so you’ll only start it once.” That’s all well and good except: + + * Fast things feel nicer. + * When customizing Emacs, you sometimes get into weird states that can be hard to recover from without restarting. For example, if you add a slow `lambda` function to your `post-command-hook`, it’s tough to remove it. + * Restarting Emacs helps verify that customization will persist between sessions. + + + +### 1\. Establish the Current and Best Possible Start Up Time + +The first step is to measure the current start up time. The easy way is to display the information at startup which will show progress through the next steps. + +``` +(add-hook 'emacs-startup-hook + (lambda () + (message "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) +``` + +Second, measure the best possible startup speed so you know what’s possible. Mine is 0.3 seconds. + +``` +emacs -q --eval='(message "%s" (emacs-init-time))' + +;; For macOS users: +open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))' +``` + +### 2\. Profile Emacs Startup for Easy Wins + +The [Emacs StartUp Profiler][1] (ESUP) will give you detailed metrics for top-level expressions. + +![esup.png][3] + +Figure 1: + +Emacs Start Up Profiler Screenshot + +WARNING: Spacemacs users, ESUP currently chokes on the Spacemacs init.el file. Follow for updates. + +### 3\. Set the Garbage Collection Threshold Higher during Startup + +This saves about ****0.3 seconds**** on my configuration. + +The default value for Emacs is 760kB which is extremely conservative on a modern machine. The real trick is to lower it back to something reasonable after initialization. This saves about 0.3 seconds on my init files. + +``` +;; Make startup faster by reducing the frequency of garbage +;; collection. The default is 800 kilobytes. Measured in bytes. +(setq gc-cons-threshold (* 50 1000 1000)) + +;; The rest of the init file. + +;; Make gc pauses faster by decreasing the threshold. +(setq gc-cons-threshold (* 2 1000 1000)) +``` + +### 4\. Never require anything; autoload with use-package instead + +The best way to make Emacs faster is to do less. Running `require` eagerly loads the underlying source file. It’s rare the you’ll need functionality immediately at startup time. + +With [`use-package`][4], you declare which features you need from a package and `use-package` does the right thing. Here’s what it looks like: + +``` +(use-package evil-lisp-state ; the Melpa package name + + :defer t ; autoload this package + + :init ; Code to run immediately. + (setq evil-lisp-state-global nil) + + :config ; Code to run after the package is loaded. + (abn/define-leader-keys "k" evil-lisp-state-map)) +``` + +To see what packages Emacs currently has loaded, examine the `features` variable. For nice output see [lpkg explorer][5] or my variant in [abn-funcs-benchmark.el][6]. The output looks like: + +``` +479 features currently loaded + - abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el + - evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc + - misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc + - multi-isearch: nil + - +``` + +### 5\. Avoid Helper Functions to Set Up Modes + +Often, Emacs packages will suggest running a helper function to set up keybindings. Here’s a few examples: + + * `(evil-escape-mode)` + * `(windmove-default-keybindings) ; Sets up keybindings.` + * `(yas-global-mode 1) ; Complex snippet setup.` + + + +Rewrite these with use-package to improve startup speed. These helper functions are really just sneaky ways to trick you into eagerly loading packages before you need them. + +As an example, here’s how to autoload `evil-escape-mode`. + +``` +;; The definition of evil-escape-mode. +(define-minor-mode evil-escape-mode + (if evil-escape-mode + (add-hook 'pre-command-hook 'evil-escape-pre-command-hook) + (remove-hook 'pre-command-hook 'evil-escape-pre-command-hook))) + +;; Before: +(evil-escape-mode) + +;; After: +(use-package evil-escape + :defer t + ;; Only needed for functions without an autoload comment (;;;###autoload). + :commands (evil-escape-pre-command-hook) + + ;; Adding to a hook won't load the function until we invoke it. + ;; With pre-command-hook, that means the first command we run will + ;; load evil-escape. + :init (add-hook 'pre-command-hook 'evil-escape-pre-command-hook)) +``` + +For a much trickier example, consider `org-babel`. The common recipe is: + +``` +(org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (emacs-lisp . nil))) +``` + +This is bad because `org-babel-do-load-languages` is defined in `org.el`, which is over 24k lines of code and takes about 0.2 seconds to load. After examining the source code, `org-babel-do-load-languages` is simply requiring the `ob-` package like so: + +``` +;; From org.el in the org-babel-do-load-languages function. +(require (intern (concat "ob-" lang))) +``` + +In the `ob-.el`, there’s only two methods we care about, `org-babel-execute:` and `org-babel-expand-body:`. We can autoload the org-babel functionality instead of `org-babel-do-load-languages` like so: + +``` +;; Avoid `org-babel-do-load-languages' since it does an eager require. +(use-package ob-python + :defer t + :ensure org-plus-contrib + :commands (org-babel-execute:python)) + +(use-package ob-shell + :defer t + :ensure org-plus-contrib + :commands + (org-babel-execute:sh + org-babel-expand-body:sh + + org-babel-execute:bash + org-babel-expand-body:bash)) +``` + +### 6\. Defer Packages you don’t need Immediately with Idle Timers + +This saves about ****0.4 seconds**** for the 9 packages I defer. + +Some packages are useful and you want them available soon, but are not essential for immediate editing. These modes include: + + * `recentf`: Saves recent files. + * `saveplace`: Saves point of visited files. + * `server`: Starts Emacs daemon. + * `autorevert`: Automatically reloads files that changed on disk. + * `paren`: Highlight matching parenthesis. + * `projectile`: Project management tools. + * `whitespace`: Highlight trailing whitespace. + + + +Instead of requiring these modes, ****load them after N seconds of idle time****. I use 1 second for the more important packages and 2 seconds for everything else. + +``` +(use-package recentf + ;; Loads after 1 second of idle time. + :defer 1) + +(use-package uniquify + ;; Less important than recentf. + :defer 2) +``` + +### Optimizations that aren’t Worth It + +Don’t bother byte-compiling your personal Emacs files. It saved about 0.05 seconds. Byte compiling causes difficult to debug errors when the source file gets out of sync with compiled file. + + +-------------------------------------------------------------------------------- + +via: https://blog.d46.us/advanced-emacs-startup/ + +作者:[Joe Schafer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://blog.d46.us/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/jschaf/esup +[2]: https://github.com/jschaf/dotfiles/blob/master/emacs/start.el +[3]: https://blog.d46.us/images/esup.png +[4]: https://github.com/jwiegley/use-package +[5]: https://gist.github.com/RockyRoad29/bd4ca6fdb41196a71662986f809e2b1c +[6]: https://github.com/jschaf/dotfiles/blob/master/emacs/funcs/abn-funcs-benchmark.el From 607a84a06b6140bbe47c1a5782b2f5f00d4aa1e7 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:18:29 +0800 Subject: [PATCH 625/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180826=20Be=20p?= =?UTF-8?q?roductive=20with=20Org-mode=20sources/tech/20180826=20Be=20prod?= =?UTF-8?q?uctive=20with=20Org-mode.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180826 Be productive with Org-mode.md | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 sources/tech/20180826 Be productive with Org-mode.md diff --git a/sources/tech/20180826 Be productive with Org-mode.md b/sources/tech/20180826 Be productive with Org-mode.md new file mode 100644 index 0000000000..3c6f3c4519 --- /dev/null +++ b/sources/tech/20180826 Be productive with Org-mode.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Be productive with Org-mode) +[#]: via: (https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/) +[#]: author: (Ayrat Badykov https://www.badykov.com) + +Be productive with Org-mode +====== + + +![org-mode-collage][1] + +### Introduction + +In my [previous post about emacs][2] I mentioned [Org-mode][3], a note manager and organizer. In this post, I’ll describe my day-to-day Org-mode use cases. + +### Notes and to-do lists + +First and foremost, Org-mode is a tool for managing notes and to-do lists and all work in Org-mode is centered around writing notes in plain text files. I manage several kinds of notes using Org-mode. + +#### General notes + +The most basic Org-mode use case is writing simple notes about things that you want to remember. For example, here are my notes about things I’m learning right now: + +``` +* Learn +** Emacs LISP +*** Plan + + - [ ] Read best practices + - [ ] Finish reading Emacs Manual + - [ ] Finish Exercism Exercises + - [ ] Write a couple of simple plugins + - Notification plugin + +*** Resources + + https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html + http://exercism.io/languages/elisp/about + [[http://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/][The Ultimate Collection of Emacs Resources]] + +** Rust gamedev +*** Study [[https://github.com/SergiusIW/gate][gate]] 2d game engine with web assembly support +*** [[ggez][https://github.com/ggez/ggez]] +*** [[https://www.amethyst.rs/blog/release-0-8/][Amethyst 0.8 Relesed]] + +** Upgrade Elixir/Erlang Skills +*** Read Erlang in Anger +``` + +How it looks using [org-bullets][4]: + +![notes][5] + +In this simple example you can see some of the Org-mode features: + + * nested notes + * links + * lists with checkboxes + + + +#### Project todos + +Often when I’m working on some task I notice things that I can improve or fix. Instead of leaving TODO comment in source code files (bad smell) I use [org-projectile][6] which allows me to write TODO items with a single shortcut in a separate file. Here’s an example of this file: + +``` +* [[elisp:(org-projectile-open-project%20"mana")][mana]] [3/9] + :PROPERTIES: + :CATEGORY: mana + :END: +** DONE [[file:~/Development/mana/apps/blockchain/lib/blockchain/contract/create_contract.ex::insufficient_gas_before_homestead%20=][fix this check using evm.configuration]] + CLOSED: [2018-08-08 Ср 09:14] + [[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md][eip2]]: + If contract creation does not have enough gas to pay for the final gas fee for + adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) + rather than leaving an empty contract. +** DONE Upgrade Elixir to 1.7. + CLOSED: [2018-08-08 Ср 09:14] +** TODO [#A] Difficulty tests +** TODO [#C] Upgrage to OTP 21 +** DONE [#A] EIP150 + CLOSED: [2018-08-14 Вт 21:25] +*** DONE operation cost changes + CLOSED: [2018-08-08 Ср 20:31] +*** DONE 1/64th for a call and create + CLOSED: [2018-08-14 Вт 21:25] +** TODO [#C] Refactor interfaces +** TODO [#B] Caching for storage during execution +** TODO [#B] Removing old merkle trees +** TODO do not calculate cost twice +* [[elisp:(org-projectile-open-project%20".emacs.d")][.emacs.d]] [1/3] + :PROPERTIES: + :CATEGORY: .emacs.d + :END: +** TODO fix flycheck issues (emacs config) +** TODO use-package for fetching dependencies +** DONE clean configuration + CLOSED: [2018-08-26 Вс 11:48] +``` + +How it looks in Emacs: + +![project-todos][7] + +In this example you can see more Org mode features: + + * todo items have states - `TODO`, `DONE`. You can define your own states (`WAITING` etc) + * closed items have `CLOSED` timestamp + * some items have priorities - A, B, C. + * links can be internal (`[[file:~/...]`) + + + +#### Capture templates + +As described in Org-mode’s documentation, capture lets you quickly store notes with little interruption of your workflow. + +I configured several capture templates which help me to quickly create notes about things that I want to remember. + +``` +(setq org-capture-templates +'(("t" "Todo" entry (file+headline "~/Dropbox/org/todo.org" "Todo soon") +"* TODO %? \n %^t") +("i" "Idea" entry (file+headline "~/Dropbox/org/ideas.org" "Ideas") +"* %? \n %U") +("e" "Tweak" entry (file+headline "~/Dropbox/org/tweaks.org" "Tweaks") +"* %? \n %U") +("l" "Learn" entry (file+headline "~/Dropbox/org/learn.org" "Learn") +"* %? \n") +("w" "Work note" entry (file+headline "~/Dropbox/org/work.org" "Work") +"* %? \n") +("m" "Check movie" entry (file+headline "~/Dropbox/org/check.org" "Movies") +"* %? %^g") +("n" "Check book" entry (file+headline "~/Dropbox/org/check.org" "Books") +"* %^{book name} by %^{author} %^g"))) +``` + +For a book note I should add its name and its author, for a movie note I should add tags etc. + +### Planning + +Another great feature of Org-mode is that you can use it as a day planner. Let’s see an example of one of my days: + +![schedule][8] + +I didn’t give a lot of thought to this example, it’s my real file for today. It doesn’t look like much but it helps to spend your time on things that important to you and fight with procrastination. + +#### Habits + +From Org mode’s documentation, Org has the ability to track the consistency of a special category of TODOs, called “habits”. I use this feature along with day planning when I want to create new habits: + +![habits][9] + +As you can see currently I’m trying to wake early every day and workout once in two days. Also, it helped to start reading books every day. + +#### Agenda views + +Last but not least I use agenda views. Todo items can be scattered throughout different files (in my case daily plan and habits are in separate files), agenda views give an overview of all todo items: + +![agenda][10] + +### More Org mode features + + ++ Smartphone apps (Android, ios) + ++ Exporting Org mode files into different formats (html, markdown, pdf, latex etc) + ++ Tracking Finances with ledger + +### Conclusion + +In this post, I described a small subset of Org-mode’s extensive functionality that helps me be productive every day, spending time on things that important to me. + + +-------------------------------------------------------------------------------- + +via: https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/ + +作者:[Ayrat Badykov][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://www.badykov.com +[b]: https://github.com/lujun9972 +[1]: https://i.imgur.com/hgqCyen.jpg +[2]: http://www.badykov.com/emacs/2018/07/31/why-emacs-is-a-great-editor/ +[3]: https://orgmode.org/ +[4]: https://github.com/sabof/org-bullets +[5]: https://i.imgur.com/lGi60Uw.png +[6]: https://github.com/IvanMalison/org-projectile +[7]: https://i.imgur.com/Hbu8ilX.png +[8]: https://i.imgur.com/z5HpuB0.png +[9]: https://i.imgur.com/YJIp3d0.png +[10]: https://i.imgur.com/CKX9BL9.png From 0b3426fd098a492be01450251fa213b64b002869 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:24:48 +0800 Subject: [PATCH 626/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180330=20Asynch?= =?UTF-8?q?ronous=20rsync=20with=20Emacs,=20dired=20and=20tramp.=20sources?= =?UTF-8?q?/tech/20180330=20Asynchronous=20rsync=20with=20Emacs,=20dired?= =?UTF-8?q?=20and=20tramp..md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nous rsync with Emacs, dired and tramp..md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md diff --git a/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md b/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md new file mode 100644 index 0000000000..954644918b --- /dev/null +++ b/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Asynchronous rsync with Emacs, dired and tramp.) +[#]: via: (https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/) +[#]: author: (cpbotha https://vxlabs.com/author/cpbotha/) + +Asynchronous rsync with Emacs, dired and tramp. +====== + +[tmtxt-dired-async][1] by [Trần Xuân Trường][2] is an unfortunately lesser known Emacs package which extends dired, the Emacs file manager, to be able to run rsync and other commands (zip, unzip, downloading) asynchronously. + +This means you can copy gigabytes of directories around whilst still happily continuing with all of your other tasks in the Emacs operating system. + +It has a feature where you can add any number of files from different locations into a wait list with `C-c C-a`, and then asynchronously rsync the whole wait list into a final destination directory with `C-c C-v`. This alone is worth the price of admission. + +For example here it is pointlessly rsyncing the arduino 1.9 beta archive to another directory: + +[![][3]][4] + +When the process is complete, the window at the bottom will automatically be killed after 5 seconds. Here is a separate session right after the asynchronous unzipping of the above-mentioned arduino archive: + +[![][5]][6] + +This package has further increased the utility of my dired configuration. + +I just contributed [a pull request that enables tmtxt-dired-async to rsync to remote tramp-based directories][7], and I immediately used this new functionality to sort a few gigabytes of new photos onto the Linux server. + +To add tmtxt-dired-async to your config, download [tmtxt-async-tasks.el][8] (a required library) and [tmtxt-dired-async.el][9] (check that my PR is in there if you plan to use this with tramp) into your `~/.emacs.d/` and add the following to your config: + +``` +;; no MELPA packages of this, so we have to do a simple check here +(setq dired-async-el (expand-file-name "~/.emacs.d/tmtxt-dired-async.el")) +(when (file-exists-p dired-async-el) + (load (expand-file-name "~/.emacs.d/tmtxt-async-tasks.el")) + (load dired-async-el) + (define-key dired-mode-map (kbd "C-c C-r") 'tda/rsync) + (define-key dired-mode-map (kbd "C-c C-z") 'tda/zip) + (define-key dired-mode-map (kbd "C-c C-u") 'tda/unzip) + + (define-key dired-mode-map (kbd "C-c C-a") 'tda/rsync-multiple-mark-file) + (define-key dired-mode-map (kbd "C-c C-e") 'tda/rsync-multiple-empty-list) + (define-key dired-mode-map (kbd "C-c C-d") 'tda/rsync-multiple-remove-item) + (define-key dired-mode-map (kbd "C-c C-v") 'tda/rsync-multiple) + + (define-key dired-mode-map (kbd "C-c C-s") 'tda/get-files-size) + + (define-key dired-mode-map (kbd "C-c C-q") 'tda/download-to-current-dir)) +``` + +Enjoy! + + +-------------------------------------------------------------------------------- + +via: https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/ + +作者:[cpbotha][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://vxlabs.com/author/cpbotha/ +[b]: https://github.com/lujun9972 +[1]: https://truongtx.me/tmtxt-dired-async.html +[2]: https://truongtx.me/about.html +[3]: https://i0.wp.com/vxlabs.com/wp-content/uploads/2018/03/rsync-arduino-zip.png?resize=660%2C340&ssl=1 +[4]: https://i0.wp.com/vxlabs.com/wp-content/uploads/2018/03/rsync-arduino-zip.png?ssl=1 +[5]: https://i1.wp.com/vxlabs.com/wp-content/uploads/2018/03/progress-window-5s.png?resize=660%2C310&ssl=1 +[6]: https://i1.wp.com/vxlabs.com/wp-content/uploads/2018/03/progress-window-5s.png?ssl=1 +[7]: https://github.com/tmtxt/tmtxt-dired-async/pull/6 +[8]: https://github.com/tmtxt/tmtxt-async-tasks +[9]: https://github.com/tmtxt/tmtxt-dired-async From 0a89f92c0ae091b3f9a336895904cd85ead005f3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Mar 2019 22:55:42 +0800 Subject: [PATCH 627/813] PRF:20180926 HTTP- Brief History of HTTP.md @MjSeven --- .../20180926 HTTP- Brief History of HTTP.md | 140 +++++++----------- 1 file changed, 56 insertions(+), 84 deletions(-) diff --git a/translated/tech/20180926 HTTP- Brief History of HTTP.md b/translated/tech/20180926 HTTP- Brief History of HTTP.md index 46df90e42f..64b4c0ae27 100644 --- a/translated/tech/20180926 HTTP- Brief History of HTTP.md +++ b/translated/tech/20180926 HTTP- Brief History of HTTP.md @@ -1,38 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (HTTP: Brief History of HTTP) [#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) [#]: author: (Ilya Grigorik https://www.igvita.com/) -HTTP: HTTP 历史简介 +HTTP 简史 ====== - + +译注:本文来源于 2013 年出版的《High Performance Browser Networking》的第九章,因此有些信息略有过时。事实上,现在 HTTP/2 已经有相当的不是,而新的 HTTP/3 也在设计和标准制定当中。 + ### 介绍 -超文本传输协议(HTTP)是 Internet 上最普遍和广泛采用的应用程序协议之一。它是客户端和服务器之间的通用语言,支持现代 Web。从最初作为一个简单的关键字和文档路径开始,它已成为不仅仅是浏览器的首选协议,而且几乎是所有连接互联网硬件和软件应用程序的首选协议。 +超文本传输协议Hypertext Transfer Protocol(HTTP)是互联网上最普遍和广泛采用的应用程序协议之一。它是客户端和服务器之间的通用语言,支持现代 Web。从最初作为单个的关键字和文档路径开始,它已成为不仅仅是浏览器的首选协议,而且几乎是所有连接互联网硬件和软件应用程序的首选协议。 在本文中,我们将简要回顾 HTTP 协议的发展历史。对 HTTP 不同语义的完整讨论超出了本文的范围,但理解 HTTP 的关键设计变更以及每个变更背后的动机将为我们讨论 HTTP 性能提供必要的背景,特别是在 HTTP/2 中即将进行的许多改进。 -### §HTTP 0.9: 单向协议 +### HTTP 0.9: 单行协议 -Tim Berners-Lee 最初的 HTTP 提案在设计时考虑到了简单性,以帮助他采用他的另一个新想法:万维网(World Wide Web)。这个策略看起来奏效了:注意,他是一个有抱负的协议设计者。 +蒂姆·伯纳斯·李Tim Berners-Lee 最初的 HTTP 提案在设计时考虑到了简单性,以帮助他采用他的另一个新想法:万维网World Wide Web。这个策略看起来奏效了:注意,他是一个有抱负的协议设计者。 -1991 年,Berners-Lee 概述了新协议的动机,并列出了几个高级设计目标:文件传输功能,请求超文档存档索引搜索的能力,格式协商以及将客户端引用到另一个服务器的能力。为了证明该理论的实际应用,我们构建了一个简单原型,它实现了所提议功能的一小部分。 +1991 年,伯纳斯·李概述了这个新协议的动机,并列出了几个高级设计目标:文件传输功能、请求超文档存档索引搜索的能力,格式协商以及将客户端引用到另一个服务器的能力。为了证明该理论的实际应用,构建了一个简单原型,它实现了所提议功能的一小部分。 * 客户端请求是一个 ASCII 字符串。 - * 客户端请求以回车符(CRLF)终止。 - * 服务器响应是 ASCII 字符流。 - * 服务器响应是一种超文本标记语言(HTML)。 - * 文档传输完成后连接终止。 -这些听起来就挺复杂,而实际情况比这复杂得多。这些规则支持的是一种非常简单的,对 Telnet 友好的协议,一些 Web 服务器至今仍然支持这种协议: +然而,即使这听起来也比实际复杂得多。这些规则支持的是一种非常简单的,对 Telnet 友好的协议,一些 Web 服务器至今仍然支持这种协议: ``` $> telnet google.com 80 @@ -45,39 +43,32 @@ GET /about/ (connection closed) ``` -请求包含这样一行:`GET` 方法和请求文档的路径。响应是一个超文本文档-没有标题或任何其他元数据,只有 HTML。真的是再简单不过了。此外,由于之前的交互是预期协议的子集,因此它获得了一个非官方的 HTTP 0.9 标签。其余的,就像他们所说的,都是历史。 +请求包含这样一行:`GET` 方法和请求文档的路径。响应是一个超文本文档,没有标题或任何其他元数据,只有 HTML。真的是再简单不过了。此外,由于之前的交互是预期协议的子集,因此它获得了一个非官方的 HTTP 0.9 标签。其余的,就像他们所说的,都是历史。 从 1991 年这些不起眼的开始,HTTP 就有了自己的生命,并在接下来几年里迅速发展。让我们快速回顾一下 HTTP 0.9 的特性: * 采用客户端-服务器架构,是一种请求-响应协议。 - * 采用 ASCII 协议,运行在 TCP/IP 链路上。 - * 旨在传输超文本文档(HTML)。 - * 每次请求后,服务器和客户端之间的连接都将关闭。 -``` -流行的 Web 服务器,如 Apache 和 Nginx,仍然支持 HTTP 0.9 协议,部分原因是因为它没有太多功能!如果你感兴趣,打开 Telnet 会话并尝试通过 HTTP 0.9 访问 google.com 或你最喜欢的网站,并检查早期协议的行为和限制。 +> 流行的 Web 服务器,如 Apache 和 Nginx,仍然支持 HTTP 0.9 协议,部分原因是因为它没有太多功能!如果你感兴趣,打开 Telnet 会话并尝试通过 HTTP 0.9 访问 google.com 或你最喜欢的网站,并检查早期协议的行为和限制。 -``` -### §HTTP/1.0: 快速增长和 Informational RFC +### HTTP/1.0: 快速增长和 Informational RFC -1991 年至 1995 年期间, HTML 规范和一种称为 “web 浏览器”的新型软件快速发展,面向消费者的公共互联网基础设施也开始出现并快速增长。 +1991 年至 1995 年期间,HTML 规范和一种称为 “web 浏览器”的新型软件快速发展,面向消费者的公共互联网基础设施也开始出现并快速增长。 -``` -##### §完美风暴: 1990 年代初的互联网热潮 +> **完美风暴:1990 年代初的互联网热潮** -基于 Tim Berner-Lee 最初的浏览器原型,美国国家超级计算机应用中心(NCSA)的一个团队决定实现他们自己的版本。就这样,第一个流行的浏览器诞生了:NCSA Mosaic。1994 年 10 月,NCSA 团队的一名程序员 Marc Andreessen 与 Jim Clark 合作创建了 Mosaic Communications,该公司后来改名为 Netscape(网景),并于 1994 年 12 月发布了 Netscape Navigator 1.0。从这一点来说,已经很清楚了,万维网已经不仅仅是学术上的好奇心了。 +> 基于蒂姆·伯纳斯·李最初的浏览器原型,美国国家超级计算机应用中心(NCSA)的一个团队决定实现他们自己的版本。就这样,第一个流行的浏览器诞生了:NCSA Mosaic。1994 年 10 月,NCSA 团队的一名程序员 Marc Andreessen 与 Jim Clark 合作创建了 Mosaic Communications,该公司后来改名为 Netscape(网景),并于 1994 年 12 月发布了 Netscape Navigator 1.0。从这一点来说,已经很清楚了,万维网已经不仅仅是学术上的好奇心了。 -实际上,同年在瑞士日内网组织了第一次万维网会议,这导致万维网联盟(W3C)的成立,以帮助指导 HTML 的发展。同样,在 IETF 内部建立了一个并行的 HTTP 工作组(HTTP-WG),专注于改进 HTTP 协议。后来这两个团体一直对 Web 的发展起着重要作用。 +> 实际上,同年在瑞士日内瓦组织了第一次万维网会议,这导致万维网联盟World Wide Web Consortium(W3C)的成立,以帮助指导 HTML 的发展。同样,在 IETF 内部建立了一个并行的HTTP 工作组HTTP Working Group(HTTP-WG),专注于改进 HTTP 协议。后来这两个团体一直对 Web 的发展起着重要作用。 -最后,完美的风暴来临,CompuServe,AOL 和 Prodigy 在 1994-1995 年的同一时间开始向公众提供拨号上网服务。凭借这股迅速的浪潮,Netscape 在 1995 年 8 月 9 日凭借其成功的 IPO 创造了历史。这预示着互联网热潮已经到来,人人都想分一杯羹! -``` +> 最后,完美风暴来临,CompuServe,AOL 和 Prodigy 在 1994-1995 年的同一时间开始向公众提供拨号上网服务。凭借这股迅速的浪潮,Netscape 在 1995 年 8 月 9 日凭借其成功的 IPO 创造了历史。这预示着互联网热潮已经到来,人人都想分一杯羹! -不断增长的新 Web 所需功能及其在公共网站上的用例很快暴露了 HTTP 0.9 的许多基础限制:我们需要一种能够提供超文本文档、提供关于请求和响应的更丰富的元数据,支持内容协商等等的协议。相应地,新兴的 Web 开发人员社区通过一个特殊的过程生成了大量实验性的 HTTP 服务器和客户端实现来回应:实现,部署,并查看其他人是否采用它。 +不断增长的新 Web 所需功能及其在公共网站上的应用场景很快暴露了 HTTP 0.9 的许多基础限制:我们需要一种能够提供超文本文档、提供关于请求和响应的更丰富的元数据,支持内容协商等等的协议。相应地,新兴的 Web 开发人员社区通过一个特殊的过程生成了大量实验性的 HTTP 服务器和客户端实现来回应:实现,部署,并查看其他人是否采用它。 -从这些急速增长的实验开始,一系列最佳实践和常见模式开始出现。1996 年 5 月,HTTP 工作组(HTTP-WG)发布了 RFC 1945,它记录了许多被广泛使用的 HTTP/1.0 实现的“常见用法”。请注意,这只是一个信息 RFC:HTTP/1.0,因为我们知道它不是一个正式规范或 Internet 标准! +从这些急速增长的实验开始,一系列最佳实践和常见模式开始出现。1996 年 5 月,HTTP 工作组HTTP Working Group(HTTP-WG)发布了 RFC 1945,它记录了许多被广泛使用的 HTTP/1.0 实现的“常见用法”。请注意,这只是一个信息性 RFC:HTTP/1.0,如你所知的,它不是一个正式规范或 Internet 标准! 话虽如此,HTTP/1.0 请求看起来应该是: @@ -86,11 +77,11 @@ $> telnet website.org 80 Connected to xxx.xxx.xxx.xxx -GET /rfc/rfc1945.txt HTTP/1.0 +GET /rfc/rfc1945.txt HTTP/1.0 ❶ User-Agent: CERN-LineMode/2.15 libwww/2.17b3 Accept: */* -HTTP/1.0 200 OK +HTTP/1.0 200 OK ❷ Content-Type: text/plain Content-Length: 137582 Expires: Thu, 01 Dec 1997 16:00:00 GMT @@ -101,34 +92,26 @@ Server: Apache 0.84 (connection closed) ``` - 1. 请求行有 HTTP 版本号,后面跟请求头 +- ❶ 请求行有 HTTP 版本号,后面跟请求头 +- ❷ 响应状态,后跟响应头 - 2. 响应状态,后跟响应头 +前面的交互并不是 HTTP/1.0 功能的详尽列表,但它确实说明了一些关键的协议更改: +* 请求可能多个由换行符分隔的请求头字段组成。 +* 响应对象的前缀是响应状态行。 +* 响应对象有自己的一组由换行符分隔的响应头字段。 +* 响应对象不限于超文本。 +* 每次请求后,服务器和客户端之间的连接都将关闭。 -前面交换的并不是 HTTP/1.0 功能的详尽列表,但它确实说明了一些关键的协议更改: +请求头和响应头都保留为 ASCII 编码,但响应对象本身可以是任何类型:HTML 文件、纯文本文件、图像或任何其他内容类型。因此,HTTP 的“超文本传输”部分在引入后不久就变成了用词不当。实际上,HTTP 已经迅速发展成为一种超媒体传输,但最初的名称没有改变。 - * 请求可能多个由换行符分隔的请求头字段组成。 +除了媒体类型协商之外,RFC 还记录了许多其他常用功能:内容编码、字符集支持、多部分类型、授权、缓存、代理行为、日期格式等。 - * 响应对象的前缀是响应状态行。 +> 今天,几乎所有 Web 上的服务器都可以并且仍将使用 HTTP/1.0。不过,现在你应该更加清楚了!每个请求都需要一个新的 TCP 连接,这会对 HTTP/1.0 造成严重的性能损失。参见[三次握手][1],接着会[慢启动][2]。 - * 响应对象有自己的一组由换行符分隔的响应头字段。 +### HTTP/1.1: Internet 标准 - * 响应对象不限于超文本。 - - * 每次请求后,服务器和客户端之间的连接都将关闭。 - -请求头和响应头都保留为 ASCII 编码,但响应对象本身可以是任何类型:一个 HTML 文件,一个纯文本文件,一个图像或任何其他内容类型。因此,HTTP 的“超文本传输”部分在引入后不久就变成了用词不当。实际上,HTTP 已经迅速发展成为一种超媒体传输,但最初的名称没有改变。 - -除了媒体类型协商之外,RFC 还记录了许多其他常用功能:内容编码,字符集支持,多部分类型,授权,缓存,代理行为,日期格式等。 - -``` -今天,几乎所有 Web 上的服务器都可以并且仍将使用 HTTP/1.0。不过,现在你应该更加清楚了!每个请求都需要一个新的 TCP 连接,这会对 HTTP/1.0 造成严重的性能损失。参见[三次握手][1],接着会[慢启动][2]。 -``` - -### §HTTP/1.1: Internet 标准 - -将 HTTP 转变为官方 IETF 互联网标准的工作与围绕 HTTP/1.0 的文档工作并行进行,并计划从 1995 年至 1999 年完成。事实上,第一个正式的 HTTP/1.1 标准定义于 RFC 2068,它在 HTTP/1.0 发布大约六个月后,即 1997 年 1 月正式发布。两年半后,即 1999 年 6 月,一些新的改进和更新被纳入标准,并作为 RFC 2616 发布。 +将 HTTP 转变为官方 IETF 互联网标准的工作与围绕 HTTP/1.0 的文档工作并行进行,并计划从 1995 年至 1999 年完成。事实上,第一个正式的 HTTP/1.1 标准定义于 RFC 2068,它在 HTTP/1.0 发布大约六个月后,即 1997 年 1 月正式发布。两年半后,即 1999 年 6 月,一些新的改进和更新被纳入标准,并作为 RFC 2616 发布。 HTTP/1.1 标准解决了早期版本中发现的许多协议歧义,并引入了一些关键的性能优化:保持连接,分块编码传输,字节范围请求,附加缓存机制,传输编码和请求管道。 @@ -138,7 +121,7 @@ HTTP/1.1 标准解决了早期版本中发现的许多协议歧义,并引入 $> telnet website.org 80 Connected to xxx.xxx.xxx.xxx -GET /index.html HTTP/1.1 +GET /index.html HTTP/1.1 ❶ Host: website.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 @@ -147,7 +130,7 @@ Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: __qca=P0-800083390... (snip) -HTTP/1.1 200 OK +HTTP/1.1 200 OK ❷ Server: nginx/1.0.11 Connection: keep-alive Content-Type: text/html; charset=utf-8 @@ -157,27 +140,27 @@ Expires: Wed, 25 Jul 2012 20:23:35 GMT Cache-Control: max-age=0, no-cache Transfer-Encoding: chunked -100 +100 ❸ (snip) 100 (snip) -0 +0 ❹ -GET /favicon.ico HTTP/1.1 +GET /favicon.ico HTTP/1.1 ❺ Host: www.website.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) Accept: */* Referer: http://website.org/ -Connection: close +Connection: close ❻ Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: __qca=P0-800083390... (snip) -HTTP/1.1 200 OK +HTTP/1.1 200 OK ❼ Server: nginx/1.0.11 Content-Type: image/x-icon Content-Length: 3638 @@ -194,40 +177,29 @@ Etag: W/PSA-GAu26oXbDi (connection closed) ``` - 1. 请求的 HTML 文件,包括编码,字符集和 cookie 元数据 - - 2. 原始 HTML 请求的分块响应 - - 3. 以 ASCII 十六进制数字(256 字节)表示块中的八位元数 - - 4. 分块流响应结束 - - 5. 在相同的 TCP 连接上请求一个图标文件 - - 6. 通知服务器不再重用连接 - - 7. 图标响应后,然后关闭连接 - +- ❶ 请求的 HTML 文件,包括编、字符集和 cookie 元数据 +- ❷ 原始 HTML 请求的分块响应 +- ❸ 以 ASCII 十六进制数字(256 字节)表示块中的八位元的数量 +- ❹ 分块流响应结束 +- ❺ 在相同的 TCP 连接上请求一个图标文件 +- ❻ 通知服务器不再重用连接 +- ❼ 图标响应后,然后关闭连接 哇,这里发生了很多事情!第一个也是最明显的区别是我们有两个对象请求,一个用于 HTML 页面,另一个用于图像,它们都通过一个连接完成。这就是保持连接的实际应用,它允许我们重用现有的 TCP 连接到同一个主机的多个请求,提供一个更快的最终用户体验。参见[TCP 优化][3]。 要终止持久连接,注意第二个客户端请求通过 `Connection` 请求头向服务器发送显示的 `close`。类似地,一旦传输响应,服务器就可以通知客户端关闭当前 TCP 连接。从技术上讲,任何一方都可以在没有此类信号的情况下终止 TCP 连接,但客户端和服务器应尽可能提供此类信号,以便双方都启用更好的连接重用策略。 -``` -HTTP/1.1 改变了 HTTP 协议的语义,默认情况下使用保持连接。这意味着,除非另有说明(通过 `Connection:close` 头),否则服务器应默认保持连接打开。 +> HTTP/1.1 改变了 HTTP 协议的语义,默认情况下使用保持连接。这意味着,除非另有说明(通过 `Connection:close` 头),否则服务器应默认保持连接打开。 -但是,同样的功能也被反向移植到 HTTP/1.0 上,通过 `Connection:keep-Alive` 头启用。因此,如果你使用 HTTP/1.1,从技术上讲,你不需要 `Connection:keep-Alive` 头,但许多客户端仍然选择提供它。 -``` +> 但是,同样的功能也被反向移植到 HTTP/1.0 上,通过 `Connection:keep-Alive` 头启用。因此,如果你使用 HTTP/1.1,从技术上讲,你不需要 `Connection:keep-Alive` 头,但许多客户端仍然选择提供它。 此外,HTTP/1.1 协议还添加了内容、编码、字符集,甚至语言协商、传输编码、缓存指令、客户端 cookie,以及可以针对每个请求协商的十几个其他功能。 我们不打算详细讨论每个 HTTP/1.1 特性的语义。这个主题可以写一本专门的书了,已经有了很多很棒的书。相反,前面的示例很好地说明了 HTTP 的快速进展和演变,以及每个客户端-服务器交换的错综复杂的过程,里面发生了很多事情! -``` -要了解 HTTP 协议所有内部工作原理,参考 David Gourley 和 Brian Totty 共同撰写的权威指南: The Definitive Guide。(to 校正:这里翻译的不准确) -``` +> 要了解 HTTP 协议所有内部工作原理,参考 David Gourley 和 Brian Totty 共同撰写的权威指南: The Definitive Guide。 -### §HTTP/2: 提高传输性能 +### HTTP/2: 提高传输性能 RFC 2616 自发布以来,已经成为互联网空前增长的基础:数十亿各种形状和大小的设备,从台式电脑到我们口袋里的小型网络设备,每天都在使用 HTTP 来传送新闻,视频,在我们生活中的数百万的其他网络应用程序都在依靠它。 @@ -239,7 +211,7 @@ RFC 2616 自发布以来,已经成为互联网空前增长的基础:数十 > > RFC 2616: HTTP/1.1, June 1999 -HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上,现在使用 HTTP 作为主要控制和数据协议的嵌入式设备(传感器,执行器和咖啡壶)并不罕见。但在其自身成功的重压下,随着我们越来越多地继续将日常互动转移到网络-社交、电子邮件、新闻和视频,以及越来越多的个人和工作空间,它也开始显示出压力的迹象。用户和 Web 开发人员现在都要求 HTTP/1.1 提供近乎实时的响应能力和协议 +HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上,现在使用 HTTP 作为主要控制和数据协议的嵌入式设备(传感器,执行器和咖啡壶)并不罕见。但在其自身成功的重压下,随着我们越来越多地继续将日常互动转移到网络 —— 社交、电子邮件、新闻和视频,以及越来越多的个人和工作空间,它也开始显示出压力的迹象。用户和 Web 开发人员现在都要求 HTTP/1.1 提供近乎实时的响应能力和协议 性能,如果不进行一些修改,就无法满足这些要求。 为了应对这些新挑战,HTTP 必须继续发展,因此 HTTPbis 工作组在 2012 年初宣布了一项针对 HTTP/2 的新计划: @@ -252,7 +224,7 @@ HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上 HTTP/2 的主要重点是提高传输性能并支持更低的延迟和更高的吞吐量。主要的版本增量听起来像是一个很大的步骤,但就性能而言,它将是一个重大的步骤,但重要的是要注意,没有任何高级协议语义收到影响:所有的 HTTP 头,值和用例是相同的。 -任何现有的网站或应用程序都可以并且将通过 HTTP/2 传送而无需修改。你无需修改应用程序标记来利用 HTTP/2。HTTP 服务器必须使用 HTTP/2,但这对大多数用户来说应该是透明的升级。如果工作组实现目标,唯一的区别应该是我们的应用程序以更低的延迟和更好的网络连接利用率来传送数据。 +任何现有的网站或应用程序都可以并且将通过 HTTP/2 传送而无需修改。你无需修改应用程序标记来利用 HTTP/2。HTTP 服务器将来一定会使用 HTTP/2,但这对大多数用户来说应该是透明的升级。如果工作组实现目标,唯一的区别应该是我们的应用程序以更低的延迟和更好的网络连接利用率来传送数据。 话虽如此,但我们不要走的太远了。在讨论新的 HTTP/2 协议功能之前,有必要回顾一下我们现有的 HTTP/1.1 部署和性能最佳实践。HTTP/2 工作组正在新规范上取得快速的进展,但即使最终标准已经完成并准备就绪,在可预见的未来,我们仍然必须支持旧的 HTTP/1.1 客户端,实际上,这得十年或更长时间。 @@ -263,7 +235,7 @@ via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol 作者:[Ilya Grigorik][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 424dfb20e23b00922d35f2a02c90de38a794d5a2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Mar 2019 22:56:22 +0800 Subject: [PATCH 628/813] PUB:20180926 HTTP- Brief History of HTTP.md @MjSeven https://linux.cn/article-10621-1.html --- .../20180926 HTTP- Brief History of HTTP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180926 HTTP- Brief History of HTTP.md (99%) diff --git a/translated/tech/20180926 HTTP- Brief History of HTTP.md b/published/20180926 HTTP- Brief History of HTTP.md similarity index 99% rename from translated/tech/20180926 HTTP- Brief History of HTTP.md rename to published/20180926 HTTP- Brief History of HTTP.md index 64b4c0ae27..5d95730284 100644 --- a/translated/tech/20180926 HTTP- Brief History of HTTP.md +++ b/published/20180926 HTTP- Brief History of HTTP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10621-1.html) [#]: subject: (HTTP: Brief History of HTTP) [#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) [#]: author: (Ilya Grigorik https://www.igvita.com/) From 6f849bcadbc88f47337e66d4dbee78ca342bc53f Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Sat, 16 Mar 2019 00:33:43 +0800 Subject: [PATCH 629/813] hankchow translated --- ...190226 All about -Curly Braces- in Bash.md | 239 ------------------ ...190226 All about -Curly Braces- in Bash.md | 235 +++++++++++++++++ 2 files changed, 235 insertions(+), 239 deletions(-) delete mode 100644 sources/tech/20190226 All about -Curly Braces- in Bash.md create mode 100644 translated/tech/20190226 All about -Curly Braces- in Bash.md diff --git a/sources/tech/20190226 All about -Curly Braces- in Bash.md b/sources/tech/20190226 All about -Curly Braces- in Bash.md deleted file mode 100644 index 277e2159de..0000000000 --- a/sources/tech/20190226 All about -Curly Braces- in Bash.md +++ /dev/null @@ -1,239 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (All about {Curly Braces} in Bash) -[#]: via: (https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash) -[#]: author: (Paul Brown https://www.linux.com/users/bro66) - -All about {Curly Braces} in Bash -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/curly-braces-1920.jpg?itok=cScRhWrX) - -At this stage of our Bash basics series, it would be hard not to see some crossover between topics. For example, you have already seen a lot of brackets in the examples we have shown over the past several weeks, but the focus has been elsewhere. - -For the next phase of the series, we’ll take a closer look at brackets, curly, curvy, or straight, how to use them, and what they do depending on where you use them. We will also tackle other ways of enclosing things, like when to use quotes, double-quotes, and backquotes. - -This week, we're looking at curly brackets or _braces_ : `{}`. - -### Array Builder - -You have already encountered curly brackets before in [The Meaning of Dot][1]. There, the focus was on the use of the dot/period (`.`), but using braces to build a sequence was equally important. - -As we saw then: - -``` -echo {0..10} -``` - -prints out the numbers from 0 to 10. Using: - -``` -echo {10..0} -``` - -prints out the same numbers, but in reverse order. And, - -``` -echo {10..0..2} -``` - -prints every second number, starting with 10 and making its way backwards to 0. - -Then, - -``` -echo {z..a..2} -``` - -prints every second letter, starting with _z_ and working its way backwards until _a_. - -And so on and so forth. - -Another thing you can do is combine two or more sequences: - -``` -echo {a..z}{a..z} -``` - -This prints out all the two letter combinations of the alphabet, from _aa_ to _zz_. - -Is this useful? Well, actually it is. You see, arrays in Bash are defined by putting elements between parenthesis `()` and separating each element using a space, like this: - -``` -month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") -``` - -To access an element within the array, you use its index within brackets `[]`: - -``` -$ echo ${month[3]} # Array indexes start at [0], so [3] points to the fourth item - -Apr -``` - -You can accept all those brackets, parentheses, and braces on faith for a moment. We'll talk about them presently. - -Notice that, all things being equal, you can create an array with something like this: - -``` -letter_combos=({a..z}{a..z}) -``` - -and `letter_combos` points to an array that contains all the 2-letter combinations of the entire alphabet. - -You can also do this: - -``` -dec2bin=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}) -``` - -This last one is particularly interesting because `dec2bin` now contains all the binary numbers for an 8-bit register, in ascending order, starting with 00000000, 00000001, 00000010, etc., until reaching 11111111. You can use this to build yourself an 8-bit decimal-to-binary converter. Say you want to know what 25 is in binary. You can do this: - -``` -$ echo ${dec2bin[25]} - -00011001 -``` - -Yes, there are better ways of converting decimal to binary as we saw in [the article where we discussed & as a logical operator][2], but it is still interesting, right? - -### Parameter expansion - -Getting back to - -``` -echo ${month[3]} -``` - -Here the braces `{}` are not being used as apart of a sequence builder, but as a way of generating _parameter expansion_. Parameter expansion involves what it says on the box: it takes the variable or expression within the braces and expands it to whatever it represents. - -In this case, `month` is the array we defined earlier, that is: - -``` -month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") -``` - -And, item 3 within the array points to `"Apr"` (remember: the first index in an array in Bash is `[0]`). That means that `echo ${month[3]}`, after the expansion, translates to `echo "Apr"`. - -Interpreting a variable as its value is one way of expanding it, but there are a few more you can leverage. You can use parameter expansion to manipulate what you read from variable, say, by cutting a chunk off the end. - -Suppose you have a variable like: - -``` -a="Too longgg" -``` - -The command: - -``` -echo ${a%gg} -``` - -chops off the last two gs and prints " _Too long_ ". - -Breaking this down, - - * `${...}` tells the shell to expand whatever is inside it - * `a` is the variable you are working with - * `%` tells the shell you want to chop something off the end of the expanded variable ("Too longgg") - * and `gg` is what you want to chop off. - - - -This can be useful for converting files from one format to another. Allow me to explain with a slight digression: - -[ImageMagick][3] is a set of command line tools that lets you manipulate and modify images. One of its most useful tools ImageMagick comes with is `convert`. In its simplest form `convert` allows you to, given an image in a certain format, make a copy of it in another format. - -The following command takes a JPEG image called _image.jpg_ and creates a PNG copy called _image.png_ : - -``` -convert image.jpg image.png -``` - -ImageMagick is often pre-installed on most Linux distros. If you can't find it, look for it in your distro's software manager. - -Okay, end of digression. On to the example: - -With variable expansion, you can do the same as shown above like this: - -``` -i=image.jpg - -convert $i ${i%jpg}png -``` - -What you are doing here is chopping off the extension `jpg` from `i` and then adding `png`, making the command `convert image.jpg image.png`. - -You may be wondering how this is more useful than just writing in the name of the file. Well, when you have a directory containing hundreds of JPEG images, you need to convert to PNG, run the following in it: - -``` -for i in *.jpg; do convert $i ${i%jpg}png; done -``` - -... and, hey presto! All the pictures get converted automatically. - -If you need to chop off a chunk from the beginning of a variable, instead of `%`, use `#`: - -``` -$ a="Hello World!" - -$ echo Goodbye${a#Hello} - -Goodbye World! -``` - -There's quite a bit more to parameter expansion, but a lot of it makes sense only when you are writing scripts. We'll explore more on that topic later in this series. - -### Output Grouping - -Meanwhile, let's finish up with something simple: you can also use `{ ... }` to group the output from several commands into one big blob. The command: - -``` -echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls > PNGs.txt -``` - -will execute all the commands but will only copy into the _PNGs.txt_ file the output from the last `ls` command in the list. However, doing - -``` -{ echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls; } > PNGs.txt -``` - -creates the file _PNGs.txt_ with everything, starting with the line " _I found all these PNGs:_ ", then the list of PNG files returned by `find`, then the line "Within this bunch of files:" and finishing up with the complete list of files and directories within the current directory. - -Notice that there is space between the braces and the commands enclosed within them. That’s because `{` and `}` are _reserved words_ here, commands built into the shell. They would roughly translate to " _group the outputs of all these commands together_ " in plain English. - -Also notice that the list of commands has to end with a semicolon (`;`) or the whole thing will bork. - -### Next Time - -In our next installment, we'll be looking at more things that enclose other things, but of different shapes. Until then, have fun! - -Read more: - -[And, Ampersand, and & in Linux][4] - -[Ampersands and File Descriptors in Bash][5] - -[Logical & in Bash][2] - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash - -作者:[Paul 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://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot -[2]: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash -[3]: http://www.imagemagick.org/ -[4]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[5]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash diff --git a/translated/tech/20190226 All about -Curly Braces- in Bash.md b/translated/tech/20190226 All about -Curly Braces- in Bash.md new file mode 100644 index 0000000000..8f148b33ce --- /dev/null +++ b/translated/tech/20190226 All about -Curly Braces- in Bash.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (All about {Curly Braces} in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +浅析 Bash 中的 {花括号} +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/curly-braces-1920.jpg?itok=cScRhWrX) + +在前面的 Bash 基础系列文章中,我们或多或少地使用了一些还没有讲到的符号。在之前文章的很多例子中,我们都使用到了括号,但并没有重点讲解关于括号的内容。 + +这个系列接下来的文章中,我们会研究括号们的用法:如何使用这些括号?将它们放在不同的位置会有什么不同的效果?除了圆括号、方括号、花括号以外,我们还会接触另外的将一些内容“包裹”起来的符号,例如单引号、双引号和反引号。 + +在这周,我们先来看看花括号 `{}`。 + +### 构造序列 + +花括号在之前的《[点的含义][1]》这篇文章中已经出现过了,当时我们只对点号 `.` 的用法作了介绍。但在构建一个序列的过程中,同样不可以缺少花括号。 + +我们使用 + +``` +echo {0..10} +``` + +来顺序输出 0 到 10 这 11 个数。使用 + +``` +echo {10..0} +``` + +可以将这 11 个数倒序输出。更进一步,可以使用 + +``` +echo {10..0..2} +``` + +来跳过其中的奇数。 + +而 + +``` +echo {z..a..2} +``` + +则从倒序输出字母表,并跳过其中的第奇数个字母。 + +以此类推。 + +还可以将两个序列进行组合: + +``` +echo {a..z}{a..z} +``` + +这个命令会将从 aa 到 zz 的所有双字母组合依次输出。 + +这是很有用的。在 Bash 中,定义一个数组的方法是在圆括号 `()` 中放置各个元素并使用空格隔开,就像这样: + +``` +month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") +``` + +如果需要获取数组中的元素,就要使用方括号 `[]` 并在其中填入元素的索引: + +``` +$ echo ${month[3]} # 数组索引从 0 开始,因此 [3] 对应第 4 个元素 + +Apr +``` + +先不要过分关注这里用到的三种括号,我们等下会讲到。 + +注意,像上面这样,我们可以定义这样一个数组: + +``` +letter_combos=({a..z}{a..z}) +``` + +其中 `letter_combos` 变量指向的数组依次包含了从 aa 到 zz 的所有双字母组合。 + +因此,还可以这样定义一个数组: + +``` +dec2bin=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}) +``` + +在这里,`dec2bin` 变量指向的数组按照升序依次包含了所有 8 位的二进制数,也就是 00000000、00000001、00000010,……,11111111。这个数组可以作为一个十进制数到 8 位二进制数的转换器。例如将十进制数 25 转换为二进制数,可以这样执行: + +``` +$ echo ${dec2bin[25]} + +00011001 +``` + +对于进制转换,确实还有更好的方法,但这不失为一个有趣的方法。 + +### 参数展开parameter expansion + +再看回前面的 + +``` +echo ${month[3]} +``` + +在这里,花括号的作用就不是构造序列了,而是用于参数展开。顾名思义,参数展开就是将花括号中的变量展开为这个变量实际的内容。 + +我们继续使用上面的 `month` 数组来举例: + +``` +month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") +``` + +注意,Bash 中的数组索引从 0 开始,因此 3 代表第 4 个元素 `"Apr"`。因此 `echo ${month[3]}` 在经过参数展开之后,相当于 `echo "Apr"`。 + +像上面这样将一个数组展开成它所有的元素,只是参数展开的其中一种用法。另外,还可以通过参数展开的方式读取一个字符串变量,并对其进行处理。 + +例如对于以下这个变量: + +``` +a="Too longgg" +``` + +如果执行: + +``` +echo ${a%gg} +``` + +可以输出“too long”,也就是去掉了最后的两个 g。 + +在这里, + + * `${...}` 告诉 shell 展开花括号里的内容 + * `a` 就是需要操作的变量 + * `%` 告诉 shell 需要在展开字符串之后从字符串的末尾去掉某些内容 + * `gg` 是被去掉的内容 + + + +这个特性在转换文件格式的时候会比较有用,我来举个例子: + +[ImageMagick][3] 是一套可以用于操作图像文件的命令行工具,它有一个 `convert` 命令。这个 `convert` 命令的作用是可以为某个格式的图像文件制作一个另一格式的副本。 + +下面这个命令就是使用 `convert` 为 JPEG 格式图像 `image.jpg` 制作一个 PNG 格式的图像副本 `image.png`: + +``` +convert image.jpg image.png +``` + +在很多 Linux 发行版中都预装了 ImageMagick,如果没有预装,一般可以在发行版对应的软件管理器中找到。 + +继续来看,在对变量进行展开之后,就可以批量执行相类似的操作了: + +``` +i=image.jpg +convert $i ${i%jpg}png +``` + +这实际上是将变量 `i` 末尾的 `"jpg"` 去掉,然后加上 `"png"`,最终将整个命令拼接成 `convert image.jpg image.png`。 + +如果你觉得并不怎么样,可以想象一下有成百上千个图像文件需要进行这个操作,而仅仅运行: + +``` +for i in *.jpg; do convert $i ${i%jpg}png; done +``` + +就瞬间完成任务了。 + +如果需要去掉字符串开头的部分,就要将上面的 `%` 改成 `#` 了: + +``` +$ a="Hello World!" +$ echo Goodbye${a#Hello} +Goodbye World! +``` + +参数展开还有很多用法,但一般在写脚本的时候才会需要用到。在这个系列以后的文章中就继续提到。 + +### 合并输出 + +最后介绍一个花括号的用法,这个用法很简单,就是可以将多个命令的输出合并在一起。首先看下面这个命令: + +``` +echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls > PNGs.txt +``` + +以分号分隔开的几条命令都会执行,但只有最后的 `ls` 命令的结果输出会被重定向到 `PNGs.txt` 文件中。如果将这几条命令用花括号包裹起来,就像这样: + +``` +{ echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls; } > PNGs.txt +``` + +执行完毕后,可以看到 `PNGs.txt` 文件中会包含两次 `echo` 的内容、`find` 命令查找到的 PNG 文件以及最后的 `ls` 命令结果。 + +需要注意的是,花括号与命令之间需要有空格隔开。因为这里的花括号 `{` 和 `}` 是作为 shell 中的保留字,shell 会将这两个符号之间的输出内容组合到一起。 + +另外,各个命令之间要用分号 `;` 分隔,否则命令无法正常运行。 + +### 下期预告 + +在后续的文章中,我会介绍其它“包裹”类符号的用法,敬请关注。 + +相关阅读: + +[And, Ampersand, and & in Linux][4] + +[Ampersands and File Descriptors in Bash][5] + +[Logical & in Bash][2] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash + +作者:[Paul Brown][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://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[2]: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash +[3]: http://www.imagemagick.org/ +[4]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[5]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash + From 477b11040d7baa126bda2c9ab062ef92478a7ee7 Mon Sep 17 00:00:00 2001 From: Ezio Date: Sat, 16 Mar 2019 10:32:37 +0800 Subject: [PATCH 630/813] =?UTF-8?q?20190316=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lash Booting your Raspberry Pi on Linux.md | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 sources/tech/20190315 Getting started with PiFlash Booting your Raspberry Pi on Linux.md diff --git a/sources/tech/20190315 Getting started with PiFlash Booting your Raspberry Pi on Linux.md b/sources/tech/20190315 Getting started with PiFlash Booting your Raspberry Pi on Linux.md new file mode 100644 index 0000000000..c80a21541b --- /dev/null +++ b/sources/tech/20190315 Getting started with PiFlash Booting your Raspberry Pi on Linux.md @@ -0,0 +1,182 @@ +[#]: collector: (oska874) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with PiFlash: Booting your Raspberry Pi on Linux) +[#]: via: (https://opensource.com/article/19/3/piflash?utm_campaign=intrel) +[#]: author: (Ian Kluft https://opensource.com/users/ikluft) + + +Getting started with PiFlash: Booting your Raspberry Pi on Linux +============================================================ + +### Linux users can say goodbye to manually creating bootable SD cards for Raspberry Pi with PiFlash. + +![Vector, generic Raspberry Pi board](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI "Vector, generic Raspberry Pi board") + +Most people install some form of Linux when they set up a Raspberry Pi computer. Until recently, the installation tools for creating a bootable SD card were only available for Windows and MacOS desktops. If you were running Linux on your desktop, you got a page of instructions on doing it manually from the command line. + +That works. But if you experiment with multiple Raspberry Pi boards, over time this gets tedious. As an engineer and a coder, I started thinking about automating it to make it easier and, in the usual way open source projects get started, I came away with [PiFlash][10]. + +I wrote PiFlash just for myself in 2016\. By February 2017, it had evolved far enough that I introduced it in a presentation at SVPerl (Silicon Valley Perl) about using Perl on the Raspberry Pi, then was invited to write two articles for Opensource.com:  _[Getting Started with Perl on the Raspberry Pi][7]_  and  _[How to Secure Your Raspberry Pi][8]._ + +### PiFlash features + +PiFlash has features that appeal to beginners and experts. + +Like most other open source software tools, you don't need to see the language it's written in, if you're not into that. But the source code is available for power users and participants. + +For expert users, PiFlash simplifies the process of writing an SD card. When you download a bootable OS "image" file, it's usually in a ZIP archive or compressed. All the distributions package them a little differently. With PiFlash, you don't have to unpack or decompress the image. Just specify the downloaded file as the input and PiFlash will do the tedious part of extracting it. + +For beginners, there's an important safety feature: PiFlash will write  _only_  to an SD card and refuse to write to any other type of device. Since you have to use root permissions to write the card, the system will do anything you tell it to. Therefore, it's possible to accidentally erase the wrong device, maybe a hard drive you want to keep, when trying to flash an SD card manually for a new Raspberry Pi. + +This is where PiFlash protects you from danger. Internally, it finds device attributes with the **lsblk** command from the **util-linux** package, which is part of all Linux distributions. It can recognize SD cards using various drivers. It will refuse to write to a block device if it isn't an SD card. + +Fortunately, the Etcher GUI tool that Raspberry Pi Foundation uses in its instructions for Windows and MacOS users has been expanded to Linux, so there is now a GUI option on Linux for those who prefer one. But if you want to automate the process, or if you want power-user levels of customization, only a command-line tool will do the job. + +The latest version of PiFlash adds plugin modules that can modify the SD card's filesystem after installing the OS image, so you can start to explore new options for automation. + +### Installing PiFlash + +[PiFlash is available][11] from [CPAN][12], the Comprehensive Perl Archive Network—but before you proceed, make sure you have all the dependency packages installed. To install the dependencies: + +On RPM-based Linux systems (Red Hat Enterprise, Fedora, CentOS, etc.): + +``` +sudo dnf install coreutils util-linux perl file-libs perl-File-LibMagic perl-IO perl-Exception-Class perl-Try-Tiny perl-Module-Pluggable perl-File-Path perl-YAML-LibYAML gzip unzip xz e2fsprogs dosfstools +``` + +On Debian-based Linux systems (Debian, Ubuntu, Raspbian, etc.): + +``` +sudo apt-get install coreutils util-linux klibc-utils perl-base libmagic1 libfile-libmagic-perl libio-all-perl libexception-class-perl libtry-tiny-perl libmodule-pluggable-perl libyaml-libyaml-perl gzip xz-utils e2fsprogs dosfstools +``` + +For source-based distributions or other packaging systems, see the CPAN documentation for the dependency list. + +Next, install PiFlash using the CPAN tool: + +``` +cpan PiFlash +``` + +I have the [Dist:][13][:Zilla][14]-based build set up to make DEB and RPM packages, but it isn't in any of the major package archives yet. That's possible in the future. + +### Running PiFlash + +If you just run the **piflash** command without any arguments, it will print usage information. + +``` +usage: piflash [--verbose] [--resize] [--config conf-file] input-file output-device +       piflash [--verbose] [--config conf-file] --SDsearch +       piflash --version +``` + +Scan the system for SD cards to get the exact device name, which you'll need for the Pi-Flash output-device parameter below. + +``` +piflash --sdsearch +``` + +If no SD cards are found, it says it can't find anything. + +``` +no SD cards found on system +``` +More on Raspberry Pi + +* [What is Raspberry Pi?][1] + +* [Getting started with Raspberry Pi][2] + +* [Getting started with Raspberry Pi cheat sheet][3] + +* [Our latest on Raspberry Pi][4] + +* [Send us your Raspberry Pi projects and tutorials][5] + +By the way, if you have an SD card writer that PiFlash doesn't know about, please let me know by filing a report on GitHub. For problem reports and troubleshooting, please collect the program's internal information by using the **--verbose** option so I can see what driver your system has that PiFlash didn't recognize. + +Your exact device name may vary by drivers and the names used by other devices on your system. If you have a USB-based SD reader/writer, it may say something like this: + +``` +SD cards found: /dev/sdb +``` + +Or if you have a built-in SD card slot, it may use a different driver and have a name that indicates it’s an SD card using the MMC (MultiMediaCard) driver: + +``` +SD cards found: /dev/mmcblk0 +``` + +Next, download a system image to install. The Raspberry Pi Foundation has an old [list of possibilities][15] that is no longer updated. Since Raspbian is the official Linux distribution for the Raspberry Pi, driver support goes there first. But others work: Ubuntu is on the list, but Fedora isn't because ARM and Raspberry Pi support came after the list was made, however, you can [download it][16]. + +The command to flash the SD card is **piflash  Date: Sat, 16 Mar 2019 11:27:20 +0800 Subject: [PATCH 631/813] PRF:20190213 How To Install, Configure And Use Fish Shell In Linux.md @zero-MK --- ..., Configure And Use Fish Shell In Linux.md | 80 +++++++++---------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md b/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md index 95fb75b1b2..404e8708bf 100644 --- a/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md +++ b/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md @@ -1,50 +1,40 @@ [#]: collector: "lujun9972" [#]: translator: "zero-MK" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How To Install, Configure And Use Fish Shell In Linux?" [#]: via: "https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -如何在Linux中安装,配置和使用Fish Shell? +如何在 Linux 中安装、配置和使用 Fish Shell? ====== -每个 Linux 管理员都可能听到过 shell 这个词。 - -你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少 shell 可用? +每个 Linux 管理员都可能听到过 shell 这个词。你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少个 shell 可用? shell 是一个程序,它是提供用户和内核之间交互的接口。 -内核是 Linux 操作系统的核心,它管理用户和操作系统( OS )之间的所有内容。 +内核是 Linux 操作系统的核心,它管理用户和操作系统之间的所有内容。Shell 可供所有用户在启动终端时使用。终端启动后,用户可以运行任何可用的命令。当 shell 完成命令的执行时,你将在终端窗口上获取输出。 -Shell 可供所有用户在启动终端时使用。 - -终端启动后,用户可以运行任何可用的命令。 - -当shell完成命令执行时,您将在终端窗口上获取输出。 - -Bash 全称是 Bourne Again Shell 是默认的 shell ,它运行在今天的大多数 Linux 发行版上。 - -它非常受欢迎,并具有很多功能。今天我们将讨论 Fish Shell 。 +Bash(全称是 Bourne Again Shell)是运行在今天的大多数 Linux 发行版上的默认的 shell,它非常受欢迎,并具有很多功能。但今天我们将讨论 Fish Shell 。 ### 什么是 Fish Shell? -[Fish][1] 是友好的交互式 shell , 是一个功能齐全,智能且对用户友好的 Linux 命令行 shell ,它带有一些在大多数 shell 中都不具备的方便功能。 +[Fish][1] 是友好的交互式 shell ,是一个功能齐全,智能且对用户友好的 Linux 命令行 shell ,它带有一些在大多数 shell 中都不具备的方便功能。 -这些功能包括 自动补全建议,Sane Scripting,手册页完成,基于 Web 的配置器和 Glorious VGA Color 。你对它感到好奇并想测试它吗?如果是这样,请按照以下安装步骤继续安装。 +这些功能包括自动补全建议、Sane Scripting、手册页补全、基于 Web 的配置器和 Glorious VGA Color 。你对它感到好奇并想测试它吗?如果是这样,请按照以下安装步骤继续安装。 ### 如何在 Linux 中安装 Fish Shell ? -它的安装非常简单,但除了少数几个发行版外,它在大多数发行版中都不可用。但是,可以使用以下 [fish repository][2] 轻松安装。 +它的安装非常简单,除了少数几个发行版外,它在大多数发行版中都没有。但是,可以使用以下 [fish 仓库][2] 轻松安装。 -对于基于 **`Arch Linux`** 的系统, 使用 **[Pacman Command][3]** 来安装 fish shell。 +对于基于 Arch Linux 的系统, 使用 [Pacman 命令][3] 来安装 fish shell。 ``` $ sudo pacman -S fish ``` -对于 **`Ubuntu 16.04/18.04`** 系统来说,,请使用 **[APT-GET Command][4]** 或者 **[APT Command][5]** 安装 fish shell。 +对于 Ubuntu 16.04/18.04 系统来说,请使用 [APT-GET 命令][4] 或者 [APT 命令][5] 安装 fish shell。 ``` $ sudo apt-add-repository ppa:fish-shell/release-3 @@ -52,7 +42,7 @@ $ sudo apt-get update $ sudo apt-get install fish ``` -对于 **`Fedora`** 系统来说,请使用 **[DNF Command][6]** 安装 fish shell。 +对于 Fedora 系统来说,请使用 [DNF 命令][6] 安装 fish shell。 对于 Fedora 29 系统来说: @@ -68,7 +58,7 @@ $ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/ $ sudo dnf install fish ``` -对于 **`Debian`** 系统来说,,请使用 **[APT-GET Command][4]** 或者 **[APT Command][5]** 安装 fish shell。 +对于 Debian 系统来说,请使用 [APT-GET 命令][4] 或者 [APT 命令][5] 安装 fish shell。 对于 Debian 9 系统来说: @@ -90,7 +80,7 @@ $ sudo apt-get update $ sudo apt-get install fish ``` -对于 **`RHEL/CentOS`** 系统来说,请使用 **[YUM Command][7]** 安装 fish shell。 +对于 RHEL/CentOS 系统来说,请使用 [YUM 命令][7] 安装 fish shell。 对于 RHEL 7 系统来说: @@ -120,7 +110,7 @@ $ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/ $ sudo yum install fish ``` -对于 **`openSUSE Leap`** 系统来说,请使用 **[Zypper Command][8]** 安装 fish shell。 +对于 openSUSE Leap 系统来说,请使用 [Zypper 命令][8] 安装 fish shell。 ``` $ sudo zypper addrepo https://download.opensuse.org/repositories/shells:/fish:/release:/3/openSUSE_Leap_42.3/shells:fish:release:3.repo @@ -130,7 +120,7 @@ $ sudo zypper install fish ### 如何使用 Fish Shell ? -一旦你成功安装了 fish shell 。只需在您的终端上输入 `fish` ,它将自动从默认的 bash shell 切换到 fish shell 。 +一旦你成功安装了 fish shell 。只需在你的终端上输入 `fish` ,它将自动从默认的 bash shell 切换到 fish shell 。 ``` $ fish @@ -140,33 +130,39 @@ $ fish ### 自动补全建议 -当你在 fish shell 中键入任何命令时,它会在输入几个字母后自动建议一个浅灰色的命令。 +当你在 fish shell 中键入任何命令时,它会在输入几个字母后以浅灰色自动建议一个命令。 + ![][11] -一旦你得到一个建议然后点击 ` Right Arrow Mark` (译者注:原文是左,错的)就能完成它而不是输入完整的命令。 +一旦你得到一个建议然后按下向右光标键(LCTT 译注:原文是左,错的)就能完成它而不是输入完整的命令。 + ![][12] -您可以在键入几个字母后立即按下 `Up Arrow Mark` 检索该命令以前的历史记录。它类似于 bash shell 的 `CTRL+r `选项。 +你可以在键入几个字母后立即按下向上光标键检索该命令以前的历史记录。它类似于 bash shell 的 `CTRL+r` 选项。 ### Tab 补全 -如果您想查看给定命令是否还有其他可能性,那么在键入几个字母后,只需按一下 `Tab` 按钮即可。 +如果你想查看给定命令是否还有其他可能性,那么在键入几个字母后,只需按一下 `Tab` 键即可。 + ![][13] -再次按 `Tab` 按钮可查看完整列表。 +再次按 `Tab` 键可查看完整列表。 + ![][14] ### 语法高亮 -fish 执行语法高亮显示,您可以在终端中键入任何命令时看到。 无效的命令被着色为 `RED color` 。 +fish 会进行语法高亮显示,你可以在终端中键入任何命令时看到。无效的命令被着色为 `RED color` 。 + ![][15] -同样的,有效命令以不同的颜色显示。此外,当您键入有效的文件路径时,fish会在其下面加下划线,如果路径无效,则不会显示下划线。 +同样的,有效的命令以不同的颜色显示。此外,当你键入有效的文件路径时,fish 会在其下面加下划线,如果路径无效,则不会显示下划线。 + ![][16] ### 基于 Web 的配置器 -fish shell 中有一个很酷的功能,它允许我们通过网络浏览器设置颜色,提示,功能,变量,历史和绑定。 +fish shell 中有一个很酷的功能,它允许我们通过网络浏览器设置颜色、提示符、功能、变量、历史和键绑定。 在终端上运行以下命令以启动 Web 配置界面。只需按下 `Ctrl+c` 即可退出。 @@ -180,11 +176,11 @@ Shutting down. ![][17] -### Man Page Completions +### 手册页补全 -其他 shell 支持 programmable completions, 但只有 fish 可以通过解析已安装的手册页自动生成它们。 +其他 shell 支持可编程的补全,但只有 fish 可以通过解析已安装的手册页自动生成它们。 -如果是这样,请运行以下命令 +要使用该功能,请运行以下命令: ``` $ fish_update_completions @@ -194,9 +190,9 @@ Parsing man pages and writing completions to /home/daygeek/.local/share/fish/gen ### 如何将 Fish 设置为默认 shell -If you would like to test the fish shell for some times then you can set the fish shell as your default shell instead of switching it every time. +如果你想测试 fish shell 一段时间,你可以将 fish shell 设置为默认 shell,而不用每次都切换它。 -如果是这样,首先使用以下命令获取 Fish Shell 的位置。 +要这样做,首先使用以下命令获取 Fish Shell 的位置。 ``` $ whereis fish @@ -211,7 +207,7 @@ $ chsh -s /usr/bin/fish ![][18] -`Make note:` 只需验证 Fish Shell 是否已添加到 `/etc/shells` 目录中。如果不是,则运行以下命令以附加它。 +提示:只需验证 Fish Shell 是否已添加到 `/etc/shells` 目录中。如果不是,则运行以下命令以附加它。 ``` $ echo /usr/bin/fish | sudo tee -a /etc/shells @@ -219,13 +215,13 @@ $ echo /usr/bin/fish | sudo tee -a /etc/shells 完成测试后,如果要返回 bash shell ,请使用以下命令。 -暂时的: +暂时返回: ``` $ bash ``` -永久性的: +永久返回: ``` $ chsh -s /bin/bash @@ -238,7 +234,7 @@ via: https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[zero-MK](https://github.com/zero-MK) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d26fa3ed08eac1b461213e2082bc2c5a43e2cb12 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Mar 2019 11:29:05 +0800 Subject: [PATCH 632/813] PUB:20190213 How To Install, Configure And Use Fish Shell In Linux.md @zero-MK https://linux.cn/article-10622-1.html --- ...3 How To Install, Configure And Use Fish Shell In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190213 How To Install, Configure And Use Fish Shell In Linux.md (99%) diff --git a/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md b/published/20190213 How To Install, Configure And Use Fish Shell In Linux.md similarity index 99% rename from translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md rename to published/20190213 How To Install, Configure And Use Fish Shell In Linux.md index 404e8708bf..417f170517 100644 --- a/translated/tech/20190213 How To Install, Configure And Use Fish Shell In Linux.md +++ b/published/20190213 How To Install, Configure And Use Fish Shell In Linux.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "zero-MK" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10622-1.html" [#]: subject: "How To Install, Configure And Use Fish Shell In Linux?" [#]: via: "https://www.2daygeek.com/linux-fish-shell-friendly-interactive-shell/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" From f077ad0d22756918aae8a11d10c343744ffd828f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Mar 2019 12:06:56 +0800 Subject: [PATCH 633/813] PRF:20190227 How To Check Password Complexity-Strength And Score In Linux.md @geekpi --- ... Complexity-Strength And Score In Linux.md | 56 ++++++++----------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md index b44d9c6052..2e1858bb74 100644 --- a/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md +++ b/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md @@ -1,62 +1,52 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Check Password Complexity/Strength And Score In Linux?) [#]: via: (https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -如何在 Linux 中检查密码的复杂性/强度和分数? +如何在 Linux 中检查密码的复杂性/强度和评分? ====== -我们都知道密码的重要性。这是使用难以猜测密码的最佳实践。 +我们都知道密码的重要性。最好的密码就是使用难以猜测密码。另外,我建议你为每个服务使用不同的密码,如电子邮件、ftp、ssh 等。最重要的是,我建议你们经常更改密码,以避免不必要的黑客攻击。 -另外,我建议你为每个服务使用不同的密码,如电子邮件、ftp、ssh 等。 +默认情况下,RHEL 和它的衍生版使用 cracklib 模块来检查密码强度。我们将教你如何使用 cracklib 模块检查密码强度。 -最重要的是,我建议你们经常更改密码,以避免不必要的黑客攻击。 +如果你想检查你创建的密码评分,请使用 pwscore 包。 -默认情况下,RHEL 和它的衍生版使用 `cracklib` 模块来检查密码强度。 - -我们将教你如何使用 cracklib 模块检查密码强度。 - -如果你想检查你创建的密码分数,请使用 `pwscore` 包。 - -如果你想创建一个好密码,基本上它应该至少有 12-15 个字符长度。 - -它应该在以下组合创建,如字母(小写和大写)、数字和特殊字符。 - -Linux 中有许多程序可用于检查密码复杂性,我们今天将讨论有关 `cracklib` 模块。 +如果你想创建一个好密码,最起码它应该至少有 12-15 个字符长度。它应该按以下组合创建,如字母(小写和大写)、数字和特殊字符。Linux 中有许多程序可用于检查密码复杂性,我们今天将讨论有关 cracklib 模块和 pwscore 评分。 ### 如何在 Linux 中安装 cracklib 模块? cracklib 模块在大多数发行版仓库中都有,因此,请使用发行版官方软件包管理器来安装它。 -对于 **`Fedora`** 系统,使用 **[DNF 命令][1]**来安装 cracklib。 +对于 Fedora 系统,使用 [DNF 命令][1]来安装 cracklib。 ``` $ sudo dnf install cracklib ``` -对于 **`Debian/Ubuntu`** 系统,使用 **[APT-GET 命令][2]** 或 **[APT 命令][3]**来安装 libcrack2。 +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][2] 或 [APT 命令][3]来安装 libcrack2。 ``` $ sudo apt install libcrack2 ``` -对于基于 **`Arch Linux`** 的系统,使用 **[Pacman 命令][4]**来安装 cracklib。 +对于基于 Arch Linux 的系统,使用 [Pacman 命令][4]来安装 cracklib。 ``` $ sudo pacman -S cracklib ``` -对于 **`RHEL/CentOS`** 系统,使用 **[YUM 命令][5]**来安装 cracklib。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5]来安装 cracklib。 ``` $ sudo yum install cracklib ``` -对于 **`openSUSE Leap`** 系统,使用 **[Zypper 命令][6]**来安装 cracklib。 +对于 openSUSE Leap 系统,使用 [Zypper 命令][6]来安装 cracklib。 ``` $ sudo zypper install cracklib @@ -66,21 +56,21 @@ $ sudo zypper install cracklib 我在本文中添加了一些示例来助你更好地了解此模块。 -如果你提供了任何如人名或地名或常用字,那么你将看到一条消息“它存在于单词字典中”。 +如果你提供了任何如人名或地名或常用字,那么你将看到一条消息“它存在于字典的单词中”。 ``` $ echo "password" | cracklib-check password: it is based on a dictionary word ``` -Linux 中的默认密码长度为 `7` 个字符。如果你提供的密码少于 7 个字符,那么你将看到一条消息“它太短了”。 +Linux 中的默认密码长度为 7 个字符。如果你提供的密码少于 7 个字符,那么你将看到一条消息“它太短了”。 ``` $ echo "123" | cracklib-check 123: it is WAY too short ``` -当你提供像我们这样的好密码时,你会看到 `OK`。 +当你提供像我们这样的好密码时,你会看到 “OK”。 ``` $ echo "ME$2w!@fgty6723" | cracklib-check @@ -91,37 +81,37 @@ ME!@fgty6723: OK pwscore 包在大多数发行版仓库中都有,因此,请使用发行版官方软件包管理器来安装它。 -对于 **`Fedora`** 系统,使用 **[DNF 命令][1]**来安装 libpwquality。 +对于 Fedora 系统,使用 [DNF 命令][1]来安装 libpwquality。 ``` $ sudo dnf install libpwquality ``` -对于 **`Debian/Ubuntu`** 系统,使用 **[APT-GET 命令][2]** 或 **[APT 命令][3]**来安装 libpwquality。 +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][2] 或 [APT 命令][3]来安装 libpwquality。 ``` $ sudo apt install libpwquality ``` -对于基于 **`Arch Linux`** 的系统,使用 **[Pacman 命令][4]**来安装 libpwquality。 +对于基于 Arch Linux 的系统,使用 [Pacman 命令][4]来安装 libpwquality。 ``` $ sudo pacman -S libpwquality ``` -对于 **`RHEL/CentOS`** 系统,使用 **[YUM 命令][5]**来安装 libpwquality。 +对于 RHEL/CentOS 系统,使用 [YUM 命令][5]来安装 libpwquality。 ``` $ sudo yum install libpwquality ``` -对于 **`openSUSE Leap`** 系统,使用 **[Zypper 命令][6]**来安装 libpwquality。 +对于 openSUSE Leap 系统,使用 [Zypper 命令][6]来安装 libpwquality。 ``` $ sudo zypper install libpwquality ``` -如果你提供了任何如人名或地名或常用字,那么你将看到一条消息“它存在于单词字典中”。 +如果你提供了任何如人名或地名或常用字,那么你将看到一条消息“它存在于字典的单词中”。 ``` $ echo "password" | pwscore @@ -129,7 +119,7 @@ Password quality check failed: The password fails the dictionary check - it is based on a dictionary word ``` -Linux 中的默认密码长度为 `7` 个字符。如果你提供的密码少于 7 个字符,那么你将看到一条消息“它太短了”。 +Linux 中的默认密码长度为 7 个字符。如果你提供的密码少于 7 个字符,那么你将看到一条消息“密码短于 8 个字符”。 ``` $ echo "123" | pwscore @@ -137,7 +127,7 @@ Password quality check failed: The password is shorter than 8 characters ``` -当你提供像我们这样的好密码时,你将会看到`密码分数`。 +当你像我们这样提供了一个好的密码时,你将会看到“密码评分”。 ``` $ echo "ME!@fgty6723" | pwscore @@ -151,7 +141,7 @@ via: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-scor 作者:[Magesh Maruthamuthu][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 efa93abc25536e3fd4ab5a710ae093c90eeedea4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Mar 2019 12:07:43 +0800 Subject: [PATCH 634/813] PUB:20190227 How To Check Password Complexity-Strength And Score In Linux.md @geekpi https://linux.cn/article-10623-1.html --- ...o Check Password Complexity-Strength And Score In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190227 How To Check Password Complexity-Strength And Score In Linux.md (98%) diff --git a/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/published/20190227 How To Check Password Complexity-Strength And Score In Linux.md similarity index 98% rename from translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md rename to published/20190227 How To Check Password Complexity-Strength And Score In Linux.md index 2e1858bb74..6ab262f592 100644 --- a/translated/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md +++ b/published/20190227 How To Check Password Complexity-Strength And Score In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10623-1.html) [#]: subject: (How To Check Password Complexity/Strength And Score In Linux?) [#]: via: (https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 570f9a03e15b2d81e1d023a4cacb8163839d682e Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 16 Mar 2019 17:29:49 +0800 Subject: [PATCH 635/813] translate done: 20171119 Advanced Techniques for Reducing Emacs Startup Time.md --- ...hniques for Reducing Emacs Startup Time.md | 252 ----------------- ...hniques for Reducing Emacs Startup Time.md | 256 ++++++++++++++++++ 2 files changed, 256 insertions(+), 252 deletions(-) delete mode 100644 sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md create mode 100644 translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md diff --git a/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md b/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md deleted file mode 100644 index 6a761ac7d1..0000000000 --- a/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md +++ /dev/null @@ -1,252 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Advanced Techniques for Reducing Emacs Startup Time) -[#]: via: (https://blog.d46.us/advanced-emacs-startup/) -[#]: author: (Joe Schafer https://blog.d46.us/) - -Advanced Techniques for Reducing Emacs Startup Time -====== - -Six techniques to reduce Emacs startup time by the author of the [Emacs Start Up Profiler][1]. - -tl;dr: Do these steps: - - 1. Profile with Esup. - 2. Adjust the garbage collection threshold. - 3. Autoload **everything** with use-package. - 4. Avoid helper functions which cause eager loads. - 5. See my Emacs [config][2] for an example. - - - -### From .emacs.d Bankruptcy to Now - -I recently declared my third .emacs.d bankruptcy and finished the fourth iteration of my Emacs configuration. The evolution was: - - 1. Copy and paste elisp snippets into `~/.emacs` and hope it works. - 2. Adopt a more structured approach with `el-get` to manage dependencies. - 3. Give up and outsource to Spacemacs. - 4. Get tired of Spacemacs intricacies and rewrite with `use-package`. - - - -This article is a collection of tips collected during the 3 rewrites and from creating the Emacs Start Up Profiler. Many thanks to the teams behind Spacemacs, use-package and general. Without these dedicated voluteers, this task would be vastly more difficult. - -### But What About Daemon Mode - -Before we get started, let me acknowledge the common retort when optimizing Emacs: “Emacs is meant to run as a daemon so you’ll only start it once.” That’s all well and good except: - - * Fast things feel nicer. - * When customizing Emacs, you sometimes get into weird states that can be hard to recover from without restarting. For example, if you add a slow `lambda` function to your `post-command-hook`, it’s tough to remove it. - * Restarting Emacs helps verify that customization will persist between sessions. - - - -### 1\. Establish the Current and Best Possible Start Up Time - -The first step is to measure the current start up time. The easy way is to display the information at startup which will show progress through the next steps. - -``` -(add-hook 'emacs-startup-hook - (lambda () - (message "Emacs ready in %s with %d garbage collections." - (format "%.2f seconds" - (float-time - (time-subtract after-init-time before-init-time))) - gcs-done))) -``` - -Second, measure the best possible startup speed so you know what’s possible. Mine is 0.3 seconds. - -``` -emacs -q --eval='(message "%s" (emacs-init-time))' - -;; For macOS users: -open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))' -``` - -### 2\. Profile Emacs Startup for Easy Wins - -The [Emacs StartUp Profiler][1] (ESUP) will give you detailed metrics for top-level expressions. - -![esup.png][3] - -Figure 1: - -Emacs Start Up Profiler Screenshot - -WARNING: Spacemacs users, ESUP currently chokes on the Spacemacs init.el file. Follow for updates. - -### 3\. Set the Garbage Collection Threshold Higher during Startup - -This saves about ****0.3 seconds**** on my configuration. - -The default value for Emacs is 760kB which is extremely conservative on a modern machine. The real trick is to lower it back to something reasonable after initialization. This saves about 0.3 seconds on my init files. - -``` -;; Make startup faster by reducing the frequency of garbage -;; collection. The default is 800 kilobytes. Measured in bytes. -(setq gc-cons-threshold (* 50 1000 1000)) - -;; The rest of the init file. - -;; Make gc pauses faster by decreasing the threshold. -(setq gc-cons-threshold (* 2 1000 1000)) -``` - -### 4\. Never require anything; autoload with use-package instead - -The best way to make Emacs faster is to do less. Running `require` eagerly loads the underlying source file. It’s rare the you’ll need functionality immediately at startup time. - -With [`use-package`][4], you declare which features you need from a package and `use-package` does the right thing. Here’s what it looks like: - -``` -(use-package evil-lisp-state ; the Melpa package name - - :defer t ; autoload this package - - :init ; Code to run immediately. - (setq evil-lisp-state-global nil) - - :config ; Code to run after the package is loaded. - (abn/define-leader-keys "k" evil-lisp-state-map)) -``` - -To see what packages Emacs currently has loaded, examine the `features` variable. For nice output see [lpkg explorer][5] or my variant in [abn-funcs-benchmark.el][6]. The output looks like: - -``` -479 features currently loaded - - abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el - - evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc - - misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc - - multi-isearch: nil - - -``` - -### 5\. Avoid Helper Functions to Set Up Modes - -Often, Emacs packages will suggest running a helper function to set up keybindings. Here’s a few examples: - - * `(evil-escape-mode)` - * `(windmove-default-keybindings) ; Sets up keybindings.` - * `(yas-global-mode 1) ; Complex snippet setup.` - - - -Rewrite these with use-package to improve startup speed. These helper functions are really just sneaky ways to trick you into eagerly loading packages before you need them. - -As an example, here’s how to autoload `evil-escape-mode`. - -``` -;; The definition of evil-escape-mode. -(define-minor-mode evil-escape-mode - (if evil-escape-mode - (add-hook 'pre-command-hook 'evil-escape-pre-command-hook) - (remove-hook 'pre-command-hook 'evil-escape-pre-command-hook))) - -;; Before: -(evil-escape-mode) - -;; After: -(use-package evil-escape - :defer t - ;; Only needed for functions without an autoload comment (;;;###autoload). - :commands (evil-escape-pre-command-hook) - - ;; Adding to a hook won't load the function until we invoke it. - ;; With pre-command-hook, that means the first command we run will - ;; load evil-escape. - :init (add-hook 'pre-command-hook 'evil-escape-pre-command-hook)) -``` - -For a much trickier example, consider `org-babel`. The common recipe is: - -``` -(org-babel-do-load-languages - 'org-babel-load-languages - '((shell . t) - (emacs-lisp . nil))) -``` - -This is bad because `org-babel-do-load-languages` is defined in `org.el`, which is over 24k lines of code and takes about 0.2 seconds to load. After examining the source code, `org-babel-do-load-languages` is simply requiring the `ob-` package like so: - -``` -;; From org.el in the org-babel-do-load-languages function. -(require (intern (concat "ob-" lang))) -``` - -In the `ob-.el`, there’s only two methods we care about, `org-babel-execute:` and `org-babel-expand-body:`. We can autoload the org-babel functionality instead of `org-babel-do-load-languages` like so: - -``` -;; Avoid `org-babel-do-load-languages' since it does an eager require. -(use-package ob-python - :defer t - :ensure org-plus-contrib - :commands (org-babel-execute:python)) - -(use-package ob-shell - :defer t - :ensure org-plus-contrib - :commands - (org-babel-execute:sh - org-babel-expand-body:sh - - org-babel-execute:bash - org-babel-expand-body:bash)) -``` - -### 6\. Defer Packages you don’t need Immediately with Idle Timers - -This saves about ****0.4 seconds**** for the 9 packages I defer. - -Some packages are useful and you want them available soon, but are not essential for immediate editing. These modes include: - - * `recentf`: Saves recent files. - * `saveplace`: Saves point of visited files. - * `server`: Starts Emacs daemon. - * `autorevert`: Automatically reloads files that changed on disk. - * `paren`: Highlight matching parenthesis. - * `projectile`: Project management tools. - * `whitespace`: Highlight trailing whitespace. - - - -Instead of requiring these modes, ****load them after N seconds of idle time****. I use 1 second for the more important packages and 2 seconds for everything else. - -``` -(use-package recentf - ;; Loads after 1 second of idle time. - :defer 1) - -(use-package uniquify - ;; Less important than recentf. - :defer 2) -``` - -### Optimizations that aren’t Worth It - -Don’t bother byte-compiling your personal Emacs files. It saved about 0.05 seconds. Byte compiling causes difficult to debug errors when the source file gets out of sync with compiled file. - - --------------------------------------------------------------------------------- - -via: https://blog.d46.us/advanced-emacs-startup/ - -作者:[Joe Schafer][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://blog.d46.us/ -[b]: https://github.com/lujun9972 -[1]: https://github.com/jschaf/esup -[2]: https://github.com/jschaf/dotfiles/blob/master/emacs/start.el -[3]: https://blog.d46.us/images/esup.png -[4]: https://github.com/jwiegley/use-package -[5]: https://gist.github.com/RockyRoad29/bd4ca6fdb41196a71662986f809e2b1c -[6]: https://github.com/jschaf/dotfiles/blob/master/emacs/funcs/abn-funcs-benchmark.el diff --git a/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md b/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md new file mode 100644 index 0000000000..54d8d0bfdd --- /dev/null +++ b/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md @@ -0,0 +1,256 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Advanced Techniques for Reducing Emacs Startup Time) +[#]: via: (https://blog.d46.us/advanced-emacs-startup/) +[#]: author: (Joe Schafer https://blog.d46.us/) + +降低 Emacs 启动时间的高级技术 +====== + + [Emacs Start Up Profiler][1] 的作者教你六项技术减少 Emacs 启动时间。 + +简而言之:做下面几个步骤: + +1。使用 Esup 进行性能检测。 +2。调整垃圾回收的阀值。 +3。使用 usge-page 来自动(延迟)加载所有东西。 +4。不要使用会引起立即加载的辅助函数。 +5。参考我的 [配置 ][2]。 + + + +### 从 .emacs.d 破产到现在 + +我最近宣布了第三次 .emacs.d 破产并完成了第四次 Emacs 配置的迭代。演化过程为: + +1。拷贝并粘贴 elisp 片段到 `~/.emacs` 中,希望它能工作。 +2。借助 `el-get` 来以更结构化的方式来管理依赖关系。 +3。放弃自己从零配置,以 Spacemacs 为基础。 +4。厌倦了 Spacemacs 的复杂性,基于 `use-package` 重写配置。 + +本文汇聚了三次重写和创建 `Emacs Start Up Profiler` 过程中的技巧。 +非常感谢 Spacemacs,use-package 等背后的团队。 +没有这些无私的志愿者,这项任务将会困难得多。 + + +### 不过守护进程模式又如何呢 + +在我们开始之前,让我声明一下常见的反对优化 Emacs 的观念:“Emacs 旨在作为守护进程来运行的,因此你只需要运行一次而已。” +这个观点很好,只不过: + +- 速度总是越快越好 +- 配置 Emacs 时,可能会有不得不通过重启 Emacs 的情况。例如,你可能为 `post-command-hook` 添加了一个运行缓慢的 `lambda` 函数,很难删掉它。 +- 重启 Emacs 能帮你验证不同会话之间是否还能保留配置 + +### 估算当前以及最佳的启动时间 + +第一步是衡量当前的启动时间。最简单的方法就是在启动时显示后续步骤进度的信息。 + +``` +(add-hook 'emacs-startup-hook + (lambda () + (message "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) +``` + +第二部,衡量最佳的启动速度,以便了解可能的情况。我的是 0.3 秒。 + +``` +emacs -q --eval='(message "%s" (emacs-init-time))' + +;; For macOS users: +open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))' +``` + +### 2。检测 Emacs 启动指标对你大有帮助 + +[Emacs StartUp Profiler][1] (ESUP) 将会给你顶层语句执行的详细指标。 + +![esup.png][3] + + +图 1: Emacs Start Up Profiler 截图 + +警告:Spacemacs 用户需要注意,ESUP 目前与 Spacemacs 的 init.el 文件有冲突。遵照 上说的进行升级。 + +### 启动时调高垃圾回收的阀值 + +这为我节省了 **0.3 秒**。 + +Emacs 默认值是 760kB,这在现代机器看来及其的保守。 +真正的诀窍在于初始化完成后再把它降到合理的水平。 +这为了节省了 0.3 秒 + +``` +;; Make startup faster by reducing the frequency of garbage +;; collection. The default is 800 kilobytes. Measured in bytes. +(setq gc-cons-threshold (* 50 1000 1000)) + +;; The rest of the init file. + +;; Make gc pauses faster by decreasing the threshold. +(setq gc-cons-threshold (* 2 1000 1000)) +``` + +### 4。不要 require 任何东西,转而使用 use-package 来自动加载 + +让 Emacs 变坏的最好方法就是减少要做的事情。`require` 会立即加载源文件。 +但是很少会出现需要在启动阶段就立即需要这些功能的。 + +在 [`use-package`][4] 中你只需要声明好需要哪个包中的哪个功能,`use-package` 就会帮你完成正确的事情。 +它看起来是这样的: + +``` +(use-package evil-lisp-state ; the Melpa package name + + :defer t ; autoload this package + + :init ; Code to run immediately. + (setq evil-lisp-state-global nil) + + :config ; Code to run after the package is loaded. + (abn/define-leader-keys "k" evil-lisp-state-map)) +``` + +可以通过查看 `features` 变量来查看 Emacs 现在加载了那些包。 +想要更好看的输出可以使用 [lpkg explorer][5] 或者我在 [abn-funcs-benchmark.el][6] 中的变体。 +输出看起来类似这样的: + +``` +479 features currently loaded + - abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el + - evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc + - misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc + - multi-isearch: nil + - +``` + +### 5。不要使用辅助函数来设置模式 + +通常,Emacs packages 会建议通过运行一个辅助函数来设置键绑定。下面是一些例子: + + * `(evil-escape-mode)` + * `(windmove-default-keybindings) ; 设置快捷键。` + * `(yas-global-mode 1) ;复杂的片段配置。` + +可以通过 use-package 来对此进行重构以提高启动速度。这些辅助函数只会让你立即加载那些尚用不到的 package。 + +下面这个例子告诉你如何自动加载 `evil-escape-mode`。 + +``` +;; The definition of evil-escape-mode. +(define-minor-mode evil-escape-mode + (if evil-escape-mode + (add-hook 'pre-command-hook 'evil-escape-pre-command-hook) + (remove-hook 'pre-command-hook 'evil-escape-pre-command-hook))) + +;; Before: +(evil-escape-mode) + +;; After: +(use-package evil-escape + :defer t + ;; Only needed for functions without an autoload comment (;;;###autoload). + :commands (evil-escape-pre-command-hook) + + ;; Adding to a hook won't load the function until we invoke it. + ;; With pre-command-hook, that means the first command we run will + ;; load evil-escape. + :init (add-hook 'pre-command-hook 'evil-escape-pre-command-hook)) +``` + +下面来看一个关于 `org-babel` 的例子,这个例子更为复杂。我们通常的配置时这样的: + +``` +(org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (emacs-lisp . nil))) +``` + +这种不是个好的配置,因为 `org-babel-do-load-languages` 定义在 `org.el` 中,而该文件有超过 2 万 4 千行的代码,需要花 0.2 秒来加载。 +通过查看源代码可以看到 `org-babel-do-load-languages` 仅仅只是加载 `ob-` 包而已,像这样: + +``` +;; From org.el in the org-babel-do-load-languages function. +(require (intern (concat "ob-" lang))) +``` + +而在 `ob-.el` 文件中,我们只关心其中的两个方法 `org-babel-execute:` 和 `org-babel-expand-body:`。 +我们可以延时加载 org-babel 相关功能而无需调用 `org-babel-do-load-languages`,像这样: + +``` +;; Avoid `org-babel-do-load-languages' since it does an eager require. +(use-package ob-python + :defer t + :ensure org-plus-contrib + :commands (org-babel-execute:python)) + +(use-package ob-shell + :defer t + :ensure org-plus-contrib + :commands + (org-babel-execute:sh + org-babel-expand-body:sh + + org-babel-execute:bash + org-babel-expand-body:bash)) +``` + +### 6。使用惰性定时器 (idle timer) 来推迟加载非立即需要的包 + +我推迟加载了 9 个包,这帮我节省了 **0.4 秒**。 + +有些包特别有用,你希望可以很快就能使用它们,但是它们本身在 Emacs 启动过程中又不是必须的。这些 mode 包括: + +- `recentf`: 保存最近的编辑过的那些文件。 +- `saveplace`: 保存访问过文件的光标位置。 +- `server`: 开启 Emacs 守护进程。 +- `autorevert`: 自动重载被修改过的文件。 +- `paren`: 高亮匹配的括号。 +- `projectile`: 项目管理工具。 +- `whitespace`: 高亮行尾的空格。 + +不要 require 这些 mode,** 而是等到空闲 N 秒后再加载它们**。 +我在 1 秒后加载那些比较重要的包,在 2 秒后加载其他所有的包。 + +``` +(use-package recentf + ;; Loads after 1 second of idle time. + :defer 1) + +(use-package uniquify + ;; Less important than recentf. + :defer 2) +``` + +### 不值得的优化 + +不要费力把你的 Emacs 配置文件编译成字节码了。这只节省了大约 0.05 秒。 +把配置文件编译成字节码可能导致源文件与编译后的文件不匹配从而导致难以出现错误调试。 + +-------------------------------------------------------------------------------- + +via: https://blog.d46.us/advanced-emacs-startup/ + +作者:[Joe Schafer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://blog.d46.us/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/jschaf/esup +[2]: https://github.com/jschaf/dotfiles/blob/master/emacs/start.el +[3]: https://blog.d46.us/images/esup.png +[4]: https://github.com/jwiegley/use-package +[5]: https://gist.github.com/RockyRoad29/bd4ca6fdb41196a71662986f809e2b1c +[6]: https://github.com/jschaf/dotfiles/blob/master/emacs/funcs/abn-funcs-benchmark.el From 8706447e75cfb229abe95e7a1947d3b5784d1adb Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 16 Mar 2019 17:35:22 +0800 Subject: [PATCH 636/813] translate done: 20180330 Asynchronous rsync with Emacs, dired and tramp..md --- ...nous rsync with Emacs, dired and tramp..md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) rename {sources => translated}/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md (59%) diff --git a/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md b/translated/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md similarity index 59% rename from sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md rename to translated/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md index 954644918b..caff5ddd66 100644 --- a/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md +++ b/translated/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md @@ -3,32 +3,33 @@ [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (Asynchronous rsync with Emacs, dired and tramp.) +[#]: subject: (Asynchronous rsync with Emacs,dired and tramp。) [#]: via: (https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/) [#]: author: (cpbotha https://vxlabs.com/author/cpbotha/) -Asynchronous rsync with Emacs, dired and tramp. +在 Emacs 的 dired 和 tramp 中异步运行 rsync ====== -[tmtxt-dired-async][1] by [Trần Xuân Trường][2] is an unfortunately lesser known Emacs package which extends dired, the Emacs file manager, to be able to run rsync and other commands (zip, unzip, downloading) asynchronously. +[Trần Xuân Trường][2] 写的 [tmtxt-dired-async][1] 是一个不为人知的 Emacs 包,它可以扩展 dired(Emacs 内置的文件管理器),使之可以异步地运行 rsync 等其他命令 (例如 zip,unzip,downloading)。 -This means you can copy gigabytes of directories around whilst still happily continuing with all of your other tasks in the Emacs operating system. +这意味着你可以拷贝成 G 的目录而不影响 Emacs 的其他任务。 -It has a feature where you can add any number of files from different locations into a wait list with `C-c C-a`, and then asynchronously rsync the whole wait list into a final destination directory with `C-c C-v`. This alone is worth the price of admission. +它的一个功能时让你可以通过 `C-c C-a` 从不同位置添加任意多的文件到一个等待列表中,然后按下 `C-c C-v` 异步地使用 rsync 将整个等待列表中的文件同步到目标目录中 . 光这个功能就值得一试了。 + +例如这里将 arduino 1.9 beta 存档同步到另一个目录中: -For example here it is pointlessly rsyncing the arduino 1.9 beta archive to another directory: [![][3]][4] -When the process is complete, the window at the bottom will automatically be killed after 5 seconds. Here is a separate session right after the asynchronous unzipping of the above-mentioned arduino archive: +整个进度完成后,底部的窗口会在 5 秒后自动退出。下面时异步解压上面的 arduino 存档后出现的另一个会话: [![][5]][6] -This package has further increased the utility of my dired configuration. +这个包进一步增加了我 dired 配置的实用性。 -I just contributed [a pull request that enables tmtxt-dired-async to rsync to remote tramp-based directories][7], and I immediately used this new functionality to sort a few gigabytes of new photos onto the Linux server. +我刚刚贡献了 [一个 pull request 来允许 tmtxt-dired-async 同步到远程 tramp 目录中 ][7],而且我立即使用该功能来将成 G 的新照片传输到 Linux 服务器上。 -To add tmtxt-dired-async to your config, download [tmtxt-async-tasks.el][8] (a required library) and [tmtxt-dired-async.el][9] (check that my PR is in there if you plan to use this with tramp) into your `~/.emacs.d/` and add the following to your config: +若你想配置 tmtxt-dired-async,下载 [tmtxt-async-tasks.el][8] (被依赖的库) 以及 [tmtxt-dired-async.el][9]  (若你想让它支持 tramp,请确保我的 PR 以及被合并) 到 =~/.emacs.d/= 目录中,然后添加下面配置: ``` ;; no MELPA packages of this, so we have to do a simple check here @@ -50,7 +51,7 @@ To add tmtxt-dired-async to your config, download [tmtxt-async-tasks.el][8] (a r (define-key dired-mode-map (kbd "C-c C-q") 'tda/download-to-current-dir)) ``` -Enjoy! +祝你开心! -------------------------------------------------------------------------------- From 295ba7171bdd7eaa48b51487dd29bb2ffa9f3163 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 16 Mar 2019 17:42:00 +0800 Subject: [PATCH 637/813] translate done: 20180826 Be productive with Org-mode.md --- .../20180826 Be productive with Org-mode.md | 84 +++++++++---------- 1 file changed, 41 insertions(+), 43 deletions(-) rename {sources => translated}/tech/20180826 Be productive with Org-mode.md (56%) diff --git a/sources/tech/20180826 Be productive with Org-mode.md b/translated/tech/20180826 Be productive with Org-mode.md similarity index 56% rename from sources/tech/20180826 Be productive with Org-mode.md rename to translated/tech/20180826 Be productive with Org-mode.md index 3c6f3c4519..8592649c1c 100644 --- a/sources/tech/20180826 Be productive with Org-mode.md +++ b/translated/tech/20180826 Be productive with Org-mode.md @@ -7,23 +7,23 @@ [#]: via: (https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/) [#]: author: (Ayrat Badykov https://www.badykov.com) -Be productive with Org-mode +高效使用 Org-mode ====== ![org-mode-collage][1] -### Introduction +### 简介 -In my [previous post about emacs][2] I mentioned [Org-mode][3], a note manager and organizer. In this post, I’ll describe my day-to-day Org-mode use cases. +在我 [前篇关于 Emacs 的文章中 ][2] 我提到了 [Org-mode][3],一个笔记管理工具和组织工具。文本,我将会描述一下我日常的 Org-mode 使用案例。 -### Notes and to-do lists +### 笔记和代办列表 -First and foremost, Org-mode is a tool for managing notes and to-do lists and all work in Org-mode is centered around writing notes in plain text files. I manage several kinds of notes using Org-mode. +首先而且最重要的是,Org-mode 是一个管理笔记和待办列表的工具,Org-mode 的所有工具都聚焦于使用纯文本文件记录笔记。我使用 Org-mode 管理多种笔记。 -#### General notes +#### 一般性笔记 -The most basic Org-mode use case is writing simple notes about things that you want to remember. For example, here are my notes about things I’m learning right now: +Org-mode 最基本的应用场景就是以笔记的形式记录下你想记住的事情。比如,下面是我正在学习的笔记内容: ``` * Learn @@ -51,21 +51,19 @@ The most basic Org-mode use case is writing simple notes about things that you w *** Read Erlang in Anger ``` -How it looks using [org-bullets][4]: +借助 [org-bullets][4] 它看起来是这样的: ![notes][5] -In this simple example you can see some of the Org-mode features: +在这个简单的例子中,你能看到 Org-mode 的一些功能: - * nested notes - * links - * lists with checkboxes +- 笔记允许嵌套 +- 链接 +- 带复选框的列表 +#### 项目待办 - -#### Project todos - -Often when I’m working on some task I notice things that I can improve or fix. Instead of leaving TODO comment in source code files (bad smell) I use [org-projectile][6] which allows me to write TODO items with a single shortcut in a separate file. Here’s an example of this file: +我在工作时时常会发现一些能够改进或修复的事情。我并不会在代码文件中留下 TODO 注释 (坏味道),相反我使用 [org-projectile][6] 来在另一个文件中记录一个 TODO 事项,并留下一个快捷方式。下面是一个该文件的例子: ``` * [[elisp:(org-projectile-open-project%20"mana")][mana]] [3/9] @@ -102,24 +100,24 @@ Often when I’m working on some task I notice things that I can improve or fix. CLOSED: [2018-08-26 Вс 11:48] ``` -How it looks in Emacs: +它看起来是这样的: ![project-todos][7] -In this example you can see more Org mode features: +本例中你能看到更多的 Org mode 功能: - * todo items have states - `TODO`, `DONE`. You can define your own states (`WAITING` etc) - * closed items have `CLOSED` timestamp - * some items have priorities - A, B, C. - * links can be internal (`[[file:~/...]`) +- todo 列表具有 `TODO`,`DONE` 两个状态。你还可以定义自己的状态 (`WAITING` 等) +- 关闭的事项有 `CLOSED` 时间戳 +- 有些事项有优先级 - A,B,C。 +- 链接可以指向文件内部 (`[[file:~/。..]`) -#### Capture templates +#### 捕获模板 -As described in Org-mode’s documentation, capture lets you quickly store notes with little interruption of your workflow. +正如 Org-mode 的文档中所描述的,capture 可以在不怎么干扰你工作流的情况下让你快速存储笔记。 -I configured several capture templates which help me to quickly create notes about things that I want to remember. +我配置了许多捕获模板,可以帮我快速记录想要记住的事情。 ``` (setq org-capture-templates @@ -139,42 +137,42 @@ I configured several capture templates which help me to quickly create notes abo "* %^{book name} by %^{author} %^g"))) ``` -For a book note I should add its name and its author, for a movie note I should add tags etc. +做书本记录时我需要记下它的名字和作者,做电影记录时我需要记下标签,等等。 -### Planning +### 规划 -Another great feature of Org-mode is that you can use it as a day planner. Let’s see an example of one of my days: +Org-mode 的另一个超棒的功能是你可以用它来作日常规划。让我们来看一个例子: ![schedule][8] -I didn’t give a lot of thought to this example, it’s my real file for today. It doesn’t look like much but it helps to spend your time on things that important to you and fight with procrastination. +我没有挖空心思虚构一个例子,这就是我现在真实文件的样子。它看起来内容并不多,但它有助于你花时间在在重要的事情上并且帮你对抗拖延症。 -#### Habits +#### 习惯 -From Org mode’s documentation, Org has the ability to track the consistency of a special category of TODOs, called “habits”. I use this feature along with day planning when I want to create new habits: +根据 Org mode 的文档,Org 能够跟踪一种特殊的代办事情,称为 “习惯”。当我想养成新的习惯时,我会将该功能与日常规划功能一起连用: ![habits][9] -As you can see currently I’m trying to wake early every day and workout once in two days. Also, it helped to start reading books every day. +你可以看到,目前我在尝试每天早期并且每两天锻炼一次。另外,它也有助于让我每天阅读书籍。 -#### Agenda views +#### 议事日程视图 -Last but not least I use agenda views. Todo items can be scattered throughout different files (in my case daily plan and habits are in separate files), agenda views give an overview of all todo items: +最后,我还使用议事日程视图功能。待办事项可能分散在不同文件中(比如我就是日常规划和习惯分散在不同文件中),议事日程视图可以提供所有待办事项的总览: ![agenda][10] -### More Org mode features +### 更多 Org mode 功能 + ++ 手机应用 ([Android][https://play.google.com/store/apps/details?id=com.orgzly&hl=en],[ios][https://itunes.apple.com/app/id1238649962]) + ++ [将 Org mode 文档导出为其他格式 ][https://orgmode.org/manual/Exporting.html](html,markdown,pdf,latex etc) + ++ 使用 [ledger][https://github.com/ledger/ledger-mode] [追踪财务状况 ][https://orgmode.org/worg/org-tutorials/weaving-a-budget.html] -+ Smartphone apps (Android, ios) +### 总结 -+ Exporting Org mode files into different formats (html, markdown, pdf, latex etc) - -+ Tracking Finances with ledger - -### Conclusion - -In this post, I described a small subset of Org-mode’s extensive functionality that helps me be productive every day, spending time on things that important to me. +本文我描述了 Org-mode 广泛功能中的一小部分,我每天都用它来提高工作效率,把时间花在重要的事情上。 -------------------------------------------------------------------------------- From 20c4aabe550a458a9f4cc33cc01f27e546d324fd Mon Sep 17 00:00:00 2001 From: pityonline Date: Fri, 22 Feb 2019 23:12:01 +0800 Subject: [PATCH 638/813] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?How=20To=20Remove-Delete=20The=20Empty=20Lines=20In=20A=20File?= =?UTF-8?q?=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lete The Empty Lines In A File In Linux.md | 192 ----------------- ...lete The Empty Lines In A File In Linux.md | 194 ++++++++++++++++++ 2 files changed, 194 insertions(+), 192 deletions(-) delete mode 100644 sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md create mode 100644 translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md diff --git a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md deleted file mode 100644 index b55cbcd811..0000000000 --- a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md +++ /dev/null @@ -1,192 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( pityonline ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) -[#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How To Remove/Delete The Empty Lines In A File In Linux -====== - -Some times you may wants to remove or delete the empty lines in a file in Linux. - -If so, you can use the one of the below method to achieve it. - -It can be done in many ways but i have listed simple methods in the article. - -You may aware of that grep, awk and sed commands are specialized for textual data manipulation. - -Navigate to the following URL, if you would like to read more about these kind of topics. For **[creating a file in specific size in Linux][1]** multiple ways, for **[creating a file in Linux][2]** multiple ways and for **[removing a matching string from a file in Linux][3]**. - -These are fall in advanced commands category because these are used in most of the shell script to do required things. - -It can be done using the following 5 methods. - - * **`sed Command:`** Stream editor for filtering and transforming text. - * **`grep Command:`** Print lines that match patterns. - * **`cat Command:`** It concatenate files and print on the standard output. - * **`tr Command:`** Translate or delete characters. - * **`awk Command:`** The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. - * **`perl Command:`** Perl is a programming language specially designed for text editing. - - - -To test this, i had already created the file called `2daygeek.txt` with some texts and empty lines. The details are below. - -``` -$ cat 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. - -It's FIVE years old blog. - -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. - -He got two GIRL babys. - -Her names are Tanisha & Renusha. -``` - -Now everything is ready and i’m going to test this in multiple ways. - -### How To Remove/Delete The Empty Lines In A File In Linux Using sed Command? - -Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). - -``` -$ sed '/^$/d' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`sed:`** It’s a command - * **`//:`** It holds the searching string. - * **`^:`** Matches start of string. - * **`$:`** Matches end of string. - * **`d:`** Delete the matched string. - * **`2daygeek.txt:`** Source file name. - - - -### How To Remove/Delete The Empty Lines In A File In Linux Using grep Command? - -grep searches for PATTERNS in each FILE. PATTERNS is one or patterns separated by newline characters, and grep prints each line that matches a pattern. - -``` -$ grep . 2daygeek.txt -or -$ grep -Ev "^$" 2daygeek.txt -or -$ grep -v -e '^$' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`grep:`** It’s a command - * **`.:`** Replaces any character. - * **`^:`** matches start of string. - * **`$:`** matches end of string. - * **`E:`** For extended regular expressions pattern matching. - * **`e:`** For regular expressions pattern matching. - * **`v:`** To select non-matching lines from the file. - * **`2daygeek.txt:`** Source file name. - - - -### How To Remove/Delete The Empty Lines In A File In Linux Using awk Command? - -The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. An awk program is a sequence of patterns and corresponding actions. - -``` -$ awk NF 2daygeek.txt -or -$ awk '!/^$/' 2daygeek.txt -or -$ awk '/./' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`awk:`** It’s a command - * **`//:`** It holds the searching string. - * **`^:`** matches start of string. - * **`$:`** matches end of string. - * **`.:`** Replaces any character. - * **`!:`** Delete the matched string. - * **`2daygeek.txt:`** Source file name. - - - -### How To Delete The Empty Lines In A File In Linux using Combination of cat And tr Command? - -cat stands for concatenate. It is very frequently used in Linux to reads data from a file. - -cat is one of the most frequently used commands on Unix-like operating systems. It’s offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file. - -Translate, squeeze, and/or delete characters from standard input, writing to standard output. - -``` -$ cat 2daygeek.txt | tr -s '\n' -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`cat:`** It’s a command - * **`tr:`** It’s a command - * **`|:`** Pipe symbol. It pass first command output as a input to another command. - * **`s:`** Replace each sequence of a repeated character that is listed in the last specified SET. - * **`\n:`** To add a new line. - * **`2daygeek.txt:`** Source file name. - - - -### How To Remove/Delete The Empty Lines In A File In Linux Using perl Command? - -Perl stands in for “Practical Extraction and Reporting Language”. Perl is a programming language specially designed for text editing. It is now widely used for a variety of purposes including Linux system administration, network programming, web development, etc. - -``` -$ perl -ne 'print if /\S/' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[pityonline](https://github.com/pityonline) -校对:[校对者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/create-a-file-in-specific-certain-size-linux/ -[2]: https://www.2daygeek.com/linux-command-to-create-a-file/ -[3]: https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/ diff --git a/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md new file mode 100644 index 0000000000..e9e320a97b --- /dev/null +++ b/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( pityonline ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) +[#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 中如何删除文件中的空行 +====== + +有时你可能需要在 Linux 中删除某个文件中的空行。 + +如果是的,你可以使用下面方法中的其中一个。 + +有很多方法可以做到,但我在这里只是列举一些简单的方法。 + +你可能已经知道 `grep`,`awk` 和 `sed` 命令是专门用来处理文本数据的工具。 + +如果你想了解更多关于这些命令的文章,请访问这几个 URL。**[在 Linux 中创建指定大小的文件的几种方法][1]**,**[在 Linux 中创建一个文件的几种方法][2]** 以及 **[在 Linux 中删除一个文件中的匹配的字符串][3]**。 + +这些属于高级命令,它们可用在大多数 shell 脚本中执行所需的操作。 + +下列 5 种方法可以做到。 + +* **`sed:`** 过滤和替换文本的流编辑器。 +* **`grep:`** 输出匹配到的行。 +* **`cat:`** 合并文件并打印内容到标准输出。 +* **`tr:`** 替换或删除字符。 +* **`awk:`** awk 工具用于执行 awk 语言编写的程序,专门用于文本处理。 +* **`perl:`** Perl 是一种用于处理文本的编程语言。 + +我创建了一个 `2daygeek.txt` 文件来测试这些命令。下面是文件的内容。 + +``` +$ cat 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. + +It's FIVE years old blog. + +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. + +He got two GIRL babys. + +Her names are Tanisha & Renusha. +``` + +现在一切就绪,我们准备开始用多种方法来验证。 + +### 使用 sed 命令 + +sed 是一个流编辑器stream editor。流编辑器是用来编辑输入流(文件或管道)中的文本的。 + +``` +$ sed '/^$/d' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`sed:`** 该命令本身。 +* **`//:`** 标记匹配范围。 +* **`^:`** 匹配字符串开头。 +* **`$:`** 匹配字符串结尾。 +* **`d:`** 删除匹配的字符串。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 grep 命令 + +`grep` 可以通过正则表达式在文件中搜索。该表达式可以是一行或多行空行分割的字符,`grep` 会打印所有匹配的内容。 + +``` +$ grep . 2daygeek.txt +or +$ grep -Ev "^$" 2daygeek.txt +or +$ grep -v -e '^$' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +Details are follow: +以下是命令展开的细节: + +* **`grep:`** 该命令本身。 +* **`.:`** 替换任意字符。 +* **`^:`** 匹配字符串开头。 +* **`$:`** 匹配字符串结尾。 +* **`E:`** 使用扩展正则匹配模式。 +* **`e:`** 使用常规正则匹配模式。 +* **`v:`** 反向匹配。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 awk 命令 + +`awk` 可以执行使用 awk 语言写的脚本,大多是专用于处理文本的。awk 脚本是一系列 awk 命令和正则的组合。 + +``` +$ awk NF 2daygeek.txt +or +$ awk '!/^$/' 2daygeek.txt +or +$ awk '/./' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`awk:`** 该命令本身。 +* **`//:`** 标记匹配范围。 +* **`^:`** 匹配字符串开头。 +* **`$:`** 匹配字符串结尾。 +* **`.:`** 匹配任意字符。 +* **`!:`** 删除匹配的字符串。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 cat 和 tr 命令 组合 + +`cat` 是串联(拼接)concatenate的简写。经常用于在 Linux 中读取一个文件的内容。 + +cat 是在类 Unix 系统中使用频率最高的命令之一。它提供了常用的三个处理文本文件的功能:显示文件内容,将多个文件拼接成一个,以及创建一个新文件。 + +tr 可以将标准输入中的字符转换,压缩或删除,然后重定向到标准输出。 + +``` +$ cat 2daygeek.txt | tr -s '\n' +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`cat:`** cat 命令本身。 +* **`tr:`** tr 命令本身。 +* **`|:`** 管道符号。它可以将前面的命令的标准输出作为下一个命令的标准输入。 +* **`s:`** 替换标数据集中任意多个重复字符为一个。 +* **`\n:`** 添加一个新的换行。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 perl 命令 + +Perl 表示实用的提取和报告语言Practical Extraction and Reporting Language。Perl 在初期被设计为一个专用于文本处理的编程语言,现在已扩展应用到 Linux 系统管理,网络编程和网站开发等多个领域。 + +``` +$ perl -ne 'print if /\S/' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`perl:`** perl 命令。 +* **`n:`** 逐行读入数据。 +* **`e:`** 执行某个命令。 +* **`print:`** 打印信息。 +* **`if:`** if 条件分支。 +* **`//:`** 标记匹配范围。 +* **`\S:`** 匹配任意非空白字符。 +* **`2daygeek.txt:`** 源文件名。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[pityonline](https://github.com/pityonline) +校对:[校对者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/create-a-file-in-specific-certain-size-linux/ +[2]: https://www.2daygeek.com/linux-command-to-create-a-file/ +[3]: https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/ From b66058e9533d71e589a1d13949a3767359a1f087 Mon Sep 17 00:00:00 2001 From: pityonline Date: Sun, 17 Mar 2019 00:40:19 +0800 Subject: [PATCH 639/813] translating by pityonline --- ...0180601 Get Started with Snap Packages in Linux.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sources/tech/20180601 Get Started with Snap Packages in Linux.md b/sources/tech/20180601 Get Started with Snap Packages in Linux.md index 632151832a..1693d3c44e 100644 --- a/sources/tech/20180601 Get Started with Snap Packages in Linux.md +++ b/sources/tech/20180601 Get Started with Snap Packages in Linux.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (pityonline) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get Started with Snap Packages in Linux) +[#]: via: (https://www.linux.com/learn/intro-to-linux/2018/5/get-started-snap-packages-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + Get Started with Snap Packages in Linux ====== @@ -139,7 +148,7 @@ via: https://www.linux.com/learn/intro-to-linux/2018/5/get-started-snap-packages 作者:[Jack Wallen][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[pityonline](https://github.com/pityonline) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a73453dbffb6dfcd9c6663386d084f254c67f90a Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Sat, 16 Mar 2019 18:35:17 -0500 Subject: [PATCH 640/813] Submit Translatted Passage for Review Submit Translatted Passage for Review --- ...ile Encryption And Decryption CLI Utility.md | 283 ------------------ ...ile Encryption And Decryption CLI Utility.md | 225 ++++++++++++++ 2 files changed, 225 insertions(+), 283 deletions(-) delete mode 100644 sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md create mode 100644 translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md diff --git a/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md b/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md deleted file mode 100644 index 883834d7e7..0000000000 --- a/sources/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md +++ /dev/null @@ -1,283 +0,0 @@ -tomjlw is translatting -Toplip – A Very Strong File Encryption And Decryption CLI Utility -====== -There are numerous file encryption tools available on the market to protect -your files. We have already reviewed some encryption tools such as -[**Cryptomater**][1], [**Cryptkeeper**][2], [**CryptGo**][3], [**Cryptr**][4], -[**Tomb**][5], and [**GnuPG**][6] etc. Today, we will be discussing yet -another file encryption and decryption command line utility named **" -Toplip"**. It is a free and open source encryption utility that uses a very -strong encryption method called **[AES256][7]** , along with an **XTS-AES** -design to safeguard your confidential data. Also, it uses [**Scrypt**][8], a -password-based key derivation function, to protect your passphrases against -brute-force attacks. - -### Prominent features - -Compared to other file encryption tools, toplip ships with the following -unique and prominent features. - - * Very strong XTS-AES256 based encryption method. - * Plausible deniability. - * Encrypt files inside images (PNG/JPG). - * Multiple passphrase protection. - * Simplified brute force recovery protection. - * No identifiable output markers. - * Open source/GPLv3. - -### Installing Toplip - -There is no installation required. Toplip is a standalone executable binary -file. All you have to do is download the latest toplip from the [**official -products page**][9] and make it as executable. To do so, just run: - -``` -chmod +x toplip -``` - -### Usage - -If you run toplip without any arguments, you will see the help section. - -``` -./toplip -``` - -[![][10]][11] - -Allow me to show you some examples. - -For the purpose of this guide, I have created two files namely **file1** and -**file2**. Also, I have an image file which we need it to hide the files -inside it. And finally, I have **toplip** executable binary file. I have kept -them all in a directory called **test**. - -[![][12]][13] - -**Encrypt/decrypt a single file** - -Now, let us encrypt **file1**. To do so, run: - -``` -./toplip file1 > file1.encrypted -``` - -This command will prompt you to enter a passphrase. Once you have given the -passphrase, it will encrypt the contents of **file1** and save them in a file -called **file1.encrypted** in your current working directory. - -Sample output of the above command would be: - -``` -This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip file1 Passphrase #1: generating keys...Done -Encrypting...Done -``` - -To verify if the file is really encrypted., try to open it and you will see -some random characters. - -To decrypt the encrypted file, use **-d** flag like below: - -``` -./toplip -d file1.encrypted -``` - -This command will decrypt the given file and display the contents in the -Terminal window. - -To restore the file instead of writing to stdout, do: - -``` -./toplip -d file1.encrypted > file1.decrypted -``` - -Enter the correct passphrase to decrypt the file. All contents of **file1.encrypted** will be restored in a file called **file1.decrypted**. - -Please don't follow this naming method. I used it for the sake of easy understanding. Use any other name(s) which is very hard to predict. - -**Encrypt/decrypt multiple files -** - -Now we will encrypt two files with two separate passphrases for each one. - -``` -./toplip -alt file1 file2 > file3.encrypted -``` - -You will be asked to enter passphrase for each file. Use different -passphrases. - -Sample output of the above command will be: - -``` -This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -**file2 Passphrase #1** : generating keys...Done -**file1 Passphrase #1** : generating keys...Done -Encrypting...Done -``` - -What the above command will do is encrypt the contents of two files and save -them in a single file called **file3.encrypted**. While restoring, just give -the respective password. For example, if you give the passphrase of the file1, -toplip will restore file1. If you enter the passphrase of file2, toplip will -restore file2. - -Each **toplip** encrypted output may contain up to four wholly independent -files, and each created with their own separate and unique passphrase. Due to -the way the encrypted output is put together, there is no way to easily -determine whether or not multiple files actually exist in the first place. By -default, even if only one file is encrypted using toplip, random data is added -automatically. If more than one file is specified, each with their own -passphrase, then you can selectively extract each file independently and thus -deny the existence of the other files altogether. This effectively allows a -user to open an encrypted bundle with controlled exposure risk, and no -computationally inexpensive way for an adversary to conclusively identify that -additional confidential data exists. This is called **Plausible deniability** -, one of the notable feature of toplip. - -To decrypt **file1** from **file3.encrypted** , just enter: - -``` -./toplip -d file3.encrypted > file1.encrypted -``` - -You will be prompted to enter the correct passphrase of file1. - -To decrypt **file2** from **file3.encrypted** , enter: - -``` -./toplip -d file3.encrypted > file2.encrypted -``` - -Do not forget to enter the correct passphrase of file2. - -**Use multiple passphrase protection** - -This is another cool feature that I admire. We can provide multiple -passphrases for a single file when encrypting it. It will protect the -passphrases against brute force attempts. - -``` -./toplip -c 2 file1 > file1.encrypted -``` - -Here, **-c 2** represents two different passphrases. Sample output of above -command would be: - -``` -This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -**file1 Passphrase #1:** generating keys...Done -**file1 Passphrase #2:** generating keys...Done -Encrypting...Done -``` - -As you see in the above example, toplip prompted me to enter two passphrases. -Please note that you must **provide two different passphrases** , not a single -passphrase twice. - -To decrypt this file, do: - -``` -$ ./toplip -c 2 -d file1.encrypted > file1.decrypted -This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -**file1.encrypted Passphrase #1:** generating keys...Done -**file1.encrypted Passphrase #2:** generating keys...Done -Decrypting...Done -``` - -**Hide files inside image** - -The practice of concealing a file, message, image, or video within another -file is called **steganography**. Fortunately, this feature exists in toplip -by default. - -To hide a file(s) inside images, use **-m** flag as shown below. - -``` -$ ./toplip -m image.png file1 > image1.png -This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -file1 Passphrase #1: generating keys...Done -Encrypting...Done -``` - -This command conceals the contents of file1 inside an image named image1.png. -To decrypt it, run: - -``` -$ ./toplip -d image1.png > file1.decrypted This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -image1.png Passphrase #1: generating keys...Done -Decrypting...Done -``` - -**Increase password complexity** - -To make things even harder to break, we can increase the password complexity -like below. - -``` -./toplip -c 5 -i 0x8000 -alt file1 -c 10 -i 10 file2 > file3.encrypted -``` - -The above command will prompt to you enter 10 passphrases for the file1, 5 -passphrases for the file2 and encrypt both of them in a single file called -"file3.encrypted". As you may noticed, we have used one more additional flag -**-i** in this example. This is used to specify key derivation iterations. -This option overrides the default iteration count of 1 for scrypt's initial -and final PBKDF2 stages. Hexadecimal or decimal values permitted, e.g. -**0x8000** , **10** , etc. Please note that this can dramatically increase the -calculation times. - -To decrypt file1, use: - -``` -./toplip -c 5 -i 0x8000 -d file3.encrypted > file1.decrypted -``` - -To decrypt file2, use: - -``` -./toplip -c 10 -i 10 -d file3.encrypted > file2.decrypted -``` - -To know more about the underlying technical information and crypto methods -used in toplip, refer its official website given at the end. - -My personal recommendation to all those who wants to protect their data. Don't -rely on single method. Always use more than one tools/methods to encrypt -files. Do not write passphrases/passwords in a paper and/or do not save them -in your local or cloud storage. Just memorize them and destroy the notes. If -you're poor at remembering passwords, consider to use any trustworthy password -managers. - -And, that's all. More good stuffs to come. Stay tuned! - -Cheers! - - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ - -作者:[SK][a] -译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.ostechnix.com/author/sk/ -[1]:https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/ -[2]:https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/ -[3]:https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/ -[4]:https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/ -[5]:https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ -[6]:https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ -[7]:http://en.wikipedia.org/wiki/Advanced_Encryption_Standard -[8]:http://en.wikipedia.org/wiki/Scrypt -[9]:https://2ton.com.au/Products/ -[10]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png%201366w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-300x157.png%20300w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-768x403.png%20768w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-1024x537.png%201024w -[11]:http://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png -[12]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png%20779w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1-300x101.png%20300w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1-768x257.png%20768w -[13]:http://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png - diff --git a/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md b/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md new file mode 100644 index 0000000000..887718ec7d --- /dev/null +++ b/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md @@ -0,0 +1,225 @@ +Toplip ——一款十分强大的文件加密解密 CLI 工具 +====== +在市场上有许多可获得的文档加密工具用来保护你的文件。我们已经介绍过其中一些例如 [**Cryptomater**][1],[**Cryptkeeper**][2],[**CryptGo**][3],[**Cryptr**][4],[**Tomb**][5],以及 [**GnuPG**][6] 等加密工具。今天我们将讨论另一款叫做 **“Toplip”** 的命令行文件加密解密工具。它是一款使用一种叫做 **[AES256][7]** 的强大加密方法的免费开源的加密工具。它同时也使用了 **XTS-AES** 设计以保护你的隐私数据。它还使用了 [**Scrypt**][8],一种基于密码的密钥生成函数来保护你的密码免于暴力破解。 + +### 优秀的特性 + +相比于其它文件加密工具,toplip 自带以下独特且杰出的特性。 + + * 非常强大的基于 XTS-AES256 的加密方法。 + * 可能性推诿。 + * 在图片(PNG/JPG)内加密文件。 + * 多重密码保护。 + * 简化的暴力破解保护。 + * 无可辨识的输出标记。 + * 开源/GPLv3。 + +### 安装 Toplip + +没有什么需要安装的。Toplip 是独立的可执行二进制文件。你所要做的仅是从 [**产品官方页面**][9] 下载最新版的 Toplip 并赋予它可执行权限。为此你只要运行: + +``` +chmod +x toplip +``` + +### 使用 + +如果你不带任何参数运行 toplip,你将看到帮助页面。 + +``` +./toplip +``` + +[![][10]][11] + +允许我给你展示一些例子。 + +为了达到指导目的,我建了两个文件 **file1** 和 **file2**。我同时也有 **toplip** 可执行二进制文件。我把它们全都保存进一个叫做 **test** 的目录。 + +[![][12]][13] + +**加密/解密单个文件** + +现在让我们加密 **file1**。为此,运行: + +``` +./toplip file1 > file1.encrypted +``` + +这行命令将让你输入密码。一旦你输入完密码,它就会加密 **file1** 的内容并将它们保存进你当前工作目录下一个叫做 “file1.encrypted” 的文件。 + +上述命令行的示例输出将会是这样: + +``` +This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip file1 Passphrase #1: generating keys...Done +Encrypting...Done +``` + +为了验证文件是否的确经过加密,试着打开它你会发现一些随机的字符。 + +为了解密加密过的文件,像以下这样使用 **-d** 参数: + +``` +./toplip -d file1.encrypted +``` + +这行命令会解密提供的文档并在终端窗口显示内容。 + +为了保存文档而不是写入标准输出,运行: + +``` +./toplip -d file1.encrypted > file1.decrypted +``` + +输入正确的密码解密文档。**file1.encrypted** 的所有内容将会存入一个叫做 **file1.decrypted** 的文档。 + +请不要用这种命名方法,我这样用仅仅是为了便于理解。使用其它难以预测的名字。 + +**加密/解密多个文件** + +现在我们将使用分别的两个密码加密每个文件。 + +``` +./toplip -alt file1 file2 > file3.encrypted +``` + +你会被要求为每个文件输入一个密码,使用不同的密码。 + +上述命令行的示例输出将会是这样: + +``` +This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip +**file2 Passphrase #1** : generating keys...Done +**file1 Passphrase #1** : generating keys...Done +Encrypting...Done +``` + +上述命令所做的是加密两个文件的内容并将它们保存进一个单独的叫做 **file3.encrypted** 的文件。在保存中分别给予各自的密码。比如说如果你提供 file1 的密码,toplip 将复原 file1。如果你提供 file2 的密码,toplip 将复原 file2。 + +每个 **toplip** 加密输出都可能包含最多至四个单独的文件,并且每个文件都建有各自独特的密码。由于加密输出放在一起的方式,以下判断出是否存在多个文档不是一件容易的事。默认情况下,甚至就算确实只有一个文件是由 toplip 加密,随机数据都会自动加上。如果多于一个文件被指定,每个都有自己的密码,那么你可以有选择性地独立解码每个文件,以此来否认其它文件存在的可能性。这能有效地使一个用户在可控的暴露风险下打开一个加密的捆绑文件包。并且对于敌人来说,在计算上没有一种低廉的办法来确认额外的秘密数据存在。这叫做 **可能性推诿**,是 toplip 著名的特性之一。 + +为了从 **file3.encrypted** 解码 **file1**,仅需输入: + +``` +./toplip -d file3.encrypted > file1.encrypted +``` + +你将会被要求输入 file1 的正确密码。 + +为了从 **file3.encrypted** 解码 **file2**,输入: + +``` +./toplip -d file3.encrypted > file2.encrypted +``` + +别忘了输入 file2 的正确密码。 + +**使用多重密码保护** + +这是我中意的另一个炫酷特性。在加密过程中我们可以为单个文件提供多重密码。这样可以保护密码免于暴力尝试。 + +``` +./toplip -c 2 file1 > file1.encrypted +``` + +这里,**-c 2** 代表两个不同的密码。上述命令行的示例输出将会是这样: + +``` +This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip +**file1 Passphrase #1:** generating keys...Done +**file1 Passphrase #2:** generating keys...Done +Encrypting...Done +``` + +正如你在上述示例中所看到的,toplip 要求我输入两个密码。请注意你必须**提供两个不同的密码**,而不是提供两遍同一个密码。 + +为了解码这个文件,这样做: + +``` +$ ./toplip -c 2 -d file1.encrypted > file1.decrypted +This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip +**file1.encrypted Passphrase #1:** generating keys...Done +**file1.encrypted Passphrase #2:** generating keys...Done +Decrypting...Done +``` + +**将文件藏在图片中** + +将一个文件,消息,图片或视频藏在另一个文件里的方法叫做**隐写术**。幸运的是 toplip 默认包含这个特性。 + +为了将文件藏入图片中,像如下所示的样子使用 **-m** 参数。 + +``` +$ ./toplip -m image.png file1 > image1.png +This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip +file1 Passphrase #1: generating keys...Done +Encrypting...Done +``` + +这行命令将 file1 的内容藏入一张叫做 image1.png 的图片中。 +为了解码,运行: + +``` +$ ./toplip -d image1.png > file1.decrypted This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip +image1.png Passphrase #1: generating keys...Done +Decrypting...Done +``` + +**增加密码复杂度** + +为了进一步使文件变得难以破译,我们可以像以下这样增加密码复杂度: + +``` +./toplip -c 5 -i 0x8000 -alt file1 -c 10 -i 10 file2 > file3.encrypted +``` + +上述命令将会要求你为 file1 输入十条密码,为 file2 输入五条密码,并将它们存入单个叫做 “file3.encrypted” 的文件。如你所注意到的,我们在这个例子中又用了另一个 **-i** 参数。这是用来指定密钥生成循环次数。这个选项覆盖了 scrypt 函数初始和最终 PBKDF2 阶段的默认循环次数1。十六进制和十进制数值都是允许的。比如说 **0x8000**,**10**等。请注意这会大大增加计算次数。 + +为了解码 file1,使用: + +``` +./toplip -c 5 -i 0x8000 -d file3.encrypted > file1.decrypted +``` + +为了解码 file2,使用: + +``` +./toplip -c 10 -i 10 -d file3.encrypted > file2.decrypted +``` + +参考在文章结尾给出的 toplip 官网以了解更多关于其背后的技术信息和使用的加密方式。 + +我个人对所有想要保护自己数据的人的建议是,别依赖单一的方法。总是使用多种工具/方法来加密文件。不要在纸上写下密码也不要将密码存入本地或云。记住密码,阅后即焚。如果你记不住,考虑使用任何了信赖的密码管理器。 + +今天就到此为止了,更多好东西后续推出,请保持关注。 + +欢呼吧! + + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ + +作者:[SK][a] +译者:[tomjlw](https://github.com/tomjlw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ostechnix.com/author/sk/ +[1]:https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/ +[2]:https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/ +[3]:https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/ +[4]:https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/ +[5]:https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ +[6]:https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ +[7]:http://en.wikipedia.org/wiki/Advanced_Encryption_Standard +[8]:http://en.wikipedia.org/wiki/Scrypt +[9]:https://2ton.com.au/Products/ +[10]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png%201366w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-300x157.png%20300w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-768x403.png%20768w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-1024x537.png%201024w +[11]:http://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png +[12]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png%20779w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1-300x101.png%20300w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1-768x257.png%20768w +[13]:http://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png + From eab06ab1ce8158d84b86f4210a56c2636faf2eed Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 09:26:30 +0800 Subject: [PATCH 641/813] PRF:20190226 All about -Curly Braces- in Bash.md @HankChow --- ...190226 All about -Curly Braces- in Bash.md | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/translated/tech/20190226 All about -Curly Braces- in Bash.md b/translated/tech/20190226 All about -Curly Braces- in Bash.md index 8f148b33ce..33d1501c60 100644 --- a/translated/tech/20190226 All about -Curly Braces- in Bash.md +++ b/translated/tech/20190226 All about -Curly Braces- in Bash.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (All about {Curly Braces} in Bash) @@ -9,6 +9,7 @@ 浅析 Bash 中的 {花括号} ====== +> 让我们继续我们的 Bash 基础之旅,来近距离观察一下花括号,了解一下如何和何时使用它们。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/curly-braces-1920.jpg?itok=cScRhWrX) @@ -70,7 +71,6 @@ month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") ``` $ echo ${month[3]} # 数组索引从 0 开始,因此 [3] 对应第 4 个元素 - Apr ``` @@ -94,13 +94,12 @@ dec2bin=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}) ``` $ echo ${dec2bin[25]} - 00011001 ``` 对于进制转换,确实还有更好的方法,但这不失为一个有趣的方法。 -### 参数展开parameter expansion +### 参数展开 再看回前面的 @@ -108,7 +107,7 @@ $ echo ${dec2bin[25]} echo ${month[3]} ``` -在这里,花括号的作用就不是构造序列了,而是用于参数展开。顾名思义,参数展开就是将花括号中的变量展开为这个变量实际的内容。 +在这里,花括号的作用就不是构造序列了,而是用于参数展开parameter expansion。顾名思义,参数展开就是将花括号中的变量展开为这个变量实际的内容。 我们继续使用上面的 `month` 数组来举例: @@ -132,7 +131,7 @@ a="Too longgg" echo ${a%gg} ``` -可以输出“too long”,也就是去掉了最后的两个 g。 +可以输出 “too long”,也就是去掉了最后的两个 g。 在这里, @@ -141,8 +140,6 @@ echo ${a%gg} * `%` 告诉 shell 需要在展开字符串之后从字符串的末尾去掉某些内容 * `gg` 是被去掉的内容 - - 这个特性在转换文件格式的时候会比较有用,我来举个例子: [ImageMagick][3] 是一套可以用于操作图像文件的命令行工具,它有一个 `convert` 命令。这个 `convert` 命令的作用是可以为某个格式的图像文件制作一个另一格式的副本。 @@ -206,14 +203,6 @@ echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch o 在后续的文章中,我会介绍其它“包裹”类符号的用法,敬请关注。 -相关阅读: - -[And, Ampersand, and & in Linux][4] - -[Ampersands and File Descriptors in Bash][5] - -[Logical & in Bash][2] - -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash @@ -221,15 +210,12 @@ via: https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash 作者:[Paul Brown][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://www.linux.com/users/bro66 [b]: https://github.com/lujun9972 -[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot -[2]: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash +[1]: https://linux.cn/article-10465-1.html [3]: http://www.imagemagick.org/ -[4]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux -[5]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash From 09e622b086490e520ce6998e4142ecf9be18be95 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 09:27:22 +0800 Subject: [PATCH 642/813] PUB:20190226 All about -Curly Braces- in Bash.md @HankChow https://linux.cn/article-10624-1.html --- .../20190226 All about -Curly Braces- in Bash.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190226 All about -Curly Braces- in Bash.md (99%) diff --git a/translated/tech/20190226 All about -Curly Braces- in Bash.md b/published/20190226 All about -Curly Braces- in Bash.md similarity index 99% rename from translated/tech/20190226 All about -Curly Braces- in Bash.md rename to published/20190226 All about -Curly Braces- in Bash.md index 33d1501c60..ad9023f47b 100644 --- a/translated/tech/20190226 All about -Curly Braces- in Bash.md +++ b/published/20190226 All about -Curly Braces- in Bash.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10624-1.html) [#]: subject: (All about {Curly Braces} in Bash) [#]: via: (https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash) [#]: author: (Paul Brown https://www.linux.com/users/bro66) From d776448c80a7c95888dfcce6d7e36362e27feccd Mon Sep 17 00:00:00 2001 From: MjSeven Date: Fri, 15 Mar 2019 18:26:37 +0800 Subject: [PATCH 643/813] Translating by MjSeven --- ...09 How To Fix -Network Protocol Error- On Mozilla Firefox.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md index da752b07ee..17df6db81a 100644 --- a/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md +++ b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d2701ac7194c7259c79a2d00d1c0d4b2b26a323d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 10:31:25 +0800 Subject: [PATCH 644/813] PRF:20171119 Advanced Techniques for Reducing Emacs Startup Time.md @lujun9972 --- ...hniques for Reducing Emacs Startup Time.md | 147 ++++++++---------- 1 file changed, 68 insertions(+), 79 deletions(-) diff --git a/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md b/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md index 54d8d0bfdd..f62420cd05 100644 --- a/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md +++ b/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Advanced Techniques for Reducing Emacs Startup Time) @@ -10,82 +10,77 @@ 降低 Emacs 启动时间的高级技术 ====== - [Emacs Start Up Profiler][1] 的作者教你六项技术减少 Emacs 启动时间。 +> 《[Emacs Start Up Profiler][1]》 的作者教你六项减少 Emacs 启动时间的技术。 简而言之:做下面几个步骤: -1。使用 Esup 进行性能检测。 -2。调整垃圾回收的阀值。 -3。使用 usge-page 来自动(延迟)加载所有东西。 -4。不要使用会引起立即加载的辅助函数。 -5。参考我的 [配置 ][2]。 +1. 使用 Esup 进行性能检测。 +2. 调整垃圾回收的阀值。 +3. 使用 use-package 来自动(延迟)加载所有东西。 +4. 不要使用会引起立即加载的辅助函数。 +5. 参考我的 [配置][2]。 +### 从 .emacs.d 的失败到现在 +我最近宣布了 .emacs.d 的第三次失败,并完成了第四次 Emacs 配置的迭代。演化过程为: -### 从 .emacs.d 破产到现在 - -我最近宣布了第三次 .emacs.d 破产并完成了第四次 Emacs 配置的迭代。演化过程为: - -1。拷贝并粘贴 elisp 片段到 `~/.emacs` 中,希望它能工作。 -2。借助 `el-get` 来以更结构化的方式来管理依赖关系。 -3。放弃自己从零配置,以 Spacemacs 为基础。 -4。厌倦了 Spacemacs 的复杂性,基于 `use-package` 重写配置。 - -本文汇聚了三次重写和创建 `Emacs Start Up Profiler` 过程中的技巧。 -非常感谢 Spacemacs,use-package 等背后的团队。 -没有这些无私的志愿者,这项任务将会困难得多。 +1. 拷贝并粘贴 elisp 片段到 `~/.emacs` 中,希望它能工作。 +2. 借助 `el-get` 来以更结构化的方式来管理依赖关系。 +3. 放弃自己从零配置,以 Spacemacs 为基础。 +4. 厌倦了 Spacemacs 的复杂性,基于 `use-package` 重写配置。 +本文汇聚了三次重写和创建 《[Emacs Start Up Profiler][1]》过程中的技巧。非常感谢 Spacemacs、use-package 等背后的团队。没有这些无私的志愿者,这项任务将会困难得多。 ### 不过守护进程模式又如何呢 -在我们开始之前,让我声明一下常见的反对优化 Emacs 的观念:“Emacs 旨在作为守护进程来运行的,因此你只需要运行一次而已。” +在我们开始之前,让我反驳一下优化 Emacs 时的常见观念:“Emacs 旨在作为守护进程来运行的,因此你只需要运行一次而已。” + 这个观点很好,只不过: -- 速度总是越快越好 +- 速度总是越快越好。 - 配置 Emacs 时,可能会有不得不通过重启 Emacs 的情况。例如,你可能为 `post-command-hook` 添加了一个运行缓慢的 `lambda` 函数,很难删掉它。 -- 重启 Emacs 能帮你验证不同会话之间是否还能保留配置 +- 重启 Emacs 能帮你验证不同会话之间是否还能保留配置。 -### 估算当前以及最佳的启动时间 +### 1、估算当前以及最佳的启动时间 -第一步是衡量当前的启动时间。最简单的方法就是在启动时显示后续步骤进度的信息。 +第一步是测量当前的启动时间。最简单的方法就是在启动时显示后续步骤进度的信息。 ``` +;; Use a hook so the message doesn't get clobbered by other messages. (add-hook 'emacs-startup-hook - (lambda () - (message "Emacs ready in %s with %d garbage collections." - (format "%.2f seconds" - (float-time - (time-subtract after-init-time before-init-time))) - gcs-done))) + (lambda () + (message "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) ``` -第二部,衡量最佳的启动速度,以便了解可能的情况。我的是 0.3 秒。 +第二步、测量最佳的启动速度,以便了解可能的情况。我的是 0.3 秒。 ``` -emacs -q --eval='(message "%s" (emacs-init-time))' +# -q ignores personal Emacs files but loads the site files. +emacs -q --eval='(message "%s" (emacs-init-time))' ;; For macOS users: -open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))' +open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))' ``` -### 2。检测 Emacs 启动指标对你大有帮助 +### 2、检测 Emacs 启动指标对你大有帮助 -[Emacs StartUp Profiler][1] (ESUP) 将会给你顶层语句执行的详细指标。 +《[Emacs StartUp Profiler][1]》(ESUP)将会给你顶层语句执行的详细指标。 ![esup.png][3] +*图 1: Emacs Start Up Profiler 截图* -图 1: Emacs Start Up Profiler 截图 +> 警告:Spacemacs 用户需要注意,ESUP 目前与 Spacemacs 的 init.el 文件有冲突。遵照 上说的进行升级。 -警告:Spacemacs 用户需要注意,ESUP 目前与 Spacemacs 的 init.el 文件有冲突。遵照 上说的进行升级。 - -### 启动时调高垃圾回收的阀值 +### 3、调高启动时垃圾回收的阀值 这为我节省了 **0.3 秒**。 -Emacs 默认值是 760kB,这在现代机器看来及其的保守。 -真正的诀窍在于初始化完成后再把它降到合理的水平。 -这为了节省了 0.3 秒 +Emacs 默认值是 760kB,这在现代机器看来极其保守。真正的诀窍在于初始化完成后再把它降到合理的水平。这为我节省了 0.3 秒。 ``` ;; Make startup faster by reducing the frequency of garbage @@ -98,13 +93,13 @@ Emacs 默认值是 760kB,这在现代机器看来及其的保守。 (setq gc-cons-threshold (* 2 1000 1000)) ``` -### 4。不要 require 任何东西,转而使用 use-package 来自动加载 +*~/.emacs.d/init.el* -让 Emacs 变坏的最好方法就是减少要做的事情。`require` 会立即加载源文件。 -但是很少会出现需要在启动阶段就立即需要这些功能的。 +### 4、不要 require 任何东西,而是使用 use-package 来自动加载 -在 [`use-package`][4] 中你只需要声明好需要哪个包中的哪个功能,`use-package` 就会帮你完成正确的事情。 -它看起来是这样的: +让 Emacs 变坏的最好方法就是减少要做的事情。`require` 会立即加载源文件,但是很少会出现需要在启动阶段就立即需要这些功能的。 + +在 [use-package][4] 中你只需要声明好需要哪个包中的哪个功能,`use-package` 就会帮你完成正确的事情。它看起来是这样的: ``` (use-package evil-lisp-state ; the Melpa package name @@ -118,28 +113,26 @@ Emacs 默认值是 760kB,这在现代机器看来及其的保守。 (abn/define-leader-keys "k" evil-lisp-state-map)) ``` -可以通过查看 `features` 变量来查看 Emacs 现在加载了那些包。 -想要更好看的输出可以使用 [lpkg explorer][5] 或者我在 [abn-funcs-benchmark.el][6] 中的变体。 -输出看起来类似这样的: +可以通过查看 `features` 变量来查看 Emacs 现在加载了那些包。想要更好看的输出可以使用 [lpkg explorer][5] 或者我在 [abn-funcs-benchmark.el][6] 中的变体。输出看起来类似这样的: ``` 479 features currently loaded - - abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el - - evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc - - misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc - - multi-isearch: nil - - + - abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el + - evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc + - misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc + - multi-isearch: nil + - ``` -### 5。不要使用辅助函数来设置模式 +### 5、不要使用辅助函数来设置模式 -通常,Emacs packages 会建议通过运行一个辅助函数来设置键绑定。下面是一些例子: +通常,Emacs 包会建议通过运行一个辅助函数来设置键绑定。下面是一些例子: * `(evil-escape-mode)` * `(windmove-default-keybindings) ; 设置快捷键。` - * `(yas-global-mode 1) ;复杂的片段配置。` + * `(yas-global-mode 1) ; 复杂的片段配置。` -可以通过 use-package 来对此进行重构以提高启动速度。这些辅助函数只会让你立即加载那些尚用不到的 package。 +可以通过 `use-package` 来对此进行重构以提高启动速度。这些辅助函数只会让你立即加载那些尚用不到的包。 下面这个例子告诉你如何自动加载 `evil-escape-mode`。 @@ -171,19 +164,17 @@ Emacs 默认值是 760kB,这在现代机器看来及其的保守。 (org-babel-do-load-languages 'org-babel-load-languages '((shell . t) - (emacs-lisp . nil))) + (emacs-lisp . nil))) ``` -这种不是个好的配置,因为 `org-babel-do-load-languages` 定义在 `org.el` 中,而该文件有超过 2 万 4 千行的代码,需要花 0.2 秒来加载。 -通过查看源代码可以看到 `org-babel-do-load-languages` 仅仅只是加载 `ob-` 包而已,像这样: +这不是个好的配置,因为 `org-babel-do-load-languages` 定义在 `org.el` 中,而该文件有超过 2 万 4 千行的代码,需要花 0.2 秒来加载。通过查看源代码可以看到 `org-babel-do-load-languages` 仅仅只是加载 `ob-` 包而已,像这样: ``` ;; From org.el in the org-babel-do-load-languages function. (require (intern (concat "ob-" lang))) ``` -而在 `ob-.el` 文件中,我们只关心其中的两个方法 `org-babel-execute:` 和 `org-babel-expand-body:`。 -我们可以延时加载 org-babel 相关功能而无需调用 `org-babel-do-load-languages`,像这样: +而在 `ob-.el` 文件中,我们只关心其中的两个方法 `org-babel-execute:` 和 `org-babel-expand-body:`。我们可以延时加载 org-babel 相关功能而无需调用 `org-babel-do-load-languages`,像这样: ``` ;; Avoid `org-babel-do-load-languages' since it does an eager require. @@ -203,22 +194,21 @@ Emacs 默认值是 760kB,这在现代机器看来及其的保守。 org-babel-expand-body:bash)) ``` -### 6。使用惰性定时器 (idle timer) 来推迟加载非立即需要的包 +### 6、使用惰性定时器来推迟加载非立即需要的包 我推迟加载了 9 个包,这帮我节省了 **0.4 秒**。 -有些包特别有用,你希望可以很快就能使用它们,但是它们本身在 Emacs 启动过程中又不是必须的。这些 mode 包括: +有些包特别有用,你希望可以很快就能使用它们,但是它们本身在 Emacs 启动过程中又不是必须的。这些软件包包括: -- `recentf`: 保存最近的编辑过的那些文件。 -- `saveplace`: 保存访问过文件的光标位置。 -- `server`: 开启 Emacs 守护进程。 -- `autorevert`: 自动重载被修改过的文件。 -- `paren`: 高亮匹配的括号。 -- `projectile`: 项目管理工具。 -- `whitespace`: 高亮行尾的空格。 +- `recentf`:保存最近的编辑过的那些文件。 +- `saveplace`:保存访问过文件的光标位置。 +- `server`:开启 Emacs 守护进程。 +- `autorevert`:自动重载被修改过的文件。 +- `paren`:高亮匹配的括号。 +- `projectile`:项目管理工具。 +- `whitespace`:高亮行尾的空格。 -不要 require 这些 mode,** 而是等到空闲 N 秒后再加载它们**。 -我在 1 秒后加载那些比较重要的包,在 2 秒后加载其他所有的包。 +不要 `require` 这些软件包,**而是等到空闲 N 秒后再加载它们**。我在 1 秒后加载那些比较重要的包,在 2 秒后加载其他所有的包。 ``` (use-package recentf @@ -232,8 +222,7 @@ Emacs 默认值是 760kB,这在现代机器看来及其的保守。 ### 不值得的优化 -不要费力把你的 Emacs 配置文件编译成字节码了。这只节省了大约 0.05 秒。 -把配置文件编译成字节码可能导致源文件与编译后的文件不匹配从而导致难以出现错误调试。 +不要费力把你的 Emacs 配置文件编译成字节码了。这只节省了大约 0.05 秒。把配置文件编译成字节码还可能导致源文件与编译后的文件不一致从而难以重现错误进行调试。 -------------------------------------------------------------------------------- @@ -241,8 +230,8 @@ via: https://blog.d46.us/advanced-emacs-startup/ 作者:[Joe Schafer][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e0ac1547041d0038d46ba6ee10653f8ecec630db Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 10:32:17 +0800 Subject: [PATCH 645/813] PUB:20171119 Advanced Techniques for Reducing Emacs Startup Time.md @lujun9972 https://linux.cn/article-10625-1.html --- ...119 Advanced Techniques for Reducing Emacs Startup Time.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20171119 Advanced Techniques for Reducing Emacs Startup Time.md (99%) diff --git a/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md b/published/20171119 Advanced Techniques for Reducing Emacs Startup Time.md similarity index 99% rename from translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md rename to published/20171119 Advanced Techniques for Reducing Emacs Startup Time.md index f62420cd05..b6b5819c91 100644 --- a/translated/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md +++ b/published/20171119 Advanced Techniques for Reducing Emacs Startup Time.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10625-1.html) [#]: subject: (Advanced Techniques for Reducing Emacs Startup Time) [#]: via: (https://blog.d46.us/advanced-emacs-startup/) [#]: author: (Joe Schafer https://blog.d46.us/) From 95fdce540ce7785cd2ddae590e12408640dfb1c6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 13:37:16 +0800 Subject: [PATCH 646/813] PRF:20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @pityonline --- ...lete The Empty Lines In A File In Linux.md | 107 +++++++++--------- 1 file changed, 51 insertions(+), 56 deletions(-) diff --git a/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md index e9e320a97b..a362c943fc 100644 --- a/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md +++ b/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: ( pityonline ) -[#]: reviewer: ( ) +[#]: translator: (pityonline) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) @@ -10,26 +10,22 @@ 在 Linux 中如何删除文件中的空行 ====== -有时你可能需要在 Linux 中删除某个文件中的空行。 +有时你可能需要在 Linux 中删除某个文件中的空行。如果是的,你可以使用下面方法中的其中一个。有很多方法可以做到,但我在这里只是列举一些简单的方法。 -如果是的,你可以使用下面方法中的其中一个。 +你可能已经知道 `grep`、`awk` 和 `sed` 命令是专门用来处理文本数据的工具。 -有很多方法可以做到,但我在这里只是列举一些简单的方法。 - -你可能已经知道 `grep`,`awk` 和 `sed` 命令是专门用来处理文本数据的工具。 - -如果你想了解更多关于这些命令的文章,请访问这几个 URL。**[在 Linux 中创建指定大小的文件的几种方法][1]**,**[在 Linux 中创建一个文件的几种方法][2]** 以及 **[在 Linux 中删除一个文件中的匹配的字符串][3]**。 +如果你想了解更多关于这些命令的文章,请访问这几个 URL:[在 Linux 中创建指定大小的文件的几种方法][1],[在 Linux 中创建一个文件的几种方法][2] 以及 [在 Linux 中删除一个文件中的匹配的字符串][3]。 这些属于高级命令,它们可用在大多数 shell 脚本中执行所需的操作。 下列 5 种方法可以做到。 -* **`sed:`** 过滤和替换文本的流编辑器。 -* **`grep:`** 输出匹配到的行。 -* **`cat:`** 合并文件并打印内容到标准输出。 -* **`tr:`** 替换或删除字符。 -* **`awk:`** awk 工具用于执行 awk 语言编写的程序,专门用于文本处理。 -* **`perl:`** Perl 是一种用于处理文本的编程语言。 +* `sed`:过滤和替换文本的流编辑器。 +* `grep`:输出匹配到的行。 +* `cat`:合并文件并打印内容到标准输出。 +* `tr`:替换或删除字符。 +* `awk`:awk 工具用于执行 awk 语言编写的程序,专门用于文本处理。 +* `perl`:Perl 是一种用于处理文本的编程语言。 我创建了一个 `2daygeek.txt` 文件来测试这些命令。下面是文件的内容。 @@ -50,7 +46,7 @@ Her names are Tanisha & Renusha. ### 使用 sed 命令 -sed 是一个流编辑器stream editor。流编辑器是用来编辑输入流(文件或管道)中的文本的。 +`sed` 是一个流编辑器stream editor。流编辑器是用来编辑输入流(文件或管道)中的文本的。 ``` $ sed '/^$/d' 2daygeek.txt @@ -63,12 +59,12 @@ Her names are Tanisha & Renusha. 以下是命令展开的细节: -* **`sed:`** 该命令本身。 -* **`//:`** 标记匹配范围。 -* **`^:`** 匹配字符串开头。 -* **`$:`** 匹配字符串结尾。 -* **`d:`** 删除匹配的字符串。 -* **`2daygeek.txt:`** 源文件名。 +* `sed`: 该命令本身。 +* `//`: 标记匹配范围。 +* `^`: 匹配字符串开头。 +* `$`: 匹配字符串结尾。 +* `d`: 删除匹配的字符串。 +* `2daygeek.txt`: 源文件名。 ### 使用 grep 命令 @@ -87,21 +83,20 @@ He got two GIRL babes. Her names are Tanisha & Renusha. ``` -Details are follow: 以下是命令展开的细节: -* **`grep:`** 该命令本身。 -* **`.:`** 替换任意字符。 -* **`^:`** 匹配字符串开头。 -* **`$:`** 匹配字符串结尾。 -* **`E:`** 使用扩展正则匹配模式。 -* **`e:`** 使用常规正则匹配模式。 -* **`v:`** 反向匹配。 -* **`2daygeek.txt:`** 源文件名。 +* `grep`: 该命令本身。 +* `.`: 替换任意字符。 +* `^`: 匹配字符串开头。 +* `$`: 匹配字符串结尾。 +* `E`: 使用扩展正则匹配模式。 +* `e`: 使用常规正则匹配模式。 +* `v`: 反向匹配。 +* `2daygeek.txt`: 源文件名。 ### 使用 awk 命令 -`awk` 可以执行使用 awk 语言写的脚本,大多是专用于处理文本的。awk 脚本是一系列 awk 命令和正则的组合。 +`awk` 可以执行使用 awk 语言写的脚本,大多是专用于处理文本的。awk 脚本是一系列 `awk` 命令和正则的组合。 ``` $ awk NF 2daygeek.txt @@ -118,21 +113,21 @@ Her names are Tanisha & Renusha. 以下是命令展开的细节: -* **`awk:`** 该命令本身。 -* **`//:`** 标记匹配范围。 -* **`^:`** 匹配字符串开头。 -* **`$:`** 匹配字符串结尾。 -* **`.:`** 匹配任意字符。 -* **`!:`** 删除匹配的字符串。 -* **`2daygeek.txt:`** 源文件名。 +* `awk`: 该命令本身。 +* `//`: 标记匹配范围。 +* `^`: 匹配字符串开头。 +* `$`: 匹配字符串结尾。 +* `.`: 匹配任意字符。 +* `!`: 删除匹配的字符串。 +* `2daygeek.txt`: 源文件名。 ### 使用 cat 和 tr 命令 组合 `cat` 是串联(拼接)concatenate的简写。经常用于在 Linux 中读取一个文件的内容。 -cat 是在类 Unix 系统中使用频率最高的命令之一。它提供了常用的三个处理文本文件的功能:显示文件内容,将多个文件拼接成一个,以及创建一个新文件。 +`cat` 是在类 Unix 系统中使用频率最高的命令之一。它提供了常用的三个处理文本文件的功能:显示文件内容、将多个文件拼接成一个,以及创建一个新文件。 -tr 可以将标准输入中的字符转换,压缩或删除,然后重定向到标准输出。 +`tr` 可以将标准输入中的字符转换,压缩或删除,然后重定向到标准输出。 ``` $ cat 2daygeek.txt | tr -s '\n' @@ -145,12 +140,12 @@ Her names are Tanisha & Renusha. 以下是命令展开的细节: -* **`cat:`** cat 命令本身。 -* **`tr:`** tr 命令本身。 -* **`|:`** 管道符号。它可以将前面的命令的标准输出作为下一个命令的标准输入。 -* **`s:`** 替换标数据集中任意多个重复字符为一个。 -* **`\n:`** 添加一个新的换行。 -* **`2daygeek.txt:`** 源文件名。 +* `cat`: cat 命令本身。 +* `tr`: tr 命令本身。 +* `|`: 管道符号。它可以将前面的命令的标准输出作为下一个命令的标准输入。 +* `s`: 替换标数据集中任意多个重复字符为一个。 +* `\n`: 添加一个新的换行。 +* `2daygeek.txt`: 源文件名。 ### 使用 perl 命令 @@ -167,14 +162,14 @@ Her names are Tanisha & Renusha. 以下是命令展开的细节: -* **`perl:`** perl 命令。 -* **`n:`** 逐行读入数据。 -* **`e:`** 执行某个命令。 -* **`print:`** 打印信息。 -* **`if:`** if 条件分支。 -* **`//:`** 标记匹配范围。 -* **`\S:`** 匹配任意非空白字符。 -* **`2daygeek.txt:`** 源文件名。 +* `perl`: perl 命令。 +* `n`: 逐行读入数据。 +* `e`: 执行某个命令。 +* `print`: 打印信息。 +* `if`: if 条件分支。 +* `//`: 标记匹配范围。 +* `\S`: 匹配任意非空白字符。 +* `2daygeek.txt`: 源文件名。 -------------------------------------------------------------------------------- @@ -183,7 +178,7 @@ via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[pityonline](https://github.com/pityonline) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 18571d57ad2c0f76ff90c2eb9524251f38a4d42c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 13:38:01 +0800 Subject: [PATCH 647/813] PUB:20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @pityonline https://linux.cn/article-10626-1.html --- ...How To Remove-Delete The Empty Lines In A File In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md (98%) diff --git a/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/published/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md similarity index 98% rename from translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md rename to published/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md index a362c943fc..3f704df730 100644 --- a/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md +++ b/published/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (pityonline) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10626-1.html) [#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) [#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 94d9dcdfb78c0aaed8b87b8fceb6b39d863ede0a Mon Sep 17 00:00:00 2001 From: GraveAccent Date: Sun, 17 Mar 2019 15:58:03 +0800 Subject: [PATCH 648/813] translated tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md --- ...220 JSON vs XML vs TOML vs CSON vs YAML.md | 212 ------------------ ...220 JSON vs XML vs TOML vs CSON vs YAML.md | 212 ++++++++++++++++++ 2 files changed, 212 insertions(+), 212 deletions(-) delete mode 100644 sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md create mode 100644 translated/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md diff --git a/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md b/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md deleted file mode 100644 index bb723b75e6..0000000000 --- a/sources/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md +++ /dev/null @@ -1,212 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (GraveAccent) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (JSON vs XML vs TOML vs CSON vs YAML) -[#]: via: (https://www.zionandzion.com/json-vs-xml-vs-toml-vs-cson-vs-yaml/) -[#]: author: (Tim Anderson https://www.zionandzion.com) - -JSON vs XML vs TOML vs CSON vs YAML -====== - - -### A Super Serious Segment About Sets, Subsets, and Supersets of Sample Serialization - -I’m a developer. I read code. I write code. I write code that writes code. I write code that writes code for other code to read. It’s all very mumbo-jumbo, but beautiful in its own way. However, that last bit, writing code that writes code for other code to read, can get more convoluted than this paragraph—quickly. There are a lot of ways to do it. One not-so-convoluted way and a favorite among the developer community is through data serialization. For those who aren’t savvy on the super buzzword I just threw at you, data serialization is the process of taking some information from one system, churning it into a format that other systems can read, and then passing it along to those other systems. - -While there are enough [data serialization formats][1] out there to bury the Burj Khalifa, they all mostly fall into two categories: - - * simplicity for humans to read and write, - * and simplicity for machines to read and write. - - - -It’s difficult to have both as we humans enjoy loosely typed, flexible formatting standards that allow us to be more expressive, whereas machines tend to enjoy being told exactly what everything is without doubt or lack of detail, and consider “strict specifications” to be their favorite flavor of Ben & Jerry’s. - -Since I’m a web developer and we’re an agency who creates websites, we’ll stick to those special formats that web systems can understand, or be made to understand without much effort, and that are particularly useful for human readability: XML, JSON, TOML, CSON, and YAML. Each has benefits, cons, and appropriate use cases. - -### Facts First - -Back in the early days of the interwebs, [some really smart fellows][2] decided to put together a standard language which every system could read and creatively named it Standard Generalized Markup Language, or SGML for short. SGML was incredibly flexible and well defined by its publishers. It became the father of languages such as XML, SVG, and HTML. All three fall under the SGML specification, but are subsets with stricter rules and shorter flexibility. - -Eventually, people started seeing a great deal of benefit in having very small, concise, easy to read, and easy to generate data that could be shared programmatically between systems with very little overhead. Around that time, JSON was born and was able to fulfil all requirements. In turn, other languages began popping up to deal with more specialized cases such as CSON, TOML, and YAML. - -### XML: Ixnayed - -Originally, the XML language was amazingly flexible and easy to write, but its drawback was that it was verbose, difficult for humans to read, really difficult for computers to read, and had a lot of syntax that wasn’t entirely necessary to communicate information. - -Today, it’s all but dead for data serialization purposes on the web. Unless you’re writing HTML or SVG, both siblings to XML, you probably aren’t going to see XML in too many other places. Some outdated systems still use it today, but using it to pass data around tends to be overkill for the web. - -I can already hear the XML greybeards beginning to scribble upon their stone tablets as to why XML is ah-may-zing, so I’ll provide a small addendum: XML can be easy to read and write by systems and people. However, it is really, and I mean ridiculously, hard to create a system that can read it to specification. Here’s a simple, beautiful example of XML: - -``` - -Gambardella, Matthew -XML Developer's Guide -Computer -44.95 -2000-10-01 -An in-depth look at creating applications -with XML. - -``` - -Wonderful. Easy to read, reason about, write, and code a system that can read and write. But consider this example: - -``` -b"> ]> - - -b b - d - -``` - -The above is 100% valid XML. Impossible to read, understand, or reason about. Writing code that can consume and understand this would cost at least 36 heads of hair and 248 pounds of coffee grounds. We don’t have that kind of time nor coffee, and most of us greybeards are balding nowadays. So let’s let it live only in our memory alongside [css hacks][3], [internet explorer 6][4], and [vacuum tubes][5]. - -### JSON: Juxtaposition Jamboree - -Okay, we’re all in agreement. XML = bad. So, what’s a good alternative? JavaScript Object Notation, or JSON for short. JSON (read like the name Jason) was invented by Brendan Eich, and made popular by the great and powerful Douglas Crockford, the [Dutch Uncle of JavaScript][6]. It’s used just about everywhere nowadays. The format is easy to write by both human and machine, fairly easy to [parse][7] with strict rules in the specification, and flexible—allowing deep nesting of data, all of the primitive data types, and interpretation of collections as either arrays or objects. JSON became the de facto standard for transferring data from one system to another. Nearly every language out there has built-in functionality for reading and writing it. - -JSON syntax is straightforward. Square brackets denote arrays, curly braces denote records, and two values separated by semicolons denote properties (or ‘keys’) on the left, and values on the right. All keys must be wrapped in double quotes: - -``` -{ -"books": [ -{ -"id": "bk102", -"author": "Crockford, Douglas", -"title": "JavaScript: The Good Parts", -"genre": "Computer", -"price": 29.99, -"publish_date": "2008-05-01", -"description": "Unearthing the Excellence in JavaScript" -} -] -} -``` - -This should make complete sense to you. It’s nice and concise, and has stripped much of the extra nonsense from XML to convey the same amount of information. JSON is king right now, and the rest of this article will go into other language formats that are nothing more than JSON boiled down in an attempt to be either more concise or more readable by humans, but follow very similar structure. - -### TOML: Truncated to Total Altruism - -TOML (Tom’s Obvious, Minimal Language) allows for defining deeply-nested data structures rather quickly and succinctly. The name-in-the-name refers to the inventor, [Tom Preston-Werner][8], an inventor and software developer who’s active in our industry. The syntax is a bit awkward when compared to JSON, and is more akin to an [ini file][9]. It’s not a bad syntax, but could take some getting used to: - -``` -[[books]] -id = 'bk101' -author = 'Crockford, Douglas' -title = 'JavaScript: The Good Parts' -genre = 'Computer' -price = 29.99 -publish_date = 2008-05-01T00:00:00+00:00 -description = 'Unearthing the Excellence in JavaScript' -``` - -A couple great features have been integrated into TOML, such as multiline strings, auto-escaping of reserved characters, datatypes such as dates, time, integers, floats, scientific notation, and “table expansion”. That last bit is special, and is what makes TOML so concise: - -``` -[a.b.c] -d = 'Hello' -e = 'World' -``` - -The above expands to the following: - -``` -{ -"a": { -"b": { -"c": { -"d": "Hello" -"e": "World" -} -} -} -} -``` - -You can definitely see how much you can save in both time and file length using TOML. There are few systems which use it or something very similar for configuration, and that is its biggest con. There simply aren’t very many languages or libraries out there written to interpret TOML. - -### CSON: Simple Samples Enslaved by Specific Systems - -First off, there are two CSON specifications. One stands for CoffeeScript Object Notation, the other stands for Cursive Script Object Notation. The latter isn’t used too often, so we won’t be getting into it. Let’s just focus on the CoffeeScript one. - -[CSON][10] will take a bit of intro. First, let’s talk about CoffeeScript. [CoffeeScript][11] is a language that runs through a compiler to generate JavaScript. It allows you to write JavaScript in a more syntactically concise way, and have it [transcompiled][12] into actual JavaScript, which you would then use in your web application. CoffeeScript makes writing JavaScript easier by removing a lot of the extra syntax necessary in JavaScript. A big one that CoffeeScript gets rid of is curly braces—no need for them. In that same token, CSON is JSON without the curly braces. It instead relies on indentation to determine hierarchy of your data. CSON is very easy to read and write and usually requires fewer lines of code than JSON because there are no brackets. - -CSON also offers up some extra niceties that JSON doesn’t have to offer. Multiline strings are incredibly easy to write, you can enter [comments][13] by starting a line with a hash, and there’s no need for separating key-value pairs with commas. - -``` -books: [ -id: 'bk102' -author: 'Crockford, Douglas' -title: 'JavaScript: The Good Parts' -genre: 'Computer' -price: 29.99 -publish_date: '2008-05-01' -description: 'Unearthing the Excellence in JavaScript' -] -``` - -Here’s the big issue with CSON. It’s **CoffeeScript** Object Notation. Meaning CoffeeScript is what you use to parse/tokenize/lex/transcompile or otherwise use CSON. CoffeeScript is the system that reads the data. If the intent of data serialization is to allow data to be passed from one system to another, and here we have a data serialization format that’s only read by a single system, well that makes it about as useful as a fireproof match, or a waterproof sponge, or that annoyingly flimsy fork part of a spork. - -If this format is adopted by other systems, it could be pretty useful in the developer world. Thus far that hasn’t happened in a comprehensive manner, so using it in alternative languages such as PHP or JAVA are a no-go. - -### YAML: Yielding Yips from Youngsters - -Developers rejoice, as YAML comes into the scene from [one of the contributors to Python][14]. YAML has the same feature set and similar syntax as CSON, a boatload of new features, and parsers available in just about every web programming language there is. It also has some extra features, like circular referencing, soft-wraps, multi-line keys, typecasting tags, binary data, object merging, and [set maps][15]. It has incredibly good human readability and writability, and is a superset of JSON, so you can use fully qualified JSON syntax inside YAML and all will work well. You almost never need quotes, and it can interpret most of your base data types (strings, integers, floats, booleans, etc.). - -``` -books: -- id: bk102 -author: Crockford, Douglas -title: 'JavaScript: The Good Parts' -genre: Computer -price: 29.99 -publish_date: !!str 2008-05-01 -description: Unearthing the Excellence in JavaScript -``` - -The younglings of the industry are rapidly adopting YAML as their preferred data serialization and system configuration format. They are smart to do so. YAML has all the benefits of being as terse as CSON, and all the features of datatype interpretation as JSON. YAML is as easy to read as Canadians are to hang out with. - -There are two issues with YAML that stick out to me, and the first is a big one. At the time of this writing, YAML parsers haven’t yet been built into very many languages, so you’ll need to use a third-party library or extension for your chosen language to parse .yaml files. This wouldn’t be a big deal, however it seems most developers who’ve created parsers for YAML have chosen to throw “additional features” into their parsers at random. Some allow [tokenization][16], some allow [chain referencing][17], some even allow inline calculations. This is all well and good (sort of), except that none of these features are part of the specification, and so are difficult to find amongst other parsers in other languages. This results in system-locking; you end up with the same issue that CSON is subject to. If you use a feature found in only one parser, other parsers won’t be able to interpret the input. Most of these features are nonsense that don’t belong in a dataset, but rather in your application logic, so it’s best to simply ignore them and write your YAML to specification. - -The second issue is there are few parsers that yet completely implement the specification. All the basics are there, but it can be difficult to find some of the more complex and newer things like soft-wraps, document markers, and circular references in your preferred language. I have yet to see an absolute need for these things, so hopefully they shouldn’t slow you down too much. With the above considered, I tend to keep to the more matured feature set presented in the [1.1 specification][18], and avoid the newer stuff found in the [1.2 specification][19]. However, programming is an ever-evolving monster, so by the time you finish reading this article, you’re likely to be able to use the 1.2 spec. - -### Final Philosophy - -The final word here is that each serialization language should be treated with a case-by-case reverence. Some are the bee’s knees when it comes to machine readability, some are the cat’s meow for human readability, and some are simply gilded turds. Here’s the ultimate breakdown: If you are writing code for other code to read, use YAML. If you are writing code that writes code for other code to read, use JSON. Finally, if you are writing code that transcompiles code into code that other code will read, rethink your life choices. - --------------------------------------------------------------------------------- - -via: https://www.zionandzion.com/json-vs-xml-vs-toml-vs-cson-vs-yaml/ - -作者:[Tim Anderson][a] -选题:[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.zionandzion.com -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Comparison_of_data_serialization_formats -[2]: https://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language#History -[3]: https://www.quirksmode.org/css/csshacks.html -[4]: http://www.ie6death.com/ -[5]: https://en.wikipedia.org/wiki/Vacuum_tube -[6]: https://twitter.com/BrendanEich/status/773403975865470976 -[7]: https://en.wikipedia.org/wiki/Parsing#Parser -[8]: https://en.wikipedia.org/wiki/Tom_Preston-Werner -[9]: https://en.wikipedia.org/wiki/INI_file -[10]: https://github.com/bevry/cson#what-is-cson -[11]: http://coffeescript.org/ -[12]: https://en.wikipedia.org/wiki/Source-to-source_compiler -[13]: https://en.wikipedia.org/wiki/Comment_(computer_programming) -[14]: http://clarkevans.com/ -[15]: http://exploringjs.com/es6/ch_maps-sets.html -[16]: https://www.tutorialspoint.com/compiler_design/compiler_design_lexical_analysis.htm -[17]: https://en.wikipedia.org/wiki/Fluent_interface -[18]: http://yaml.org/spec/1.1/current.html -[19]: http://www.yaml.org/spec/1.2/spec.html diff --git a/translated/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md b/translated/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md new file mode 100644 index 0000000000..eb6e10eddb --- /dev/null +++ b/translated/tech/20180220 JSON vs XML vs TOML vs CSON vs YAML.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: (GraveAccent) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (JSON vs XML vs TOML vs CSON vs YAML) +[#]: via: (https://www.zionandzion.com/json-vs-xml-vs-toml-vs-cson-vs-yaml/) +[#]: author: (Tim Anderson https://www.zionandzion.com) + +JSON vs XML vs TOML vs CSON vs YAML +====== + + +### 一段超级严肃的关于样本序列化的集合、子集和超集的文字 + +我是开发者。我读代码。我写代码。我写会写代码的代码。我写会写供其它代码读的代码的代码。这些都非常火星语,但是有其美妙之处。然而,最后一点,写会写供其它代码读的代码的代码,可以很快变得比这段文字更费解。有很多方法可以做到这一点。一种不那么复杂而且开发者社区最爱的方式是数据序列化。对于那些不了解我刚刚向你抛的时髦词的人,数据序列化是从一个系统获取一些信息,将其转换为其它系统可以读取的格式,然后将其传递给其它系统的过程。 + +虽然[数据序列化格式][1]多到可以埋葬哈利法塔,但它们大多分为两类: + + * 易于人类读写, + * 易于机器读写。 + + + +很难两全其美,因为人类喜欢让我们更具表现力的松散类型和灵活格式标准,而机器倾向于被确切告知一切事情不带疑惑和细节缺失,并且认为“严格规范”是他们最爱的 Ben & Jerry's 口味。 + +由于我是一名 web 开发者而且我们是一个创建网站的代理商,我们将坚持使用 web 系统可以理解或不需要太多努力就能理解以及对人类可读性特别有用的特殊格式:XML,JSON,TOML,CSON以及 YAML。每个都有各自的优缺点和适当的用例。 + +### 事实最先 + +回到互联网的早期,[一些非常聪明的家伙][2]决定整合一种标准语言,即每个系统都能理解,创造性地将其命名为标准通用标记语言(简称SGML)。SGML 非常灵活,发布者也很好地定义了它。他成为了 XML,SVG 和 HTML 等语言之父。所有这三个都符合 SGML 规范,可是它们都是规则更严格、灵活性更少的子集。 + +最终,人们开始看到大量非常小、简洁、易读且易于生成的数据,这些数据可以在系统之间以程序的方式共享,而开销很小。大约在那个时候,JSON 诞生了并且能够满足所有的需求。反过来,其它语言开始出现以处理更多的专业用例,如 CSON,TOML 和 YAML。 + +### XML: 不行了 + +最初,XML语言非常灵活且易于编写,但它的缺点是冗长,人类难以阅读,计算机非常难以读取,并且有很多语法对于传达信息并不是完全必要的。 + +今天,它在 web 上的数据序列化目的已经消失了。除非你在编写 HTML 或者 SVG,否则你不太能在许多其它地方看到XML。一些过时的系统今天仍在使用它,但是用它传递数据往往太重了。 + +我已经可以听到 XML 老人开始在他们的石碑上乱写为什么 XML 是了不起的,所以我将提供一个小的附录:XML可以很容易地由系统和人读写。然而,真的,我的意思是荒谬,很难创建一个可以将其读入规范的系统。这是一个简单美观的 XML 示例: + +``` + +Gambardella, Matthew +XML Developer's Guide +Computer +44.95 +2000-10-01 +An in-depth look at creating applications +with XML. + +``` + +太棒了。易于阅读,推理,编写和编码的可以读写的系统。但请考虑这个例子: + +``` +b"> ]> + + +b b + d + +``` + +这上面是 100% 有效的 XML。不可能阅读、理解或推理。编写可以使用和理解这个的代码将花费至少36头的头发和248磅咖啡。我们没有那么多时间或咖啡,而且我们大多数老人现在都是秃头。所以,让它活在我们的记忆里,就像 [css hacks][3],[internet explorer][4] 和[真空管][5]那样。 + +### JSON: 并列聚会 + +好吧,我们都同意了。XML = 差劲。那么,什么是好的替代品?JavaScript 对象表示法,简称 JSON。JSON(读起来像 Jason 这个名字) 是 Brendan Eich 发明的,并且被 [JavaScript 的荷兰叔叔][6] Douglas Crockford 推广。它现在几乎用在任何地方。这种格式很容易由人和机器编写,相当容易用规范中的严格规则[解析][7],并且灵活-允许深层嵌套数据,所有原始数据类型和集合如数组和对象的解释。JSON 成为了将数据从一个系统传输到另一个系统的事实标准。几乎所有语言都有内置读写它的功能。 + +JSON语法很简单。 方括号表示数组,花括号表示记录,由冒号分隔两个值表示属性(或“键”)在左边,值在右边。所有键必须用双引号括起来: + +``` +{ +"books": [ +{ +"id": "bk102", +"author": "Crockford, Douglas", +"title": "JavaScript: The Good Parts", +"genre": "Computer", +"price": 29.99, +"publish_date": "2008-05-01", +"description": "Unearthing the Excellence in JavaScript" +} +] +} +``` + +这对你来说应该是完全合理的。它简洁明了,并且从 XML 中删除了大量额外废话以传达相同数量的信息。JSON 现在是王道,本文剩下的部分会介绍其它语言格式,这些格式只不过是煮沸了的 JSON,尝试让其更简洁或更易读,可结构还是非常相似的。 + +### TOML: 缩短到彻底的利他主义 + + TOML(Tom 的显而易见最低限度语言)允许快速简洁地定义深层嵌套的数据结构。名字中的名字是指发明者 [Tom Preston Werner][8],他是一位活跃于我们行业的创造者和软件开发人员。与 JSON 相比,语法有点尴尬,更类似 [ini 文件][9]。这不是一个糟糕的语法,但是需要一些时间适应。 + +``` +[[books]] +id = 'bk101' +author = 'Crockford, Douglas' +title = 'JavaScript: The Good Parts' +genre = 'Computer' +price = 29.99 +publish_date = 2008-05-01T00:00:00+00:00 +description = 'Unearthing the Excellence in JavaScript' +``` + +TOML 中集成了一些很棒的功能,例如多行字符串,保留字符的自动转义,日期,时间,整数,浮点数,科学记数法和“表扩展”等数据类型。最后一点是特别的,是TOML如此简洁的原因: + +``` +[a.b.c] +d = 'Hello' +e = 'World' +``` + +以上扩展到以下内容: + +``` +{ +"a": { +"b": { +"c": { +"d": "Hello" +"e": "World" +} +} +} +} +``` + +使用TOML,你可以肯定在时间和文件长度上会节省不少。很少有系统使用它或非常类似的东西作为配置,这是它最大的缺点。根本没有很多语言或库可以用来解释 TOML。 + +### CSON: 特定系统所包含的简单样本 + +首先,有两个 CSON 规范。 一个代表 CoffeeScript Object Notation,另一个代表 Cursive Script Object Notation。后者不经常使用,所以我们不会关注它。我们只关注 CoffeeScript。 + +[CSON][10] 会介绍一点。首先,我们来谈谈 CoffeeScript。[CoffeeScript][11] 是一种通过运行编译器生成 JavaScript 的语言。它允许你以更加简洁的语法编写 JavaScript 并[转译][12]成实际的 JavaScript,然后你可以在你的 web 应用程序中使用它。CoffeeScript 通过删除 JavaScript 中必需的许多额外语法,使编写 JavaScript 变得更容易。CoffeeScript 摆脱的一个大问题是花括号 - 不需要他们。同样,CSON 是没有大括号的 JSON。它依赖于缩进来确定数据的层次结构。CSON 非常易于读写,并且通常比 JSON 需要更少的代码行,因为没有括号。 + +CSON 还提供一些 JSON 不提供的额外细节。多行字符串非常容易编写,你可以通过使用 hash 符号开始一行来输入[注释][13],并且不需要用逗号分隔键值对。 + +``` +books: [ +id: 'bk102' +author: 'Crockford, Douglas' +title: 'JavaScript: The Good Parts' +genre: 'Computer' +price: 29.99 +publish_date: '2008-05-01' +description: 'Unearthing the Excellence in JavaScript' +] +``` + +这是 CSON 的重大问题。它是 **CoffeScript** 对象表示法。也就是说你用 CoffeeScript 解析/标记化/lex/转译或其它方式使用 CSON。CoffeeScript 是读取数据的系统。如果数据序列化的目的是允许数据从一个系统传递到另一个系统,这里我们有一个只能由单个系统读取的数据序列化格式,这使得它与防火的火柴、防水的海绵或者叉勺恼人的脆弱分叉处一样有用。 + +如果其它系统采用这种格式,它在开发者世界中可能非常有用。到目前为止这整体上没有发生,所以在 PHP 或 JAVA 等替代语言中使用它是不行的。 + +### YAML:年轻人的呼喊 + +开发人员感到高兴,因为 YAML 来自[一个 Python 的贡献者][14]。YAML 具有与 CSON 相同的功能集和类似的语法,一系列新功能,以及几乎所有 web 编程语言都可用的解析器。它还有一些额外的功能,如循环引用,软包装,多行键,类型转换标签,二进制数据,对象合并和[集合映射][15]。它具有令人难以置信的良好的可读性和可写性,并且是 JSON 的超集,因此你可以在 YAML 中使用完全合格的 JSON 语法并且一切正常工作。你几乎从不需要引号,它可以解释大多数基本数据类型(字符串,整数,浮点数,布尔值等)。 + +``` +books: +- id: bk102 +author: Crockford, Douglas +title: 'JavaScript: The Good Parts' +genre: Computer +price: 29.99 +publish_date: !!str 2008-05-01 +description: Unearthing the Excellence in JavaScript +``` + +业界的年轻人正在迅速采用 YAML 作为他们首选的数据序列化和系统配置格式。他们这样做很机智。YAML 有像 CSON 一样简洁带来的所有好处,有 JSON 在数据类型解释方面的所有功能。YAML 像加拿大人容易相处一样容易阅读。 + +YAML 有两个问题,对我而言,第一个是大问题。在撰写本文时,YAML 解析器尚未内置于多种语言,因此你需要使用第三方库或扩展来为你选择的语言解析 .yaml 文件。这不是什么大问题,可似乎大多数为 YAML 创建解析器的开发人员都选择随机将“附加功能”放入解析器中。有些允许[标记化][16],有些允许[链引用][17],有些甚至允许内联计算。这一切都很好(某种意义上),除了这些功能都不是规范的一部分,因此很难在其他语言的其他解析器中找到。这导致系统锁定,你最终遇到了与 CSON 相同的问题。如果你使用仅在一个解析器中找到的功能,则其他解析器将无法解释输入。大多数这些功能都是无意义的,不属于数据集,而是属于你的应用程序逻辑,因此最好简单地忽略它们和编写符合规范的 YAML。 + +第二个问题是很少有解析器完全实现规范。所有的基本要素都在那里,但是很难找到一些更复杂和更新的东西,比如软包装,文档标记和首选语言的循环引用。我还没有看到对这些东西的刚需,所以希望它们不让你很失望。考虑到上述情况,我倾向于保持 [1.1 规范][18] 中呈现的更成熟的功能集,避免在 [1.2 规范][19] 中找到的新东西。然而,编程是一个不断发展的怪兽,所以当你读完这篇文章时,你或许可以使用 1.2 规范。 + +### 最终哲学 + +这是最后一段话。每个序列化语言都应该以其用例的标准评价。当涉及机器的可读性时,有些是蜜蜂的膝盖。对于人类可读性,有些是猫的喵喵声,有些只是镀金的粪便。以下是最终细分:如果你要编写供其他代码阅读的代码,请使用 YAML。如果你正在编写能写供其他代码读取的代码的代码,请使用 JSON。最后,如果你正在编写将代码转译为供其他代码读取的代码的代码,请重新考虑你的人生选择。 + +-------------------------------------------------------------------------------- + +via: https://www.zionandzion.com/json-vs-xml-vs-toml-vs-cson-vs-yaml/ + +作者:[Tim Anderson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/GraveAccent) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.zionandzion.com +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Comparison_of_data_serialization_formats +[2]: https://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language#History +[3]: https://www.quirksmode.org/css/csshacks.html +[4]: http://www.ie6death.com/ +[5]: https://en.wikipedia.org/wiki/Vacuum_tube +[6]: https://twitter.com/BrendanEich/status/773403975865470976 +[7]: https://en.wikipedia.org/wiki/Parsing#Parser +[8]: https://en.wikipedia.org/wiki/Tom_Preston-Werner +[9]: https://en.wikipedia.org/wiki/INI_file +[10]: https://github.com/bevry/cson#what-is-cson +[11]: http://coffeescript.org/ +[12]: https://en.wikipedia.org/wiki/Source-to-source_compiler +[13]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[14]: http://clarkevans.com/ +[15]: http://exploringjs.com/es6/ch_maps-sets.html +[16]: https://www.tutorialspoint.com/compiler_design/compiler_design_lexical_analysis.htm +[17]: https://en.wikipedia.org/wiki/Fluent_interface +[18]: http://yaml.org/spec/1.1/current.html +[19]: http://www.yaml.org/spec/1.2/spec.html \ No newline at end of file From afd8d01018ce6279fee6cb824925cd377619b2bc Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 17 Mar 2019 15:47:34 +0800 Subject: [PATCH 649/813] =?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 --- ...work Protocol Error- On Mozilla Firefox.md | 67 ------------------- ...work Protocol Error- On Mozilla Firefox.md | 66 ++++++++++++++++++ 2 files changed, 66 insertions(+), 67 deletions(-) delete mode 100644 sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md create mode 100644 translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md diff --git a/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md deleted file mode 100644 index 17df6db81a..0000000000 --- a/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md +++ /dev/null @@ -1,67 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Fix “Network Protocol Error” On Mozilla Firefox) -[#]: via: (https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Fix “Network Protocol Error” On Mozilla Firefox -====== -![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-logo-1-720x340.png) - -Mozilla Firefox is my default web browser for years. I have been using it for my day to day web activities, such as accessing my mails, browsing favorite websites etc. Today, I experienced a strange error while using Firefox. I tried to share one of our guide on Reddit platform and got the following error message. - -``` -Network Protocol Error - -Firefox has experienced a network protocol violation that cannot be repaired. - -The page you are trying to view cannot be shown because an error in the network protocol was detected. - -Please contact the website owners to inform them of this problem. -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox.png) - -To be honest, I panicked a bit and thought my system might be affected with some kind of malware. LOL! I was wrong! I am using latest Firefox version on my Arch Linux desktop. I opened the same link in Chromium browser. It’s working fine! I guessed it is Firefox related error. After Googling a bit, I fixed this issue as described below. - -This kind of problems occurs mostly because of the **browser’s cache**. If you’ve encountered these kind of errors, such as “Network Protocol Error” or “Corrupted Content Error”, follow any one of these methods. - -**Method 1:** - -To fix “Network Protocol Error” or “Corrupted Content Error”, you need to reload the webpage while bypassing the cache. To do so, Press **Ctrl + F5** or **Ctrl + Shift + R** keys. It will reload the webpage fresh from the server, not from the Firefox cache. Now the web page should work just fine. - -**Method 2:** - -If the method1 doesn’t work, please try this method. - -Go to **Edit - > Preferences**. From the Preferences window, navigate to **Privacy & Security** tab on the left pane. Now clear the Firefox cache by clicking on **“Clear Data”** option. -![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-1.png) - -Make sure you have checked both “Cookies and Site Data” and “Cached Web Content” options and click **“Clear”**. - -![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-2.png) - -Done! Now the cookies and offline content will be removed. Please note that Firefox may sign you out of the logged-in websites. You can re-login to those websites later. Finally, close the Firefox browser and restart your system. Now the webpage will load without any issues. - -Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/ - -作者:[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 diff --git a/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md new file mode 100644 index 0000000000..f60e0969e3 --- /dev/null +++ b/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Fix “Network Protocol Error” On Mozilla Firefox) +[#]: via: (https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何修复 Mozilla Firefox 中出现的 “Network Protocol Error” +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-logo-1-720x340.png) + +Mozilla Firefox 多年来一直是我的默认 Web 浏览器,我每天用它来进行日常网络活动,例如访问邮件,浏览喜欢的网站等。今天,我在使用 Firefox 时遇到了一个奇怪的错误。我试图在 Reddit 平台上分享我们的一个指南时,在 Firefox 上出现了以下错误消息: + +``` +Network Protocol Error + +Firefox has experienced a network protocol violation that cannot be repaired. + +The page you are trying to view cannot be shown because an error in the network protocol was detected. + +Please contact the website owners to inform them of this problem. +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox.png) + +老实说,我有点慌,我以为可能是我的系统受到了某种恶意软件的影响。哈哈!但是我发现我错了。我在 Arch Linux 桌面上使用的是最新的 Firefox 版本,我在 Chromium 浏览器中打开了相同的链接,它正确显示了,我猜这是 Firefox 相关的错误。在谷歌上搜索后,我解决了这个问题,如下所述。 + +出现这种问题主要是因为“**浏览器缓存**”,如果你遇到此类错误,例如 "Network Protocol Error" 或 "Corrupted Content Error",遵循以下任何一种方法。 + +**方法 1:** + +要修复 "Network Protocol Error" 或 "Corrupted Content Error",你需要在绕过缓存时重新加载网页。为此,按下 **Ctrl + F5** 或 **Ctrl + Shift + R** 快捷键,它将从服务器重新加载页面,而不是从 Firefox 缓存加载。这样网页就应该可以正常工作了。 + +**方法 2:** + +如果方法 1 不起作用,尝试以下方法。 + +打开 **Edit - > Preferences**,在 "Preferences" 窗口中,打开左窗格中的 **Privacy & Security** 选项卡,单击 **“Clear Data”** 选项清除 Firefox 缓存。 + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-1.png) + +确保你选中了 Cookies and Site Data” 和 "Cached Web Content" 选项,然后单击 **"Clear"**。 + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-2.png) + +完成!现在 Cookie 和离线内容将被删除。注意,Firefox 可能会将你从登录的网站中注销,稍后你可以重新登录这些网站。最后,关闭 Firefox 浏览器并重新启动系统。现在网页加载没有任何问题。 + +希望这对你有帮助。更多好东西要来了,敬请关注! + +干杯! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/ + +作者:[SK][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://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 From 5f9b263f253cd0067f3b6589f083824b566843b5 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Sun, 17 Mar 2019 17:43:24 +0800 Subject: [PATCH 650/813] Update 20190227 How To Find Available Network Interfaces On Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 准备翻译这篇文章。 --- ...0190227 How To Find Available Network Interfaces On Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md index e71aa15459..8bf09bdefa 100644 --- a/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md +++ b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (FSSlc) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6fac4fbb0ba8406cf01df0356d0755fe2e91b72a Mon Sep 17 00:00:00 2001 From: sanfusu <34563541+sanfusu@users.noreply.github.com> Date: Sun, 17 Mar 2019 18:02:07 +0800 Subject: [PATCH 651/813] Update 20180206 Power(Shell) to the people.md --- sources/tech/20180206 Power(Shell) to the people.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180206 Power(Shell) to the people.md b/sources/tech/20180206 Power(Shell) to the people.md index 941dceffe5..295443877f 100644 --- a/sources/tech/20180206 Power(Shell) to the people.md +++ b/sources/tech/20180206 Power(Shell) to the people.md @@ -1,3 +1,4 @@ +sanfusu is translating Power(Shell) to the people ====== From a85e584f47aae9b5639b39aa3a3a9ae4ad747e9c Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 17 Mar 2019 18:10:07 +0800 Subject: [PATCH 652/813] Translating by MjSeven --- ...190220 Set up two-factor authentication for SSH on Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md index 7410262f3f..b54361dfd4 100644 --- a/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md +++ b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e06100e0f81a0f5e96d80678c26b3b66e4124eb6 Mon Sep 17 00:00:00 2001 From: sanfusu <34563541+sanfusu@users.noreply.github.com> Date: Sun, 17 Mar 2019 21:17:41 +0800 Subject: [PATCH 653/813] translation finished --- .../20180206 Power(Shell) to the people.md | 157 ----------------- .../20180206 Power(Shell) to the people.md | 164 ++++++++++++++++++ 2 files changed, 164 insertions(+), 157 deletions(-) delete mode 100644 sources/tech/20180206 Power(Shell) to the people.md create mode 100644 translated/tech/20180206 Power(Shell) to the people.md diff --git a/sources/tech/20180206 Power(Shell) to the people.md b/sources/tech/20180206 Power(Shell) to the people.md deleted file mode 100644 index 295443877f..0000000000 --- a/sources/tech/20180206 Power(Shell) to the people.md +++ /dev/null @@ -1,157 +0,0 @@ -sanfusu is translating -Power(Shell) to the people -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_lightbulbs.png?itok=pwp22hTw) - -Earlier this year, [PowerShell Core][1] [became generally available][2] under an Open Source ([MIT][3]) license. PowerShell is hardly a new technology. From its first release for Windows in 2006, PowerShell's creators [sought][4] to incorporate the power and flexibility of Unix shells while remedying their perceived deficiencies, particularly the need for text manipulation to derive value from combining commands. - -Five major releases later, PowerShell Core allows the same innovative shell and command environment to run natively on all major operating systems, including OS X and Linux. Some (read: almost everyone) may still scoff at the audacity and/or the temerity of this Windows-born interloper to offer itself to platforms that have had strong shell environments since time immemorial (at least as defined by a millennial). In this post, I hope to make the case that PowerShell can provide advantages to even seasoned users. - -### Consistency across platforms - -If you plan to port your scripts from one execution environment to another, you need to make sure you use only the commands and syntaxes that work. For example, on GNU systems, you would obtain yesterday's date as follows: -``` -date --date="1 day ago" - -``` - -On BSD systems (such as OS X), the above syntax wouldn't work, as the BSD date utility requires the following syntax: -``` -date -v -1d - -``` - -Because PowerShell is licensed under a permissive license and built for all platforms, you can ship it with your application. Thus, when your scripts run in the target environment, they'll be running on the same shell using the same command implementations as the environment in which you tested your scripts. - -### Objects and structured data - -*nix commands and utilities rely on your ability to consume and manipulate unstructured data. Those who have lived for years with `sed` `grep` and `awk` may be unbothered by this statement, but there is a better way. - -Let's redo the yesterday's date example in PowerShell. To get the current date, run the `Get-Date` cmdlet (pronounced "commandlet"): -``` -> Get-Date                         - - - -Sunday, January 21, 2018 8:12:41 PM - -``` - -The output you see isn't really a string of text. Rather, it is a string representation of a .Net Core object. Just like any other object in any other OOP environment, it has a type and most often, methods you can call. - -Let's prove this: -``` -> $(Get-Date).GetType().FullName - -System.DateTime - -``` - -The `$(...)` syntax behaves exactly as you'd expect from POSIX shells—the result of the evaluation of the command in parentheses is substituted for the entire expression. In PowerShell, however, the $ is strictly optional in such expressions. And, most importantly, the result is a .Net object, not text. So we can call the `GetType()` method on that object to get its type object (similar to `Class` object in Java), and the `FullName` [property][5] to get the full name of the type. - -So, how does this object-orientedness make your life easier? - -First, you can pipe any object to the `Get-Member` cmdlet to see all the methods and properties it has to offer. -``` -> (Get-Date) | Get-Member -PS /home/yevster/Documents/ArticlesInProgress> $(Get-Date) | Get-Member         - - -   TypeName: System.DateTime - - -Name                 MemberType     Definition                                 -----                 ----------     ----------                                 -Add                  Method         datetime Add(timespan value)               -AddDays              Method         datetime AddDays(double value)             -AddHours             Method         datetime AddHours(double value)             -AddMilliseconds      Method         datetime AddMilliseconds(double value)     -AddMinutes           Method         datetime AddMinutes(double value)           -AddMonths            Method         datetime AddMonths(int months)             -AddSeconds           Method         datetime AddSeconds(double value)           -AddTicks             Method         datetime AddTicks(long value)               -AddYears             Method         datetime AddYears(int value)               -CompareTo            Method         int CompareTo(System.Object value), int ... -``` - -You can quickly see that the DateTime object has an `AddDays` that you can quickly use to get yesterday's date: -``` -> (Get-Date).AddDays(-1) - - -Saturday, January 20, 2018 8:24:42 PM -``` - -To do something slightly more exciting, let's call Yahoo's weather service (because it doesn't require an API token) and get your local weather. -``` -$city="Boston" -$state="MA" -$url="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22${city}%2C%20${state}%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" -``` - -Now, we could do things the old-fashioned way and just run `curl $url` to get a giant blob of JSON, or... -``` -$weather=(Invoke-RestMethod $url) -``` - -If you look at the type of `$weather` (by running `echo $weather.GetType().FullName`), you will see that it's a `PSCustomObject`. It's a dynamic object that reflects the structure of the JSON. - -And PowerShell will be thrilled to help you navigate through it with its tab completion. Just type `$weather.` (making sure to include the ".") and press Tab. You will see all the root-level JSON keys. Type one, followed by a "`.`", press Tab again, and you'll see its children (if any). - -Thus, you can easily navigate to the data you want: -``` -> echo $weather.query.results.channel.atmosphere.pressure                                                               -1019.0 - - -> echo $weather.query.results.channel.wind.chill                                                                       -41 -``` - -And if you have JSON or CSV lying around (or returned by an outside command) as unstructured data, just pipe it into the `ConvertFrom-Json` or `ConvertFrom-CSV` cmdlet, respectively, and you can have your data in nice clean objects. - -### Computing vs. automation - -We use shells for two purposes. One is for computing, to run individual commands and to manually respond to their output. The other is automation, to write scripts that execute multiple commands and respond to their output programmatically. - -A problem that most of us have learned to overlook is that these two purposes place different and conflicting requirements on the shell. Computing requires the shell to be laconic. The fewer keystrokes a user can get away with, the better. It's unimportant if what the user has typed is barely legible to another human being. Scripts, on the other hand, are code. Readability and maintainability are key. And here, POSIX utilities often fail us. While some commands do offer both laconic and readable syntaxes (e.g. `-f` and `--force`) for some of their parameters, the command names themselves err on the side of brevity, not readability. - -PowerShell includes several mechanisms to eliminate that Faustian tradeoff. - -First, tab completion eliminates typing of argument names. For instance, type `Get-Random -Mi`, press Tab and PowerShell will complete the argument for you: `Get-Random -Minimum`. But if you really want to be laconic, you don't even need to press Tab. For instance, PowerShell will understand -``` -Get-Random -Mi 1 -Ma 10 -``` - -because `Mi` and `Ma` each have unique completions. - -You may have noticed that all PowerShell cmdlet names have a verb-noun structure. This can help script readability, but you probably don't want to keep typing `Get-` over and over in the command line. So don't! If you type a noun without a verb, PowerShell will look for a `Get-` command with that noun. - -Caution: although PowerShell is not case-sensitive, it's a good practice to capitalize the first letter of the noun when you intend to use a PowerShell command. For example, typing `date` will call your system's `date` utility. Typing `Date` will call PowerShell's `Get-Date` cmdlet. - -And if that's not enough, PowerShell has aliases to create simple names. For example, if you type `alias -name cd`, you will discover the `cd` command in PowerShell is itself an alias for the `Set-Location` command. - -So to review—you get powerful tab completion, aliases, and noun completions to keep your command names short, automatic and consistent parameter name truncation, while still enjoying a rich, readable syntax for scripting. - -### So... friends? - -There are just some of the advantages of PowerShell. There are more features and cmdlets I haven't discussed (check out [Where-Object][6] or its alias `?` if you want to make `grep` cry). And hey, if you really feel homesick, PowerShell will be happy to launch your old native utilities for you. But give yourself enough time to get acclimated in PowerShell's object-oriented cmdlet world, and you may find yourself choosing to forget the way back. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/powershell-people - -作者:[Yev Bronshteyn][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/yevster -[1]:https://github.com/PowerShell/PowerShell/blob/master/README.md -[2]:https://blogs.msdn.microsoft.com/powershell/2018/01/10/powershell-core-6-0-generally-available-ga-and-supported/ -[3]:https://spdx.org/licenses/MIT -[4]:http://www.jsnover.com/Docs/MonadManifesto.pdf -[5]:https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties -[6]:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/where-object?view=powershell-6 diff --git a/translated/tech/20180206 Power(Shell) to the people.md b/translated/tech/20180206 Power(Shell) to the people.md new file mode 100644 index 0000000000..89553183fc --- /dev/null +++ b/translated/tech/20180206 Power(Shell) to the people.md @@ -0,0 +1,164 @@ +安利 Power(Shell) +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_lightbulbs.png?itok=pwp22hTw) + +早些年,[Powershell Core][1] 在 [MIT][3] 开源协议下逐步开放。PowerShell 算不上是新技术。自 2006 年第一版 Windows 版的 PowerShell 发布以来,PowerShell 的创建者在合并 Unⅸ shell 的强大和灵活的同时也在弥补他们所意识到的缺点,特别是从组合命令中获取值时,所要进行的文本操作。 + +在 5 个主要版本发布之后,PowerShell 允许在所有主流操作系统上本地运行相同的 shell 和命令行环境(包括 OS X 和 Linux)。一些人(大多数)可能依旧在嘲弄这位 Windows 出生的闯入者为远古时期便存在强大 shell 环境的平台引荐自己。在本帖中,我希望可以将 PowerShell 的优势提供大部分人,甚至是那些经验老道的用户。 + +### 一致性跨平台 + +如果你计划将脚本从一个执行环境迁移到另一个平台时,你需要确保只使用了那些在两个平台下都起作用的命令和语法。比如在 GNU 系统中,你可以通过以下方式获取昨天的日期: + +``` +date --date="1 day ago" + +``` + +在 BSD 系统中(比如 OS X),上述语法将没办法工作,因为 BSD date 工具需要以下语法: + +``` +date -v -1d + +``` + +因为 PowerShell 具有宽松的许可证,并且为所有的平台都有构建,所以你可以和你的应用一起迁移 PowerShell。因此,你可以使用与你的测试环境相同的命令,将脚本运行在目标系统中。 + +### 对象和结构化的数据 + +*nix 命令和工具依赖于你的能力,来操控非结构化数据。对于那些长期活在 `sed` `grep` 和 `awk` 环境下的人们来说,这可能是小菜一碟,但现在有更好的选择。 + +让我们使用 PowerShell 从写获取昨天日期的实例。为了获取当前日期,使用 `Get-Date` cmdlet(读作 "commandlet"): +``` +> Get-Date                         + + + +Sunday, January 21, 2018 8:12:41 PM + +``` + +你所看到的输出实际上并不是一个文本字符串。不如说,是 .Net Core 对象的一个字符串表现形式。就像任何 OOP 环境中的对象一样,它具有类型以及你可以调用的方法。 + +让我们来证明这一点: +``` +> $(Get-Date).GetType().FullName + +System.DateTime + +``` + +`$(...)` 语法就像你所期望的 POSIX shell 中那样,计算括弧中的命令然后替换整个表达式。但是在 PowerShell 中,这种表达式中的 $ 是可选的。并且,最重要的是,结果是一个 .Net 对象,而不是文本。因此我们可以调用该对象中的 `GetType()` 方法来获取该对象类型(类似于 Java 中的 `Class` 对象),`FullName` [属性][5] 则用来获取该类型的全称。 + +那么,这种对象导向的 shell 是如何让你的工作变得更加简单呢? + +首先,你可将任何对象排进 `Get-Member` cmdlet 来查看它提供的所有方法和属性。 + +``` +> (Get-Date) | Get-Member +PS /home/yevster/Documents/ArticlesInProgress> $(Get-Date) | Get-Member         + + +   TypeName: System.DateTime + + +Name                 MemberType     Definition                                 +----                 ----------     ----------                                 +Add                  Method         datetime Add(timespan value)               +AddDays              Method         datetime AddDays(double value)             +AddHours             Method         datetime AddHours(double value)             +AddMilliseconds      Method         datetime AddMilliseconds(double value)     +AddMinutes           Method         datetime AddMinutes(double value)           +AddMonths            Method         datetime AddMonths(int months)             +AddSeconds           Method         datetime AddSeconds(double value)           +AddTicks             Method         datetime AddTicks(long value)               +AddYears             Method         datetime AddYears(int value)               +CompareTo            Method         int CompareTo(System.Object value), int ... +``` + +你可以很快的看到 DateTime 对象具有一个 `AddDays` 方法,从而可以使用它来快速的获取昨天的日期: + +``` +> (Get-Date).AddDays(-1) + + +Saturday, January 20, 2018 8:24:42 PM +``` + +为了做一些更刺激的事,让我们调用 Yahoo 的天气服务(因为这不需要 API 通证)然后获取你的本地天气。 + +``` +$city="Boston" +$state="MA" +$url="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22${city}%2C%20${state}%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" +``` + +现在,我们可以使用老派的方法然后直接运行 `curl $url` 来获取 JSON 二进制对象,或者 ... + +``` +$weather=(Invoke-RestMethod $url) +``` + +如果你查看了 `$weather` 类型(运行 `echo $weather.GetType().FullName`),你将会发现它是一个 `PSCustomObject`。这是一个用来反射 JSON 结构的动态对象。 + +然后 PowerShell 可以通过 tab 补齐来帮助你完成命令输入。只需要输入 `$weather.`(确报包含了 ".")然后按下 Tab 键。你将看到所有根级别的 JSON 键。输入其中的一个,然后跟上 `.` ,再一次按下 Tab 键,你将看到它所有的子键(如果有的话)。 + +因此,你可以轻易的导航到你所想要的数据: +``` +> echo $weather.query.results.channel.atmosphere.pressure                                                               +1019.0 + + +> echo $weather.query.results.channel.wind.chill                                                                       +41 +``` + +并且如果你有非结构化的 JSON 或 CSV 数据(通过外部命令返回的),只需要将它相应的排进 `ConverFrom-Json` 或 `ConvertFrom-CSV` cmdlet,然后你可以得到一个漂亮干净的对象。 + +### 计算 vs. 自动化 + +我们使用 shell 用于两种目的。一个是用于计算,运行独立的命令然后手动的响应他们的输出。另一个是自动化,通过写脚本执行躲过命令,然后以编程的方式相应他们的输出。 + +我们大多数人都能发现这两种目的在 shell 上的不同且互相冲突的要求。计算任务要求 shell 简洁明了。用户输入的越少,越好。但如果用户输入对其他用户来说几乎难以理解,那这一点就不重要了。脚本,从另一个角度来讲是代码。可读性和可维护性是关键。这一方面,POSIX 工具通常是失败的。虽然一些命令通常会为它们的参数提供简洁明了的语法(如:`-f` 和 `--force`),但是命令名字本身就不简洁明了。 + +PowerShell 提供了几个机制来消除这种浮士德士的平衡。 + +首先,tab 补齐可以消除键入参数名的需要。比如:键入 `Get-Random -Mi`,按下 Tab 然后 PowerShell 将会为你完成参数:`Get-Random -Minimum`。但是如果你想更简洁一些,你甚至不需要按下 Tab。如下所示,PowerShell 可以理解 + +``` +Get-Random -Mi 1 -Ma 10 +``` + +应为 `Mi` 和 `Ma` 每一个都具有独立不同的补齐。 + +你可能已经留意到所有的 PowerShell cmdlet 名称具有动名词结构。这有助于脚本的可读性,但是你可能不想一而再,再而三的键入 `Get-`。所以并不需要!如果你之间键入了一个名词而没有动词的话,PowerShell 将查找带有该名词的 `Get-` 命令。 + +小心:尽管 PowerShell 不区分大小写,但在使用 PowerShell 命令是时,名词首字母大写是一个好习惯。比如,键入 `date` 将会调用系统中的 `date` 工具。键入 `Date` 将会调用 PowerShell 的 `Get-Date` cmdlet。 + +如果这还不够,PowerShell 还提供了别名,用来创建简单的名字。比如,如果键入 `alias -name cd`,你将会发现 `cd` 在 PowerShell 实际上时 `Set-Location` 命令的别名。 + +所以回顾以下 — 你可以使用强大的 tab 补全,别名,和名词补全来保持命令名词简洁,自动化和一致性参数名截断,与此同时还可以享受丰富,可读的语法格式。 + +### 那么... 朋友? + +这些只是 PowerShell 的一部分优势。还有更多特性和 cmdlet,我还没讨论(如果你想弄哭 `grep` 的话,可以查看 [Where-Object][6] 或其别称 `?`)。如果你有点怀旧的话,PowerShell 可以为你加载本地工具。但是给自己足够的时间来适应 PowerShell 面向对象 cmdlet 的世界,然后你将发现自己会选择忘记回去的路。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/2/powershell-people + +作者:[Yev Bronshteyn][a] +译者:[sanfusu](https://github.com/sanfusu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/yevster +[1]:https://github.com/PowerShell/PowerShell/blob/master/README.md +[2]:https://blogs.msdn.microsoft.com/powershell/2018/01/10/powershell-core-6-0-generally-available-ga-and-supported/ +[3]:https://spdx.org/licenses/MIT +[4]:http://www.jsnover.com/Docs/MonadManifesto.pdf +[5]:https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties +[6]:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/where-object?view=powershell-6 From f53e3774996aa215ec35069fa2986d7a1e9ee41b Mon Sep 17 00:00:00 2001 From: sanfusu <34563541+sanfusu@users.noreply.github.com> Date: Sun, 17 Mar 2019 21:56:28 +0800 Subject: [PATCH 654/813] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190301 Blockchain 2.0- An Introduction -Part 1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md index e8922aa789..0594433893 100644 --- a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md +++ b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (sanfusu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 869462fe958d06154a234d0e04994ab3de7c4141 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Sun, 17 Mar 2019 22:51:26 +0800 Subject: [PATCH 655/813] [Translated] 20190227 How To Find Available Network Interfaces On Linux.md Signed-off-by: Chang Liu --- ...d Available Network Interfaces On Linux.md | 202 ------------------ ...d Available Network Interfaces On Linux.md | 202 ++++++++++++++++++ 2 files changed, 202 insertions(+), 202 deletions(-) delete mode 100644 sources/tech/20190227 How To Find Available Network Interfaces On Linux.md create mode 100644 translated/tech/20190227 How To Find Available Network Interfaces On Linux.md diff --git a/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md deleted file mode 100644 index 8bf09bdefa..0000000000 --- a/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md +++ /dev/null @@ -1,202 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (FSSlc) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Find Available Network Interfaces On Linux) -[#]: via: (https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Find Available Network Interfaces On Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/network-interface-720x340.jpeg) - -One of the common task we do after installing a Linux system is network configuration. Of course, you can configure network interfaces during the installation time. But, some of you might prefer to do it after installation or change the existing settings. As you know already, you must first know how many interfaces are available on the system in-order to configure network settings from command line. This brief tutorial addresses all the possible ways to find available network interfaces on Linux and Unix operating systems. - -### Find Available Network Interfaces On Linux - -We can find the available network cards in couple ways. - -**Method 1 – Using ‘ifconfig’ Command:** - -The most commonly used method to find the network interface details is using **‘ifconfig’** command. I believe some of Linux users might still use this. - -``` -$ ifconfig -a -``` - -Sample output: - -``` -enp5s0: flags=4098 mtu 1500 -ether 24:b6:fd:37:8b:29 txqueuelen 1000 (Ethernet) -RX packets 0 bytes 0 (0.0 B) -RX errors 0 dropped 0 overruns 0 frame 0 -TX packets 0 bytes 0 (0.0 B) -TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 - -lo: flags=73 mtu 65536 -inet 127.0.0.1 netmask 255.0.0.0 -inet6 ::1 prefixlen 128 scopeid 0x10 -loop txqueuelen 1000 (Local Loopback) -RX packets 171420 bytes 303980988 (289.8 MiB) -RX errors 0 dropped 0 overruns 0 frame 0 -TX packets 171420 bytes 303980988 (289.8 MiB) -TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 - -wlp9s0: flags=4163 mtu 1500 -inet 192.168.225.37 netmask 255.255.255.0 broadcast 192.168.225.255 -inet6 2409:4072:6183:c604:c218:85ff:fe50:474f prefixlen 64 scopeid 0x0 -inet6 fe80::c218:85ff:fe50:474f prefixlen 64 scopeid 0x20 -ether c0:18:85:50:47:4f txqueuelen 1000 (Ethernet) -RX packets 564574 bytes 628671925 (599.5 MiB) -RX errors 0 dropped 0 overruns 0 frame 0 -TX packets 299706 bytes 60535732 (57.7 MiB) -TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 -``` - -As you see in the above output, I have two network interfaces namely **enp5s0** (on board wired ethernet adapter) and **wlp9s0** (wireless network adapter) on my Linux box. Here, **lo** is loopback interface, which is used to access all network services locally. It has an ip address of 127.0.0.1. - -We can also use the same ‘ifconfig’ command in many UNIX variants, for example **FreeBSD** , to list available network cards. - -**Method 2 – Using ‘ip’ Command:** - -The ‘ifconfig’ command is deprecated in the latest Linux versions. So you can use **‘ip’** command to display the network interfaces as shown below. - -``` -$ ip link show -``` - -Sample output: - -``` -1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 - link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 -2: enp5s0: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 - link/ether 24:b6:fd:37:8b:29 brd ff:ff:ff:ff:ff:ff -3: wlp9s0: mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000 - link/ether c0:18:85:50:47:4f brd ff:ff:ff:ff:ff:ff -``` - -![](https://www.ostechnix.com/wp-content/uploads/2019/02/ip-command.png) - -You can also use the following commands as well. - -``` -$ ip addr - -$ ip -s link -``` - -Did you notice that these command also shows the connected state of the network interfaces? If you closely look at the above output, you will notice that my Ethernet card is not connected with network cable (see the word **“DOWN”** in the above output). And wireless network card is connected (See the word **“UP”** ). For more details, check our previous guide to [**find the connected state of network interfaces on Linux**][1]. - -These two commands (ifconfig and ip) are just enough to find the available network cards on your Linux systems. - -However, there are few other methods available to list network interfaces on Linux. Here you go. - -**Method 3:** - -The Linux Kernel saves the network interface details inside **/sys/class/net** directory. You can verify the list of available interfaces by looking into this directory. - -``` -$ ls /sys/class/net -``` - -Output: - -``` -enp5s0 lo wlp9s0 -``` - -**Method 4:** - -In Linux operating systems, **/proc/net/dev** file contains statistics about network interfaces. - -To view the available network cards, just view its contents using command: - -``` -$ cat /proc/net/dev -``` - -Output: - -``` -Inter-| Receive | Transmit -face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed -wlp9s0: 629189631 566078 0 0 0 0 0 0 60822472 300922 0 0 0 0 0 0 -enp5s0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -lo: 303980988 171420 0 0 0 0 0 0 303980988 171420 0 0 0 0 0 0 -``` - -**Method 5: Using ‘netstat’ command** - -The **netstat** command displays various details such as network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. - -``` -$ netstat -i -``` - -**Sample output:** - -``` -Kernel Interface table -Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg -lo 65536 171420 0 0 0 171420 0 0 0 LRU -wlp9s0 1500 565625 0 0 0 300543 0 0 0 BMRU -``` - -Please be mindful that netstat is obsolete. The Replacement for “netstat -i” is “ip -s link”. Also note that this method will list only the active interfaces, not all available interfaces. - -**Method 6: Using ‘nmcli’ command** - -The nmcli is nmcli is a command-line tool for controlling NetworkManager and reporting network status. It is used to create, display, edit, delete, activate, and deactivate network connections and display network status. - -If you have Linux system with Network Manager installed, you can list the available network interfaces using nmcli tool using the following commands: - -``` -$ nmcli device status -``` - -Or, - -``` -$ nmcli connection show -``` - -You know now how to find the available network interfaces on Linux. Next, check the following guides to know how to configure IP address on Linux. - -[How To Configure Static IP Address In Linux And Unix][2] - -[How To Configure IP Address In Ubuntu 18.04 LTS][3] - -[How To Configure Static And Dynamic IP Address In Arch Linux][4] - -[How To Assign Multiple IP Addresses To Single Network Card In Linux][5] - -If you know any other quick ways to do it, please share them in the comment section below. I will check and update the guide with your inputs. - -And, that’s all. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/ - -作者:[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]: https://www.ostechnix.com/how-to-find-out-the-connected-state-of-a-network-cable-in-linux/ -[2]: https://www.ostechnix.com/configure-static-ip-address-linux-unix/ -[3]: https://www.ostechnix.com/how-to-configure-ip-address-in-ubuntu-18-04-lts/ -[4]: https://www.ostechnix.com/configure-static-dynamic-ip-address-arch-linux/ -[5]: https://www.ostechnix.com/how-to-assign-multiple-ip-addresses-to-single-network-card-in-linux/ diff --git a/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md b/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md new file mode 100644 index 0000000000..9c5b133bf2 --- /dev/null +++ b/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: (FSSlc) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Find Available Network Interfaces On Linux) +[#]: via: (https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在 Linux 中查看可用的网络接口 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/network-interface-720x340.jpeg) + +在我们安装完一个 Linux 系统后最为常见的任务便是网络配置了。当然,你可以在安装系统时进行网络接口的配置。但是,对于某些人来说,他们更偏爱在安装完系统后再进行网络的配置或者更改现存的设置。众所周知,为了在命令行中进行网络设定的配置,我们首先必须知道系统中有多少个可用的网络接口。本次这个简单的指南将列出所有可能的方式来在 Linux 和 Unix 操作系统中找到可用的网络接口。 + +### 在 Linux 中找到可用的网络接口 + +我们可以使用下面的这些方法来找到可用的网络接口。 + +**方法 1 —— 使用 `ifconfig` 命令:** + +使用 **`ifconfig`** 命令来查看网络接口仍然是最常使用的方法。我相信还有很多 Linux 用户仍然使用这个方法。 + +``` +$ ifconfig -a +``` + +示例输出: + +``` +enp5s0: flags=4098 mtu 1500 +ether 24:b6:fd:37:8b:29 txqueuelen 1000 (Ethernet) +RX packets 0 bytes 0 (0.0 B) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 0 bytes 0 (0.0 B) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 +inet 127.0.0.1 netmask 255.0.0.0 +inet6 ::1 prefixlen 128 scopeid 0x10 +loop txqueuelen 1000 (Local Loopback) +RX packets 171420 bytes 303980988 (289.8 MiB) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 171420 bytes 303980988 (289.8 MiB) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +wlp9s0: flags=4163 mtu 1500 +inet 192.168.225.37 netmask 255.255.255.0 broadcast 192.168.225.255 +inet6 2409:4072:6183:c604:c218:85ff:fe50:474f prefixlen 64 scopeid 0x0 +inet6 fe80::c218:85ff:fe50:474f prefixlen 64 scopeid 0x20 +ether c0:18:85:50:47:4f txqueuelen 1000 (Ethernet) +RX packets 564574 bytes 628671925 (599.5 MiB) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 299706 bytes 60535732 (57.7 MiB) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + +如上面的输出所示,在我的 Linux 机子上有两个网络接口,它们分别叫做 **enp5s0**(主板上的有线网卡)和 **wlp9s0**(无线网卡)。其中的 **lo** 是环回网卡,被用来访问本地的网络的服务,通常它的 IP 地址为 127.0.0.1。 + +我们也可以在许多 UNIX 变种例如 **FreeBSD** 中使用相同的 `ifconfig` 来列出可用的网卡。 + +**方法 2 —— 使用 `ip` 命令:** + +在最新的 Linux 版本中, `ifconfig` 命令已经被弃用了。你可以使用 **`ip`** 命令来罗列出网络接口,正如下面这样: + +``` +$ ip link show +``` + +示例输出: + +``` +1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: enp5s0: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 + link/ether 24:b6:fd:37:8b:29 brd ff:ff:ff:ff:ff:ff +3: wlp9s0: mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000 + link/ether c0:18:85:50:47:4f brd ff:ff:ff:ff:ff:ff +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/ip-command.png) + +你也可以使用下面的命令来查看。 + +``` +$ ip addr +``` + +``` +$ ip -s link +``` + +你注意到了吗?这些命令同时还显示出了已经连接的网络接口的状态。假如你仔细查看上面的输出,你将注意到我的有线网卡并没有跟网络线缆连接(从上面输出中的 **DOWN** 可以看出)。另外,我的无线网卡已经连接了(从上面输出中的 **UP** 可以看出)。想知晓更多的细节,可以查看我们先前的指南 [**在 Linux 中查看网络接口的已连接状态**][1]。 + +这两个命令(ifconfig 和 ip)已经足够在你的 LInux 系统中查看可用的网卡了。 + +然而,仍然有其他方法来列出 Linux 中的网络接口,下面我们接着看。 + +**方法 3:** + +Linux 内核将网络接口的详细信息保存在 **/sys/class/net** 目录中,你可以通过查看这个目录的内容来检验可用接口的列表是否和前面的结果相符。 + +``` +$ ls /sys/class/net +``` + +示例输出: + +``` +enp5s0 lo wlp9s0 +``` + +**方法 4:** + +在 Linux 操作系统中,文件 **/proc/net/dev** 中包含有关网络接口的信息。 + +要查看可用的网卡,只需使用下面的命令来查看上面文件的内容: + +``` +$ cat /proc/net/dev +``` + +示例输出: + +``` +Inter-| Receive | Transmit +face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed +wlp9s0: 629189631 566078 0 0 0 0 0 0 60822472 300922 0 0 0 0 0 0 +enp5s0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +lo: 303980988 171420 0 0 0 0 0 0 303980988 171420 0 0 0 0 0 0 +``` + +**方法 5 : 使用 `netstat` 命令* + +**netstat** 命令可以列出各种不同的信息,例如网络连接、路由表、接口统计信息、伪装连接和多播成员等。 + +``` +$ netstat -i +``` + +示例输出: + +``` +Kernel Interface table +Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg +lo 65536 171420 0 0 0 171420 0 0 0 LRU +wlp9s0 1500 565625 0 0 0 300543 0 0 0 BMRU +``` + +请注意 `netstat` 被弃用了, `netstat -i` 的替代命令是 `ip -s link`。另外需要注意的是这个方法将只列出激活的接口,而不是所有可用的接口。 + +**方法 6: 使用 `nmcli` 命令** + +`nmcli` 是一个用来控制 `NetworkManager` 和报告网络状态的命令行工具。它可以被用来创建、展示、编辑、删除、激活、停用网络连接和展示网络状态。 + +假如你的 Linux 系统中安装了 `Network Manager`,你便可以使用下面的命令来使用 `nmcli` 列出可以的网络接口: + +``` +$ nmcli device status +``` + +或者 + +``` +$ nmcli connection show +``` + +现在你知道了如何在 Linux 中找到可用网络接口的方法,接下来,请查看下面的指南来知晓如何在 Linux 中配置 IP 地址吧。 + +[如何在 Linux 和 Unix 中配置静态 IP 地址][2] + +[如何在 Ubuntu 18.04 LTS 中配置 IP 地址][3] + +[如何在 Arch Linux 中配置静态和动态 IP 地址][4] + +[如何在 Linux 中为单个网卡分配多个 IP 地址][5] + +假如你知道其他快捷的方法来在 Linux 中找到可用的网络接口,请在下面的评论部分中分享出来,我将检查你们的评论并更新这篇指南。 + +这就是全部的内容了,更多精彩内容即将呈现,请保持关注! + +干杯! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[FSSlc](https://github.com/FSSlc) +校对:[校对者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]: https://www.ostechnix.com/how-to-find-out-the-connected-state-of-a-network-cable-in-linux/ +[2]: https://www.ostechnix.com/configure-static-ip-address-linux-unix/ +[3]: https://www.ostechnix.com/how-to-configure-ip-address-in-ubuntu-18-04-lts/ +[4]: https://www.ostechnix.com/configure-static-dynamic-ip-address-arch-linux/ +[5]: https://www.ostechnix.com/how-to-assign-multiple-ip-addresses-to-single-network-card-in-linux/ From 2c0e25811cdbfb3b4ed5a4e832aa27f71cdf1105 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 23:41:00 +0800 Subject: [PATCH 656/813] PRF:20190218 Emoji-Log- A new way to write Git commit messages.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @MjSeven 为了这篇文章, 我修改了数据库的字符集,以支持大量的表情符,哈哈。 --- ... A new way to write Git commit messages.md | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md b/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md index 2b4d41ecb3..551587497a 100644 --- a/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md +++ b/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Emoji-Log: A new way to write Git commit messages) @@ -9,20 +9,22 @@ Emoji-Log:编写 Git 提交信息的新方法 ====== -使用 Emoji-Log 为你的提交添加上下文。 + +> 使用 Emoji-Log 为你的提交添加上下文。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji_tech_keyboard.jpg?itok=ncBNKZFl) -我是一名全职开源开发人员,我喜欢称自己为“开源者”。我从事开源软件工作已经超过十年,并[构建了数百个][1]开源软件应用程序。 +我是一名全职的开源开发人员,我喜欢称自己为“开源者”。我从事开源软件工作已经超过十年,并[构建了数以百计的][1]开源软件应用程序。 -同时我也是不要重复自己 Don't Repeat Yourself(DRY)哲学的忠实粉丝,并且相信编写更好的 Git 提交消息是 DRY 的一个重要组成部分。它们具有足够的上下文关联可以作为你开源软件的变更日志。我编写的众多工作流之一是 [Emoji-Log][2],它是一个简单易用的开源 Git 提交日志标准。它通过使用表情符号来创建更好的 Git 提交消息,从而改善了开发人员的体验(DX)。 +同时我也是“避免重复工作Don't Repeat Yourself”(DRY)哲学的忠实粉丝,并且我相信编写更好的 Git 提交消息是 DRY 的一个重要组成部分。它们具有足够的上下文关联,可以作为你开源软件的变更日志。我编写的众多工作流之一是 [Emoji-Log][2],它是一个简单易用的开源 Git 提交日志标准。它通过使用表情符号来创建更好的 Git 提交消息,从而改善了开发人员的体验(DX)。 我使用 Emoji-Log 构建了 [VSCode Tips & Tricks 仓库][3] 和我的 🦄 [紫色 VSCode 主题仓库][4],以及一个看起来很漂亮的[自动变更日志][5]。 ### Emoji-Log 的哲学 -我喜欢表情符号,我很喜欢它们。编程,代码,极客/书呆子,开源...所有这一切本质上都很枯燥,有时甚至很无聊。表情符号帮助我添加颜色和情感。想要将感受添加到 2D、平面和基于文本的代码世界并没有错。 +我喜欢(很多)表情符号,我很喜欢它们。编程、代码、极客/书呆子、开源……所有这一切本质上都很枯燥,有时甚至很无聊。表情符号帮助我添加颜色和情感。想要将感受添加到这个 2D 的、平板的、基于文本的代码世界并没有错。 -相比于[数百个表情符号][6],我学会了更好的办法是保持小类别和普遍性。以下是指导使用 Emoji-Log 编写提交信息的原则: +相比于[数百个表情符号][6],我学会的更好办法是让类别较小和普遍性。以下是指导使用 Emoji-Log 编写提交信息的原则: 1. **必要的** * Git 提交信息是必要的。 @@ -31,10 +33,10 @@ Emoji-Log:编写 Git 提交信息的新方法 * 例如,使用 ✅ **Create** 而不是 ❌ **Creating** 2. **规则** * 少数类别易于记忆。 - * 不多不也少 - * 例如 **📦 NEW** , **👌 IMPROVE** , **🐛 FIX** , **📖 DOC** , **🚀 RELEASE**, **✅ TEST** + * 不多也不少 + * 例如 **📦 NEW** 、 **👌 IMPROVE** 、 **🐛 FIX** 、 **📖 DOC** 、 **🚀 RELEASE** 、 **✅ TEST** 3. **行为** - * 让 Git 基于你所采取的操作提交 + * 让 Git 的提交基于你所采取的操作 * 使用像 [VSCode][7] 这样的编辑器来提交带有提交信息的正确文件。 ### 编写提交信息 @@ -63,7 +65,7 @@ Emoji-Log:编写 Git 提交信息的新方法 ### Emoji-Log 函数 -为了快速构建原型,我写了以下函数,你可以将它们添加到 **.bashrc** 或者 **.zshrc** 文件中以快速使用 Emoji-Log。 +为了快速构建原型,我写了以下函数,你可以将它们添加到 `.bashrc` 或者 `.zshrc` 文件中以快速使用 Emoji-Log。 ``` #.# Better Git Logs. @@ -126,7 +128,8 @@ funcsave gdoc funcsave gtst ``` -如果你愿意,可以将这些别名直接粘贴到 **~/.gitconfig** 文件: +如果你愿意,可以将这些别名直接粘贴到 `~/.gitconfig` 文件: + ``` # Git Commit, Add all and Push — in one step. cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f" @@ -145,6 +148,17 @@ doc = "!f() { git cap \"📖 DOC: $@\"; }; f" tst = "!f() { git cap \"✅ TEST: $@\"; }; f" ``` +### Emoji-Log 例子 + +这里列出了一些使用 Emoji-Log 的仓库: + +- [Create-guten-block toolkit](https://github.com/ahmadawais/create-guten-block/commits/) +- [VSCode Shades of Purple theme](https://github.com/ahmadawais/shades-of-purple-vscode/commits/) +- [Ahmad Awais' GitHub repos](https://github.com/ahmadawais) (我的最新的仓库) +- [CaptainCore CLI](https://github.com/CaptainCore/captaincore-cli/commits/) (WordPress 管理工具) +- [CaptainCore GUI](https://github.com/CaptainCore/captaincore-gui/commits/) (WordPress 插件) + +你呢?如果你的仓库使用 Emoji-Log,请将这个 [Emoji-Log 徽章](https://on.ahmda.ws/rOMZ/c)放到你的 README 中,并给我发送一个[拉取请求](https://github.com/ahmadawais/Emoji-Log/pulls),以让我可以将你的仓库列在这里。 -------------------------------------------------------------------------------- @@ -153,7 +167,7 @@ via: https://opensource.com/article/19/2/emoji-log-git-commit-messages 作者:[Ahmad Awais][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 3ac8ec846427b2d6fd995759f2e60f4254665fa4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Mar 2019 23:43:34 +0800 Subject: [PATCH 657/813] PUB:20190218 Emoji-Log- A new way to write Git commit messages.md @MjSeven https://linux.cn/article-10627-1.html --- ...90218 Emoji-Log- A new way to write Git commit messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190218 Emoji-Log- A new way to write Git commit messages.md (98%) diff --git a/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md b/published/20190218 Emoji-Log- A new way to write Git commit messages.md similarity index 98% rename from translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md rename to published/20190218 Emoji-Log- A new way to write Git commit messages.md index 551587497a..89820ed92a 100644 --- a/translated/tech/20190218 Emoji-Log- A new way to write Git commit messages.md +++ b/published/20190218 Emoji-Log- A new way to write Git commit messages.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10627-1.html) [#]: subject: (Emoji-Log: A new way to write Git commit messages) [#]: via: (https://opensource.com/article/19/2/emoji-log-git-commit-messages) [#]: author: (Ahmad Awais https://opensource.com/users/mrahmadawais) From 4290d23efe5efbd1a0ca4a849961e4aae6ca11a6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 Mar 2019 08:54:05 +0800 Subject: [PATCH 658/813] translated --- ... visibility, control over user activity.md | 86 ------------------ ... visibility, control over user activity.md | 87 +++++++++++++++++++ 2 files changed, 87 insertions(+), 86 deletions(-) delete mode 100644 sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md create mode 100644 translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md diff --git a/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md deleted file mode 100644 index 2a1dc8ff53..0000000000 --- a/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux security: Cmd provides visibility, control over user activity) -[#]: via: (https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Linux security: Cmd provides visibility, control over user activity -====== - -![](https://images.techhive.com/images/article/2017/01/background-1900329_1920-100705659-large.jpg) - -There's a new Linux security tool you should be aware of — Cmd (pronounced "see em dee") dramatically modifies the kind of control that can be exercised over Linux users. It reaches way beyond the traditional configuration of user privileges and takes an active role in monitoring and controlling the commands that users are able to run on Linux systems. - -Provided by a company of the same name, Cmd focuses on cloud usage. Given the increasing number of applications being migrated into cloud environments that rely on Linux, gaps in the available tools make it difficult to adequately enforce required security. However, Cmd can also be used to manage and protect on-premises systems. - -### How Cmd differs from traditional Linux security controls - -The leaders at Cmd — Milun Tesovic and Jake King — say organizations cannot confidently predict or control user behavior until they understand how users work routinely and what is considered “normal.” They seek to provide a tool that will granularly control, monitor, and authenticate user activity. - -Cmd monitors user activity by forming user activity profiles (characterizing the activities these users generally perform), noticing abnormalities in their online behavior (login times, commands used, user locations, etc.), and preventing and reporting certain activities (e.g., downloading or modifying files and running privileged commands) that suggest some kind of system compromise might be underway. The product's behaviors are configurable and changes can be made rapidly. - -The kind of tools most of us are using today to detect threats, identify vulnerabilities, and control user privileges have taken us a long way, but we are still fighting the battle to keep our systems and data safe. Cmd brings us a lot closer to identifying the intentions of hostile users whether those users are people who have managed to break into accounts or represent insider threats. - -![1 sources live sessions][1] - -View live Linux sessions - -### How does Cmd work? - -In monitoring and managing user activity, Cmd: - - * Collects information that profiles user activity - * Uses the baseline to determine what is considered normal - * Detects and proactively prevents threats using specific indicators - * Sends alerts to responsible people - - - -![2 triggers][3] - -Building custom policies in Cmd - -Cmd goes beyond defining what sysadmins can control through traditional methods, such as configuring sudo privileges, providing much more granular and situation-specific controls. - -Administrators can select escalation policies that can be managed separately from the user privilege controls managed by Linux sysadmins. - -The Cmd agent provides real-time visibility (not after-the-fact log analysis) and can block actions, require additional authentication, or negotiate authorization as needed. - -Also, Cmd supports custom rules based on geolocation if user locations are available. And new policies can be pushed to agents deployed on hosts within minutes. - -![3 command blocked][4] - -Building a trigger query in Cmd - -### Funding news for Cmd - -[Cmd][2] recently got a financial boost, having [completed of a $15 million round of funding][5] led by [GV][6] (formerly Google Ventures) with participation from Expa, Amplify Partners, and additional strategic investors. This brings the company's raised funding to $21.6 million and will help it continue to add new defensive capabilities to the product and grow its engineering teams. - -In addition, the company appointed Karim Faris, general partner at GV, to its board of directors. - -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/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.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://images.idgesg.net/images/article/2019/02/1-sources-live-sessions-100789431-large.jpg -[2]: https://cmd.com -[3]: https://images.idgesg.net/images/article/2019/02/2-triggers-100789432-large.jpg -[4]: https://images.idgesg.net/images/article/2019/02/3-command-blocked-100789433-large.jpg -[5]: https://www.linkedin.com/pulse/changing-cybersecurity-announcing-cmds-15-million-funding-jake-king/ -[6]: https://www.gv.com/ -[7]: https://www.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md new file mode 100644 index 0000000000..72133e9ab8 --- /dev/null +++ b/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux security: Cmd provides visibility, control over user activity) +[#]: via: (https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 安全:Cmd 提供可视化控制用户活动 +====== + +![](https://images.techhive.com/images/article/2017/01/background-1900329_1920-100705659-large.jpg) + +你应该知道一个新的 Linux 安全工具--Cmd(读作 “see em dee”)极大地改变了可以对 Linux 用户进行控制的类型。它远远超出了传统的用户权限配置,,并在监视和控制用户能够在 Linux 系统上运行的命令方面发挥积极作用。 + +它由同名公司开发,Cmd 专注于云应用。鉴于越来越多的应用迁移到依赖于 Linux 的云环境中,可用工具的缺口使得难以充分实施所需的安全性。而且,Cmd 还可用于管理和保护本地系统。 + +### Cmd 与传统 Linux 安全控件的区别 + +Cmd 公司的领导 Milun Tesovic 和 Jake King 表示,组织无法自信地预测或控制用户行为,直到他们了解了用户日常如何工作以及什么认为是“正常”。他们寻求提供一种能够精细控制、监控和验证用户活动的工具。 + +Cmd 通过形成用户活动配置文件(表示这些用户通常进行的活动)监视用户活动,注意其在线行为的异常(登录时间、使用的命令、用户位置等),以及预防和报告某些意味着系统攻击的活动(例如,下载或修改文件和运行特权命令)。产品的行为是可配置的,可以快速进行更改。 + +我们大多数人如今用来检测威胁、识别漏洞和控制用户权限的工具已经花费了很长的时间,但我们仍在努力保持系统和数据的安全。Cmd 让我们更能够确定恶意用户的意图,无论这些用户是设法侵入帐户还是代表内部威胁。 + +![1 sources live sessions][1] + +查看实时 Linux 会话 + +### Cmd 如何工作? + +在监视和管理用户活动时,Cmd: + + * 收集描述用户活动的信息 +  * 使用基线来确定什么是正常的 +  * 使用特定指标检测并主动防止威胁 +  * 向负责人发送警报 + + + +![2 triggers][3] + +在 Cmd 中构建自定义策略 + +Cmd 扩展了系统管理员通过传统方法控制的内容,例如配置 sudo 权限,提供更精细和特定情境的控制。 + +管理员可以选择可以与 Linux 系统管理员管理的用户权限控制分开管理的升级策略。 + +Cmd 客户端提供实时可视化(不是事后日志分析),并且可以阻止操作,它需要额外的身份验证或根据需要协商授权。 + +此外,如果存在用户位置,Cmd 支持基于地理定位的自定义规则。并且可以在几分钟内将新策略推送到部署在主机上的客户端。 + +![3 command blocked][4] + +在 Cmd 中构建触发器查询 + + +### Cmd 的融资新闻 + +[Cmd][2] 最近完成了由 [GV][6] (前身为 Google Ventures)领投,Expa、Amplify Partners 和其他战略投资者跟投的 [1500 万美元的融资][5]。这使该公司的融资金额达到了 2160 万美元,这将帮助其继续为该产品增加新的防御能力并发展其工程师团队。 + +此外,该公司还任命 GV 的普通合伙人 Karim Faris 为董事会成员。 + +在 [Facebook][7] 和 [LinkedIn][8] 中加入 Network World 社区,评论顶部话题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.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://images.idgesg.net/images/article/2019/02/1-sources-live-sessions-100789431-large.jpg +[2]: https://cmd.com +[3]: https://images.idgesg.net/images/article/2019/02/2-triggers-100789432-large.jpg +[4]: https://images.idgesg.net/images/article/2019/02/3-command-blocked-100789433-large.jpg +[5]: https://www.linkedin.com/pulse/changing-cybersecurity-announcing-cmds-15-million-funding-jake-king/ +[6]: https://www.gv.com/ +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From b90be0538e2773c67c23565f8c5e57fcf2245e53 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 Mar 2019 08:56:31 +0800 Subject: [PATCH 659/813] translating --- ...90116 Get started with Cypht, an open source email client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190116 Get started with Cypht, an open source email client.md b/sources/tech/20190116 Get started with Cypht, an open source email client.md index 64be2e4a02..eb146614ca 100644 --- a/sources/tech/20190116 Get started with Cypht, an open source email client.md +++ b/sources/tech/20190116 Get started with Cypht, an open source email client.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c5058c41ff7603642b447a17fec9611b55a96dc3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Mar 2019 10:32:32 +0800 Subject: [PATCH 660/813] PRF:20180206 Power(Shell) to the people.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @sanfusu 欢迎回来~ --- .../20180206 Power(Shell) to the people.md | 100 ++++++++---------- 1 file changed, 47 insertions(+), 53 deletions(-) diff --git a/translated/tech/20180206 Power(Shell) to the people.md b/translated/tech/20180206 Power(Shell) to the people.md index 89553183fc..6f81e417a1 100644 --- a/translated/tech/20180206 Power(Shell) to the people.md +++ b/translated/tech/20180206 Power(Shell) to the people.md @@ -1,55 +1,52 @@ -安利 Power(Shell) +给大家安利一下 PowerShell ====== +> 代码更简洁、脚本更清晰、跨平台一致性等好处是让 Linux 和 OS X 用户喜爱 PowerShell 的原因。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_lightbulbs.png?itok=pwp22hTw) -早些年,[Powershell Core][1] 在 [MIT][3] 开源协议下逐步开放。PowerShell 算不上是新技术。自 2006 年第一版 Windows 版的 PowerShell 发布以来,PowerShell 的创建者在合并 Unⅸ shell 的强大和灵活的同时也在弥补他们所意识到的缺点,特别是从组合命令中获取值时,所要进行的文本操作。 +今年(2018)早些时候,[Powershell Core][1] 以 [MIT][3] 开源协议发布了[正式可用版(GA)][2]。PowerShell 算不上是新技术。自 2006 年为 Windows 发布了第一版 PowerShell 以来,PowerShell 的创建者在[结合了][4] Unⅸ shell 的强大和灵活的同时也在弥补他们所意识到的缺点,特别是从组合命令中获取值时所要进行的文本操作。 -在 5 个主要版本发布之后,PowerShell 允许在所有主流操作系统上本地运行相同的 shell 和命令行环境(包括 OS X 和 Linux)。一些人(大多数)可能依旧在嘲弄这位 Windows 出生的闯入者为远古时期便存在强大 shell 环境的平台引荐自己。在本帖中,我希望可以将 PowerShell 的优势提供大部分人,甚至是那些经验老道的用户。 +在发布了 5 个主要版本之后,PowerShell 已经可以在所有主流操作系统上(包括 OS X 和 Linux)本地运行同样创新的 shell 和命令行环境。一些人(应该说是大多数人)可能依旧在嘲弄这位诞生于 Windows 的闯入者的大胆和冒失:为那些远古以来(从千禧年开始算不算?)便存在着强大的 shell 环境的平台引荐自己。在本帖中,我希望可以将 PowerShell 的优势介绍给大家,甚至是那些经验老道的用户。 -### 一致性跨平台 +### 跨平台一致性 如果你计划将脚本从一个执行环境迁移到另一个平台时,你需要确保只使用了那些在两个平台下都起作用的命令和语法。比如在 GNU 系统中,你可以通过以下方式获取昨天的日期: ``` date --date="1 day ago" - ``` -在 BSD 系统中(比如 OS X),上述语法将没办法工作,因为 BSD date 工具需要以下语法: +在 BSD 系统中(比如 OS X),上述语法将没办法工作,因为 BSD 的 date 工具需要以下语法: ``` date -v -1d - ``` -因为 PowerShell 具有宽松的许可证,并且为所有的平台都有构建,所以你可以和你的应用一起迁移 PowerShell。因此,你可以使用与你的测试环境相同的命令,将脚本运行在目标系统中。 +因为 PowerShell 具有宽松的许可证,并且在所有的平台都有构建,所以你可以把 PowerShell 和你的应用一起打包。因此,当你的脚本运行在目标系统中时,它们会运行在一样的 shell 环境中,使用与你的测试环境中同样的命令实现。 -### 对象和结构化的数据 +### 对象和结构化数据 -*nix 命令和工具依赖于你的能力,来操控非结构化数据。对于那些长期活在 `sed` `grep` 和 `awk` 环境下的人们来说,这可能是小菜一碟,但现在有更好的选择。 +*nix 命令和工具依赖于你使用和操控非结构化数据的能力。对于那些长期活在 `sed`、 `grep` 和 `awk` 环境下的人们来说,这可能是小菜一碟,但现在有更好的选择。 + +让我们使用 PowerShell 重写那个获取昨天日期的实例。为了获取当前日期,使用 `Get-Date` cmdlet(读作 “commandlet”): -让我们使用 PowerShell 从写获取昨天日期的实例。为了获取当前日期,使用 `Get-Date` cmdlet(读作 "commandlet"): ``` > Get-Date                         - - Sunday, January 21, 2018 8:12:41 PM - ``` -你所看到的输出实际上并不是一个文本字符串。不如说,是 .Net Core 对象的一个字符串表现形式。就像任何 OOP 环境中的对象一样,它具有类型以及你可以调用的方法。 +你所看到的输出实际上并不是一个文本字符串。不如说,这是 .Net Core 对象的一个字符串表现形式。就像任何 OOP 环境中的对象一样,它具有类型以及你可以调用的方法。 让我们来证明这一点: + ``` > $(Get-Date).GetType().FullName - System.DateTime - ``` -`$(...)` 语法就像你所期望的 POSIX shell 中那样,计算括弧中的命令然后替换整个表达式。但是在 PowerShell 中,这种表达式中的 $ 是可选的。并且,最重要的是,结果是一个 .Net 对象,而不是文本。因此我们可以调用该对象中的 `GetType()` 方法来获取该对象类型(类似于 Java 中的 `Class` 对象),`FullName` [属性][5] 则用来获取该类型的全称。 +`$(...)` 语法就像你所期望的 POSIX shell 中那样,计算括弧中的命令然后替换整个表达式。但是在 PowerShell 中,这种表达式中的 `$` 是可选的。并且,最重要的是,结果是一个 .Net 对象,而不是文本。因此我们可以调用该对象中的 `GetType()` 方法来获取该对象类型(类似于 Java 中的 `Class` 对象),`FullName` [属性][5] 则用来获取该类型的全称。 那么,这种对象导向的 shell 是如何让你的工作变得更加简单呢? @@ -57,24 +54,23 @@ System.DateTime ``` > (Get-Date) | Get-Member -PS /home/yevster/Documents/ArticlesInProgress> $(Get-Date) | Get-Member         +PS /home/yevster/Documents/ArticlesInProgress> $(Get-Date) | Get-Member -   TypeName: System.DateTime + TypeName: System.DateTime - -Name                 MemberType     Definition                                 -----                 ----------     ----------                                 -Add                  Method         datetime Add(timespan value)               -AddDays              Method         datetime AddDays(double value)             -AddHours             Method         datetime AddHours(double value)             -AddMilliseconds      Method         datetime AddMilliseconds(double value)     -AddMinutes           Method         datetime AddMinutes(double value)           -AddMonths            Method         datetime AddMonths(int months)             -AddSeconds           Method         datetime AddSeconds(double value)           -AddTicks             Method         datetime AddTicks(long value)               -AddYears             Method         datetime AddYears(int value)               -CompareTo            Method         int CompareTo(System.Object value), int ... +Name MemberType Definition +---- ---------- ---------- +Add Method datetime Add(timespan value) +AddDays Method datetime AddDays(double value) +AddHours Method datetime AddHours(double value) +AddMilliseconds Method datetime AddMilliseconds(double value) +AddMinutes Method datetime AddMinutes(double value) +AddMonths Method datetime AddMonths(int months) +AddSeconds Method datetime AddSeconds(double value) +AddTicks Method datetime AddTicks(long value) +AddYears Method datetime AddYears(int value) +CompareTo Method int CompareTo(System.Object value), int ... ``` 你可以很快的看到 DateTime 对象具有一个 `AddDays` 方法,从而可以使用它来快速的获取昨天的日期: @@ -82,11 +78,10 @@ CompareTo            Method         int CompareTo(System.Object value) ``` > (Get-Date).AddDays(-1) - Saturday, January 20, 2018 8:24:42 PM ``` -为了做一些更刺激的事,让我们调用 Yahoo 的天气服务(因为这不需要 API 通证)然后获取你的本地天气。 +为了做一些更刺激的事,让我们调用 Yahoo 的天气服务(因为它不需要 API 令牌)然后获取你的本地天气。 ``` $city="Boston" @@ -94,55 +89,54 @@ $state="MA" $url="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22${city}%2C%20${state}%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" ``` -现在,我们可以使用老派的方法然后直接运行 `curl $url` 来获取 JSON 二进制对象,或者 ... +现在,我们可以使用老派的方法然后直接运行 `curl $url` 来获取 JSON 二进制对象,或者…… ``` $weather=(Invoke-RestMethod $url) ``` -如果你查看了 `$weather` 类型(运行 `echo $weather.GetType().FullName`),你将会发现它是一个 `PSCustomObject`。这是一个用来反射 JSON 结构的动态对象。 +如果你查看了 `$weather` 类型(运行 `echo $weather.GetType().FullName`),你将会发现它是一个 `PSCustomObject`。这是一个用来反射 JSON 结构的动态对象。 -然后 PowerShell 可以通过 tab 补齐来帮助你完成命令输入。只需要输入 `$weather.`(确报包含了 ".")然后按下 Tab 键。你将看到所有根级别的 JSON 键。输入其中的一个,然后跟上 `.` ,再一次按下 Tab 键,你将看到它所有的子键(如果有的话)。 +然后 PowerShell 可以通过 tab 补齐来帮助你完成命令输入。只需要输入 `$weather.`(确报包含了 `.`)然后按下 `Tab` 键。你将看到所有根级别的 JSON 键。输入其中的一个,然后跟上 `.` ,再一次按下 `Tab` 键,你将看到它所有的子键(如果有的话)。 因此,你可以轻易的导航到你所想要的数据: + ``` -> echo $weather.query.results.channel.atmosphere.pressure                                                               +> echo $weather.query.results.channel.atmosphere.pressure                       1019.0 - -> echo $weather.query.results.channel.wind.chill                                                                       -41 +> echo $weather.query.results.channel.wind.chill                                 41 ``` 并且如果你有非结构化的 JSON 或 CSV 数据(通过外部命令返回的),只需要将它相应的排进 `ConverFrom-Json` 或 `ConvertFrom-CSV` cmdlet,然后你可以得到一个漂亮干净的对象。 ### 计算 vs. 自动化 -我们使用 shell 用于两种目的。一个是用于计算,运行独立的命令然后手动的响应他们的输出。另一个是自动化,通过写脚本执行躲过命令,然后以编程的方式相应他们的输出。 +我们使用 shell 用于两种目的。一个是用于计算,运行独立的命令然后手动响应它们的输出。另一个是自动化,通过写脚本执行多个命令,然后以编程的方式相应它们的输出。 -我们大多数人都能发现这两种目的在 shell 上的不同且互相冲突的要求。计算任务要求 shell 简洁明了。用户输入的越少,越好。但如果用户输入对其他用户来说几乎难以理解,那这一点就不重要了。脚本,从另一个角度来讲是代码。可读性和可维护性是关键。这一方面,POSIX 工具通常是失败的。虽然一些命令通常会为它们的参数提供简洁明了的语法(如:`-f` 和 `--force`),但是命令名字本身就不简洁明了。 +我们大多数人都能发现这两种目的在 shell 上的不同且互相冲突的要求。计算任务要求 shell 简洁明了。用户输入的越少越好。但如果用户输入对其他用户来说几乎难以理解,那这一点就不重要了。脚本,从另一个角度来讲是代码。可读性和可维护性是关键。这一方面,POSIX 工具通常是失败的。虽然一些命令通常会为它们的参数提供简洁明了的语法(如:`-f` 和 `--force`),但是命令名字本身就不简洁明了。 -PowerShell 提供了几个机制来消除这种浮士德士的平衡。 +PowerShell 提供了几个机制来消除这种浮士德式的平衡。 -首先,tab 补齐可以消除键入参数名的需要。比如:键入 `Get-Random -Mi`,按下 Tab 然后 PowerShell 将会为你完成参数:`Get-Random -Minimum`。但是如果你想更简洁一些,你甚至不需要按下 Tab。如下所示,PowerShell 可以理解 +首先,tab 补齐可以消除键入参数名的需要。比如:键入 `Get-Random -Mi`,按下 `Tab` 然后 PowerShell 将会为你完成参数:`Get-Random -Minimum`。但是如果你想更简洁一些,你甚至不需要按下 `Tab`。如下所示,PowerShell 可以理解: ``` Get-Random -Mi 1 -Ma 10 ``` -应为 `Mi` 和 `Ma` 每一个都具有独立不同的补齐。 +因为 `Mi` 和 `Ma` 每一个都具有独立不同的补齐。 -你可能已经留意到所有的 PowerShell cmdlet 名称具有动名词结构。这有助于脚本的可读性,但是你可能不想一而再,再而三的键入 `Get-`。所以并不需要!如果你之间键入了一个名词而没有动词的话,PowerShell 将查找带有该名词的 `Get-` 命令。 +你可能已经留意到所有的 PowerShell cmdlet 名称具有动名词结构。这有助于脚本的可读性,但是你可能不想一而再、再而三的键入 `Get-`。所以并不需要!如果你之间键入了一个名词而没有动词的话,PowerShell 将查找带有该名词的 `Get-` 命令。 -小心:尽管 PowerShell 不区分大小写,但在使用 PowerShell 命令是时,名词首字母大写是一个好习惯。比如,键入 `date` 将会调用系统中的 `date` 工具。键入 `Date` 将会调用 PowerShell 的 `Get-Date` cmdlet。 +> 小心:尽管 PowerShell 不区分大小写,但在使用 PowerShell 命令是时,名词首字母大写是一个好习惯。比如,键入 `date` 将会调用系统中的 `date` 工具。键入 `Date` 将会调用 PowerShell 的 `Get-Date` cmdlet。 如果这还不够,PowerShell 还提供了别名,用来创建简单的名字。比如,如果键入 `alias -name cd`,你将会发现 `cd` 在 PowerShell 实际上时 `Set-Location` 命令的别名。 -所以回顾以下 — 你可以使用强大的 tab 补全,别名,和名词补全来保持命令名词简洁,自动化和一致性参数名截断,与此同时还可以享受丰富,可读的语法格式。 +所以回顾以下 —— 你可以使用强大的 tab 补全、别名,和名词补全来保持命令名词简洁、自动化和一致性参数名截断,与此同时还可以享受丰富、可读的语法格式。 -### 那么... 朋友? +### 那么……你看呢? -这些只是 PowerShell 的一部分优势。还有更多特性和 cmdlet,我还没讨论(如果你想弄哭 `grep` 的话,可以查看 [Where-Object][6] 或其别称 `?`)。如果你有点怀旧的话,PowerShell 可以为你加载本地工具。但是给自己足够的时间来适应 PowerShell 面向对象 cmdlet 的世界,然后你将发现自己会选择忘记回去的路。 +这些只是 PowerShell 的一部分优势。还有更多特性和 cmdlet,我还没讨论(如果你想弄哭 `grep` 的话,可以查看 [Where-Object][6] 或其别称 `?`)。如果你有点怀旧的话,PowerShell 可以为你加载原来的本地工具。但是给自己足够的时间来适应 PowerShell 面向对象 cmdlet 的世界,然后你将发现自己会选择忘记回去的路。 -------------------------------------------------------------------------------- @@ -151,7 +145,7 @@ via: https://opensource.com/article/18/2/powershell-people 作者:[Yev Bronshteyn][a] 译者:[sanfusu](https://github.com/sanfusu) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 742579f71493c3356ba2e60c054d3297c9d0dcae Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Mar 2019 10:33:02 +0800 Subject: [PATCH 661/813] PUB:20180206 Power(Shell) to the people.md @sanfusu https://linux.cn/article-10628-1.html --- .../tech => published}/20180206 Power(Shell) to the people.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180206 Power(Shell) to the people.md (100%) diff --git a/translated/tech/20180206 Power(Shell) to the people.md b/published/20180206 Power(Shell) to the people.md similarity index 100% rename from translated/tech/20180206 Power(Shell) to the people.md rename to published/20180206 Power(Shell) to the people.md From 35fe16ecf94f711d2e1273fed5781e870dcec76d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Mar 2019 10:39:11 +0800 Subject: [PATCH 662/813] PRF:20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @MjSeven --- ...work Protocol Error- On Mozilla Firefox.md | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md index f60e0969e3..2d15c686e5 100644 --- a/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md +++ b/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Fix “Network Protocol Error” On Mozilla Firefox) @@ -9,39 +9,38 @@ 如何修复 Mozilla Firefox 中出现的 “Network Protocol Error” ====== + ![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-logo-1-720x340.png) Mozilla Firefox 多年来一直是我的默认 Web 浏览器,我每天用它来进行日常网络活动,例如访问邮件,浏览喜欢的网站等。今天,我在使用 Firefox 时遇到了一个奇怪的错误。我试图在 Reddit 平台上分享我们的一个指南时,在 Firefox 上出现了以下错误消息: -``` -Network Protocol Error +> Network Protocol Error -Firefox has experienced a network protocol violation that cannot be repaired. +> Firefox has experienced a network protocol violation that cannot be repaired. -The page you are trying to view cannot be shown because an error in the network protocol was detected. +> The page you are trying to view cannot be shown because an error in the network protocol was detected. -Please contact the website owners to inform them of this problem. -``` +> Please contact the website owners to inform them of this problem. ![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox.png) 老实说,我有点慌,我以为可能是我的系统受到了某种恶意软件的影响。哈哈!但是我发现我错了。我在 Arch Linux 桌面上使用的是最新的 Firefox 版本,我在 Chromium 浏览器中打开了相同的链接,它正确显示了,我猜这是 Firefox 相关的错误。在谷歌上搜索后,我解决了这个问题,如下所述。 -出现这种问题主要是因为“**浏览器缓存**”,如果你遇到此类错误,例如 "Network Protocol Error" 或 "Corrupted Content Error",遵循以下任何一种方法。 +出现这种问题主要是因为“浏览器缓存”,如果你遇到此类错误,例如 “Network Protocol Error” 或 “Corrupted Content Error”,遵循以下任何一种方法。 -**方法 1:** +**方法 1:** -要修复 "Network Protocol Error" 或 "Corrupted Content Error",你需要在绕过缓存时重新加载网页。为此,按下 **Ctrl + F5** 或 **Ctrl + Shift + R** 快捷键,它将从服务器重新加载页面,而不是从 Firefox 缓存加载。这样网页就应该可以正常工作了。 +要修复 “Network Protocol Error” 或 “Corrupted Content Error”,你需要在重新加载网页时绕过缓存。为此,按下 `Ctrl + F5` 或 `Ctrl + Shift + R` 快捷键,它将从服务器重新加载页面,而不是从 Firefox 缓存加载。这样网页就应该可以正常工作了。 -**方法 2:** +**方法 2:** 如果方法 1 不起作用,尝试以下方法。 -打开 **Edit - > Preferences**,在 "Preferences" 窗口中,打开左窗格中的 **Privacy & Security** 选项卡,单击 **“Clear Data”** 选项清除 Firefox 缓存。 +打开 “Edit - > Preferences”,在 “Preferences” 窗口中,打开左窗格中的 “Privacy & Security” 选项卡,单击 “Clear Data” 选项清除 Firefox 缓存。 ![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-1.png) -确保你选中了 Cookies and Site Data” 和 "Cached Web Content" 选项,然后单击 **"Clear"**。 +确保你选中了 “Cookies and Site Data” 和 “Cached Web Content” 选项,然后单击 “Clear”。 ![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-2.png) @@ -58,7 +57,7 @@ via: https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-fire 作者:[SK][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 26813b90328a78ae726be671751136a8c4e96a5e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Mar 2019 10:40:10 +0800 Subject: [PATCH 663/813] PUB:20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @MjSeven https://linux.cn/article-10629-1.html --- ... How To Fix -Network Protocol Error- On Mozilla Firefox.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md (97%) diff --git a/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/published/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md similarity index 97% rename from translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md rename to published/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md index 2d15c686e5..5c44afebd1 100644 --- a/translated/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md +++ b/published/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10629-1.html) [#]: subject: (How To Fix “Network Protocol Error” On Mozilla Firefox) [#]: via: (https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 00a2bad73443736870e148db76d52cae18cdf0db Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 11:05:22 +0800 Subject: [PATCH 664/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How=20?= =?UTF-8?q?to=20create=20portable=20documents=20with=20CBZ=20and=20DjVu=20?= =?UTF-8?q?sources/tech/20190315=20How=20to=20create=20portable=20document?= =?UTF-8?q?s=20with=20CBZ=20and=20DjVu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...te portable documents with CBZ and DjVu.md | 317 ++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 sources/tech/20190315 How to create portable documents with CBZ and DjVu.md diff --git a/sources/tech/20190315 How to create portable documents with CBZ and DjVu.md b/sources/tech/20190315 How to create portable documents with CBZ and DjVu.md new file mode 100644 index 0000000000..70f292e827 --- /dev/null +++ b/sources/tech/20190315 How to create portable documents with CBZ and DjVu.md @@ -0,0 +1,317 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create portable documents with CBZ and DjVu) +[#]: via: (https://opensource.com/article/19/3/comic-book-archive-djvu) +[#]: author: (Seth Kenlon (Red Hat, Community Moderator) https://opensource.com/users/seth) + +How to create portable documents with CBZ and DjVu +====== + +Stop using PDFs with these two smart digital archive formats. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_stack_library_reading.jpg?itok=uulcS8Sw) + +Recently, I discovered that my great-great-grandfather wrote two books near the turn of the 20th century: one about sailing and the other about his career as [New York City's fire chief][1]. The books have a niche audience, but since they are part of my family history, I wanted to preserve a digital copy of each. But, I wondered, what portable document format is best suited for such an endeavor? + +I decided early on that PDF was not an option. The format, while good for printing preflight, seems condemned to nonstop feature bloat, and it produces documents that are difficult to introspect and edit. I wanted a smarter format with similar features. Two came to mind: comic book archive and DjVu. + +### Comic book archive + +[Comic book archive][2] is a simple format most often used, as the name suggests, for comic books. You can see examples of comic book archives on sites like [Comic Book Plus][3] and [The Digital Comic Museum][4]. + +The greatest feature of a comic book archive is also its weakest: it's so simple, it's almost more of a convention than a format. In fact, a comic book archive is just a ZIP, TAR, 7Z, or RAR archive given the extension .cbz, .cbt, .cb7, or .cbr, respectively. It has no standard for storing metadata. + +They are, however, very easy to create. + +#### Creating comic book archives + + 1. Create a directory full of image files, and rename the images so that they have an inherent order: + +``` +$ n=0 && for i in *.png ; do mv $i `printf %04d $n`.png ; done +``` + + + + 2. Archive the files using your favorite archive tool. In my experience, CBZ is best supported. + +``` +$ zip comicbook.zip -r *.png +``` + + + + 3. Finally, rename the file with the appropriate extension. + +``` +$ mv comicbook.zip comicbook.cbz +``` + + + + +The resulting file should open on most of your devices. On Linux, both [Evince][5] and [Okular][6] can open CBZ files. On Android, [Document Viewer][7] and [Bubble][8] can open them. + +#### Uncompressing comic book archives + +Getting your data back out of a comic book archive is also easy: just unarchive the CBZ file. + +Since your favorite archive tool may not recognize the .cbz extension as a valid archive, it's best to rename it back to its native extension: +``` + +``` + +$ mv comicbook.cbz comicbook.zip +$ unzip comicbook.zip + +### DjVu + +A more advanced format, developed more than 20 years ago by AT&T, is [DjVu][9] (pronounced "déjà vu"). It's a digital document format with advanced compression technology and is viewable in more applications than you probably realize, including [Evince][5], [Okular][6], [DjVu.js][10] online, the [DjVu.js viewer][11] Firefox extension, [GNU Emacs][12], [Document Viewer][7] on Android, and the open source, cross-platform [DjView][13] viewer on Sourceforge. + +You can read more about DjVu and find sample .djvu files, at [djvu.org][14]. + +DjVu has several appealing features, including image compression, outline (bookmark) structure, and support for embedded text. It's easy to introspect and edit using free and open source tools. + +#### Installing DjVu + +The open source toolchain is [DjVuLibre][15], which you can find in your distribution's software repository. For example, on Fedora: + +``` +$ sudo dnf install dvjulibre +``` + +#### Creating a DjVu file + +A .djvu is an image that has been encoded as a DjVu file. A .djvu can contain one or more images (stored as "pages"). + +To manually produce a DjVu, you can use one of two encoders: **c44** for high-quality images or **cjb2** for simple bi-tonal images. Each encoder accepts a different image format: c44 can process .pnm or .jpeg files, while cjb2 can process .pbm or .tiff images. + +If you need to preprocess an image, you can do that in a terminal with [Image Magick][16], using the **-density** option to define your desired resolution: + +``` +$ convert -density 200 foo.png foo.pnm +``` + +Then you can convert it to DjVu: + +``` +$ c44 -dpi 200 foo.pnm foo.djvu +``` + +If your image is simple, like black text on a white page, you can try to convert it using the simpler encoder. If necessary, use Image Magick first to convert it to a compatible intermediate format: + +``` +$ convert -density 200 foo.png foo.pbm +``` + +And then convert it to DjVu: + +``` +$ cjb2 -dpi 200 foo.pbm foo.djvu +``` + +You now have a simple, single-page .djvu document. + +#### Creating a multi-page DjVu file + +While a single-page DjVu can be useful, given DjVu's sometimes excellent compression, it's most commonly used as a multi-page format. + +Assuming you have a directory of many .djvu files, you can bundle them together with the **djvm** command: + +``` +$ djvm -c pg_1.djvu two.djvu 003.djvu mybook.djvu +``` + +Unlike a CBZ archive, the names of the bundled images have no effect on their order in the DjVu document, rather it preserves the order you provide in the command. If you had the foresight to name them in a natural sorting order (001.djvu, 002.djvu, 003.djvu, 004.djvu, and so on), you can use a wildcard: + +``` +$ djvm -c *.djvu mybook.djvu +``` + +#### Manipulating a DjVu document + +It's easy to edit DjVu documents with **djvm**. For instance, you can insert a page into an existing DjVu document: + +``` +$ djvm -i mybook.djvu newpage.djvu 2 +``` + +In this example, the page _newpage.djvu_ becomes the new page 2 in the file _mybook.djvu_. + +You can also delete a page. For example, to delete page 4 from _mybook.djvu_ : + +``` +$ djvm -d mybook.djvu 4 +``` + +#### Setting an outline + +You can add metadata to a DjVu file, such as an outline (commonly called "bookmarks"). To do this manually, create a plaintext file with the document's outline. A DjVu outline is expressed in a [Lisp][17]-like structure, with an opening **bookmarks** element followed by bookmark names and page numbers: +``` +(bookmarks +("Front cover" "#1") +("Chapter 1" "#3") +("Chapter 2" "#18") +("Chapter 3" "#26") +) +``` + +The parentheses define levels in the outline. The outline currently has only top-level bookmarks, but any section can have a subsection by delaying its closing parenthesis. For example, to add a subsection to Chapter 1: +``` +(bookmarks +("Front cover" "#1") +("Chapter 1" "#3" +("Section 1" "#6")) +("Chapter 2" "#18") +("Chapter 3" "#26") +) +``` + +Once the outline is complete, save the file and apply it to your DjVu file using the **djvused** command: + +``` +$ djvused -e 'set-outline outline.txt' -s mybook.djvu +``` + +Open the DjVu file to see the outline. + +![A DjVu with an outline as viewed in Okular][19] + +#### Embedding text + +If you want to store the text of a document you're creating, you can embed text elements ("hidden text" in **djvused** terminology) in your DjVu file so that applications like Okular or DjView can select and copy the text to a user's clipboard. + +This is a complex operation because, in order to embed text, you must first have text. If you have access to a good OCR application (or the time and dedication to transcribe the printed page), you may have that data, but then you must map the text to the bitmap image. + +Once you have the text and the coordinates for each line (or, if you prefer, for each word), you can write a **djvused** script with blocks for each page: +``` +select; remove-ant; remove-txt +# ------------------------- +select "p0004.djvu" # page 4 +set-txt +(page 0 0 2550 3300 +(line 1661 2337 2235 2369 "Fires and Fire-fighters") +(line 1761 2337 2235 2369 "by John Kenlon")) + +. +# ------------------------- +select "p0005.djvu" # page 5 +set-txt +(page 0 0 2550 3300 +(line 294 2602 1206 2642 "Some more text here, blah blah blah.")) +``` + +The integers for each line represent the minimum and maximum locations for the X and Y coordinates of each line ( **xmin** , **ymin** , **xmax** , **ymax** ). Each line is a rectangle measured in pixels, with an origin at the _bottom-left_ corner of the page. + +You can define embedded text elements as words, lines, and hyperlinks, and you can map complex regions with shapes other than just rectangles. You can also embed specially defined metadata, such as BibTex keys, which are expressed in lowercase (year, booktitle, editor, author, and so on), and DocInfo keys, borrowed from the PDF spec, always starting with an uppercase letter (Title, Author, Subject, Creator, Produced, CreationDate, ModDate, and so on). + +#### Automating DjVu creation + +While it's nice to be able to handcraft a finely detailed DjVu document, if you adopt DjVu as an everyday format, you'll notice that your applications lack some of the conveniences available in the more ubiquitous PDF. For instance, few (if any) applications offer a convenient _Print to DjVu_ or _Export to DjVu_ option, as they do for PDF. + +However, you can still use DjVu by leveraging PDF as an intermediate format. + +Unfortunately, the library required for easy, automated DjVu conversion is licensed under the CPL, which has requirements that cannot be satisfied by the GPL code in the toolchain. For this reason, it can't be distributed as a compiled library, but you're free to compile it yourself. + +The process is relatively simple due to an excellent build script provided by the DjVuLibre team. + + 1. First, prepare your system with software development tools. On Fedora, the quick-and-easy way is with a DNF group: + +``` +$ sudo dnf group install @c-development +``` + +On Ubuntu: + +``` +$ sudo apt-get install build-essential +``` + + + + 2. Next, download the [**GSDjVu** source code][20] from Sourceforge. Be sure to download **GSDjVu** , not **DjVuLibre** (in other words, don't click on the big green button at the top of the file listing, but on the latest file instead). + + + 3. Unarchive the file you just downloaded, and change directory into it: +``` +$ cd ~/Downloads +$ tar xvf gsdjvu-X.YY.tar.gz +$ cd gsdjvu-X.YY +``` + + + + 4. Create a directory called **BUILD**. It must be called **BUILD** , so quell your creativity: +``` +$ mkdir BUILD +$ cd BUILD +``` + + + + 5. Download the additional source packages required to build the **GSDjVu **application. Specifically, you must download the source for **Ghostscript** (you almost certainly already have this installed, but you need its source to build against). Additionally, your system must have source packages for **jpeg** , **libpng** , **openjpeg** , and **zlib**. If you think your system already has the source packages for these projects, you can run the build script; if the sources are not found, the script will fail and let you correct the error before trying again. + + + 6. Run the interactive **build-gsdjvu** build script included in the download. This script unpacks the source files, patches Ghostscript with the **gdevdjvu** driver, compiles Ghostscript, and prunes unnecessary files from the build results. + + + 7. You can install **GSDjVu **anywhere in your path. If you don't know what your **PATH** variable is, you can see it with **echo $PATH**. For example, to install it to the **/usr/local** prefix: +``` +$ sudo cp -r BUILD/INST/gsdjvu /usr/local/lib64 +$ cd /usr/local/bin +$ sudo ln -s ../lib64/gsdjvu/gsdjvu gsdjvu +``` + + + + +#### Converting a PDF to DjVu + +Now that you've built the Ghostscript driver, converting a PDF to DjVu requires just one command: + +``` +$ djvudigital --words mydocument.pdf mydocument.djvu +``` + +This transforms all pages, bookmarks, and embedded text in a PDF into a DjVu file. The `--words` option maps all mapped embedded PDF text to the corresponding points in the DjVu file. If there is no embedded PDF, then no embedded text is carried over. Using this tool, you can use convenient PDF functions from your applications and end up with DjVu files. + +### Why DjVu and CBZ? + +DjVu and comic book archive are great additional document formats for your archival arsenal. It seems silly to stuff a series of images into a PostScript format, like PDF, or a format clearly meant mostly for text, like EPUB, so it's nice to have CBZ and DjVu as additional options. They might not be right for all of your documents, but it's good to get comfortable with them so you can use one when it makes the most sense. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/comic-book-archive-djvu + +作者:[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://www.fireengineering.com/articles/print/volume-56/issue-27/features/chief-john-kenlon-of-new-york-city.html +[2]: https://en.wikipedia.org/wiki/Comic_book_archive +[3]: https://comicbookplus.com/ +[4]: https://digitalcomicmuseum.com/ +[5]: https://wiki.gnome.org/Apps/Evince +[6]: https://okular.kde.org +[7]: https://f-droid.org/en/packages/org.sufficientlysecure.viewer/ +[8]: https://f-droid.org/en/packages/com.nkanaev.comics/ +[9]: http://djvu.org/ +[10]: http://djvu.js.org/ +[11]: https://github.com/RussCoder/djvujs +[12]: https://elpa.gnu.org/packages/djvu.html +[13]: http://djvu.sourceforge.net/djview4.html +[14]: http://djvu.org +[15]: http://djvu.sourceforge.net +[16]: https://www.imagemagick.org/ +[17]: https://en.wikipedia.org/wiki/Lisp_(programming_language) +[18]: /file/426061 +[19]: https://opensource.com/sites/default/files/uploads/outline.png (A DjVu with an outline as viewed in Okular) +[20]: https://sourceforge.net/projects/djvu/files/GSDjVu/1.10/ From 021cbf308981e16775adaacc82f6f4ed3e8d7563 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 11:09:34 +0800 Subject: [PATCH 665/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20Sweet?= =?UTF-8?q?=20Home=203D:=20An=20open=20source=20tool=20to=20help=20you=20d?= =?UTF-8?q?ecide=20on=20your=20dream=20home=20sources/tech/20190315=20Swee?= =?UTF-8?q?t=20Home=203D-=20An=20open=20source=20tool=20to=20help=20you=20?= =?UTF-8?q?decide=20on=20your=20dream=20home.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...l to help you decide on your dream home.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md diff --git a/sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md b/sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md new file mode 100644 index 0000000000..63c9e5f282 --- /dev/null +++ b/sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sweet Home 3D: An open source tool to help you decide on your dream home) +[#]: via: (https://opensource.com/article/19/3/tool-find-home) +[#]: author: (Jeff Macharyas (Community Moderator) ) + +Sweet Home 3D: An open source tool to help you decide on your dream home +====== + +Interior design application makes it easy to render your favorite house—real or imaginary. + +![Houses in a row][1] + +I recently accepted a new job in Virginia. Since my wife was working and watching our house in New York until it sold, it was my responsibility to go out and find a new house for us and our cat. A house that she would not see until we moved into it! + +I contracted with a real estate agent and looked at a few houses, taking many pictures and writing down illegible notes. At night, I would upload the photos into a Google Drive folder, and my wife and I would review them simultaneously over the phone while I tried to remember whether the room was on the right or the left, whether it had a fan, etc. + +Since this was a rather tedious and not very accurate way to present my findings, I went in search of an open source solution to better illustrate what our future dream house would look like that wouldn't hinge on my fuzzy memory and blurry photos. + +[Sweet Home 3D][2] did exactly what I wanted it to do. Sweet Home 3D is available on Sourceforge and released under the GNU General Public License. The [website][3] is very informative, and I was able to get it up and running in no time. Sweet Home 3D was developed by Paris-based Emmanuel Puybaret of eTeks. + +### Hanging the drywall + +I downloaded Sweet Home 3D onto my MacBook Pro and added a PNG version of a flat floorplan of a house to use as a background base map. + +From there, it was a simple matter of using the Rooms palette to trace the pattern and set the "real life" dimensions. After I mapped the rooms, I added the walls, which I could customize by color, thickness, height, etc. + +![Sweet Home 3D floorplan][5] + +Now that I had the "drywall" built, I downloaded various pieces of "furniture" from a large array that includes actual furniture as well as doors, windows, shelves, and more. Each item downloads as a ZIP file, so I created a folder of all my uncompressed pieces. I could customize each piece of furniture, and repetitive items, such as doors, were easy to copy-and-paste into place. + +Once I had all my walls and doors and windows in place, I used the application's 3D view to navigate through the house. Drawing upon my photos and memory, I made adjustments to all the objects until I had a close representation of the house. I could have spent more time modifying the house by adding textures, additional furniture, and objects, but I got it to the point I needed. + +![Sweet Home 3D floorplan][7] + +After I finished, I exported the plan as an OBJ file, which can be opened in a variety of programs, such as [Blender][8] and Preview on the Mac, to spin the house around and examine it from various angles. The Video function was most useful, as I could create a starting point, draw a path through the house, and record the "journey." I exported the video as a MOV file, which I opened and viewed on the Mac using QuickTime. + +My wife was able to see (almost) exactly what I saw, and we could even start arranging furniture ahead of the move, too. Now, all I have to do is load up the moving truck and head south. + +Sweet Home 3D will also prove useful at my new job. I was looking for a way to improve the map of the college's buildings and was planning to just re-draw it in [Inkscape][9] or Illustrator or something. However, since I have the flat map, I can use Sweet Home 3D to create a 3D version of the floorplan and upload it to our website to make finding the bathrooms so much easier! + +### An open source crime scene? + +An interesting aside: according to the [Sweet Home 3D blog][10], "the French Forensic Police Office (Scientific Police) recently chose Sweet Home 3D as a tool to design plans [to represent roads and crime scenes]. This is a concrete application of the recommendation of the French government to give the preference to free open source solutions." + +This is one more bit of evidence of how open source solutions are being used by citizens and governments to create personal projects, solve crimes, and build worlds. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/tool-find-home + +作者:[Jeff Macharyas (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]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row) +[2]: https://sourceforge.net/projects/sweethome3d/ +[3]: http://www.sweethome3d.com/ +[4]: /file/426441 +[5]: https://opensource.com/sites/default/files/uploads/virginia-house-create-screenshot.png (Sweet Home 3D floorplan) +[6]: /file/426451 +[7]: https://opensource.com/sites/default/files/uploads/virginia-house-3d-screenshot.png (Sweet Home 3D floorplan) +[8]: https://opensource.com/article/18/5/blender-hotkey-cheat-sheet +[9]: https://opensource.com/article/19/1/inkscape-cheat-sheet +[10]: http://www.sweethome3d.com/blog/2018/12/10/customization_for_the_forensic_police.html From 9d31ac816598c5afd407e171431558a00fa8bf1a Mon Sep 17 00:00:00 2001 From: sanfusu <34563541+sanfusu@users.noreply.github.com> Date: Mon, 18 Mar 2019 14:42:59 +0800 Subject: [PATCH 666/813] translation finished --- ...Blockchain 2.0- An Introduction -Part 1.md | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md index 0594433893..f9f08eca24 100644 --- a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md +++ b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md @@ -1,59 +1,56 @@ -[#]: collector: (lujun9972) -[#]: translator: (sanfusu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0: An Introduction [Part 1]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction/) -[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) +[#]: collector: "lujun9972" +[#]: translator: "sanfusu " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Blockchain 2.0: An Introduction [Part 1]" +[#]: via: "https://www.ostechnix.com/blockchain-2-0-an-introduction/" +[#]: author: "EDITOR https://www.ostechnix.com/author/editor/" -Blockchain 2.0: An Introduction [Part 1] -====== +# 区块链 2.0: 一份介绍 [Part 1] ![](https://www.ostechnix.com/wp-content/uploads/2019/03/blockchain-introduction-720x340.png) -### Blockchain 2.0 – The next paradigm of computing +### 区块链 2.0 - 下一个计算范式 -The **Blockchain** is now easily distinguishable as a transformational technology poised to bring in revolutionary changes in the way people use the internet. The present series of posts will explore the upcoming wave of Blockchain 2.0 based technologies and applications. The Blockchain is here to stay as evidenced by the tremendous interest in it shown by different stakeholders. +**区块链**现在被认为是一种转型技术,它将为人们使用互联网的方式带来革新。本系列文章将探讨即将到来的基于区块链 2.0 的技术和应用。不同的涉众对它表现出的极大兴趣证明了区块链的存在。 -Staying on top of what it is and how it works is paramount to anyone who plans on using the internet for literally anything. Even if all you do is just stare at your friends’ morning breakfast pics on Instagram or looking for the next best clip to watch, you need to know what this technology can do to all of that. +对于任何打算使用互联网做任何事情的人来说,了解它是什么以及它是如何工作的都是至关重要的。即使你所做的只是盯着 Instagram 上朋友们的早餐照片,或者寻找下一个最好的视频片段,你也需要知道这项技术能对这些提供什么样的帮助。 -Even though the basic concept behind the Blockchain was first talked about in academia in the **1990s** , its prominence to being a trending buzzword among netizens is owed to the rise of payment platforms such as **Bitcoins** and **Ethers**. +尽管区块链的基本概念早在上世纪 90 年代就被学术界提及,但它之所以成为网民热词,要归功于诸如**比特币**和 **Ethers** 等支付平台的崛起。 -Bitcoin started off as a decentralized digital currency. Its advent meant that you could basically pay people over the internet being totally anonymous, safe and secure. What lay beneath the simple financial token system that was bitcoin though was the BLOCKCHAIN. You can think of Bitcoin technology or any cryptocurrency for that matter as being built up from 3 layers. There’s the foundational Blockchain tech that verifies, records and confirms transactions, on top of the foundation rests the protocol, basically, a rule or an online etiquette to honor, record and confirm transactions and of course, on top of it all is the cryptocurrency token commonly called Bitcoin. A token is generated by the Blockchain once a transaction respecting the protocol is recorded on it. +比特币最初是一种去中心化的数字货币。它的出现意味着你基本上可以通过互联网进行完全匿名,安全可靠的支付。不过,在比特币这个简单的金融令牌系统背后,是区块链。您可以将比特币技术或任何加密货币看作是 3 层结构。区块链基础技术包括验证、记录和确认交易,在这个基础之上是协议,本质上来讲是一个规则或在线礼仪,用来尊重、记录和确认交易,当然,最重要的是通常被称作比特币的加密货币令牌。一旦记录了协议相关的事务,区块链就会生成令牌。 -While most people only saw the top layer, the coins or tokens being representative of what bitcoin really was, few ventured deep enough to understand that financial transactions were just one of many such possibilities that could be accomplished with the help of the Blockchain foundation. These possibilities are now being explored to generate and develop new standards for decentralizing all manners of transactions. +虽然大多数人只看到了最顶层,即代表比特币真正含义的硬币或代币,但很少有人敢于深入了解,在区块链基金会的帮助下,金融交易只是众多此类可能性中的一种。目前正在探讨这些可能性,以产生和开发所有去中心化交易方式的新标准。 -At its very basic level, the Blockchain can be thought of as an all-encompassing ledger of records and transactions. This in effect means that all kinds of records can theoretically be handled by the Blockchain. Developments in this area will possibly in the future result in all kinds of hard (Such as real estate deeds, physical keys, etc.) and soft intangible assets (Such as identity records, patents, trademarks, reservations etc.) can be encoded as digital assets to be protected and transferred via the blockchain. +在最基本的层次上,区块链可以被认为是一个包含所有记录和交易的账簿。这实际上意味着区块链理论上可以处理所有类型的记录。未来这方面的发展可能会导致各种硬资产(如房地产契约、实物钥匙等)和软无形资产(如身份记录、专利、商标、预约等)被编码为数字资产,通过区块链进行保护和转让。 -For the uninitiated, transactions on the Blockchain are inherently thought of and designed to be unbiased, permanent records. This is possible because of a **“consensus system”** that is built into the protocol. All transactions are confirmed, vetted and recorded by the participants of the system, in the case of the Bitcoin cryptocurrency platform, this role is taken care of by **miners** and exchanges. This can vary from platform to platform or from blockchain to blockchain. The protocol stack on which the platform is built is by definition supposed to be open-source and free for anyone with the technical know-how to verify. Transparency is woven into the system unlike much of the other platforms that the internet currently runs on. +对于不熟悉区块链的人来说,区块链上的事务本质上被认为是无偏见的永久记录。这是可能的,因为协议中内置了**共识系统**。所有交易均由系统参与者确认、审核和记录,在比特币加密货币平台中,该角色由**矿商**和交易所负责。这可能因平台而异,也可能因区块链到区块链而异。根据定义,构建该平台的协议栈应该是开放源码的,并且对任何具有技术能力的人都是免费的。与目前互联网上运行的许多其他平台不同,该系统内置了透明度。 -Once transactions are recorded and coded into the Blockchain, they will be seen through. Participants are bound to honor their transactions and contracts the way they were originally intended to be executed. The execution itself will be automatically taken care of by the platform since it’s hardcoded into it, unless of course if the original terms forbid it. This resilience of the Blockchain platform toward attempts of tampering with records, permanency of the records etc., are hitherto unheard of for something working over the internet. This is the added layer of trust that is often talked about while supporters of the technology claim its rising significance. +一旦事务被记录并编码到区块链中,它们就会被看穿。参与者有义务按照他们最初打算执行的方式履行他们的交易和合同。除非最初的条款禁止执行,否则执行本身将由平台自动处理,因为它是硬编码的。区块链平台对于试图篡改记录、记录的持久性等方面的恢复能力,在因特网上是闻所未闻的。当这项技术的支持者们宣称其日益重要的意义时,这种能力是经常被提及的附加信任层。 -These features are not recently discovered hidden potentials of the platform, these were envisioned from the start. In a communique, **Satoshi Nakamoto** , the fabled creator(s) of Bitcoin mentioned, **“the design supports a tremendous variety of possible transaction types that I designed years ago… If Bitcoin catches on in a big way, these are things we’ll want to explore in the future… but they all had to be designed at the beginning to make sure they would be possible later.”**. Cementing the fact that these features are designed and baked into the already existing protocols. The key idea being that the decentralized transaction ledger like the functionality of the Blockchain could be used to transfer, deploy and execute all manner of contracts. +这些特性并不是最近发现的隐藏的平台潜力,而是从一开始就被设想出来的。公报中,**Satoshi Nakamoto(中本聪)**,传说中的比特币创造者,**“我花了数年的时间来构造一个用来支撑巨大的各种可能事务类型的设计……如果比特币能够流行起来,这些都是我们未来要探索的……但是他们从设计之初,就要确保他们以后可能性。”**。结合这样一个事实,即这些特性被设计并融入到已经存在的协议中。关键的想法是,去中性化的事务分类账(如区块链的功能)可以用于传输、部署和执行各种形式的契约。 -Leading institutions are currently exploring the possibility of re-inventing financial instruments such as stocks, pensions, and derivatives, while governments all over the world are concerned more with the tamper-proof permanent record keeping potential of the Blockchain. Supporters of the platform claim that once development reaches a critical threshold, everything from your hotel key cards to copyrights and patents will from then on be recorded and implemented via the use of Blockchains. +领先机构目前正在探索重新发明股票、养老金和衍生品等金融工具的可能性,而世界各国政府更关注区块链的防篡改和永久性保存记录的潜力。该平台的支持者声称,一旦开发达到一个关键的门槛,从你的酒店钥匙卡到版权和专利,那时起,一切都将通过区块链记录和实现。 -An almost full list of items and particulars that could theoretically be implemented via a Blockchain model is compiled and maintained on [**this**][1] page by **Ledra Capital**. A thought experiment to actually realize how much of our lives the Blockchain might effect is a daunting task, but a look at that list will reiterate the importance of doing so. +**Ledra Capital**在[**这个**][1]页面上编译并维护了几乎完整的项目和细节列表,这些项目和细节理论上可以通过区块链模型实现。想要真正意识到区块链对我们生活的影响有多大是一项艰巨的任务,但看看这个清单就会重申这么做的重要性。 -Now, all of the bureaucratic and commercial uses mentioned above might lead you to believe that a technology such as this will be solely in the domain of Governments and Large private corporations. However, the truth is far from that. Given the fact that the vast potentials of the system make it attractive for such uses, there are other possibilities and features harbored by Blockchains. There are other more intricate concepts related to the technology such as **DApps** , **DAOs** , **DACs** , **DASs** etc., more of which will be covered in depth in this series of articles. +现在,上面提到的所有官僚和商业用途可能会让你相信,这样的技术只会出现在政府和大型私营企业领域。然而,事实远非如此。鉴于该系统的巨大潜力使其对此类用途具有吸引力,区块链还具有其他可能性和特性。还有一些与该技术相关的更复杂的概念,如**DApps**、**DAOs**、**DACs**、**DASs**等,本系列文章将深入讨论这些概念。 -Basically, development is going on in full swing and its early for anyone to comment on definitions, standards, and capabilities of such Blockchain based systems for a wider roll-out, but the possibilities and its imminent effects are doubtless. There are even talks about Blockchain based smartphones and polling during elections. +基本上,开发正在如火如荼地进行,任何人都还没有来得及对基于区块链的系统的定义、标准和功能进行评论,以便进行更广泛的推广,但是这种可能性及其即将产生的影响无疑是存在的。甚至有人谈到基于区块链的智能手机和选举期间的投票。 -This was just a brief birds-eye view of what the platform is capable of. We’ll look at the distinct possibilities through a series of such detailed posts and articles. Keep an eye out for the [**next post of the series**][2], which will explore how the Blockchain is revolutionizing transactions and contracts. +这只是一个简短的鸟瞰平台的能力。我们将通过一系列这样详细的帖子和文章来研究这些不同的可能性。关注[**本系列的下一篇文章**][2],它将探索区块链是如何革新交易和契约的。 - - --------------------------------------------------------------------------------- +--- via: https://www.ostechnix.com/blockchain-2-0-an-introduction/ 作者:[EDITOR][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[译者 ID](https://github.com/译者ID) +校对:[校对者 ID](https://github.com/校对者ID) -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/) 荣誉推出 [a]: https://www.ostechnix.com/author/editor/ [b]: https://github.com/lujun9972 From 518ee2e655457e2e84f04e6b174dff0ca8fd2b00 Mon Sep 17 00:00:00 2001 From: sanfusu <34563541+sanfusu@users.noreply.github.com> Date: Mon, 18 Mar 2019 14:42:59 +0800 Subject: [PATCH 667/813] translation finished --- ...Blockchain 2.0- An Introduction -Part 1.md | 61 ------------------- ...Blockchain 2.0- An Introduction -Part 1.md | 58 ++++++++++++++++++ 2 files changed, 58 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md create mode 100644 translated/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md diff --git a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md deleted file mode 100644 index 0594433893..0000000000 --- a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (sanfusu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0: An Introduction [Part 1]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction/) -[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) - -Blockchain 2.0: An Introduction [Part 1] -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/03/blockchain-introduction-720x340.png) - -### Blockchain 2.0 – The next paradigm of computing - -The **Blockchain** is now easily distinguishable as a transformational technology poised to bring in revolutionary changes in the way people use the internet. The present series of posts will explore the upcoming wave of Blockchain 2.0 based technologies and applications. The Blockchain is here to stay as evidenced by the tremendous interest in it shown by different stakeholders. - -Staying on top of what it is and how it works is paramount to anyone who plans on using the internet for literally anything. Even if all you do is just stare at your friends’ morning breakfast pics on Instagram or looking for the next best clip to watch, you need to know what this technology can do to all of that. - -Even though the basic concept behind the Blockchain was first talked about in academia in the **1990s** , its prominence to being a trending buzzword among netizens is owed to the rise of payment platforms such as **Bitcoins** and **Ethers**. - -Bitcoin started off as a decentralized digital currency. Its advent meant that you could basically pay people over the internet being totally anonymous, safe and secure. What lay beneath the simple financial token system that was bitcoin though was the BLOCKCHAIN. You can think of Bitcoin technology or any cryptocurrency for that matter as being built up from 3 layers. There’s the foundational Blockchain tech that verifies, records and confirms transactions, on top of the foundation rests the protocol, basically, a rule or an online etiquette to honor, record and confirm transactions and of course, on top of it all is the cryptocurrency token commonly called Bitcoin. A token is generated by the Blockchain once a transaction respecting the protocol is recorded on it. - -While most people only saw the top layer, the coins or tokens being representative of what bitcoin really was, few ventured deep enough to understand that financial transactions were just one of many such possibilities that could be accomplished with the help of the Blockchain foundation. These possibilities are now being explored to generate and develop new standards for decentralizing all manners of transactions. - -At its very basic level, the Blockchain can be thought of as an all-encompassing ledger of records and transactions. This in effect means that all kinds of records can theoretically be handled by the Blockchain. Developments in this area will possibly in the future result in all kinds of hard (Such as real estate deeds, physical keys, etc.) and soft intangible assets (Such as identity records, patents, trademarks, reservations etc.) can be encoded as digital assets to be protected and transferred via the blockchain. - -For the uninitiated, transactions on the Blockchain are inherently thought of and designed to be unbiased, permanent records. This is possible because of a **“consensus system”** that is built into the protocol. All transactions are confirmed, vetted and recorded by the participants of the system, in the case of the Bitcoin cryptocurrency platform, this role is taken care of by **miners** and exchanges. This can vary from platform to platform or from blockchain to blockchain. The protocol stack on which the platform is built is by definition supposed to be open-source and free for anyone with the technical know-how to verify. Transparency is woven into the system unlike much of the other platforms that the internet currently runs on. - -Once transactions are recorded and coded into the Blockchain, they will be seen through. Participants are bound to honor their transactions and contracts the way they were originally intended to be executed. The execution itself will be automatically taken care of by the platform since it’s hardcoded into it, unless of course if the original terms forbid it. This resilience of the Blockchain platform toward attempts of tampering with records, permanency of the records etc., are hitherto unheard of for something working over the internet. This is the added layer of trust that is often talked about while supporters of the technology claim its rising significance. - -These features are not recently discovered hidden potentials of the platform, these were envisioned from the start. In a communique, **Satoshi Nakamoto** , the fabled creator(s) of Bitcoin mentioned, **“the design supports a tremendous variety of possible transaction types that I designed years ago… If Bitcoin catches on in a big way, these are things we’ll want to explore in the future… but they all had to be designed at the beginning to make sure they would be possible later.”**. Cementing the fact that these features are designed and baked into the already existing protocols. The key idea being that the decentralized transaction ledger like the functionality of the Blockchain could be used to transfer, deploy and execute all manner of contracts. - -Leading institutions are currently exploring the possibility of re-inventing financial instruments such as stocks, pensions, and derivatives, while governments all over the world are concerned more with the tamper-proof permanent record keeping potential of the Blockchain. Supporters of the platform claim that once development reaches a critical threshold, everything from your hotel key cards to copyrights and patents will from then on be recorded and implemented via the use of Blockchains. - -An almost full list of items and particulars that could theoretically be implemented via a Blockchain model is compiled and maintained on [**this**][1] page by **Ledra Capital**. A thought experiment to actually realize how much of our lives the Blockchain might effect is a daunting task, but a look at that list will reiterate the importance of doing so. - -Now, all of the bureaucratic and commercial uses mentioned above might lead you to believe that a technology such as this will be solely in the domain of Governments and Large private corporations. However, the truth is far from that. Given the fact that the vast potentials of the system make it attractive for such uses, there are other possibilities and features harbored by Blockchains. There are other more intricate concepts related to the technology such as **DApps** , **DAOs** , **DACs** , **DASs** etc., more of which will be covered in depth in this series of articles. - -Basically, development is going on in full swing and its early for anyone to comment on definitions, standards, and capabilities of such Blockchain based systems for a wider roll-out, but the possibilities and its imminent effects are doubtless. There are even talks about Blockchain based smartphones and polling during elections. - -This was just a brief birds-eye view of what the platform is capable of. We’ll look at the distinct possibilities through a series of such detailed posts and articles. Keep an eye out for the [**next post of the series**][2], which will explore how the Blockchain is revolutionizing transactions and contracts. - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/blockchain-2-0-an-introduction/ - -作者:[EDITOR][a] -选题:[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/editor/ -[b]: https://github.com/lujun9972 -[1]: http://ledracapital.com/blog/2014/3/11/bitcoin-series-24-the-mega-master-blockchain-list -[2]: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ diff --git a/translated/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md b/translated/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md new file mode 100644 index 0000000000..a91055011c --- /dev/null +++ b/translated/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md @@ -0,0 +1,58 @@ +[#]: collector: "lujun9972" +[#]: translator: "sanfusu " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Blockchain 2.0: An Introduction [Part 1]" +[#]: via: "https://www.ostechnix.com/blockchain-2-0-an-introduction/" +[#]: author: "EDITOR https://www.ostechnix.com/author/editor/" + +# 区块链 2.0: 一份介绍 [Part 1] + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/blockchain-introduction-720x340.png) + +### 区块链 2.0 - 下一个计算范式 + +**区块链**现在被认为是一种转型技术,它将为人们使用互联网的方式带来革新。本系列文章将探讨即将到来的基于区块链 2.0 的技术和应用。不同的涉众对它表现出的极大兴趣证明了区块链的存在。 + +对于任何打算使用互联网做任何事情的人来说,了解它是什么以及它是如何工作的都是至关重要的。即使你所做的只是盯着 Instagram 上朋友们的早餐照片,或者寻找下一个最好的视频片段,你也需要知道这项技术能对这些提供什么样的帮助。 + +尽管区块链的基本概念早在上世纪 90 年代就被学术界提及,但它之所以成为网民热词,要归功于诸如**比特币**和 **Ethers** 等支付平台的崛起。 + +比特币最初是一种去中心化的数字货币。它的出现意味着你基本上可以通过互联网进行完全匿名,安全可靠的支付。不过,在比特币这个简单的金融令牌系统背后,是区块链。您可以将比特币技术或任何加密货币看作是 3 层结构。区块链基础技术包括验证、记录和确认交易,在这个基础之上是协议,本质上来讲是一个规则或在线礼仪,用来尊重、记录和确认交易,当然,最重要的是通常被称作比特币的加密货币令牌。一旦记录了协议相关的事务,区块链就会生成令牌。 + +虽然大多数人只看到了最顶层,即代表比特币真正含义的硬币或代币,但很少有人敢于深入了解,在区块链基金会的帮助下,金融交易只是众多此类可能性中的一种。目前正在探讨这些可能性,以产生和开发所有去中心化交易方式的新标准。 + +在最基本的层次上,区块链可以被认为是一个包含所有记录和交易的账簿。这实际上意味着区块链理论上可以处理所有类型的记录。未来这方面的发展可能会导致各种硬资产(如房地产契约、实物钥匙等)和软无形资产(如身份记录、专利、商标、预约等)被编码为数字资产,通过区块链进行保护和转让。 + +对于不熟悉区块链的人来说,区块链上的事务本质上被认为是无偏见的永久记录。这是可能的,因为协议中内置了**共识系统**。所有交易均由系统参与者确认、审核和记录,在比特币加密货币平台中,该角色由**矿商**和交易所负责。这可能因平台而异,也可能因区块链到区块链而异。根据定义,构建该平台的协议栈应该是开放源码的,并且对任何具有技术能力的人都是免费的。与目前互联网上运行的许多其他平台不同,该系统内置了透明度。 + +一旦事务被记录并编码到区块链中,它们就会被看穿。参与者有义务按照他们最初打算执行的方式履行他们的交易和合同。除非最初的条款禁止执行,否则执行本身将由平台自动处理,因为它是硬编码的。区块链平台对于试图篡改记录、记录的持久性等方面的恢复能力,在因特网上是闻所未闻的。当这项技术的支持者们宣称其日益重要的意义时,这种能力是经常被提及的附加信任层。 + +这些特性并不是最近发现的隐藏的平台潜力,而是从一开始就被设想出来的。公报中,**Satoshi Nakamoto(中本聪)**,传说中的比特币创造者,**“我花了数年的时间来构造一个用来支撑巨大的各种可能事务类型的设计……如果比特币能够流行起来,这些都是我们未来要探索的……但是他们从设计之初,就要确保他们以后可能性。”**。结合这样一个事实,即这些特性被设计并融入到已经存在的协议中。关键的想法是,去中性化的事务分类账(如区块链的功能)可以用于传输、部署和执行各种形式的契约。 + +领先机构目前正在探索重新发明股票、养老金和衍生品等金融工具的可能性,而世界各国政府更关注区块链的防篡改和永久性保存记录的潜力。该平台的支持者声称,一旦开发达到一个关键的门槛,从你的酒店钥匙卡到版权和专利,那时起,一切都将通过区块链记录和实现。 + +**Ledra Capital**在[**这个**][1]页面上编译并维护了几乎完整的项目和细节列表,这些项目和细节理论上可以通过区块链模型实现。想要真正意识到区块链对我们生活的影响有多大是一项艰巨的任务,但看看这个清单就会重申这么做的重要性。 + +现在,上面提到的所有官僚和商业用途可能会让你相信,这样的技术只会出现在政府和大型私营企业领域。然而,事实远非如此。鉴于该系统的巨大潜力使其对此类用途具有吸引力,区块链还具有其他可能性和特性。还有一些与该技术相关的更复杂的概念,如**DApps**、**DAOs**、**DACs**、**DASs**等,本系列文章将深入讨论这些概念。 + +基本上,开发正在如火如荼地进行,任何人都还没有来得及对基于区块链的系统的定义、标准和功能进行评论,以便进行更广泛的推广,但是这种可能性及其即将产生的影响无疑是存在的。甚至有人谈到基于区块链的智能手机和选举期间的投票。 + +这只是一个简短的鸟瞰平台的能力。我们将通过一系列这样详细的帖子和文章来研究这些不同的可能性。关注[**本系列的下一篇文章**][2],它将探索区块链是如何革新交易和契约的。 + +--- + +via: https://www.ostechnix.com/blockchain-2-0-an-introduction/ + +作者:[EDITOR][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 +[1]: http://ledracapital.com/blog/2014/3/11/bitcoin-series-24-the-mega-master-blockchain-list +[2]: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ From 02326a55c1ca79e5408cf829d3cba2727be0267b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 14:53:23 +0800 Subject: [PATCH 668/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=20Why=20?= =?UTF-8?q?feedback,=20not=20metrics,=20is=20critical=20to=20DevOps=20sour?= =?UTF-8?q?ces/talk/20190314=20Why=20feedback,=20not=20metrics,=20is=20cri?= =?UTF-8?q?tical=20to=20DevOps.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ack, not metrics, is critical to DevOps.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md diff --git a/sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md b/sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md new file mode 100644 index 0000000000..b2a79226ed --- /dev/null +++ b/sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why feedback, not metrics, is critical to DevOps) +[#]: via: (https://opensource.com/article/19/3/devops-feedback-not-metrics) +[#]: author: (Ranjith Varakantam (Red Hat) https://opensource.com/users/ranjith) + +Why feedback, not metrics, is critical to DevOps +====== + +Metrics can tell you some things, but not the most important things about how your products and teams are doing. + +![CICD with gears][1] + +Most managers and agile coaches depend on metrics over feedback from their teams, users, and even customers. In fact, quite a few use feedback and metrics synonymously, where they present feedback from teams or customers as a bunch of numbers or a graphical representation of those numbers. This is not only unfortunate, but it can be misleading as it presents only part of the story and not the entire truth. + +When it comes to two critical factors—how we manage or guide our teams and how we operate and influence the product that our teams are developing—few exceptional leaders and teams get it right. For one thing, it has become very easy to get your hands on data and metrics. Furthermore, it's still hard to get real feedback from teams and users. It requires significant investments and energy, and unless everyone understands the critical need for it, getting and giving feedback tends to be a low priority and keeps getting pushed to the back burner. + +### How to manage and guide teams + +With the acceptance of agile, a lot of teams have put a ridiculously high value on metrics, such as velocity, burndown charts, cumulative flow diagram (CFD), etc., instead of the value delivered by the team in each iteration or deployment. The focus is on the delivery or output produced without a clear understanding of how this relates to personal performance or implications for the project, product, or service. + +A few managers and agile coaches even abuse the true spirit of agile by misusing metrics to chastise or even penalize their teams. Instead of creating an environment of empowerment, they are slipping back into the command-and-control method where metrics are used to bully teams into submission. + +In our group, the best managers have weekly one-on-one meetings with every team member. These meetings not only give them a real pulse on team morale but also a profound understanding of the project and the decisions being made to move it forward. This weekly feedback loop also helps the team members communicate technical, functional, and even personal issues better. As a result, the team is much more cohesive in understanding the overall project needs and able to make decisions promptly. + +These leaders also skip levels—reaching out to team members two or three levels below them—and have frequent conversations with other group members who interact with their teams on a regular basis. These actions give the managers a holistic picture, which they couldn't get if they relied on feedback from one manager or lead, and help them identify any blind spots the leads and managers may have. + +These one-on-one meetings effectively transform a manager into a coach who has a close understanding of every team member. Like a good coach, these managers both give and receive feedback from the team members regarding the product, decision-making transparency, places where the team feels management is lagging, and areas that are being ignored. This empowers the teams by giving them a voice, not once in a while in an annual meeting or an annual survey, but every week. This is the level where DevOps teams should be in order to deliver their commitments successfully. + +This demands significant investments of time and energy, but the results more than justify it. The alternative is to rely on metrics and annual reviews and surveys, which has failed miserably. Unless we begin valuing feedback over metrics, we will keep seeing the metrics we want to see but failed projects and miserable team morale. + +### Influencing projects and product development + +We see similar behavior on the project or product side, with too few conversations with the users and developers and too much focus on metrics. Let's take the example of a piece of software that was released to the community or market, and the primary success metric is the number of downloads or installs. This can be deceiving for several reasons: + + 1. This product was packaged into another piece of software that users installed; even though the users are not even aware of your product's existence or purpose, it is still counted as a win and something the user needs. + + 2. The marketing team spent a huge budget promoting the product—and even offered an incentive to developers to download it. The _incentive_ drives the downloads, not user need or desire, but the metric is still considered a measure of success. + + 3. Software updates are counted as downloads, even when they are involuntary updates pushed rather than initiated by the user. This keeps bumping up the number, even though the user might have used it once, a year ago, for a specific task. + + + + +In these cases, the user automatically becomes a metric that's used to report how well the product is doing, just based on the fact it was downloaded and it's accepting updates, regardless of whether the user likes or uses the software. Instead, we should be focusing on actual usage of the product and the feedback these users have to offer us, rather than stopping short at the download numbers. + +The same holds true for SaaS products—instead of counting the number of signups, we should look at how often users use the product or service. Signups by themselves have little meaning, especially to the DevOps team where the focus is on getting constant feedback and striving for continuous improvements. + +### Gathering feedback + +So, why do we rely on metrics so much? My guess is they are easy to collect, and the marketing team is more interested in getting the product into the users' hands than evaluating how it is fairing. Unless the engineering team invests quite a bit of time in collecting feedback with tracing, which captures how often the program is executed and which components are used most often, it can be difficult to collect feedback. + +A big advantage of working in an open source community is that we first release the piece of software into a community where we can get feedback. Most open source enthusiasts take the time to log issues and bugs based on their experience with the product. If we can supplement this data with tracing, the team has an accurate record of how the product is used. + +Open as many channels of communication as possible–chat, email, Twitter, etc.—and allow users to choose their feedback channel. + +A few DevOps teams have integrated blue-green deployments, A/B testing, and canary releases to shorten the feedback loop. Setting up these frameworks it is not a trivial matter and calls for a huge upfront investment and constant updates to make them seamlessly work. But once everything is set up and data begins to flow, the team can act upon real feedback based on real user interactions with every new bit of software released. + +Most agile practitioners and lean movement activists push for a build-deploy-measure-learn cycle, and for this to happen, we need to collect feedback in addition to metrics. It might seem expensive and time consuming in the short term, but in the long run, it is a foolproof way of learning. + +### Proof that feedback pays off + +Whether it pertains to people or projects, it pays to rely on first-hand feedback rather than metrics, which are seldom interpreted in impartial ways. We have ample proof of this in other industries, where companies such as Zappos and the Virgin Group have done wonders for their business simply by listening to their customers. There is no reason we cannot follow suit, especially those of us working in open source communities. + +Feedback is the only effective way we can uncover our blind spots. Metrics are not of much help in this regard, as we can't find out what's wrong when we are dealing with unknowns. Blind spots can create serious gaps between reality and what we think we know. Feedback not only encourages continuous improvement, whether it's on a personal or a product level, but the simple act of listening and acting on it increases trust and loyalty. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/devops-feedback-not-metrics + +作者:[Ranjith Varakantam (Red Hat)][a] +选题:[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/ranjith +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc (CICD with gears) From cf8575f619eb6692482263e678bb966463d62850 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:01:11 +0800 Subject: [PATCH 669/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190316=20Progra?= =?UTF-8?q?m=20the=20real=20world=20using=20Rust=20on=20Raspberry=20Pi=20s?= =?UTF-8?q?ources/tech/20190316=20Program=20the=20real=20world=20using=20R?= =?UTF-8?q?ust=20on=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e real world using Rust on Raspberry Pi.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md diff --git a/sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md b/sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md new file mode 100644 index 0000000000..773fd1cc10 --- /dev/null +++ b/sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Program the real world using Rust on Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/physical-computing-rust-raspberry-pi) +[#]: author: (Rahul Thakoor https://opensource.com/users/rahul27) + +Program the real world using Rust on Raspberry Pi +====== + +rust_gpizero uses the Rust programming language to do physical computing on the Raspberry Pi. + +![][1] + +If you own a Raspberry Pi, chances are you may already have experimented with physical computing—writing code to interact with the real, physical world, like blinking some LEDs or [controlling a servo motor][2]. You may also have used [GPIO Zero][3], a Python library that provides a simple interface to GPIO devices from Raspberry Pi with a friendly Python API. GPIO Zero is developed by [Opensource.com][4] community moderator [Ben Nuttall][5]. + +I am working on [**rust_gpiozero**][6], a port of the awesome GPIO Zero library that uses the Rust programming language. It is still a work in progress, but it already includes some useful components. + +[Rust][7] is a systems programming language developed at Mozilla. It is focused on performance, reliability, and productivity. The Rust website has [great resources][8] if you'd like to learn more about it. + +### Getting started + +Before starting with rust_gpiozero, it's smart to have a basic grasp of the Rust programming language. I recommend working through at least the first three chapters in [The Rust Programming Language][9] book. + +I recommend [installing Rust][10] on your Raspberry Pi using [**rustup**][11]. Alternatively, you can set up a cross-compilation environment using [cross][12] (which works only on an x86_64 Linux host) or [this how-to][13]. + +After you've installed Rust, create a new Rust project by entering: + +``` +cargo new rust_gpiozero_demo +``` + +Add **rust_gpiozero** as a dependency (currently in v0.2.0) by adding the following to the dependencies section in your **Cargo.toml** file + +``` +rust_gpiozero = "0.2.0" +``` + +Next, blink an LED—the "hello world" of physical computing by modifying the **main.rs** file with the following: +``` +use rust_gpiozero::*; +use std::thread; +use std::time::Duration; + +fn main() { + // Create a new LED attached to Pin 17 + let led = LED::new(17); + + // Blink the LED 5 times + for _ in 0.. 5{ + led.on(); + thread::sleep(Duration::from_secs(1)); + led.off(); + thread::sleep(Duration::from_secs(1)); + } +} +``` + +rust_gpiozero provides an easier interface for blinking an LED. You can use the blink method, providing the number of seconds it should stay on and off. This simplifies the code to the following: +``` +use rust_gpiozero::*; +fn main() { + // Create a new LED attached to Pin 17 + let mut led = LED::new(17); + + // on_time = 2 secs, off_time=3 secs + led.blink(2.0,3.0); + + // prevent program from exiting immediately + led.wait(); +} +``` + +### Other components + +rust_gpiozero provides several components that are similar to GPIO Zero for controlling output and input devices. These include [LED][14], [Buzzer][15], [Motor][16], Pulse Width Modulation LED ([PWMLED][17]), [Servo][18], and [Button][19]. + +Support for other components, sensors, and devices will be added eventually. You can refer to the [documentation][20] for further usage information. + +### More resources + +rust_gpiozero is still a work in progress. If you need more resources for getting started with Rust on your Raspberry Pi, here are some useful links: + +#### Raspberry Pi Peripheral Access Library (RPPAL) + +Similar to GPIO Zero, which is based on the [RPi.GPIO][21] library, rust_gpiozero builds upon the awesome **[RPPAL][22]** library by [Rene van der Meer][23]. If you want more control for your projects using Rust, you should definitely try RPPAL. It has support for GPIO, Inter-Integrated Circuit (I 2C), hardware and software Pulse Width Modulation (PWM), and Serial Peripheral Interface (SPI). Universal asynchronous receiver-transmitter (UART) support is currently in development. + +#### Sense HAT support + +**[Sensehat-rs][24]** is a library by [Jonathan Pallant][25] ([@therealjpster][26]) that provides Rust support for the Raspberry Pi [Sense HAT][27] add-on board. Jonathan also has a [starter workshop][28] for using the library and he wrote a beginner's intro to use Rust on Raspberry Pi, "Read Sense HAT with Rust," in [Issue 73 of _The MagPi_][29] magazine. + +### Wrap Up + +Hopefully, this has inspired you to use the Rust programming language for physical computing on your Raspberry Pi. rust_gpiozero is a library which provides useful components such as LED, Buzzer, Motor, PWMLED, Servo, and Button. More features are planned and you can follow me on [twitter][30] or check out [my blog][31] to stay tuned. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/physical-computing-rust-raspberry-pi + +作者:[Rahul Thakoor][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[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 +[2]: https://projects.raspberrypi.org/en/projects/grandpa-scarer/4 +[3]: https://gpiozero.readthedocs.io/en/stable/# +[4]: http://Opensource.com +[5]: https://opensource.com/users/bennuttall +[6]: https://crates.io/crates/rust_gpiozero +[7]: https://www.rust-lang.org/ +[8]: https://www.rust-lang.org/learn +[9]: https://doc.rust-lang.org/book/ +[10]: https://www.rust-lang.org/tools/install +[11]: https://rustup.rs/ +[12]: https://github.com/rust-embedded/cross +[13]: https://github.com/kunerd/clerk/wiki/How-to-use-HD44780-LCD-from-Rust#setting-up-the-cross-toolchain +[14]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.LED.html +[15]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.Buzzer.html +[16]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.Motor.html +[17]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.PWMLED.html +[18]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.Servo.html +[19]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/input_devices/struct.Button.html +[20]: https://docs.rs/rust_gpiozero/ +[21]: https://pypi.org/project/RPi.GPIO/ +[22]: https://github.com/golemparts/rppal +[23]: https://twitter.com/golemparts +[24]: https://crates.io/crates/sensehat +[25]: https://github.com/thejpster +[26]: https://twitter.com/therealjpster +[27]: https://www.raspberrypi.org/products/sense-hat/ +[28]: https://github.com/thejpster/pi-workshop-rs/ +[29]: https://www.raspberrypi.org/magpi/issues/73/ +[30]: https://twitter.com/rahulthakoor +[31]: https://rahul-thakoor.github.io/ From 385fc136b563ef1efdb234aa1eb76895cadbf78c Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:26:04 +0800 Subject: [PATCH 670/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=2014=20d?= =?UTF-8?q?ays=20of=20celebrating=20the=20Raspberry=20Pi=20sources/tech/20?= =?UTF-8?q?190314=2014=20days=20of=20celebrating=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...14 days of celebrating the Raspberry Pi.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20190314 14 days of celebrating the Raspberry Pi.md diff --git a/sources/tech/20190314 14 days of celebrating the Raspberry Pi.md b/sources/tech/20190314 14 days of celebrating the Raspberry Pi.md new file mode 100644 index 0000000000..42ea4ab03e --- /dev/null +++ b/sources/tech/20190314 14 days of celebrating the Raspberry Pi.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (14 days of celebrating the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/happy-pi-day) +[#]: author: (Anderson Silva (Red Hat) https://opensource.com/users/ansilva) + +14 days of celebrating the Raspberry Pi +====== + +In the 14th and final article in our series on getting started with the Raspberry Pi, take a look back at all the things we've learned. + +![][1] + +**Happy Pi Day!** + +Every year on March 14th, we geeks celebrate Pi Day. In the way we abbreviate dates—MMDD—March 14 is written 03/14, which numerically reminds us of 3.14, or the first three numbers of [pi][2]. What many Americans don't realize is that virtually no other country in the world uses this [date format][3], so Pi Day pretty much only works in the US, though it is celebrated globally. + +Wherever you are in the world, let's celebrate the Raspberry Pi and wrap up this series by reviewing the topics we've covered in the past two weeks: + + * Day 1: [Which Raspberry Pi should you choose?][4] + * Day 2: [How to buy a Raspberry Pi][5] + * Day 3: [How to boot up a new Raspberry Pi][6] + * Day 4: [Learn Linux with the Raspberry Pi][7] + * Day 5: [5 ways to teach kids to program with Raspberry Pi][8] + * Day 6: [3 popular programming languages you can learn with Raspberry Pi][9] + * Day 7: [How to keep your Raspberry Pi updated][10] + * Day 8: [How to use your Raspberry Pi for entertainment][11] + * Day 9: [Play games on the Raspberry Pi][12] + * Day 10: [Let's get physical: How to use GPIO pins on the Raspberry Pi][13] + * Day 11: [Learn about computer security with the Raspberry Pi][14] + * Day 12: [Do advanced math with Mathematica on the Raspberry Pi][15] + * Day 13: [Contribute to the Raspberry Pi community][16] + + + +![Pi Day illustration][18] + +I'll end this series by thanking everyone who was brave enough to follow along and especially those who learned something from it during these past 14 days! I also want to encourage everyone to keep expanding their knowledge about the Raspberry Pi and all of the open (and closed) source technology that has been built around it. + +I also encourage you to learn about other cultures, philosophies, religions, and worldviews. What makes us human is this amazing (and sometimes amusing) ability that we have to adapt not only to external environmental circumstances—but also intellectual ones. + +No matter what you do, keep learning! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/happy-pi-day + +作者:[Anderson Silva (Red Hat)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberry-pi-juggle.png?itok=oTgGGSRA +[2]: https://www.piday.org/million/ +[3]: https://en.wikipedia.org/wiki/Date_format_by_country +[4]: https://opensource.com/article/19/3/which-raspberry-pi-choose +[5]: https://opensource.com/article/19/3/how-buy-raspberry-pi +[6]: https://opensource.com/article/19/3/how-boot-new-raspberry-pi +[7]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[8]: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi +[9]: https://opensource.com/article/19/3/programming-languages-raspberry-pi +[10]: https://opensource.com/article/19/3/how-raspberry-pi-update +[11]: https://opensource.com/article/19/3/raspberry-pi-entertainment +[12]: https://opensource.com/article/19/3/play-games-raspberry-pi +[13]: https://opensource.com/article/19/3/gpio-pins-raspberry-pi +[14]: https://opensource.com/article/19/3/learn-about-computer-security-raspberry-pi +[15]: https://opensource.com/article/19/3/do-math-raspberry-pi +[16]: https://opensource.com/article/19/3/contribute-raspberry-pi-community +[17]: /file/426561 +[18]: https://opensource.com/sites/default/files/uploads/raspberrypi_14_piday.jpg (Pi Day illustration) From ff6080d1a675c1254d9b9017f4a98ba96ce59261 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:37:45 +0800 Subject: [PATCH 671/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How=20?= =?UTF-8?q?To=20Parse=20And=20Pretty=20Print=20JSON=20With=20Linux=20Comma?= =?UTF-8?q?ndline=20Tools=20sources/tech/20190315=20How=20To=20Parse=20And?= =?UTF-8?q?=20Pretty=20Print=20JSON=20With=20Linux=20Commandline=20Tools.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Print JSON With Linux Commandline Tools.md | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md diff --git a/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md new file mode 100644 index 0000000000..6cf53bdbca --- /dev/null +++ b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md @@ -0,0 +1,264 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Parse And Pretty Print JSON With Linux Commandline Tools) +[#]: via: (https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +How To Parse And Pretty Print JSON With Linux Commandline Tools +====== + +**JSON** is a lightweight and language independent data storage format, easy to integrate with most programming languages and also easy to understand by humans, of course when properly formatted. The word JSON stands for **J** ava **S** cript **O** bject **N** otation, though it starts with JavaScript, and primarily used to exchange data between server and browser, but now being used in many fields including embedded systems. Here we’re going to parse and pretty print JSON with command line tools on Linux. It’s extremely useful for handling large JSON data in a shell scripts, or manipulating JSON data in a shell script. + +### What is pretty printing? + +The JSON data is structured to be somewhat more human readable. However in most cases, JSON data is stored in a single line, even without a line ending character. + +Obviously that’s not very convenient for reading and editing manually. + +That’s when pretty print is useful. The name is quite self explanatory, re-formatting the JSON text to be more legible by humans. This is known as **JSON pretty printing**. + +### Parse And Pretty Print JSON With Linux Commandline Tools + +JSON data could be parsed with command line text processors like **awk** , **sed** and **gerp**. In fact JSON.awk is an awk script to do that. However there are some dedicated tools for the same purpose. + + 1. **jq** or **jshon** , JSON parser for shell, both of them are quite useful. + + 2. Shell scripts like **JSON.sh** or **jsonv.sh** to parse JSON in bash, zsh or dash shell. + + 3. **JSON.awk** , JSON parser awk script. + + 4. Python modules like **json.tool**. + + 5. **underscore-cli** , Node.js and javascript based. + + + + +In this tutorial I’m focusing only on **jq** , which is quite powerful JSON parser for shells with advanced filtering and scripting capability. + +### JSON pretty printing + +JSON data could be in one and nearly illegible for humans, so to make it somewhat readable, JSON pretty printing is here. + +**Example:** A data from **jsonip.com** , to get external IP address in JSON format, use **curl** or **wget** tools like below. + +``` +$ wget -cq http://jsonip.com/ -O - +``` + +The actual data looks like this: + +``` +{"ip":"111.222.333.444","about":"/about","Pro!":"http://getjsonip.com"} +``` + +Now pretty print it with jq: + +``` +$ wget -cq http://jsonip.com/ -O - | jq '.' +``` + +This should look like below, after filtering the result with jq. + +``` +{ + + "ip": "111.222.333.444", + + "about": "/about", + + "Pro!": "http://getjsonip.com" + +} +``` + +The Same thing could be done with python **json.tool** module. Here is an example: + +``` +$ cat anything.json | python -m json.tool +``` + +This Python based solution should be fine for most users, but it’s not that useful where Python is not pre-installed or could not be installed, like on embedded systems. + +However the json.tool python module has a distinct advantage, it’s cross platform. So, you can use it seamlessly on Windows, Linux or mac OS. + + +### How to parse JSON with jq + +First, you need to install jq, it’s already picked up by most GNU/Linux distributions, install it with their respective package installer commands. + +On Arch Linux: + +``` +$ sudo pacman -S jq +``` + +On Debian, Ubuntu, Linux Mint: + +``` +$ sudo apt-get install jq +``` + +On Fedora: + +``` +$ sudo dnf install jq +``` + +On openSUSE: + +``` +$ sudo zypper install jq +``` + +For other OS or platforms, see the [official installation instructions][1]. + +**Basic filters and identifiers of jq** + +jq could read the JSON data either from **stdin** or a **file**. You’ve to use both depending on the situation. + +The single symbol of **.** is the most basic filter. These filters are also called as **object identifier-index**. Using a single **.** along with jq basically pretty prints the input JSON file. + +**Single quotes** – You don’t have to use the single quote always. But if you’re combining several filters in a single line, then you must use them. + +**Double quotes** – You’ve to enclose any special character like **@** , **#** , **$** within two double quotes, like this example, **jq .foo.”@bar”** + +**Raw data print** – For any reason, if you need only the final parsed data, not enclosed within a double quote, use the -r flag with the jq command, like this. **– jq -r .foo.bar**. + +**Parsing specific data** + +To filter out a specific part of JSON, you’ve to look into the pretty printed JSON file’s data hierarchy. + +An example of JSON data, from Wikipedia: + +``` +{ + + "firstName": "John", + + "lastName": "Smith", + + "age": 25, + + "address": { + + "streetAddress": "21 2nd Street", + + "city": "New York", + + "state": "NY", + + "postalCode": "10021" + +}, + + "phoneNumber": [ + +{ + + "type": "home", + + "number": "212 555-1234" + +}, + +{ + + "type": "fax", + + "number": "646 555-4567" + +} + +], + + "gender": { + + "type": "male" + + } + +} +``` + +I’m going to use this JSON data as an example in this tutorial, saved this as **sample.json**. + +Let’s say I want to filter out the address from sample.json file. So the command should be like: + +``` +$ jq .address sample.json +``` + +**Sample output:** + +``` +{ + + "streetAddress": "21 2nd Street", + + "city": "New York", + + "state": "NY", + + "postalCode": "10021" + +} +``` + +Again let’s say I want the postal code, then I’ve to add another **object identifier-index** , i.e. another filter. + +``` +$ cat sample.json | jq .address.postalCode +``` + +Also note that the **filters are case sensitive** and you’ve to use the exact same string to get something meaningful output instead of null. + +**Parsing elements from JSON array** + +Elements of JSON array are enclosed within square brackets, undoubtedly quite versatile to use. + +To parse elements from a array, you’ve to use the **[]identifier** along with other object identifier-index. + +In this sample JSON data, the phone numbers are stored inside an array, to get all the contents from this array, you’ve to use only the brackets, like this example. + +``` +$ jq .phoneNumber[] sample.json +``` + +Let’s say you just want the first element of the array, then use the array object numbers starting for 0, for the first item, use **[0]** , for the next items, it should be incremented by one each step. + +``` +$ jq .phoneNumber[0] sample.json +``` + +**Scripting examples** + +Let’s say I want only the the number for home, not entire JSON array data. Here’s when scripting within jq command comes handy. + +``` +$ cat sample.json | jq -r '.phoneNumber[] | select(.type == "home") | .number' +``` + +Here first I’m piping the results of one filer to another, then using the select attribute to select a particular type of data, again piping the result to another filter. + +Explaining every type of jq filters and scripting is beyond the scope and purpose of this tutorial. It’s highly suggested to read the JQ manual for better understanding given below. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/ + +作者:[EDITOR][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 +[1]: https://stedolan.github.io/jq/download/ From b42b89b05c67be8568f886b5fbe78d874c5f929e Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:41:15 +0800 Subject: [PATCH 672/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How=20?= =?UTF-8?q?To=20Navigate=20Inside=20A=20Directory/Folder=20In=20Linux=20Wi?= =?UTF-8?q?thout=20CD=20Command=3F=20sources/tech/20190315=20How=20To=20Na?= =?UTF-8?q?vigate=20Inside=20A=20Directory-Folder=20In=20Linux=20Without?= =?UTF-8?q?=20CD=20Command.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tory-Folder In Linux Without CD Command.md | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md diff --git a/sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md b/sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md new file mode 100644 index 0000000000..d0d21adeb8 --- /dev/null +++ b/sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Navigate Inside A Directory/Folder In Linux Without CD Command?) +[#]: via: (https://www.2daygeek.com/navigate-switch-directory-without-using-cd-command-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Navigate Inside A Directory/Folder In Linux Without CD Command? +====== + +As everybody know that we can’t navigate inside a directory in Linux without CD command. + +Yes that’s true but we have the Linux built-in command called `shopt` that help us to solve this issue. + +[shopt][1] is a shell builtin command to set and unset various bash shell options, which is installed so, we no need to install it again. + +Yes we can navigate inside a directory without CD command after enabling this option. + +We will show you, how to do this in this article. This is a small tweak but it’s very useful for newbies who all are moving from Windows to Linux. + +This is not useful for Linux administrator because we won’t navigate to the directory without CD command, as we had a good practices on this. + +If you are trying to navigate a directory/folder in Linux without cd command, you will be getting the following error message. This is common in Linux. + +``` +$ Documents/ +bash: Documents/: Is a directory +``` + +To achieve this, we need to append the following values in a user `.bashrc` file. + +### What Is the .bashrc File? + +The “.bashrc” file is a shell script which is run every time a user opens a new shell in interactive mode. + +You can add any command in that file that you want to type at the command prompt. + +The .bashrc file itself contains a series of configurations for the terminal session. This includes setting up or enabling: colouring, completion, the shell history, command aliases and more. + +``` +$ vi ~/.bashrc + +shopt -s autocd +``` + +Run the following command to make the changes to take effect. + +``` +$ source ~/.bashrc +``` + +We have done all the configuration. Simple do the testing on this to confirm whether this working or not. + +``` +$ Documents/ +cd -- Documents/ + +$ daygeek/ +cd -- daygeek/ + +$ /home/daygeek/Documents/daygeek +cd -- /home/daygeek/Documents/daygeek + +$ pwd +/home/daygeek/Documents/daygeek +``` + +![][3] +Yes, it’s working fine as expected. + +However, it’s working fine in `fish shell` without making any changes in the `.bashrc` file. +![][4] + +If you would like to perform this action for temporarily then use the following commands (set/unset). This will go away when you reboot the system. + +``` +# shopt -s autocd + +# shopt | grep autocd +autocd on + +# shopt -u autocd + +# shopt | grep autocd +autocd off +``` + +shopt command is offering so many other options and if you want to verify those, run the following command. + +``` +$ shopt +autocd on +assoc_expand_once off +cdable_vars off +cdspell on +checkhash off +checkjobs off +checkwinsize on +cmdhist on +compat31 off +compat32 off +compat40 off +compat41 off +compat42 off +compat43 off +compat44 off +complete_fullquote on +direxpand off +dirspell off +dotglob off +execfail off +expand_aliases on +extdebug off +extglob off +extquote on +failglob off +force_fignore on +globasciiranges on +globstar off +gnu_errfmt off +histappend on +histreedit off +histverify off +hostcomplete on +huponexit off +inherit_errexit off +interactive_comments on +lastpipe off +lithist off +localvar_inherit off +localvar_unset off +login_shell off +mailwarn off +no_empty_cmd_completion off +nocaseglob off +nocasematch off +nullglob off +progcomp on +progcomp_alias off +promptvars on +restricted_shell off +shift_verbose off +sourcepath on +xpg_echo off +``` + +I had found few other utilities, that are help us to navigate a directory faster in Linux compared with cd command. + +Those are pushd, popd, up shell script and bd utility. We will cover these topics in the upcoming articles. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/navigate-switch-directory-without-using-cd-command-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.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/03/navigate-switch-directory-without-using-cd-command-in-linux-1.jpg +[4]: https://www.2daygeek.com/wp-content/uploads/2019/03/navigate-switch-directory-without-using-cd-command-in-linux-2.jpg From 01920a58fb699ec57de4be30ed3380ac3e6e5fa7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 16:01:54 +0800 Subject: [PATCH 673/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170414=205=20pr?= =?UTF-8?q?ojects=20for=20Raspberry=20Pi=20at=20home=20sources/tech/201704?= =?UTF-8?q?14=205=20projects=20for=20Raspberry=20Pi=20at=20home.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...414 5 projects for Raspberry Pi at home.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20170414 5 projects for Raspberry Pi at home.md diff --git a/sources/tech/20170414 5 projects for Raspberry Pi at home.md b/sources/tech/20170414 5 projects for Raspberry Pi at home.md new file mode 100644 index 0000000000..37c9fde3db --- /dev/null +++ b/sources/tech/20170414 5 projects for Raspberry Pi at home.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 projects for Raspberry Pi at home) +[#]: via: (https://opensource.com/article/17/4/5-projects-raspberry-pi-home) +[#]: author: (Ben Nuttall (Community Moderator) ) + +5 projects for Raspberry Pi at home +====== + +![5 projects for Raspberry Pi at home][1] + +The [Raspberry Pi][2] computer can be used in all kinds of settings and for a variety of purposes. It obviously has a place in education for helping students with learning programming and maker skills in the classroom and the hackspace, and it has plenty of industrial applications in the workplace and in factories. I'm going to introduce five projects you might want to build in your own home. + +### Media center + +One of the most common uses for Raspberry Pi in people's homes is behind the TV running media center software serving multimedia files. It's easy to set this up, and the Raspberry Pi provides plenty of GPU (Graphics Processing Unit) power to render HD TV shows and movies to your big screen TV. [Kodi][3] (formerly XBMC) on a Raspberry Pi is a great way to playback any media you have on a hard drive or network-attached storage. You can also install a plugin to play YouTube videos. + +There are a few different options available, most prominently [OSMC][4] (Open Source Media Center) and [LibreELEC][5], both based on Kodi. They both perform well at playing media content, but OSMC has a more visually appearing user interface, while LibreElec is much more lightweight. All you have to do is choose a distribution, download the image and install on an SD card (or just use [NOOBS][6]), boot it up, and you're ready to go. + +![LibreElec ][7] + +LibreElec; Raspberry Pi Foundation, CC BY-SA + +![OSMC][8] + +OSMC.tv, Copyright, Used with permission + +Before proceeding you'll need to decide [w][9][hich Raspberry Pi model to use][9]. These distributions will work on any Pi (1, 2, 3, or Zero), and video playback will essentially be matched on each of these. Apart from the Pi 3 (and Zero W) having built-in Wi-Fi, the only noticeable difference is the reaction speed of the user interface, which will be much faster on a Pi 3. A Pi 2 will not be much slower, so that's fine if you don't need Wi-Fi, but the Pi 3 will noticeably outperform the Pi 1 and Zero when it comes to flicking through the menus. + +### SSH gateway + +If you want to be able to access computers and devices on your home network from outside over the internet, you have to open up ports on those devices to allow outside traffic. Opening ports to the internet is a security risk, meaning you're always at risk of attack, misuse, or any kind of unauthorized access. However, if you install a Raspberry Pi on your network and set up port forwarding to allow only SSH access to that Pi, you can use that as a secure gateway to hop onto other Pis and PCs on the network. + +Most routers allow you to configure port-forwarding rules. You'll need to give your Pi a fixed internal IP address and set up port 22 on your router to map to port 22 on your Raspberry Pi. If your ISP provides you with a static IP address, you'll be able to SSH into it with this as the host address (for example, **ssh pi@123.45.56.78** ). If you have a domain name, you can configure a subdomain to point to this IP address, so you don't have to remember it (for example, **ssh[pi@home.mydomain.com][10]** ). + +![][11] + +However, if you're going to expose a Raspberry Pi to the internet, you should be very careful not to put your network at risk. There are a few simple procedures you can follow to make it sufficiently secure: + +1\. Most people suggest you change your login password (which makes sense, seeing as the default password “raspberry” is well known), but this does not protect against brute-force attacks. You could change your password and add a two-factor authentication (so you need your password _and_ a time-dependent passcode generated by your phone), which is more secure. However, I believe the best way to secure your Raspberry Pi from intruders is to [disable][12] [“password authentication”][12] in your SSH configuration, so you allow only SSH key access. This means that anyone trying to SSH in by guessing your password will never succeed. Only with your private SSH key can anyone gain access. Similarly, most people suggest changing the SSH port from the default 22 to something unexpected, but a simple [Nmap][13] of your IP address will reveal your true SSH port. + +2\. Ideally, you would not run much in the way of other software on this Pi, so you don't end up accidentally exposing anything else. If you want to run other software, you might be better running it on another Pi on the network that is not exposed to the internet. Ensure that you keep your packages up to date by upgrading regularly, particularly the **openssh-server** package, so that any security vulnerabilities are patched. + +3\. Install [sshblack][14] or [fail2ban][15] to blacklist any users who seem to be acting maliciously, such as attempting to brute force your SSH password. + +Once you've secured your Raspberry Pi and put it online, you'll be able to log in to your network from anywhere in the world. Once you're on your Raspberry Pi, you can SSH into other devices on the network using their local IP address (for example, 192.168.1.31). If you have passwords on these devices, just use the password. If they're also SSH-key-only, you'll need to ensure your key is forwarded over SSH by using the **-A** flag: **ssh -A pi@123.45.67.89**. + +### CCTV / pet camera + +Another great home project is to set up a camera module to take photos or stream video, capture and save files, or streamed internally or to the internet. There are many reasons you might want to do this, but two common use cases are for a homemade security camera or to monitor a pet. + +The [Raspberry Pi camera module][16] is a brilliant accessory. It provides full HD photo and video, lots of advanced configuration, and is [easy to][17] [program][17]. The [infrared camera][18] is ideal for this kind of use, and with an infrared LED (which the Pi can control) you can see in the dark! + +If you want to take still images on a regular basis to keep an eye on things, you can just write a short [Python][19] script or use the command line tool [raspistill][20], and schedule it to recur in [Cron][21]. You might want to have it save them to [Dropbox][22] or another web service, upload them to a web server, or you can even create a [web app][23] to display them. + +If you want to stream video, internally or externally, that's really easy, too. A simple MJPEG (Motion JPEG) example is provided in the [picamera documentation][24] (under “web streaming”). Just download or copy that code into a file, run it and visit the Pi's IP address at port 8000, and you'll see your camera's output live. + +A more advanced streaming project, [pistreaming][25], is available, which uses [JSMpeg][26] (a JavaScript video player) with the web server and a websocket for the camera stream running separately. This method is more performant and is just as easy to get running as the previous example, but there is more code involved and if set up to stream on the internet, requires you to open two ports. + +Once you have web streaming set up, you can position the camera where you want it. I have one set up to keep an eye on my pet tortoise: + +![Tortoise ][27] + +Ben Nuttall, CC BY-SA + +If you want to be able to control where the camera actually points, you can do so using servos. A neat solution is to use Pimoroni's [Pan-Tilt HAT][28], which allows you to move the camera easily in two dimensions. To integrate this with pistreaming, see the project's [pantilthat branch][29]. + +![Pan-tilt][30] + +Pimoroni.com, Copyright, Used with permission + +If you want to position your Pi outside, you'll need a waterproof enclosure and some way of getting power to the Pi. PoE (Power-over-Ethernet) cables can be a good way of achieving this. + +### Home automation and IoT + +It's 2017 and there are internet-connected devices everywhere, especially in the home. Our lightbulbs have Wi-Fi, our toasters are smarter than they used to be, and our tea kettles are at risk of attack from Russia. As long as you keep your devices secure, or don't connect them to the internet if they don't need to be, then you can make great use of IoT devices to automate tasks around the home. + +There are plenty of services you can buy or subscribe to, like Nest Thermostat or Philips Hue lightbulbs, which allow you to control your heating or your lighting from your phone, respectively—whether you're inside or away from home. You can use a Raspberry Pi to boost the power of these kinds of devices by automating interactions with them according to a set of rules involving timing or even sensors. One thing you can't do with Philips Hue is have the lights come on when you enter the room, but with a Raspberry Pi and a motion sensor, you can use a Python API to turn on the lights. Similarly, you can configure your Nest to turn on the heating when you're at home, but what if you only want it to turn on if there's at least two people home? Write some Python code to check which phones are on the network and if there are at least two, tell the Nest to turn on the heat. + +You can do a great deal more without integrating with existing IoT devices and with only using simple components. A homemade burglar alarm, an automated chicken coop door opener, a night light, a music box, a timed heat lamp, an automated backup server, a print server, or whatever you can imagine. + +### Tor proxy and blocking ads + +Adafruit's [Onion Pi][31] is a [Tor][32] proxy that makes your web traffic anonymous, allowing you to use the internet free of snoopers and any kind of surveillance. Follow Adafruit's tutorial on setting up Onion Pi and you're on your way to a peaceful anonymous browsing experience. + +![Onion-Pi][33] + +Onion-pi from Adafruit, Copyright, Used with permission + +![Pi-hole][34]You can install a Raspberry Pi on your network that intercepts all web traffic and filters out any advertising. Simply download the [Pi-hole][35] software onto the Pi, and all devices on your network will be ad-free (it even blocks in-app ads on your mobile devices). + +There are plenty more uses for the Raspberry Pi at home. What do you use Raspberry Pi for at home? What do you want to use it for? + +Let us know in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/4/5-projects-raspberry-pi-home + +作者:[Ben Nuttall (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]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberry_pi_home_automation.png?itok=2TnmJpD8 (5 projects for Raspberry Pi at home) +[2]: https://www.raspberrypi.org/ +[3]: https://kodi.tv/ +[4]: https://osmc.tv/ +[5]: https://libreelec.tv/ +[6]: https://www.raspberrypi.org/downloads/noobs/ +[7]: https://opensource.com/sites/default/files/libreelec_0.png (LibreElec ) +[8]: https://opensource.com/sites/default/files/osmc.png (OSMC) +[9]: https://opensource.com/life/16/10/which-raspberry-pi-should-you-choose-your-project +[10]: mailto:pi@home.mydomain.com +[11]: https://opensource.com/sites/default/files/resize/screenshot_from_2017-04-07_15-13-01-700x380.png +[12]: http://stackoverflow.com/questions/20898384/ssh-disable-password-authentication +[13]: https://nmap.org/ +[14]: http://www.pettingers.org/code/sshblack.html +[15]: https://www.fail2ban.org/wiki/index.php/Main_Page +[16]: https://www.raspberrypi.org/products/camera-module-v2/ +[17]: https://opensource.com/life/15/6/raspberry-pi-camera-projects +[18]: https://www.raspberrypi.org/products/pi-noir-camera-v2/ +[19]: http://picamera.readthedocs.io/ +[20]: https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md +[21]: https://www.raspberrypi.org/documentation/linux/usage/cron.md +[22]: https://github.com/RZRZR/plant-cam +[23]: https://github.com/bennuttall/bett-bot +[24]: http://picamera.readthedocs.io/en/release-1.13/recipes2.html#web-streaming +[25]: https://github.com/waveform80/pistreaming +[26]: http://jsmpeg.com/ +[27]: https://opensource.com/sites/default/files/tortoise.jpg (Tortoise) +[28]: https://shop.pimoroni.com/products/pan-tilt-hat +[29]: https://github.com/waveform80/pistreaming/tree/pantilthat +[30]: https://opensource.com/sites/default/files/pan-tilt.gif (Pan-tilt) +[31]: https://learn.adafruit.com/onion-pi/overview +[32]: https://www.torproject.org/ +[33]: https://opensource.com/sites/default/files/onion-pi.jpg (Onion-Pi) +[34]: https://opensource.com/sites/default/files/resize/pi-hole-250x250.png (Pi-hole) +[35]: https://pi-hole.net/ From 7594b0c11d7d6b0c65fbfb33561be7a57cfd1e58 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 16:04:39 +0800 Subject: [PATCH 674/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180919=20Host?= =?UTF-8?q?=20your=20own=20cloud=20with=20Raspberry=20Pi=20NAS=20sources/t?= =?UTF-8?q?ech/20180919=20Host=20your=20own=20cloud=20with=20Raspberry=20P?= =?UTF-8?q?i=20NAS.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...st your own cloud with Raspberry Pi NAS.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 sources/tech/20180919 Host your own cloud with Raspberry Pi NAS.md diff --git a/sources/tech/20180919 Host your own cloud with Raspberry Pi NAS.md b/sources/tech/20180919 Host your own cloud with Raspberry Pi NAS.md new file mode 100644 index 0000000000..5d34623e8c --- /dev/null +++ b/sources/tech/20180919 Host your own cloud with Raspberry Pi NAS.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Host your own cloud with Raspberry Pi NAS) +[#]: via: (https://opensource.com/article/18/9/host-cloud-nas-raspberry-pi?extIdCarryOver=true) +[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) + +Host your own cloud with Raspberry Pi NAS +====== + +Protect and secure your data with a self-hosted cloud powered by your Raspberry Pi. + +![Tree clouds][1] + +In the first two parts of this series, we discussed the [hardware and software fundamentals][2] for building network-attached storage (NAS) on a Raspberry Pi. We also put a proper [backup strategy][3] in place to secure the data on the NAS. In this third part, we will talk about a convenient way to store, access, and share your data with [Nextcloud][4]. + +![Raspberry Pi NAS infrastructure with Nextcloud][6] + +### Prerequisites + +To use Nextcloud conveniently, you have to meet a few prerequisites. First, you should have a domain you can use for the Nextcloud instance. For the sake of simplicity in this how-to, we'll use **nextcloud.pi-nas.com**. This domain should be directed to your Raspberry Pi. If you want to run it on your home network, you probably need to set up dynamic DNS for this domain and enable port forwarding of ports 80 and 443 (if you go for an SSL setup, which is highly recommended; otherwise port 80 should be sufficient) from your router to the Raspberry Pi. + +You can automate dynamic DNS updates from the Raspberry Pi using [ddclient][7]. + +### Install Nextcloud + +To run Nextcloud on your Raspberry Pi (using the setup described in the [first part][2] of this series), install the following packages as dependencies to Nextcloud using **apt**. + +``` +sudo apt install unzip wget php apache2 mysql-server php-zip php-mysql php-dom php-mbstring php-gd php-curl +``` + +The next step is to download Nextcloud. [Get the latest release's URL][8] and copy it to download via **wget** on the Raspberry Pi. In the first article in this series, we attached two disk drives to the Raspberry Pi, one for current data and one for backups. Install Nextcloud on the data drive to make sure data is backed up automatically every night. +``` +sudo mkdir -p /nas/data/nextcloud +sudo chown pi /nas/data/nextcloud +cd /nas/data/ +wget -O /nas/data/nextcloud.zip +unzip nextcloud.zip +sudo ln -s /nas/data/nextcloud /var/www/nextcloud +sudo chown -R www-data:www-data /nas/data/nextcloud +``` + +When I wrote this, the latest release (as you see in the code above) was 14. Nextcloud is under heavy development, so you may find a newer version when installing your copy of Nextcloud onto your Raspberry Pi. + +### Database setup + +When we installed Nextcloud above, we also installed MySQL as a dependency to use it for all the metadata Nextcloud generates (for example, the users you create to access Nextcloud). If you would rather use a Postgres database, you'll need to adjust some of the modules installed above. + +To access the MySQL database as root, start the MySQL client as root: + +``` +sudo mysql +``` + +This will open a SQL prompt where you can insert the following commands—substituting the placeholder with the password you want to use for the database connection—to create a database for Nextcloud. +``` +CREATE USER nextcloud IDENTIFIED BY ''; +CREATE DATABASE nextcloud; +GRANT ALL ON nextcloud.* TO nextcloud; +``` + + +You can exit the SQL prompt by pressing **Ctrl+D** or entering **quit**. + +### Web server configuration + +Nextcloud can be configured to run using Nginx or other web servers, but for this how-to, I decided to go with the Apache web server on my Raspberry Pi NAS. (Feel free to try out another alternative and let me know if you think it performs better.) + +To set it up, configure a virtual host for the domain you created for your Nextcloud instance **nextcloud.pi-nas.com**. To create a virtual host, create the file **/etc/apache2/sites-available/001-nextcloud.conf** with content similar to the following. Make sure to adjust the ServerName to your domain and paths, if you didn't use the ones suggested earlier in this series. +``` + +ServerName nextcloud.pi-nas.com +ServerAdmin [admin@pi-nas.com][9] +DocumentRoot /var/www/nextcloud/ + + +AllowOverride None + + +``` + + +To enable this virtual host, run the following two commands. +``` +a2ensite 001-nextcloud +sudo systemctl reload apache2 +``` + + +With this configuration, you should now be able to reach the web server with your domain via the web browser. To secure your data, I recommend using HTTPS instead of HTTP to access Nextcloud. A very easy (and free) way is to obtain a [Let's Encrypt][10] certificate with [Certbot][11] and have a cron job automatically refresh it. That way you don't have to mess around with self-signed or expiring certificates. Follow Certbot's simple how-to [instructions to install it on your Raspberry Pi][12]. During Certbot configuration, you can even decide to automatically forward HTTP to HTTPS, so visitors to **** will be redirected to ****. Please note, if your Raspberry Pi is running behind your home router, you must have port forwarding enabled for ports 443 and 80 to obtain Let's Encrypt certificates. + +### Configure Nextcloud + +The final step is to visit your fresh Nextcloud instance in a web browser to finish the configuration. To do so, open your domain in a browser and insert the database details from above. You can also set up your first Nextcloud user here, the one you can use for admin tasks. By default, the data directory should be inside the Nextcloud folder, so you don't need to change anything for the backup mechanisms from the [second part of this series][3] to pick up the data stored by users in Nextcloud. + +Afterward, you will be directed to your Nextcloud and can log in with the admin user you created previously. To see a list of recommended steps to ensure a performant and secure Nextcloud installation, visit the Basic Settings tab in the Settings page (in our example: settings/admin) and see the Security & Setup Warnings section. + +Congratulations! You've set up your own Nextcloud powered by a Raspberry Pi. Go ahead and [download a Nextcloud client][13] from the Nextcloud page to sync data with your client devices and access it offline. Mobile clients even provide features like instant upload of pictures you take, so they'll automatically sync to your desktop PC without wondering how to get them there. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/host-cloud-nas-raspberry-pi?extIdCarryOver=true + +作者:[Manuel Dewald][a] +选题:[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/ntlx +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_tree_clouds.png?itok=b_ftihhP (Tree clouds) +[2]: https://opensource.com/article/18/7/network-attached-storage-Raspberry-Pi +[3]: https://opensource.com/article/18/8/automate-backups-raspberry-pi +[4]: https://nextcloud.com/ +[5]: /file/409336 +[6]: https://opensource.com/sites/default/files/uploads/nas_part3.png (Raspberry Pi NAS infrastructure with Nextcloud) +[7]: https://sourceforge.net/p/ddclient/wiki/Home/ +[8]: https://nextcloud.com/install/#instructions-server +[9]: mailto:admin@pi-nas.com +[10]: https://letsencrypt.org/ +[11]: https://certbot.eff.org/ +[12]: https://certbot.eff.org/lets-encrypt/debianother-apache +[13]: https://nextcloud.com/install/#install-clients From c36858753eaeadf55e7ba651713fa17ef810b2ff Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 19:35:07 +0800 Subject: [PATCH 675/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Instal?= =?UTF-8?q?l=20MEAN.JS=20Stack=20In=20Ubuntu=2018.04=20LTS=20sources/tech/?= =?UTF-8?q?20190318=20Install=20MEAN.JS=20Stack=20In=20Ubuntu=2018.04=20LT?= =?UTF-8?q?S.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...stall MEAN.JS Stack In Ubuntu 18.04 LTS.md | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md diff --git a/sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md b/sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md new file mode 100644 index 0000000000..925326e0d7 --- /dev/null +++ b/sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install MEAN.JS Stack In Ubuntu 18.04 LTS) +[#]: via: (https://www.ostechnix.com/install-mean-js-stack-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +Install MEAN.JS Stack In Ubuntu 18.04 LTS +====== + +![Install MEAN.JS Stack][1] + +**MEAN.JS** is an Open-Source, full-Stack JavaScript solution for building fast, and robust web applications. **MEAN.JS** stack consists of **MongoDB** (NoSQL database), **ExpressJs** (NodeJS server-side application web framework), **AngularJS** (Client-side web application framework), and **Node.js** (JavaScript run-time, popular for being a web server platform). In this tutorial, we will be discussing how to install MEAN.JS stack in Ubuntu. This guide was tested in Ubuntu 18.04 LTS server. However, it should work on other Ubuntu versions and Ubuntu variants. + +### Install MongoDB + +**MongoDB** is a free, cross-platform, open source, NoSQL document-oriented database. To install MongoDB on your Ubuntu system, refer the following guide: + + * [**Install MongoDB Community Edition In Linux**][2] + + + +### Install Node.js + +**NodeJS** is an open source, cross-platform, and lightweight JavaScript run-time environment that can be used to build scalable network applications. + +To install NodeJS on your system, refer the following guide: + + * [**How To Install NodeJS On Linux**][3] + + + +After installing, MongoDB, and Node.js, we need to install the other required components such as **Yarn** , **Grunt** , and **Gulp** for MEAN.js stack. + +### Install Yarn package manager + +Yarn is a package manager used by MEAN.JS stack to manage front-end packages. + +To install Bower, run the following command: + +``` +$ npm install -g yarn +``` + +### Install Grunt Task Runner + +Grunt Task Runner is used to to automate the development process. + +To install Grunt, run: + +``` +$ npm install -g grunt-cli +``` + +To verify if Yarn and Grunt have been installed, run: + +``` +$ npm list -g --depth=0 /home/sk/.nvm/versions/node/v11.11.0/lib ├── [email protected] ├── [email protected] └── [email protected] +``` + +### Install Gulp Task Runner (Optional) + +This is optional. You can use Gulp instead of Grunt. To install Gulp Task Runner, run the following command: + +``` +$ npm install -g gulp +``` + +We have installed all required prerequisites. Now, let us deploy MEAN.JS stack. + +### Download and Install MEAN.JS Stack + +Install Git if it is not installed already: + +``` +$ sudo apt-get install git +``` + +Next, git clone the MEAN.JS repository with command: + +``` +$ git clone https://github.com/meanjs/mean.git meanjs +``` + +**Sample output:** + +``` +Cloning into 'meanjs'... +remote: Counting objects: 8596, done. +remote: Compressing objects: 100% (12/12), done. +remote: Total 8596 (delta 3), reused 0 (delta 0), pack-reused 8584 Receiving objects: 100% (8596/8596), 2.62 MiB | 140.00 KiB/s, done. +Resolving deltas: 100% (4322/4322), done. +Checking connectivity... done. +``` + +The above command will clone the latest version of the MEAN.JS repository to **meanjs** folder in your current working directory. + +Go to the meanjs folder: + +``` +$ cd meanjs/ +``` + +Run the following command to install the Node.js dependencies required for testing and running our application: + +``` +$ npm install +``` + +This will take some time. Please be patient. + +* * * + +**Troubleshooting:** + +When I run the above command in Ubuntu 18.04 LTS, I get the following error: + +``` +Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-67_binding.node +Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-67_binding.node": + +HTTP error 404 Not Found + +[....] +``` + +If you ever get these type of common errors like “node-sass and gulp-sass”, do the following: + +First uninstall the project and global gulp-sass modules using the following commands: + +``` +$ npm uninstall gulp-sass +$ npm uninstall -g gulp-sass +``` + +Next uninstall the global node-sass module: + +``` +$ npm uninstall -g node-sass +``` + +Install the global node-sass first. Then install the gulp-sass module at the local project level. + +``` +$ npm install -g node-sass +$ npm install gulp-sass +``` + +Now try the npm install again from the project folder using command: + +``` +$ npm install +``` + +Now all dependencies will start to install without any issues. + +* * * + +Once all dependencies are installed, run the following command to install all the front-end modules needed for the application: + +``` +$ yarn --allow-root --config.interactive=false install +``` + +Or, + +``` +$ yarn --allow-root install +``` + +You will see the following message at the end if the installation is successful. + +``` +[...] +> meanjs@0.6.0 snyk-protect /home/sk/meanjs +> snyk protect + +Successfully applied Snyk patches + +Done in 99.47s. +``` + +### Test MEAN.JS + +MEAN.JS stack has been installed. We can now able to start a sample application using command: + +``` +$ npm start +``` + +After a few seconds, you will see a message like below. This means MEAN.JS stack is working! + +``` +[...] +MEAN.JS - Development Environment + +Environment: development +Server: http://0.0.0.0:3000 +Database: mongodb://localhost/mean-dev +App version: 0.6.0 +MEAN.JS version: 0.6.0 +``` + +![][4] + +To verify, open up the browser and navigate to **** or ****. You should see a screen something like below. + +![][5] + +Mean stack test page + +Congratulations! MEAN.JS stack is ready to start building web applications. + +For further details, I recommend you to refer **[MEAN.JS stack official documentation][6]**. + +* * * + +Want to setup MEAN.JS stack in CentOS, RHEL, Scientific Linux? Check the following link for more details. + + * **[Install MEAN.JS Stack in CentOS 7][7]** + + + +* * * + +And, that’s all for now, folks. Hope this tutorial will help you to setup MEAN.JS stack. + +If you find this tutorial useful, please share it on your social, professional networks and support OSTechNix. + +More good stuffs to come. Stay tuned! + +Cheers! + +**Resources:** + + * **[MEAN.JS website][8]** + * [**MEAN.JS GitHub Repository**][9] + + + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/install-mean-js-stack-ubuntu/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.ostechnix.com/install-mongodb-linux/ +[3]: https://www.ostechnix.com/install-node-js-linux/ +[4]: http://www.ostechnix.com/wp-content/uploads/2016/03/meanjs.png +[5]: http://www.ostechnix.com/wp-content/uploads/2016/03/mean-stack-test-page.png +[6]: http://meanjs.org/docs.html +[7]: http://www.ostechnix.com/install-mean-js-stack-centos-7/ +[8]: http://meanjs.org/ +[9]: https://github.com/meanjs/mean From eda05a64f51f74ad06978cfa1232bd0ff8840a15 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Mon, 18 Mar 2019 06:43:15 -0500 Subject: [PATCH 676/813] Apply for Translatting Apply for Translatting --- .../20180329 Python ChatOps libraries- Opsdroid and Errbot.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20180329 Python ChatOps libraries- Opsdroid and Errbot.md b/sources/tech/20180329 Python ChatOps libraries- Opsdroid and Errbot.md index 5f409956f7..438057f08e 100644 --- a/sources/tech/20180329 Python ChatOps libraries- Opsdroid and Errbot.md +++ b/sources/tech/20180329 Python ChatOps libraries- Opsdroid and Errbot.md @@ -1,3 +1,4 @@ +tomjlw is translating Python ChatOps libraries: Opsdroid and Errbot ====== @@ -211,7 +212,7 @@ Have you used Errbot or Opsdroid? If so, please leave a comment with your impres via: https://opensource.com/article/18/3/python-chatops-libraries-opsdroid-and-errbot 作者:[Jeff Triplett][a] -译者:[译者ID](https://github.com/译者ID) +译者:[tomjlw](https://github.com/tomjlw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8275cae67ee808f56f3fdbcfd0f41a261715af75 Mon Sep 17 00:00:00 2001 From: David Max <42110350+DavidMax2006@users.noreply.github.com> Date: Mon, 18 Mar 2019 21:31:24 +0800 Subject: [PATCH 677/813] Translate Request I want to translate this article. --- sources/tech/20180629 100 Best Ubuntu Apps.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180629 100 Best Ubuntu Apps.md b/sources/tech/20180629 100 Best Ubuntu Apps.md index 581d22b527..487ebd6e7d 100644 --- a/sources/tech/20180629 100 Best Ubuntu Apps.md +++ b/sources/tech/20180629 100 Best Ubuntu Apps.md @@ -1,3 +1,4 @@ +DaivdMax2006 is translating 100 Best Ubuntu Apps ====== From 311ddf2bf0812e7a911e229ef1b8b34b6ce1713a Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 18 Mar 2019 22:49:15 +0800 Subject: [PATCH 678/813] Update 20190214 Run Particular Commands Without Sudo Password In Linux.md --- ... Run Particular Commands Without Sudo Password In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md b/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md index df5bfddb3a..aaad1819e4 100644 --- a/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md +++ b/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (FSSlc) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -142,7 +142,7 @@ via: https://www.ostechnix.com/run-particular-commands-without-sudo-password-lin 作者:[SK][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[FSSlc](https://github.com/FSSlc) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 77a7fe4e56dc5cb4d641b60da4787867744ebc71 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Mar 2019 23:04:50 +0800 Subject: [PATCH 679/813] PRF:20190226 Linux security- Cmd provides visibility, control over user activity.md @geekpi --- ... visibility, control over user activity.md | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md index 72133e9ab8..972d221d05 100644 --- a/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md +++ b/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux security: Cmd provides visibility, control over user activity) @@ -9,52 +9,50 @@ Linux 安全:Cmd 提供可视化控制用户活动 ====== +> Cmd 可以帮助机构监控、验证和阻止那些超出系统预期使用范围的活动。 ![](https://images.techhive.com/images/article/2017/01/background-1900329_1920-100705659-large.jpg) -你应该知道一个新的 Linux 安全工具--Cmd(读作 “see em dee”)极大地改变了可以对 Linux 用户进行控制的类型。它远远超出了传统的用户权限配置,,并在监视和控制用户能够在 Linux 系统上运行的命令方面发挥积极作用。 +有一个新的 Linux 安全工具你值得了解一下:Cmd(读作 “see em dee”),它极大地改变了可以对 Linux 用户进行控制的类型。它远远超出了传统的用户权限配置,并在监视和控制用户能够在 Linux 系统上运行的命令方面发挥了积极作用。 -它由同名公司开发,Cmd 专注于云应用。鉴于越来越多的应用迁移到依赖于 Linux 的云环境中,可用工具的缺口使得难以充分实施所需的安全性。而且,Cmd 还可用于管理和保护本地系统。 +Cmd 由同名公司开发,专注于云应用。鉴于越来越多的应用迁移到依赖于 Linux 的云环境中,而可用工具的缺口使得难以充分实施所需的安全性。除此以外,Cmd 还可用于管理和保护本地系统。 ### Cmd 与传统 Linux 安全控件的区别 -Cmd 公司的领导 Milun Tesovic 和 Jake King 表示,组织无法自信地预测或控制用户行为,直到他们了解了用户日常如何工作以及什么认为是“正常”。他们寻求提供一种能够精细控制、监控和验证用户活动的工具。 +Cmd 公司的领导 Milun Tesovic 和 Jake King 表示,除非了解了用户日常如何工作以及什么被视是“正常”,机构无法自信地预测或控制用户行为。他们寻求提供一种能够精细控制、监控和验证用户活动的工具。 -Cmd 通过形成用户活动配置文件(表示这些用户通常进行的活动)监视用户活动,注意其在线行为的异常(登录时间、使用的命令、用户位置等),以及预防和报告某些意味着系统攻击的活动(例如,下载或修改文件和运行特权命令)。产品的行为是可配置的,可以快速进行更改。 +Cmd 通过形成用户活动配置文件(描绘这些用户通常进行的活动)来监视用户活动,注意其在线行为的异常(登录时间、使用的命令、用户位置等),以及预防和报告某些意味着系统攻击的活动(例如,下载或修改文件和运行特权命令)。产品的行为是可配置的,可以快速进行更改。 -我们大多数人如今用来检测威胁、识别漏洞和控制用户权限的工具已经花费了很长的时间,但我们仍在努力保持系统和数据的安全。Cmd 让我们更能够确定恶意用户的意图,无论这些用户是设法侵入帐户还是代表内部威胁。 +如今大多数人用来检测威胁、识别漏洞和控制用户权限的工具,我们已经使用了很久了,但我们仍在努力抗争保持系统和数据的安全。Cmd 让我们更能够确定恶意用户的意图,无论这些用户是设法侵入帐户还是代表内部威胁。 ![1 sources live sessions][1] -查看实时 Linux 会话 +*查看实时 Linux 会话* ### Cmd 如何工作? -在监视和管理用户活动时,Cmd: - - * 收集描述用户活动的信息 -  * 使用基线来确定什么是正常的 -  * 使用特定指标检测并主动防止威胁 -  * 向负责人发送警报 - +在监视和管理用户活动时,Cmd 可以: +* 收集描述用户活动的信息 +* 使用基线来确定什么是正常的 +* 使用特定指标检测并主动防止威胁 +* 向负责人发送警报 ![2 triggers][3] -在 Cmd 中构建自定义策略 +*在 Cmd 中构建自定义策略* -Cmd 扩展了系统管理员通过传统方法控制的内容,例如配置 sudo 权限,提供更精细和特定情境的控制。 +Cmd 扩展了系统管理员通过传统方法可以控制的内容,例如配置 `sudo` 权限,提供更精细和特定情境的控制。 -管理员可以选择可以与 Linux 系统管理员管理的用户权限控制分开管理的升级策略。 +管理员可以选择可以与 Linux 系统管理员所管理的用户权限控制分开管理的升级策略。 -Cmd 客户端提供实时可视化(不是事后日志分析),并且可以阻止操作,它需要额外的身份验证或根据需要协商授权。 +Cmd 客户端提供实时可视化(而不是事后日志分析),并且可以阻止操作、要求额外的身份验证或根据需要进行协商授权。 -此外,如果存在用户位置,Cmd 支持基于地理定位的自定义规则。并且可以在几分钟内将新策略推送到部署在主机上的客户端。 +此外,如果有用户位置信息,Cmd 支持基于地理定位的自定义规则。并且可以在几分钟内将新策略推送到部署在主机上的客户端。 ![3 command blocked][4] -在 Cmd 中构建触发器查询 - +*在 Cmd 中构建触发器查询* ### Cmd 的融资新闻 @@ -62,8 +60,6 @@ Cmd 客户端提供实时可视化(不是事后日志分析),并且可以 此外,该公司还任命 GV 的普通合伙人 Karim Faris 为董事会成员。 -在 [Facebook][7] 和 [LinkedIn][8] 中加入 Network World 社区,评论顶部话题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html @@ -71,7 +67,7 @@ via: https://www.networkworld.com/article/3342454/linux-security-cmd-provides-vi 作者:[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 e1cb70242320d08a733deee8b488b72f92d8e546 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 18 Mar 2019 23:23:11 +0800 Subject: [PATCH 680/813] PUB:20190226 Linux security- Cmd provides visibility, control over user activity.md @geekpi https://linux.cn/article-10631-1.html --- ...ty- Cmd provides visibility, control over user activity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190226 Linux security- Cmd provides visibility, control over user activity.md (98%) diff --git a/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/published/20190226 Linux security- Cmd provides visibility, control over user activity.md similarity index 98% rename from translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md rename to published/20190226 Linux security- Cmd provides visibility, control over user activity.md index 972d221d05..7d5848e2b6 100644 --- a/translated/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md +++ b/published/20190226 Linux security- Cmd provides visibility, control over user activity.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10631-1.html) [#]: subject: (Linux security: Cmd provides visibility, control over user activity) [#]: via: (https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 2f50eede956290c90f46cea44b8df69dd80c3b0e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Mar 2019 00:25:35 +0800 Subject: [PATCH 681/813] =?UTF-8?q?PRF:20171212=20Toplip=20=E2=80=93=20A?= =?UTF-8?q?=20Very=20Strong=20File=20Encryption=20And=20Decryption=20CLI?= =?UTF-8?q?=20Utility.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tomjlw --- ...ile Encryption And Decryption CLI Utility.md | 112 +++++++++--------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md b/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md index 887718ec7d..8ae771aa28 100644 --- a/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md +++ b/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md @@ -1,22 +1,24 @@ -Toplip ——一款十分强大的文件加密解密 CLI 工具 +toplip:一款十分强大的文件加密解密 CLI 工具 ====== -在市场上有许多可获得的文档加密工具用来保护你的文件。我们已经介绍过其中一些例如 [**Cryptomater**][1],[**Cryptkeeper**][2],[**CryptGo**][3],[**Cryptr**][4],[**Tomb**][5],以及 [**GnuPG**][6] 等加密工具。今天我们将讨论另一款叫做 **“Toplip”** 的命令行文件加密解密工具。它是一款使用一种叫做 **[AES256][7]** 的强大加密方法的免费开源的加密工具。它同时也使用了 **XTS-AES** 设计以保护你的隐私数据。它还使用了 [**Scrypt**][8],一种基于密码的密钥生成函数来保护你的密码免于暴力破解。 +![](https://www.ostechnix.com/wp-content/uploads/2017/12/Toplip-720x340.jpg) + +在市场上能找到许多用来保护文件的文档加密工具。我们已经介绍过其中一些例如 [Cryptomater][1]、[Cryptkeeper][2]、[CryptGo][3]、[Cryptr][4]、[Tomb][5],以及 [GnuPG][6] 等加密工具。今天我们将讨论另一款叫做 “toplip” 的命令行文件加密解密工具。它是一款使用一种叫做 [AES256][7] 的强大加密方法的自由开源的加密工具。它同时也使用了 XTS-AES 设计以保护你的隐私数据。它还使用了 [Scrypt][8],一种基于密码的密钥生成函数来保护你的密码免于暴力破解。 ### 优秀的特性 相比于其它文件加密工具,toplip 自带以下独特且杰出的特性。 * 非常强大的基于 XTS-AES256 的加密方法。 - * 可能性推诿。 - * 在图片(PNG/JPG)内加密文件。 + * 合理的推诿Plausible deniability。 + * 加密并嵌入文件到图片(PNG/JPG)中。 * 多重密码保护。 - * 简化的暴力破解保护。 + * 可防护直接暴力破解。 * 无可辨识的输出标记。 - * 开源/GPLv3。 + * 开源(GPLv3)。 -### 安装 Toplip +### 安装 toplip -没有什么需要安装的。Toplip 是独立的可执行二进制文件。你所要做的仅是从 [**产品官方页面**][9] 下载最新版的 Toplip 并赋予它可执行权限。为此你只要运行: +没有什么需要安装的。`toplip` 是独立的可执行二进制文件。你所要做的仅是从 [产品官方页面][9] 下载最新版的 `toplip` 并赋予它可执行权限。为此你只要运行: ``` chmod +x toplip @@ -24,29 +26,29 @@ chmod +x toplip ### 使用 -如果你不带任何参数运行 toplip,你将看到帮助页面。 +如果你不带任何参数运行 `toplip`,你将看到帮助页面。 ``` ./toplip ``` -[![][10]][11] +![][10] -允许我给你展示一些例子。 +请允许我给你展示一些例子。 -为了达到指导目的,我建了两个文件 **file1** 和 **file2**。我同时也有 **toplip** 可执行二进制文件。我把它们全都保存进一个叫做 **test** 的目录。 +为了达到指导目的,我建了两个文件 `file1` 和 `file2`。我同时也有 `toplip` 可执行二进制文件。我把它们全都保存进一个叫做 `test` 的目录。 -[![][12]][13] +![][12] -**加密/解密单个文件** +#### 加密/解密单个文件 -现在让我们加密 **file1**。为此,运行: +现在让我们加密 `file1`。为此,运行: ``` ./toplip file1 > file1.encrypted ``` -这行命令将让你输入密码。一旦你输入完密码,它就会加密 **file1** 的内容并将它们保存进你当前工作目录下一个叫做 “file1.encrypted” 的文件。 +这行命令将让你输入密码。一旦你输入完密码,它就会加密 `file1` 的内容并将它们保存进你当前工作目录下一个叫做 `file1.encrypted` 的文件。 上述命令行的示例输出将会是这样: @@ -57,7 +59,7 @@ Encrypting...Done 为了验证文件是否的确经过加密,试着打开它你会发现一些随机的字符。 -为了解密加密过的文件,像以下这样使用 **-d** 参数: +为了解密加密过的文件,像以下这样使用 `-d` 参数: ``` ./toplip -d file1.encrypted @@ -65,19 +67,19 @@ Encrypting...Done 这行命令会解密提供的文档并在终端窗口显示内容。 -为了保存文档而不是写入标准输出,运行: +为了保存文档而不是写入到标准输出,运行: ``` ./toplip -d file1.encrypted > file1.decrypted ``` -输入正确的密码解密文档。**file1.encrypted** 的所有内容将会存入一个叫做 **file1.decrypted** 的文档。 +输入正确的密码解密文档。`file1.encrypted` 的所有内容将会存入一个叫做 `file1.decrypted` 的文档。 请不要用这种命名方法,我这样用仅仅是为了便于理解。使用其它难以预测的名字。 -**加密/解密多个文件** +#### 加密/解密多个文件 -现在我们将使用分别的两个密码加密每个文件。 +现在我们将使用两个分别的密码加密每个文件。 ``` ./toplip -alt file1 file2 > file3.encrypted @@ -89,32 +91,32 @@ Encrypting...Done ``` This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -**file2 Passphrase #1** : generating keys...Done -**file1 Passphrase #1** : generating keys...Done +file2 Passphrase #1 : generating keys...Done +file1 Passphrase #1 : generating keys...Done Encrypting...Done ``` -上述命令所做的是加密两个文件的内容并将它们保存进一个单独的叫做 **file3.encrypted** 的文件。在保存中分别给予各自的密码。比如说如果你提供 file1 的密码,toplip 将复原 file1。如果你提供 file2 的密码,toplip 将复原 file2。 +上述命令所做的是加密两个文件的内容并将它们保存进一个单独的叫做 `file3.encrypted` 的文件。在保存中分别给予各自的密码。比如说如果你提供 `file1` 的密码,`toplip` 将复原 `file1`。如果你提供 `file2` 的密码,`toplip` 将复原 `file2`。 -每个 **toplip** 加密输出都可能包含最多至四个单独的文件,并且每个文件都建有各自独特的密码。由于加密输出放在一起的方式,以下判断出是否存在多个文档不是一件容易的事。默认情况下,甚至就算确实只有一个文件是由 toplip 加密,随机数据都会自动加上。如果多于一个文件被指定,每个都有自己的密码,那么你可以有选择性地独立解码每个文件,以此来否认其它文件存在的可能性。这能有效地使一个用户在可控的暴露风险下打开一个加密的捆绑文件包。并且对于敌人来说,在计算上没有一种低廉的办法来确认额外的秘密数据存在。这叫做 **可能性推诿**,是 toplip 著名的特性之一。 +每个 `toplip` 加密输出都可能包含最多四个单独的文件,并且每个文件都建有各自独特的密码。由于加密输出放在一起的方式,一下判断出是否存在多个文档不是一件容易的事。默认情况下,甚至就算确实只有一个文件是由 `toplip` 加密,随机数据都会自动加上。如果指定了多于一个文件,每个都有自己的密码,那么你可以有选择性地独立解码每个文件,以此来否认其它文件存在的可能性。这能有效地使一个用户在可控的暴露风险下打开一个加密的捆绑文件包。并且对于敌人来说,在计算上没有一种低廉的办法来确认额外的秘密数据存在。这叫做“合理的推诿Plausible deniability”,是 toplip 著名的特性之一。 -为了从 **file3.encrypted** 解码 **file1**,仅需输入: +为了从 `file3.encrypted` 解码 `file1`,仅需输入: ``` ./toplip -d file3.encrypted > file1.encrypted ``` -你将会被要求输入 file1 的正确密码。 +你将会被要求输入 `file1` 的正确密码。 -为了从 **file3.encrypted** 解码 **file2**,输入: +为了从 `file3.encrypted` 解码 `file2`,输入: ``` ./toplip -d file3.encrypted > file2.encrypted ``` -别忘了输入 file2 的正确密码。 +别忘了输入 `file2` 的正确密码。 -**使用多重密码保护** +#### 使用多重密码保护 这是我中意的另一个炫酷特性。在加密过程中我们可以为单个文件提供多重密码。这样可以保护密码免于暴力尝试。 @@ -122,32 +124,32 @@ Encrypting...Done ./toplip -c 2 file1 > file1.encrypted ``` -这里,**-c 2** 代表两个不同的密码。上述命令行的示例输出将会是这样: +这里,`-c 2` 代表两个不同的密码。上述命令行的示例输出将会是这样: ``` This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -**file1 Passphrase #1:** generating keys...Done -**file1 Passphrase #2:** generating keys...Done +file1 Passphrase #1: generating keys...Done +file1 Passphrase #2: generating keys...Done Encrypting...Done ``` -正如你在上述示例中所看到的,toplip 要求我输入两个密码。请注意你必须**提供两个不同的密码**,而不是提供两遍同一个密码。 +正如你在上述示例中所看到的,`toplip` 要求我输入两个密码。请注意你必须提供两个不同的密码,而不是提供两遍同一个密码。 为了解码这个文件,这样做: ``` $ ./toplip -c 2 -d file1.encrypted > file1.decrypted This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip -**file1.encrypted Passphrase #1:** generating keys...Done -**file1.encrypted Passphrase #2:** generating keys...Done +file1.encrypted Passphrase #1: generating keys...Done +file1.encrypted Passphrase #2: generating keys...Done Decrypting...Done ``` -**将文件藏在图片中** +#### 将文件藏在图片中 -将一个文件,消息,图片或视频藏在另一个文件里的方法叫做**隐写术**。幸运的是 toplip 默认包含这个特性。 +将一个文件、消息、图片或视频藏在另一个文件里的方法叫做隐写术。幸运的是 `toplip` 默认包含这个特性。 -为了将文件藏入图片中,像如下所示的样子使用 **-m** 参数。 +为了将文件藏入图片中,像如下所示的样子使用 `-m` 参数。 ``` $ ./toplip -m image.png file1 > image1.png @@ -156,8 +158,9 @@ file1 Passphrase #1: generating keys...Done Encrypting...Done ``` -这行命令将 file1 的内容藏入一张叫做 image1.png 的图片中。 -为了解码,运行: +这行命令将 `file1` 的内容藏入一张叫做 `image1.png` 的图片中。 + +要解码,运行: ``` $ ./toplip -d image1.png > file1.decrypted This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip @@ -165,7 +168,7 @@ image1.png Passphrase #1: generating keys...Done Decrypting...Done ``` -**增加密码复杂度** +#### 增加密码复杂度 为了进一步使文件变得难以破译,我们可以像以下这样增加密码复杂度: @@ -173,30 +176,31 @@ Decrypting...Done ./toplip -c 5 -i 0x8000 -alt file1 -c 10 -i 10 file2 > file3.encrypted ``` -上述命令将会要求你为 file1 输入十条密码,为 file2 输入五条密码,并将它们存入单个叫做 “file3.encrypted” 的文件。如你所注意到的,我们在这个例子中又用了另一个 **-i** 参数。这是用来指定密钥生成循环次数。这个选项覆盖了 scrypt 函数初始和最终 PBKDF2 阶段的默认循环次数1。十六进制和十进制数值都是允许的。比如说 **0x8000**,**10**等。请注意这会大大增加计算次数。 +上述命令将会要求你为 `file1` 输入十条密码,为 `file2` 输入五条密码,并将它们存入单个叫做 `file3.encrypted` 的文件。如你所注意到的,我们在这个例子中又用了另一个 `-i` 参数。这是用来指定密钥生成循环次数。这个选项覆盖了 `scrypt` 函数初始和最终 PBKDF2 阶段的默认循环次数 1。十六进制和十进制数值都是允许的。比如说 `0x8000`、`10` 等。请注意这会大大增加计算次数。 -为了解码 file1,使用: +为了解码 `file1`,使用: ``` ./toplip -c 5 -i 0x8000 -d file3.encrypted > file1.decrypted ``` -为了解码 file2,使用: +为了解码 `file2`,使用: ``` ./toplip -c 10 -i 10 -d file3.encrypted > file2.decrypted ``` -参考在文章结尾给出的 toplip 官网以了解更多关于其背后的技术信息和使用的加密方式。 +参考 `toplip` [官网](https://2ton.com.au/toplip/)以了解更多关于其背后的技术信息和使用的加密方式。 我个人对所有想要保护自己数据的人的建议是,别依赖单一的方法。总是使用多种工具/方法来加密文件。不要在纸上写下密码也不要将密码存入本地或云。记住密码,阅后即焚。如果你记不住,考虑使用任何了信赖的密码管理器。 +- [KeeWeb – An Open Source, Cross Platform Password Manager](https://www.ostechnix.com/keeweb-an-open-source-cross-platform-password-manager/) +- [Buttercup – A Free, Secure And Cross-platform Password Manager](https://www.ostechnix.com/buttercup-a-free-secure-and-cross-platform-password-manager/) +- [Titan – A Command line Password Manager For Linux](https://www.ostechnix.com/titan-command-line-password-manager-linux/) + 今天就到此为止了,更多好东西后续推出,请保持关注。 -欢呼吧! - - - +顺祝时祺! -------------------------------------------------------------------------------- @@ -204,7 +208,7 @@ via: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-util 作者:[SK][a] 译者:[tomjlw](https://github.com/tomjlw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -218,8 +222,6 @@ via: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-util [7]:http://en.wikipedia.org/wiki/Advanced_Encryption_Standard [8]:http://en.wikipedia.org/wiki/Scrypt [9]:https://2ton.com.au/Products/ -[10]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png%201366w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-300x157.png%20300w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-768x403.png%20768w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2-1024x537.png%201024w -[11]:http://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png -[12]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png%20779w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1-300x101.png%20300w,%20https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1-768x257.png%20768w -[13]:http://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png +[10]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-2.png +[12]:https://www.ostechnix.com/wp-content/uploads/2017/12/toplip-1.png From 3a0f3986f7af7e4b52235209882469e9c137c1b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Mar 2019 00:26:06 +0800 Subject: [PATCH 682/813] =?UTF-8?q?PUB:20171212=20Toplip=20=E2=80=93=20A?= =?UTF-8?q?=20Very=20Strong=20File=20Encryption=20And=20Decryption=20CLI?= =?UTF-8?q?=20Utility.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tomjlw https://linux.cn/article-10632-1.html --- ... – A Very Strong File Encryption And Decryption CLI Utility.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md (100%) diff --git a/translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md b/published/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md similarity index 100% rename from translated/tech/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md rename to published/20171212 Toplip – A Very Strong File Encryption And Decryption CLI Utility.md From db76ba81dd740205536ae0d60fb2311cf2244c49 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 Mar 2019 08:48:31 +0800 Subject: [PATCH 683/813] translated --- ...ve) - Google Drive GUI Client For Linux.md | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) rename {sources => translated}/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md (51%) diff --git a/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md b/translated/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md similarity index 51% rename from sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md rename to translated/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md index 65787015dd..f7386a40f9 100644 --- a/sources/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md +++ b/translated/tech/20190124 ODrive (Open Drive) - Google Drive GUI Client For Linux.md @@ -7,83 +7,82 @@ [#]: via: (https://www.2daygeek.com/odrive-open-drive-google-drive-gui-client-for-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -ODrive (Open Drive) – Google Drive GUI Client For Linux +ODrive(Open Drive) - Linux 中的 Google Drive 图形客户端 ====== -This we had discussed in so many times. However, i will give a small introduction about it. +这个我们已经多次讨论过。但是,我还要简要介绍一下它。 -As of now there is no official Google Drive Client for Linux and we need to use unofficial clients. +截至目前,还没有官方的 Google Drive 的 Linux 客户端,我们需要使用非官方客户端。 -There are many applications available in Linux for Google Drive integration. +Linux 中有许多集成 Google Drive 的应用。 -Each application has came out with set of features. +每个应用都提供了一组功能。 -We had written few articles about this in our website in the past. +我们过去在网站上很少写过此类文章。 -Those are **[DriveSync][1]** , **[Google Drive Ocamlfuse Client][2]** and **[Mount Google Drive in Linux Using Nautilus File Manager][3]**. +这些文章是 **[DriveSync][1]** 、**[Google Drive Ocamlfuse 客户端][2]** 和 **[在 Linux 中使用 Nautilus 文件管理器挂载 Google Drive][3]**。 -Today also we are going to discuss about the same topic and the utility name is ODrive. +今天我们也将讨论相同的主题,程序名字是 ODrive。 -### What’s ODrive? +### ODrive 是什么? -ODrive stands for Open Drive. It’s a GUI client for Google Drive which was written in electron framework. +ODrive 代表 Open Drive。它是 Google Drive 的图形客户端,它用 electron 框架编写。 -It’s simple GUI which allow users to integrate the Google Drive with few steps. +它简单的图形界面能让用户几步就能集成 Google Drive。 -### How To Install & Setup ODrive on Linux? +### 如何在 Linux 上安装和设置 ODrive? -Since the developer is offering the AppImage package and there is no difficulty for installing the ODrive on Linux. +由于开发者提供了 AppImage 包,因此在 Linux 上安装 ODrive 没有任何困难。 -Simple download the latest ODrive AppImage package from developer github page using **wget Command**. +只需使用 **wget 命令**从开发者的 github 页面下载最新的 ODrive AppImage 包。 ``` $ wget https://github.com/liberodark/ODrive/releases/download/0.1.3/odrive-0.1.3-x86_64.AppImage ``` -You have to set executable file permission to the ODrive AppImage file. +你必须为 ODrive AppImage 文件设置可执行文件权限。 ``` $ chmod +x odrive-0.1.3-x86_64.AppImage ``` -Simple run the following ODrive AppImage file to launch the ODrive GUI for further setup. +只需运行 ODrive AppImage 文件以启动 ODrive GUI 以进行进一步设置。 ``` $ ./odrive-0.1.3-x86_64.AppImage ``` -You might get the same window like below when you ran the above command. Just hit the **`Next`** button for further setup. +运行上述命令时,可能会看到下面的窗口。只需按下**“下一步”**按钮即可进行进一步设置。 ![][5] -Click **`Connect`** link to add a Google drive account. +点击**`连接`**链接添加 Google Drive 帐户。 ![][6] -Enter your email id which you want to setup a Google Drive account. +输入你要设置 Google Drive 帐户的电子邮箱。 ![][7] -Enter your password for the given email id. +输入邮箱密码。 ![][8] -Allow ODrive (Open Drive) to access your Google account. +允许 ODrive(Open Drive) 访问你的 Google 帐户。 ![][9] -By default, it will choose the folder location. You can change if you want to use the specific one. +默认情况下,它将选择文件夹位置。如果你要选择特定文件夹,则可以更改。 ![][10] -Finally hit **`Synchronize`** button to start download the files from Google Drive to your local system. +最后点击**`同步`**按钮开始将文件从 Google Drive 下载到本地系统。 ![][11] -Synchronizing is in progress. +同步正在进行中。 ![][12] -Once synchronizing is completed. It will show you all files downloaded. -Once synchronizing is completed. It’s shows you that all the files has been downloaded. +同步完成后。它会显示所有已下载的文件。 ![][13] -I have seen all the files were downloaded in the mentioned directory. +我看到所有文件都下载到上述目录中。 ![][14] -If you want to sync any new files from local system to Google Drive. Just start the `ODrive` from the application menu but it won’t actual launch the application. But it will be running in the background that we can able to see by using the ps command. +如果要将本地系统中的任何新文件同步到 Google Drive。只需从应用菜单启动 `ODrive`,但它不会实际启动应用。但它将在后台运行,我们可以使用 ps 命令查看。 ``` $ ps -df | grep odrive @@ -91,10 +90,10 @@ $ ps -df | grep odrive ![][15] -It will automatically sync once you add a new file into the google drive folder. The same has been checked through notification menu. Yes, i can see one file was synced to Google Drive. +将新文件添加到 Google Drive 文件夹后,它会自动开始同步。从通知菜单中也可以看到。是的,我看到一个文件已同步到 Google Drive 中。 ![][16] -GUI is not loading after sync, and i’m not sure this functionality. I will check with developer and will add update based on his input. +同步完成后图形界面没有加载,我不确定这个功能。我会向开发者之后,根据他的反馈更新。 -------------------------------------------------------------------------------- @@ -102,7 +101,7 @@ via: https://www.2daygeek.com/odrive-open-drive-google-drive-gui-client-for-linu 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7d4a2dd6d51fe3fcdd323c9ae9185c64e4f4d7f0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 Mar 2019 08:51:07 +0800 Subject: [PATCH 684/813] translating --- ...d with Freeplane, an open source mind mapping application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md b/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md index cefca12303..aca70d3fc8 100644 --- a/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md +++ b/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 83341a3bd57893d1b1c851f1c80d584c0f8d0c8f Mon Sep 17 00:00:00 2001 From: MZZZ Date: Tue, 19 Mar 2019 09:58:36 +0800 Subject: [PATCH 685/813] MZqk translating --- sources/tech/20190124 What does DevOps mean to you.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190124 What does DevOps mean to you.md b/sources/tech/20190124 What does DevOps mean to you.md index c62f0f83ba..8b4d3ab33a 100644 --- a/sources/tech/20190124 What does DevOps mean to you.md +++ b/sources/tech/20190124 What does DevOps mean to you.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MZqk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5a5cf05e2e5368faf7a77ed492434dc004052f8c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:00:49 +0800 Subject: [PATCH 686/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20How=20?= =?UTF-8?q?to=20host=20your=20own=20webfonts=20sources/tech/20190318=20How?= =?UTF-8?q?=20to=20host=20your=20own=20webfonts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190318 How to host your own webfonts.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20190318 How to host your own webfonts.md diff --git a/sources/tech/20190318 How to host your own webfonts.md b/sources/tech/20190318 How to host your own webfonts.md new file mode 100644 index 0000000000..78fba8389d --- /dev/null +++ b/sources/tech/20190318 How to host your own webfonts.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to host your own webfonts) +[#]: via: (https://opensource.com/article/19/3/webfonts) +[#]: author: (Seth Kenlon (Red Hat, Community Moderator) https://opensource.com/users/seth) + +How to host your own webfonts +====== + +### Customize your website by self-hosting openly licensed fonts. + +![Open source fonts][1] + +Fonts are often a mystery to many computer users. For example, have you designed a cool flyer and, when you take the file somewhere for printing, find all the titles rendered in Arial because the printer doesn't have the fancy font you used in your design? There are ways to prevent this, of course: you can convert words in special fonts into paths, bundle fonts into a PDF, bundle open source fonts with your design files, or—at least—list the fonts required. And yet it's still a problem because we're human and we're forgetful. + +The web has the same sort of problem. If you have even a basic understanding of CSS, you've probably seen this kind of declaration: + +``` +h1 { font-family: "Times New Roman", Times, serif; } +``` + +This is a designer's attempt to define a specific font, provide a fallback if a user doesn't have Times New Roman installed, and offer yet another fallback if the user doesn't have Times either. It's better than using a graphic instead of text, but it's still an awkward, inelegant method of font non-management, However, in the early-ish days of the web, it's all we had to work with. + +### Webfonts + +Then webfonts happened, moving font management from the client to the server. Fonts on websites were rendered for the client by the server, rather than requiring the web browser to find a font on the user's system. Google and other providers even host openly licensed fonts, which designers can include on their sites with a simple CSS rule. + +The problem with this free convenience, of course, is that it doesn't come without cost. It's $0 to use, but major sites like Google love to keep track of who references their data, fonts included. If you don't see a need to assist Google in building a record of everyone's activity on the web, the good news is you can host your own webfonts, and it's as simple as uploading fonts to your host and using one easy CSS rule. As a side benefit, your site may load faster, as you'll be making one fewer external call upon loading each page. + +### Self-hosted webfonts + +The first thing you need is an openly licensed font. This can be confusing if you're not used to thinking or caring about obscure software licenses, especially since it seems like all fonts are free. Very few of us have consciously paid for a font, and yet most people have high-priced fonts on their computers. Thanks to licensing deals, your computer may have shipped with fonts that [you aren't legally allowed to copy and redistribute][2]. Fonts like Arial, Verdana, Calibri, Georgia, Impact, Lucida and Lucida Grande, Times and Times New Roman, Trebuchet, Geneva, and many others are owned by Microsoft, Apple, and Adobe. If you purchased a computer preloaded with Windows or MacOS, you paid for the right to use the bundled fonts, but you don't own those fonts and are not permitted to upload them to a web server (unless otherwise stated). + +Fortunately, the open source craze hit the font world long ago, and there are excellent collections of openly licensed fonts from collectives and projects like [The League of Moveable Type][3], [Font Library][4], [Omnibus Type][5], and even [Google][6] and [Adobe][7]. + +You can use most common font file formats, including TTF, OTF, WOFF, EOT, and so on. Since Sorts Mill Goudy includes a WOFF (Web Open Font Format, developed in part by Mozilla) version, I'll use it in this example. However, other formats work the same way. + +Assuming you want to use [Sorts Mill Goudy][8] on your web page: + + 1. Upload the **GoudyStM-webfont.woff** file to your web server: + +``` +scp GoudyStM-webfont.woff seth@example.com:~/www/fonts/ +``` + +Your host may also provide a graphical upload tool through cPanel or a similar web control panel. + + + + 2. In your site's CSS file, add an **@font-face** rule, similar to this: + + +``` +@font-face { +  font-family: "titlefont"; +  src: url("../fonts/GoudyStM-webfont.woff"); +} +``` + +The **font-family** value is something you make up. It's a human-friendly name for whatever the font face represents. I am using "titlefont" in this example because I imagine this font will be used for the main titles on an imaginary site. You could just as easily use "officialfont" or "myfont." + +The **src** value is the path to the font file. The path to the font must be appropriate for your server's file structure; in this example, I have the **fonts** directory alongside a **css** directory. You may not have your site structured that way, so adjust the paths as needed, remembering that a single dot means _this folder_ and two dots mean _a folder back_. + + + + 3. Now that you've defined the font face name and the location, you can call it for any given CSS class or ID you desire. For example, if you want **< h1>** to render in the Sorts Mill Goudy font, then make its CSS rule use your custom font name: + +``` +h1 { font-family: "titlefont", serif; } +``` + + + + +You're now hosting and using your own fonts. + + +![Web fonts on a website][10] + +_Thanks to Alexandra Kanik for teaching me about @font-face and most everything else I know about good web design._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/webfonts + +作者:[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/life_typography_fonts.png?itok=Q1jMys5G (Open source fonts) +[2]: https://docs.microsoft.com/en-us/typography/fonts/font-faq +[3]: https://www.theleagueofmoveabletype.com/ +[4]: https://fontlibrary.org/ +[5]: https://www.omnibus-type.com +[6]: https://github.com/googlefonts +[7]: https://github.com/adobe-fonts +[8]: https://www.theleagueofmoveabletype.com/sorts-mill-goudy +[9]: /file/426056 +[10]: https://opensource.com/sites/default/files/uploads/webfont.jpg (Web fonts on a website) From a5df1edc9f7fa9d5ecb324fec1748316e0faa7e9 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:13:30 +0800 Subject: [PATCH 687/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Buildi?= =?UTF-8?q?ng=20and=20augmenting=20libraries=20by=20calling=20Rust=20from?= =?UTF-8?q?=20JavaScript=20sources/tech/20190318=20Building=20and=20augmen?= =?UTF-8?q?ting=20libraries=20by=20calling=20Rust=20from=20JavaScript.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...braries by calling Rust from JavaScript.md | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md diff --git a/sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md b/sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md new file mode 100644 index 0000000000..935f8eded5 --- /dev/null +++ b/sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building and augmenting libraries by calling Rust from JavaScript) +[#]: via: (https://opensource.com/article/19/3/calling-rust-javascript) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +Building and augmenting libraries by calling Rust from JavaScript +====== + +Explore how to use WebAssembly (Wasm) to embed Rust inside JavaScript. + +![JavaScript in Vim][1] + +In _[Why should you use Rust in WebAssembly?][2]_ , I looked at why you might want to write WebAssembly (Wasm), and why you might choose Rust as the language to do it in. Now I'll share what that looks like by exploring ways to embed Rust inside JavaScript. + +This is something that separates Rust from Go, C#, and other languages with large runtimes that can compile to Wasm. Rust has a minimal runtime (basically just an allocator), making it easy to use Rust from JavaScript libraries. C and C++ have similar stories, but what sets Rust apart is its tooling, which we'll take a look at now. + +### The basics + +If you've never used Rust before, you'll first want to get that set up. It's pretty easy. First download [**Rustup**][3], which is a way to control versions of Rust and different toolchains for cross-compilation. This will give you access to [**Cargo**][4], which is the Rust build tool and package manager. + +Now we have a decision to make. We can easily write Rust code that runs in the browser through WebAssembly, but if we want to do anything other than make people's CPU fans spin, we'll probably at some point want to interact with the Document Object Model (DOM) or use some JavaScript API. In other words: _we need JavaScript interop_ (aka the JavaScript interoperability API). + +### The problem and the solutions + +WebAssembly is an extremely simple machine language. If we want to be able to communicate with JavaScript, Wasm gives us only four data types to do it with: 32- and 64-bit floats and integers. Wasm doesn't have a concept of strings, arrays, objects, or any other rich data type. Basically, we can only pass around pointers between Rust and JavaScript. Needless to say, this is less than ideal. + +The good news is there are two libraries that facilitate communication between Rust-based Wasm and JavaScript: [**wasm-bindgen**][5] and [**stdweb**][6]. The bad news, however, is these two libraries are unfortunately incompatible with each other. **wasm-bindgen** is lower-level than **stdweb** and attempts to provide full control over how JavaScript and Rust interact. In fact, there is even talk of [rewriting **stdweb** using **wasm-bindgen**][7], which would get rid of the issue of incompatibility. + +Because **wasm-bindgen** is the lighter-weight option (and the option officially worked on by the official [Rust WebAssembly working group][8]), we'll focus at that. + +### wasm-bindgen and wasm-pack + +We're going to create a function that takes a string from JavaScript, makes it uppercase and prepends "HELLO, " to it, and returns it back to JavaScript. We'll call this function **excited_greeting**! + +First, let's create our Rust library that will house this fabulous function: + +``` +$ cargo new my-wasm-library --lib +$ cd my-wasm-library +``` + +Now we'll want to replace the contents of **src/lib.rs** with our exciting logic. I think it's best to write the code out instead of copy/pasting. + +``` +// Include the `wasm_bindgen` attribute into the current namespace. +use wasm_bindgen::prelude::wasm_bindgen; + +// This attribute makes calling Rust from JavaScript possible. +// It generates code that can convert the basic types wasm understands +// (integers and floats) into more complex types like strings and +// vice versa. If you're interested in how this works, check this out: +// +#[wasm_bindgen] +// This is pretty plain Rust code. If you've written Rust before this +// should look extremely familiar. If not, why wait?! Check this out: +// +pub fn excited_greeting(original: &str) -> String { +format!("HELLO, {}", original.to_uppercase()) +} +``` + +Second, we'll have to make two changes to our **Cargo.toml** configuration file: + + * Add **wasm_bindgen** as a dependency. + * Configure the type of library binary to be a **cdylib** or dynamic system library. In this case, our system is **wasm** , and setting this option is how we produce **.wasm** binary files. + + +``` +[package] +name = "my-wasm-library" +version = "0.1.0" +authors = ["$YOUR_INFO"] +edition = "2018" + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +wasm-bindgen = "0.2.33" +``` + +Now let's build! If we just use **cargo build** , we'll get a **.wasm** binary, but in order to make it easy to call our Rust code from JavaScript, we'd like to have some JavaScript code that converts rich JavaScript types like strings and objects to pointers and passes these pointers to the Wasm module on our behalf. Doing this manually is tedious and prone to bugs. + +Luckily, in addition to being a library, **wasm-bindgen** also has the ability to create this "glue" JavaScript for us. This means in our code we can interact with our Wasm module using normal JavaScript types, and the generated code from **wasm-bindgen** will do the dirty work of converting these rich types into the pointer types that Wasm actually understands. + +We can use the awesome **wasm-pack** to build our Wasm binary, invoke the **wasm-bindgen** CLI tool, and package all of our JavaScript (and any optional generated TypeScript types) into one nice and neat package. Let's do that now! + +First we'll need to install **wasm-pack** : + +``` +$ cargo install wasm-pack +``` + +By default, **wasm-bindgen** produces ES6 modules. We'll use our code from a simple script tag, so we just want it to produce a plain old JavaScript object that gives us access to our Wasm functions. To do this, we'll pass it the **\--target no-modules** option. + +``` +$ wasm-pack build --target no-modules +``` + +We now have a **pkg** directory in our project. If we look at the contents, we'll see the following: + + * **package.json** : useful if we want to package this up as an NPM module + * **my_wasm_library_bg.wasm** : our actual Wasm code + * **my_wasm_library.js** : the JavaScript "glue" code + * Some TypeScript definition files + + + +Now we can create an **index.html** file that will make use of our JavaScript and Wasm: + +``` +<[html][9]> +<[head][10]> +<[meta][11] content="text/html;charset=utf-8" http-equiv="Content-Type" /> + +<[body][12]> + +<[script][13] src='./pkg/my_wasm_library.js'> + +<[script][13]> +window.addEventListener('load', async () => { +// Load the wasm file +await wasm_bindgen('./pkg/my_wasm_library_bg.wasm'); +// Once it's loaded the `wasm_bindgen` object is populated +// with the functions defined in our Rust code +const greeting = wasm_bindgen.excited_greeting("Ryan") +console.log(greeting) +}); + + + +``` + +You may be tempted to open the HTML file in your browser, but unfortunately, this is not possible. For security reasons, Wasm files have to be served from the same domain as the HTML file. You'll need an HTTP server. If you have a favorite static HTTP server that can serve files from your filesystem, feel free to use that. I like to use [**basic-http-server**][14], which you can install and run like so: + +``` +$ cargo install basic-http-server +$ basic-http-server +``` + +Now open the **index.html** file through the web server by going to **** and check your JavaScript console. You should see a very exciting greeting there! + +If you have any questions, please [let me know][15]. Next time, we'll take a look at how we can use various browser and JavaScript APIs from within our Rust code. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/calling-rust-javascript + +作者:[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/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) +[2]: https://opensource.com/article/19/2/why-use-rust-webassembly +[3]: https://rustup.rs/ +[4]: https://doc.rust-lang.org/cargo/ +[5]: https://github.com/rustwasm/wasm-bindgen +[6]: https://github.com/koute/stdweb +[7]: https://github.com/koute/stdweb/issues/318 +[8]: https://www.rust-lang.org/governance/wgs/wasm +[9]: http://december.com/html/4/element/html.html +[10]: http://december.com/html/4/element/head.html +[11]: http://december.com/html/4/element/meta.html +[12]: http://december.com/html/4/element/body.html +[13]: http://december.com/html/4/element/script.html +[14]: https://github.com/brson/basic-http-server +[15]: https://twitter.com/ryan_levick From 70e1196bb01510e906567b7cde96087130ad7ca8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:34:27 +0800 Subject: [PATCH 688/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=2010=20P?= =?UTF-8?q?ython=20image=20manipulation=20tools=20sources/tech/20190318=20?= =?UTF-8?q?10=20Python=20image=20manipulation=20tools.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0318 10 Python image manipulation tools.md | 331 ++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 sources/tech/20190318 10 Python image manipulation tools.md diff --git a/sources/tech/20190318 10 Python image manipulation tools.md b/sources/tech/20190318 10 Python image manipulation tools.md new file mode 100644 index 0000000000..334e2b4344 --- /dev/null +++ b/sources/tech/20190318 10 Python image manipulation tools.md @@ -0,0 +1,331 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Python image manipulation tools) +[#]: via: (https://opensource.com/article/19/3/python-image-manipulation-tools) +[#]: author: (Parul Pandey https://opensource.com/users/parul-pandey) + +10 Python image manipulation tools +====== + +These Python libraries provide an easy and intuitive way to transform images and make sense of the underlying data. + +![][1] + +Today's world is full of data, and images form a significant part of this data. However, before they can be used, these digital images must be processed—analyzed and manipulated in order to improve their quality or extract some information that can be put to use. + +Common image processing tasks include displays; basic manipulations like cropping, flipping, rotating, etc.; image segmentation, classification, and feature extractions; image restoration; and image recognition. Python is an excellent choice for these types of image processing tasks due to its growing popularity as a scientific programming language and the free availability of many state-of-the-art image processing tools in its ecosystem. + +This article looks at 10 of the most commonly used Python libraries for image manipulation tasks. These libraries provide an easy and intuitive way to transform images and make sense of the underlying data. + +### 1\. scikit-image + +**[**scikit** -image][2]** is an open source Python package that works with [NumPy][3] arrays. It implements algorithms and utilities for use in research, education, and industry applications. It is a fairly simple and straightforward library, even for those who are new to Python's ecosystem. The code is high-quality, peer-reviewed, and written by an active community of volunteers. + +#### Resources + +scikit-image is very well [documented][4] with a lot of examples and practical use cases. + +#### Usage + +The package is imported as **skimage** , and most functions are found within the submodules. + +Image filtering: + +``` +import matplotlib.pyplot as plt +%matplotlib inline + +from skimage import data,filters + +image = data.coins() # ... or any other NumPy array! +edges = filters.sobel(image) +plt.imshow(edges, cmap='gray') +``` + +![Image filtering in scikit-image][6] + +Template matching using the [match_template][7] function: + +![Template matching in scikit-image][9] + +You can find more examples in the [gallery][10]. + +### 2\. NumPy + +[**NumPy**][11] is one of the core libraries in Python programming and provides support for arrays. An image is essentially a standard NumPy array containing pixels of data points. Therefore, by using basic NumPy operations, such as slicing, masking, and fancy indexing, you can modify the pixel values of an image. The image can be loaded using **skimage** and displayed using Matplotlib. + +#### Resources + +A complete list of resources and documentation is available on NumPy's [official documentation page][11]. + +#### Usage + +Using Numpy to mask an image: + +``` +import numpy as np +from skimage import data +import matplotlib.pyplot as plt +%matplotlib inline + +image = data.camera() +type(image) +numpy.ndarray #Image is a NumPy array: + +mask = image < 87 +image[mask]=255 +plt.imshow(image, cmap='gray') +``` + +![NumPy][13] + +### 3\. SciPy + +**[SciPy][14]** is another of Python's core scientific modules (like NumPy) and can be used for basic image manipulation and processing tasks. In particular, the submodule [**scipy.ndimage**][15] (in SciPy v1.1.0) provides functions operating on n-dimensional NumPy arrays. The package currently includes functions for linear and non-linear filtering, binary morphology, B-spline interpolation, and object measurements. + +#### Resources + +For a complete list of functions provided by the **scipy.ndimage** package, refer to the [documentation][16]. + +#### Usage + +Using SciPy for blurring using a [Gaussian filter][17]: +``` +from scipy import misc,ndimage + +face = misc.face() +blurred_face = ndimage.gaussian_filter(face, sigma=3) +very_blurred = ndimage.gaussian_filter(face, sigma=5) + +#Results +plt.imshow() +``` + +![Using a Gaussian filter in SciPy][19] + +### 4\. PIL/Pillow + +**PIL** (Python Imaging Library) is a free library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. However, its development has stagnated, with its last release in 2009. Fortunately, there is [**Pillow**][20], an actively developed fork of PIL, that is easier to install, runs on all major operating systems, and supports Python 3. The library contains basic image processing functionality, including point operations, filtering with a set of built-in convolution kernels, and color-space conversions. + +#### Resources + +The [documentation][21] has instructions for installation as well as examples covering every module of the library. + +#### Usage + +Enhancing an image in Pillow using ImageFilter: + +``` +from PIL import Image,ImageFilter +#Read image +im = Image.open('image.jpg') +#Display image +im.show() + +from PIL import ImageEnhance +enh = ImageEnhance.Contrast(im) +enh.enhance(1.8).show("30% more contrast") +``` + +![Enhancing an image in Pillow using ImageFilter][23] + +[Image source code][24] + +### 5\. OpenCV-Python + +**OpenCV** (Open Source Computer Vision Library) is one of the most widely used libraries for computer vision applications. [**OpenCV-Python**][25] is the Python API for OpenCV. OpenCV-Python is not only fast, since the background consists of code written in C/C++, but it is also easy to code and deploy (due to the Python wrapper in the foreground). This makes it a great choice to perform computationally intensive computer vision programs. + +#### Resources + +The [OpenCV2-Python-Guide][26] makes it easy to get started with OpenCV-Python. + +#### Usage + +Using _Image Blending using Pyramids_ in OpenCV-Python to create an "Orapple": + + +![Image blending using Pyramids in OpenCV-Python][28] + +[Image source code][29] + +### 6\. SimpleCV + +[**SimpleCV**][30] is another open source framework for building computer vision applications. It offers access to several high-powered computer vision libraries such as OpenCV, but without having to know about bit depths, file formats, color spaces, etc. Its learning curve is substantially smaller than OpenCV's, and (as its tagline says), "it's computer vision made easy." Some points in favor of SimpleCV are: + + * Even beginning programmers can write simple machine vision tests + * Cameras, video files, images, and video streams are all interoperable + + + +#### Resources + +The official [documentation][31] is very easy to follow and has tons of examples and use cases to follow. + +#### Usage + +### [7-_simplecv.png][32] + +![SimpleCV][33] + +### 7\. Mahotas + +**[Mahotas][34]** is another computer vision and image processing library for Python. It contains traditional image processing functions such as filtering and morphological operations, as well as more modern computer vision functions for feature computation, including interest point detection and local descriptors. The interface is in Python, which is appropriate for fast development, but the algorithms are implemented in C++ and tuned for speed. Mahotas' library is fast with minimalistic code and even minimum dependencies. Read its [official paper][35] for more insights. + +#### Resources + +The [documentation][36] contains installation instructions, examples, and even some tutorials to help you get started using Mahotas easily. + +#### Usage + +The Mahotas library relies on simple code to get things done. For example, it does a good job with the [Finding Wally][37] problem with a minimum amount of code. + +Solving the Finding Wally problem: + +![Finding Wally problem in Mahotas][39] + +[Image source code][40] + +![Finding Wally problem in Mahotas][42] + +[Image source code][40] + +### 8\. SimpleITK + +[**ITK**][43] (Insight Segmentation and Registration Toolkit) is an "open source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. **[SimpleITK][44]** is a simplified layer built on top of ITK, intended to facilitate its use in rapid prototyping, education, [and] interpreted languages." It's also an image analysis toolkit with a [large number of components][45] supporting general filtering operations, image segmentation, and registration. SimpleITK is written in C++, but it's available for a large number of programming languages including Python. + +#### Resources + +There are a large number of [Jupyter Notebooks][46] illustrating the use of SimpleITK for educational and research activities. The notebooks demonstrate using SimpleITK for interactive image analysis using the Python and R programming languages. + +#### Usage + +Visualization of a rigid CT/MR registration process created with SimpleITK and Python: + +![SimpleITK animation][48] + +[Image source code][49] + +### 9\. pgmagick + +[**pgmagick**][50] is a Python-based wrapper for the GraphicsMagick library. The [**GraphicsMagick**][51] image processing system is sometimes called the Swiss Army Knife of image processing. Its robust and efficient collection of tools and libraries supports reading, writing, and manipulating images in over 88 major formats including DPX, GIF, JPEG, JPEG-2000, PNG, PDF, PNM, and TIFF. + +#### Resources + +pgmagick's [GitHub repository][52] has installation instructions and requirements. There is also a detailed [user guide][53]. + +#### Usage + +Image scaling: + +![Image scaling in pgmagick][55] + +[Image source code][56] + +Edge extraction: + +![Edge extraction in pgmagick][58] + +[Image source code][59] + +### 10\. Pycairo + +[**Pycairo**][60] is a set of Python bindings for the [Cairo][61] graphics library. Cairo is a 2D graphics library for drawing vector graphics. Vector graphics are interesting because they don't lose clarity when resized or transformed. Pycairo can call Cairo commands from Python. + +#### Resources + +The Pycairo [GitHub repository][62] is a good resource with detailed instructions on installation and usage. There is also a [getting started guide][63], which has a brief tutorial on Pycairo. + +#### Usage + +Drawing lines, basic shapes, and radial gradients with Pycairo: + +![Pycairo][65] + +[Image source code][66] + +### Conclusion + +These are some of the useful and freely available image processing libraries in Python. Some are well known and others may be new to you. Try them out to get to know more about them! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/python-image-manipulation-tools + +作者:[Parul Pandey][a] +选题:[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/parul-pandey +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/daisy_gimp_art_design.jpg?itok=6kCxAKWO +[2]: https://scikit-image.org/ +[3]: http://docs.scipy.org/doc/numpy/reference/index.html#module-numpy +[4]: http://scikit-image.org/docs/stable/user_guide.html +[5]: /file/426206 +[6]: https://opensource.com/sites/default/files/uploads/1-scikit-image.png (Image filtering in scikit-image) +[7]: http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_template.html#sphx-glr-auto-examples-features-detection-plot-template-py +[8]: /file/426211 +[9]: https://opensource.com/sites/default/files/uploads/2-scikit-image.png (Template matching in scikit-image) +[10]: https://scikit-image.org/docs/dev/auto_examples +[11]: http://www.numpy.org/ +[12]: /file/426216 +[13]: https://opensource.com/sites/default/files/uploads/3-numpy.png (NumPy) +[14]: https://www.scipy.org/ +[15]: https://docs.scipy.org/doc/scipy/reference/ndimage.html#module-scipy.ndimage +[16]: https://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html#correlation-and-convolution +[17]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.gaussian_filter.html +[18]: /file/426221 +[19]: https://opensource.com/sites/default/files/uploads/4-scipy.png (Using a Gaussian filter in SciPy) +[20]: https://python-pillow.org/ +[21]: https://pillow.readthedocs.io/en/3.1.x/index.html +[22]: /file/426226 +[23]: https://opensource.com/sites/default/files/uploads/5-pillow.png (Enhancing an image in Pillow using ImageFilter) +[24]: http://sipi.usc.edu/database/ +[25]: https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_setup/py_intro/py_intro.html +[26]: https://github.com/abidrahmank/OpenCV2-Python-Tutorials +[27]: /file/426236 +[28]: https://opensource.com/sites/default/files/uploads/6-opencv.jpeg (Image blending using Pyramids in OpenCV-Python) +[29]: https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_pyramids/py_pyramids.html#pyramids +[30]: http://simplecv.org/ +[31]: http://examples.simplecv.org/en/latest/ +[32]: /file/426241 +[33]: https://opensource.com/sites/default/files/uploads/7-_simplecv.png (SimpleCV) +[34]: https://mahotas.readthedocs.io/en/latest/ +[35]: https://openresearchsoftware.metajnl.com/articles/10.5334/jors.ac/ +[36]: https://mahotas.readthedocs.io/en/latest/install.html +[37]: https://blog.clarifai.com/wheres-waldo-using-machine-learning-to-find-all-the-waldos +[38]: /file/426246 +[39]: https://opensource.com/sites/default/files/uploads/8-mahotas.png (Finding Wally problem in Mahotas) +[40]: https://mahotas.readthedocs.io/en/latest/wally.html +[41]: /file/426251 +[42]: https://opensource.com/sites/default/files/uploads/9-mahotas.png (Finding Wally problem in Mahotas) +[43]: https://itk.org/ +[44]: http://www.simpleitk.org/ +[45]: https://itk.org/ITK/resources/resources.html +[46]: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/ +[47]: /file/426256 +[48]: https://opensource.com/sites/default/files/uploads/10-simpleitk.gif (SimpleITK animation) +[49]: https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Utilities/intro_animation.py +[50]: https://pypi.org/project/pgmagick/ +[51]: http://www.graphicsmagick.org/ +[52]: https://github.com/hhatto/pgmagick +[53]: https://pgmagick.readthedocs.io/en/latest/ +[54]: /file/426261 +[55]: https://opensource.com/sites/default/files/uploads/11-pgmagick.png (Image scaling in pgmagick) +[56]: https://pgmagick.readthedocs.io/en/latest/cookbook.html#scaling-a-jpeg-image +[57]: /file/426266 +[58]: https://opensource.com/sites/default/files/uploads/12-pgmagick.png (Edge extraction in pgmagick) +[59]: https://pgmagick.readthedocs.io/en/latest/cookbook.html#edge-extraction +[60]: https://pypi.org/project/pycairo/ +[61]: https://cairographics.org/ +[62]: https://github.com/pygobject/pycairo +[63]: https://pycairo.readthedocs.io/en/latest/tutorial.html +[64]: /file/426271 +[65]: https://opensource.com/sites/default/files/uploads/13-pycairo.png (Pycairo) +[66]: http://zetcode.com/gfx/pycairo/basicdrawing/ From 1f87b7701b964dc7d5470371c71a16d37cb7aaf1 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:52:36 +0800 Subject: [PATCH 689/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Solus?= =?UTF-8?q?=204=20=E2=80=98Fortitude=E2=80=99=20Released=20with=20Signific?= =?UTF-8?q?ant=20Improvements=20sources/tech/20190318=20Solus=204=20?= =?UTF-8?q?=E2=80=98Fortitude-=20Released=20with=20Significant=20Improveme?= =?UTF-8?q?nts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e- Released with Significant Improvements.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md diff --git a/sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md b/sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md new file mode 100644 index 0000000000..c7a8d4bc55 --- /dev/null +++ b/sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solus 4 ‘Fortitude’ Released with Significant Improvements) +[#]: via: (https://itsfoss.com/solus-4-release) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Solus 4 ‘Fortitude’ Released with Significant Improvements +====== + +Finally, after a year of work, the much anticipated Solus 4 is here. It’s a significant release not just because this is a major upgrade, but also because this is the first major release after [Ikey Doherty (the founder of Solus) left the project][1] a few months ago. + +Now that everything’s under control with the new _management_ , **Solus 4 Fortitude** with updated Budgie desktop and other significant improvements has officially released. + +### What’s New in Solus 4 + +![Solus 4 Fortitude][2] + +#### Core Improvements + +Solus 4 comes loaded with **[Linux Kernel 4.20.16][3]** which enables better hardware support (like Touchpad support, improved support for Intel Coffee Lake and Ice Lake CPUs, and for AMD Picasso & Raven2 APUs). + +This release also ships with the latest [FFmpeg 4.1.1][4]. Also, they have enabled the support for [dav1d][5] in [VLC][6] – which is an open source AV1 decoder. So, you can consider these upgrades to significantly improve the Multimedia experience. + +It also includes some minor fixes to the Software Center – if you were encountering any issues while finding an application or viewing the description. + +In addition, WPS Office has been removed from the listing. + +#### UI Improvements + +![Budgie 10.5][7] + +The Budgie desktop update includes some minor changes and also comes baked in with the [Plata (Noir) GTK Theme.][8] + +You will no longer observe same applications multiple times in the menu, they’ve fixed this. They have also introduced a “ **Caffeine** ” mode as applet which prevents the system from suspending, locking the screen or changing the brightness while you are working. You can schedule the time accordingly. + +![Caffeine Mode][9] + +The new Budgie desktop experience also adds quick actions to the app icons on the task bar, dubbed as “ **Icon Tasklist** “. It makes it easy to manage the active tabs on a browser or the actions to minimize and move it to a new workplace (as shown in the image below). + +![Icon Tasklist][10] + +As the [change log][11] mentions, the above pop over design lets you do more: + + * _Close all instances of the selected application_ + * _Easily access per-window controls for marking it always on top, maximizing / unmaximizing, minimizing, and moving it to various workspaces._ + * _Quickly favorite / unfavorite apps_ + * _Quickly launch a new instance of the selected application_ + * _Scroll up or down on an IconTasklist button when a single window is open to activate and bring it into focus, or minimize it, based on the scroll direction._ + * _Toggle to minimize and unminimize various application windows_ + + + +The notification area now groups the notifications from specific applications instead of piling it all up. So, that’s a good improvement. + +In addition to these, the sound widget got some cool improvements while letting you personalize the look and feel of your desktop in an efficient manner. + +To know about all the nitty-gritty details, do refer the official [release note][11]s. + +### Download Solus 4 + +You can get the latest version of Solus from its download page below. It is available in the default Budgie, GNOME and MATE desktop flavors. + +[Get Solus 4][12] + +### Wrapping Up** + +Solus 4 is definitely an impressive upgrade – without introducing any unnecessary fancy features but by adding only the useful ones, subtle changes. + +What do you think about the latest Solus 4 Fortitude? Have you tried it yet? + +Let us know your thoughts in the comments below. + + + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/solus-4-release + +作者:[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/ikey-leaves-solus/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/solus-4-featured.jpg?fit=800%2C450&ssl=1 +[3]: https://itsfoss.com/kernel-4-20-release/ +[4]: https://www.ffmpeg.org/ +[5]: https://code.videolan.org/videolan/dav1d +[6]: https://www.videolan.org/index.html +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/Budgie-desktop.jpg?resize=800%2C450&ssl=1 +[8]: https://gitlab.com/tista500/plata-theme +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/caffeine-mode.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/IconTasklistPopover.jpg?ssl=1 +[11]: https://getsol.us/2019/03/17/solus-4-released/ +[12]: https://getsol.us/download/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/Budgie-desktop.jpg?fit=800%2C450&ssl=1 +[14]: https://www.facebook.com/sharer.php?t=Solus%204%20%E2%80%98Fortitude%E2%80%99%20Released%20with%20Significant%20Improvements&u=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F +[15]: https://twitter.com/intent/tweet?text=Solus+4+%E2%80%98Fortitude%E2%80%99+Released+with+Significant+Improvements&url=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F&via=itsfoss2 +[16]: https://www.linkedin.com/shareArticle?title=Solus%204%20%E2%80%98Fortitude%E2%80%99%20Released%20with%20Significant%20Improvements&url=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F&mini=true +[17]: https://www.reddit.com/submit?title=Solus%204%20%E2%80%98Fortitude%E2%80%99%20Released%20with%20Significant%20Improvements&url=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F From 241e79743cf5033b57968b62f7cca612c49616d8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 11:08:11 +0800 Subject: [PATCH 690/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=203=20Wa?= =?UTF-8?q?ys=20To=20Check=20Whether=20A=20Port=20Is=20Open=20On=20The=20R?= =?UTF-8?q?emote=20Linux=20System=3F=20sources/tech/20190318=203=20Ways=20?= =?UTF-8?q?To=20Check=20Whether=20A=20Port=20Is=20Open=20On=20The=20Remote?= =?UTF-8?q?=20Linux=20System.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Port Is Open On The Remote Linux System.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md diff --git a/sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md b/sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md new file mode 100644 index 0000000000..046682ef83 --- /dev/null +++ b/sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Ways To Check Whether A Port Is Open On The Remote Linux System?) +[#]: via: (https://www.2daygeek.com/how-to-check-whether-a-port-is-open-on-the-remote-linux-system-server/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +3 Ways To Check Whether A Port Is Open On The Remote Linux System? +====== + +This is an important topic, which is not only for Linux administrator and it will be very helpful for all. + +I mean to say. It’s very useful for users who are working in IT Infra. + +They have to check whether the port is open or not on Linux server before proceeding to next steps. + +If it’s not open then they can directly ask the Linux admin to check on this. + +If it’s open then we need to check with application team, etc,. + +In this article, we will show you, how to check this using three methods. + +It can be done using the following Linux commands. + + * **`nc:`** Netcat is a simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol. + * **`nmap:`** Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks. + * **`telnet:`** The telnet command is used for interactive communication with another host using the TELNET protocol. + + + +### How To Check Whether A Port Is Open On The Remote Linux System Using nc (netcat) Command? + +nc stands for netcat. Netcat is a simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol. + +It is designed to be a reliable “back-end” tool that can be used directly or easily driven by other programs and scripts. + +At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities. + +Netcat has three main modes of functionality. These are the connect mode, the listen mode, and the tunnel mode. + +**Common Syntax for nc (netcat):** + +``` +$ nc [-options] [HostName or IP] [PortNumber] +``` + +In this example, we are going to check whether the port 22 is open or not on the remote Linux system. + +If it’s success then you will be getting the following output. + +``` +# nc -zvw3 192.168.1.8 22 +Connection to 192.168.1.8 22 port [tcp/ssh] succeeded! +``` + +**Details:** + + * **`nc:`** It’s a command. + * **`z:`** zero-I/O mode (used for scanning). + * **`v:`** For verbose. + * **`w3:`** timeout wait seconds + * **`192.168.1.8:`** Destination system IP. + * **`22:`** Port number needs to be verified. + + + +If it’s fail then you will be getting the following output. + +``` +# nc -zvw3 192.168.1.95 22 +nc: connect to 192.168.1.95 port 22 (tcp) failed: Connection refused +``` + +### How To Check Whether A Port Is Open On The Remote Linux System Using nmap Command? + +Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. + +Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. + +While Nmap is commonly used for security audits, many systems and network administrators find it useful for routine tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. + +**Common Syntax for nmap:** + +``` +$ nmap [-options] [HostName or IP] [-p] [PortNumber] +``` + +If it’s success then you will be getting the following output. + +``` +# nmap 192.168.1.8 -p 22 + +Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-16 03:37 IST Nmap scan report for 192.168.1.8 Host is up (0.00031s latency). + +PORT STATE SERVICE + +22/tcp open ssh + +Nmap done: 1 IP address (1 host up) scanned in 13.06 seconds +``` + +If it’s fail then you will be getting the following output. + +``` +# nmap 192.168.1.8 -p 80 +Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-16 04:30 IST +Nmap scan report for 192.168.1.8 +Host is up (0.00036s latency). + +PORT STATE SERVICE +80/tcp closed http + +Nmap done: 1 IP address (1 host up) scanned in 13.07 seconds +``` + +### How To Check Whether A Port Is Open On The Remote Linux System Using telnet Command? + +The telnet command is used for interactive communication with another host using the TELNET protocol. + +**Common Syntax for telnet:** + +``` +$ telnet [HostName or IP] [PortNumber] +``` + +If it’s success then you will be getting the following output. + +``` +$ telnet 192.168.1.9 22 +Trying 192.168.1.9... +Connected to 192.168.1.9. +Escape character is '^]'. +SSH-2.0-OpenSSH_5.3 +^] +Connection closed by foreign host. +``` + +If it’s fail then you will be getting the following output. + +``` +$ telnet 192.168.1.9 80 +Trying 192.168.1.9... +telnet: Unable to connect to remote host: Connection refused +``` + +We had found only the above three methods. If you found any other ways, please let us know by updating your query in the comments section. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-check-whether-a-port-is-open-on-the-remote-linux-system-server/ + +作者:[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 From 535d16406d7bccf30b57f8af0a104e1da849e5d3 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 19 Mar 2019 13:16:13 +0800 Subject: [PATCH 691/813] [Translated] 20190214 Run Particular Commands Without Sudo Password In Linux.md Signed-off-by: Chang Liu --- ...Commands Without Sudo Password In Linux.md | 157 ------------------ ...Commands Without Sudo Password In Linux.md | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 157 deletions(-) delete mode 100644 sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md create mode 100644 translated/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md diff --git a/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md b/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md deleted file mode 100644 index aaad1819e4..0000000000 --- a/sources/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md +++ /dev/null @@ -1,157 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (FSSlc) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run Particular Commands Without Sudo Password In Linux) -[#]: via: (https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -Run Particular Commands Without Sudo Password In Linux -====== - -I had a script on my Ubuntu system deployed on AWS. The primary purpose of this script is to check if a specific service is running at regular interval (every one minute to be precise) and start that service automatically if it is stopped for any reason. But the problem is I need sudo privileges to start the service. As you may know already, we should provide password when we run something as sudo user. But I don’t want to do that. What I actually want to do is to run the service as sudo without password. If you’re ever in a situation like this, I know a small work around, Today, in this brief guide, I will teach you how to run particular commands without sudo password in Unix-like operating systems. - -Have a look at the following example. - -``` -$ sudo mkdir /ostechnix -[sudo] password for sk: -``` - -![][2] - -As you can see in the above screenshot, I need to provide sudo password when creating a directory named ostechnix in root (/) folder. Whenever we try to execute a command with sudo privileges, we must enter the password. However, in my scenario, I don’t want to provide the sudo password. Here is what I did to run a sudo command without password on my Linux box. - -### Run Particular Commands Without Sudo Password In Linux - -For any reasons, if you want to allow a user to run a particular command without giving the sudo password, you need to add that command in **sudoers** file. - -I want the user named **sk** to execute **mkdir** command without giving the sudo password. Let us see how to do it. - -Edit sudoers file: - -``` -$ sudo visudo -``` - -Add the following line at the end of file. - -``` -sk ALL=NOPASSWD:/bin/mkdir -``` - -![][3] - -Here, **sk** is the username. As per the above line, the user **sk** can run ‘mkdir’ command from any terminal, without sudo password. - -You can add additional commands (for example **chmod** ) with comma-separated values as shown below. - -``` -sk ALL=NOPASSWD:/bin/mkdir,/bin/chmod -``` - -Save and close the file. Log out (or reboot) your system. Now, log in as normal user ‘sk’ and try to run those commands with sudo and see what happens. - -``` -$ sudo mkdir /dir1 -``` - -![][4] - -See? Even though I ran ‘mkdir’ command with sudo privileges, there was no password prompt. From now on, the user **sk** need not to enter the sudo password while running ‘mkdir’ command. - -When running all other commands except those commands added in sudoers files, you will be prompted to enter the sudo password. - -Let us run another command with sudo. - -``` -$ sudo apt update -``` - -![][5] - -See? This command prompts me to enter the sudo password. - -If you don’t want this command to prompt you to ask sudo password, edit sudoers file: - -``` -$ sudo visudo -``` - -Add the ‘apt’ command in visudo file like below: - -``` -sk ALL=NOPASSWD: /bin/mkdir,/usr/bin/apt -``` - -Did you notice that the apt binary executable file path is different from mkdir? Yes, you must provide the correct executable file path. To find executable file path of any command, for example ‘apt’, use ‘whereis’ command like below. - -``` -$ whereis apt -apt: /usr/bin/apt /usr/lib/apt /etc/apt /usr/share/man/man8/apt.8.gz -``` - -As you see, the executable file for apt command is **/usr/bin/apt** , hence I added it in sudoers file. - -Like I already mentioned, you can add any number of commands with comma-separated values. Save and close your sudoers file once you’re done. Log out and log in again to your system. - -Now, check if you can be able to run the command with sudo prefix without using the password: - -``` -$ sudo apt update -``` - -![][6] - -See? The apt command didn’t ask me the password even though I ran it with sudo. - -Here is yet another example. If you want to run a specific service, for example apache2, add it as shown below. - -``` -sk ALL=NOPASSWD:/bin/mkdir,/usr/bin/apt,/bin systemctl restart apache2 -``` - -Now, the user can run ‘sudo systemctl restart apache2’ command without sudo password. - -Can I re-authenticate to a particular command in the above case? Of course, yes! Just remove the added command. Log out and log in back. - -Alternatively, you can add **‘PASSWD:’** directive in-front of the command. Look at the following example. - -Add/modify the following line as shown below. - -``` -sk ALL=NOPASSWD:/bin/mkdir,/bin/chmod,PASSWD:/usr/bin/apt -``` - -In this case, the user **sk** can run ‘mkdir’ and ‘chmod’ commands without entering the sudo password. However, he must provide sudo password when running ‘apt’ command. - -**Disclaimer:** This is for educational-purpose only. You should be very careful while applying this method. This method might be both productive and destructive. Say for example, if you allow users to execute ‘rm’ command without sudo password, they could accidentally or intentionally delete important stuffs. You have been warned! - -**Suggested read:** - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-1.png -[3]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-7.png -[4]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-6.png -[5]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-4.png -[6]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-5.png diff --git a/translated/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md b/translated/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md new file mode 100644 index 0000000000..2b488634c4 --- /dev/null +++ b/translated/tech/20190214 Run Particular Commands Without Sudo Password In Linux.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (FSSlc) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run Particular Commands Without Sudo Password In Linux) +[#]: via: (https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +在 Linux 中运行特定命令而无需 sudo 密码 +====== + +我有一台部署在 AWS 上的 Ubuntu 系统,在它的里面有一个脚本,这个脚本的原有目的是以一定间隔(准确来说是每隔 1 分钟)去检查某个特定服务是否正在运行,如果这个服务因为某些原因停止了,就自动重启这个服务。 但问题是我需要 sudo 权限来开启这个服务。正如你所知道的那样,当我们以 sudo 用户运行命令时,我们应该提供密码,但我并不想这么做,实际上我想做的是以 sudo 用户的身份运行这个服务但无需提供密码。假如你曾经经历过这样的情形,那么我知道一个简单的方法来做到这点。今天,在这个简短的指南中,我将教你如何在类 Unix 的操作系统中运行特定命令而无需 sudo 密码。 + +就让我们看看下面的例子吧。 + +``` +$ sudo mkdir /ostechnix +[sudo] password for sk: +``` + +![][2] + +正如上面的截图中看到的那样,当我在根目录(`/`)中创建一个名为 `ostechnix` 的目录时,我需要提供 sudo 密码。每当我们尝试以 sudo 特权执行一个命令时,我们必须输入密码。而在我的预想中,我不想提供 sudo 密码。下面的内容便是我如何在我的 Linux 机子上运行一个 sudo 命令而无需输入密码的过程。 + +### 在 Linux 中运行特定命令而无需 sudo 密码 + +基于某些原因,假如你想允许一个用户运行特定命令而无需提供 sudo 密码,则你需要在 **sudoers** 文件中添加上这个命令。 + +假如我想让名为 **sk** 的用户去执行 **mkdir** 而无需提供 sudo 密码,下面就让我们看看该如何做到这点。 + +使用下面的命令来编辑 sudoers 文件: + +``` +$ sudo visudo +``` + +将下面的命令添加到这个文件的最后。 + +``` +sk ALL=NOPASSWD:/bin/mkdir +``` + +![][3] + +其中 **sk** 是用户名。根据上面一行的内容,用户 **sk** 可以从任意终端执行 `mkdir` 命令而不必输入 sudo 密码。 + +你可以用逗号分隔的值来添加额外的命令(例如 **chmod**),正如下面展示的那样。 + +``` +sk ALL=NOPASSWD:/bin/mkdir,/bin/chmod +``` + +保存并关闭这个文件,然后注销(或重启)你的系统。现在以普通用户 `sk` 登录,然后试试使用 sudo 来运行这些命令,看会发生什么。 + +``` +$ sudo mkdir /dir1 +``` + +![][4] + +看到了吗?即便我以 sudo 特权运行 `mkdir` 命令,也不会弹出提示让我输入密码。从现在开始,当用户 **sk** 运行 `mkdir` 时,就不必输入 sudo 密码了。 + +当运行除了添加到 sudoers 文件之外的命令时,你将被提示输入 sudo 密码。 + +让我们用 sudo 来运行另一个命令。 + +``` +$ sudo apt update +``` + +![][5] + +看到了吗?这个命令将提示我输入 sudo 密码。 + +假如你不想让这个命令提示你输入 sudo 密码,请编辑 sudoers 文件: + +``` +$ sudo visudo +``` + +像下面这样将 `apt` 命令添加到 visudo 文件中: + +``` +sk ALL=NOPASSWD: /bin/mkdir,/usr/bin/apt +``` + +你注意到了上面命令中 `apt` 二进制执行文件的路径与 `mkdir` 的有所不同吗?是的,你必须提供一个正确的可执行文件路径。要找到任意命令的可执行文件路径,例如这里的 `apt`,可以像下面这样使用 `whichis` 命令来查看: + +``` +$ whereis apt +apt: /usr/bin/apt /usr/lib/apt /etc/apt /usr/share/man/man8/apt.8.gz +``` + +如你所见,`apt` 命令的可执行文件路径为 **/usr/bin/apt**,所以我将这个路径添加到了 sudoers 文件中。 + +正如我前面提及的那样,你可以添加任意多个以逗号分隔的命令。一旦你做完添加的动作,保存并关闭你的 sudoers 文件,接着注销,然后重新登录进你的系统。 + +现在就检验你是否可以直接运行以 sudo 开头的命令而不必使用密码: + +``` +$ sudo apt update +``` + +![][6] + +看到了吗?`apt` 命令没有让我输入 sudo 密码,即便我用 sudo 来运行它。 + +下面展示另一个例子。假如你想运行一个特定服务,例如 `apache2`,那么就添加下面这条命令到 sudoers 文件中: + +``` +sk ALL=NOPASSWD:/bin/mkdir,/usr/bin/apt,/bin/systemctl restart apache2 +``` + +现在用户 `sk` 就可以运行 `sudo systemctl restart apache` 命令而不必输入 sudo 密码了。 + +我可以再次让一个特别的命令提醒输入 sudo 密码吗?当然可以!只需要删除添加的命令,注销然后再次登录即可。 + +除了这种方法外,你还可以在命令的前面添加 **`PASSWD:`** 指令。让我们看看下面的例子: + +在 sudoers 文件中添加或者修改下面的一行: + +``` +sk ALL=NOPASSWD:/bin/mkdir,/bin/chmod,PASSWD:/usr/bin/apt +``` + +在这种情况下,用户 **sk** 可以运行 `mkdir` 和 `chmod` 命令而不用输入 sudo 密码。然而,当他运行 `apt` 命令时,就必须提供 sudo 密码了。 + +**免责声明:** 本篇指南仅具有教育意义。在使用这个方法的时候,你必须非常小心。这个命令既可能富有成效但也可能带来摧毁性效果。例如,假如你允许用户执行 `rm` 命令而不输入 sudo 密码,那么他们可能无意或有意地删除某些重要文件。我警告过你了! + +那么这就是全部的内容了。希望这个能够给你带来帮助。更多精彩内容即将呈现,请保持关注! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[FSSlc](https://github.com/FSSlc) +校对:[校对者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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-1.png +[3]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-7.png +[4]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-6.png +[5]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-4.png +[6]: http://www.ostechnix.com/wp-content/uploads/2017/05/sudo-password-5.png From 0de030a9c77505f17d8f47f4483ea5b69934402f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Mar 2019 18:12:50 +0800 Subject: [PATCH 692/813] PRF:20180826 Be productive with Org-mode.md @lujun9972 --- .../20180826 Be productive with Org-mode.md | 120 +++++++++--------- 1 file changed, 57 insertions(+), 63 deletions(-) diff --git a/translated/tech/20180826 Be productive with Org-mode.md b/translated/tech/20180826 Be productive with Org-mode.md index 8592649c1c..582d1fafc7 100644 --- a/translated/tech/20180826 Be productive with Org-mode.md +++ b/translated/tech/20180826 Be productive with Org-mode.md @@ -1,46 +1,45 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Be productive with Org-mode) [#]: via: (https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/) [#]: author: (Ayrat Badykov https://www.badykov.com) -高效使用 Org-mode +高效使用 Org 模式 ====== - ![org-mode-collage][1] ### 简介 -在我 [前篇关于 Emacs 的文章中 ][2] 我提到了 [Org-mode][3],一个笔记管理工具和组织工具。文本,我将会描述一下我日常的 Org-mode 使用案例。 +在我 [前一篇关于 Emacs 的文章中][2] 我提到了 [Org 模式][3]Org-mode,这是一个笔记管理工具和组织工具。本文中,我将会描述一下我日常的 Org 模式使用案例。 ### 笔记和代办列表 -首先而且最重要的是,Org-mode 是一个管理笔记和待办列表的工具,Org-mode 的所有工具都聚焦于使用纯文本文件记录笔记。我使用 Org-mode 管理多种笔记。 +首先而且最重要的是,Org 模式是一个管理笔记和待办列表的工具,Org 模式的所有工具都聚焦于使用纯文本文件记录笔记。我使用 Org 模式管理多种笔记。 #### 一般性笔记 -Org-mode 最基本的应用场景就是以笔记的形式记录下你想记住的事情。比如,下面是我正在学习的笔记内容: +Org 模式最基本的应用场景就是以笔记的形式记录下你想记住的事情。比如,下面是我正在学习的笔记内容: ``` * Learn ** Emacs LISP *** Plan - - [ ] Read best practices - - [ ] Finish reading Emacs Manual - - [ ] Finish Exercism Exercises - - [ ] Write a couple of simple plugins - - Notification plugin + - [ ] Read best practices + - [ ] Finish reading Emacs Manual + - [ ] Finish Exercism Exercises + - [ ] Write a couple of simple plugins + - Notification plugin *** Resources - https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html - http://exercism.io/languages/elisp/about - [[http://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/][The Ultimate Collection of Emacs Resources]] + https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html + http://exercism.io/languages/elisp/about + [[http://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/][The Ultimate Collection of Emacs Resources]] ** Rust gamedev *** Study [[https://github.com/SergiusIW/gate][gate]] 2d game engine with web assembly support @@ -55,7 +54,7 @@ Org-mode 最基本的应用场景就是以笔记的形式记录下你想记住 ![notes][5] -在这个简单的例子中,你能看到 Org-mode 的一些功能: +在这个简单的例子中,你能看到 Org 模式的一些功能: - 笔记允许嵌套 - 链接 @@ -67,81 +66,79 @@ Org-mode 最基本的应用场景就是以笔记的形式记录下你想记住 ``` * [[elisp:(org-projectile-open-project%20"mana")][mana]] [3/9] - :PROPERTIES: - :CATEGORY: mana - :END: + :PROPERTIES: + :CATEGORY: mana + :END: ** DONE [[file:~/Development/mana/apps/blockchain/lib/blockchain/contract/create_contract.ex::insufficient_gas_before_homestead%20=][fix this check using evm.configuration]] - CLOSED: [2018-08-08 Ср 09:14] - [[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md][eip2]]: - If contract creation does not have enough gas to pay for the final gas fee for - adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) - rather than leaving an empty contract. + CLOSED: [2018-08-08 Ср 09:14] + [[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md][eip2]]: + If contract creation does not have enough gas to pay for the final gas fee for + adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) + rather than leaving an empty contract. ** DONE Upgrade Elixir to 1.7. - CLOSED: [2018-08-08 Ср 09:14] + CLOSED: [2018-08-08 Ср 09:14] ** TODO [#A] Difficulty tests ** TODO [#C] Upgrage to OTP 21 ** DONE [#A] EIP150 - CLOSED: [2018-08-14 Вт 21:25] + CLOSED: [2018-08-14 Вт 21:25] *** DONE operation cost changes - CLOSED: [2018-08-08 Ср 20:31] + CLOSED: [2018-08-08 Ср 20:31] *** DONE 1/64th for a call and create - CLOSED: [2018-08-14 Вт 21:25] + CLOSED: [2018-08-14 Вт 21:25] ** TODO [#C] Refactor interfaces ** TODO [#B] Caching for storage during execution ** TODO [#B] Removing old merkle trees ** TODO do not calculate cost twice * [[elisp:(org-projectile-open-project%20".emacs.d")][.emacs.d]] [1/3] - :PROPERTIES: - :CATEGORY: .emacs.d - :END: + :PROPERTIES: + :CATEGORY: .emacs.d + :END: ** TODO fix flycheck issues (emacs config) ** TODO use-package for fetching dependencies ** DONE clean configuration - CLOSED: [2018-08-26 Вс 11:48] + CLOSED: [2018-08-26 Вс 11:48] ``` 它看起来是这样的: ![project-todos][7] -本例中你能看到更多的 Org mode 功能: +本例中你能看到更多的 Org 模式的功能: -- todo 列表具有 `TODO`,`DONE` 两个状态。你还可以定义自己的状态 (`WAITING` 等) +- 代办列表具有 `TODO`、`DONE` 两个状态。你还可以定义自己的状态 (`WAITING` 等) - 关闭的事项有 `CLOSED` 时间戳 -- 有些事项有优先级 - A,B,C。 +- 有些事项有优先级 - A、B、C - 链接可以指向文件内部 (`[[file:~/。..]`) - - #### 捕获模板 -正如 Org-mode 的文档中所描述的,capture 可以在不怎么干扰你工作流的情况下让你快速存储笔记。 +正如 Org 模式的文档中所描述的,捕获可以在不怎么干扰你工作流的情况下让你快速存储笔记。 我配置了许多捕获模板,可以帮我快速记录想要记住的事情。 ``` -(setq org-capture-templates -'(("t" "Todo" entry (file+headline "~/Dropbox/org/todo.org" "Todo soon") -"* TODO %? \n %^t") -("i" "Idea" entry (file+headline "~/Dropbox/org/ideas.org" "Ideas") -"* %? \n %U") -("e" "Tweak" entry (file+headline "~/Dropbox/org/tweaks.org" "Tweaks") -"* %? \n %U") -("l" "Learn" entry (file+headline "~/Dropbox/org/learn.org" "Learn") -"* %? \n") -("w" "Work note" entry (file+headline "~/Dropbox/org/work.org" "Work") -"* %? \n") -("m" "Check movie" entry (file+headline "~/Dropbox/org/check.org" "Movies") -"* %? %^g") -("n" "Check book" entry (file+headline "~/Dropbox/org/check.org" "Books") -"* %^{book name} by %^{author} %^g"))) + (setq org-capture-templates + '(("t" "Todo" entry (file+headline "~/Dropbox/org/todo.org" "Todo soon") + "* TODO %? \n %^t") + ("i" "Idea" entry (file+headline "~/Dropbox/org/ideas.org" "Ideas") + "* %? \n %U") + ("e" "Tweak" entry (file+headline "~/Dropbox/org/tweaks.org" "Tweaks") + "* %? \n %U") + ("l" "Learn" entry (file+headline "~/Dropbox/org/learn.org" "Learn") + "* %? \n") + ("w" "Work note" entry (file+headline "~/Dropbox/org/work.org" "Work") + "* %? \n") + ("m" "Check movie" entry (file+headline "~/Dropbox/org/check.org" "Movies") + "* %? %^g") + ("n" "Check book" entry (file+headline "~/Dropbox/org/check.org" "Books") + "* %^{book name} by %^{author} %^g"))) ``` 做书本记录时我需要记下它的名字和作者,做电影记录时我需要记下标签,等等。 ### 规划 -Org-mode 的另一个超棒的功能是你可以用它来作日常规划。让我们来看一个例子: +Org 模式的另一个超棒的功能是你可以用它来作日常规划。让我们来看一个例子: ![schedule][8] @@ -149,7 +146,7 @@ Org-mode 的另一个超棒的功能是你可以用它来作日常规划。让 #### 习惯 -根据 Org mode 的文档,Org 能够跟踪一种特殊的代办事情,称为 “习惯”。当我想养成新的习惯时,我会将该功能与日常规划功能一起连用: +根据 Org 模式的文档,Org 能够跟踪一种特殊的代办事情,称为 “习惯”。当我想养成新的习惯时,我会将该功能与日常规划功能一起连用: ![habits][9] @@ -161,18 +158,15 @@ Org-mode 的另一个超棒的功能是你可以用它来作日常规划。让 ![agenda][10] -### 更多 Org mode 功能 - -+ 手机应用 ([Android][https://play.google.com/store/apps/details?id=com.orgzly&hl=en],[ios][https://itunes.apple.com/app/id1238649962]) - -+ [将 Org mode 文档导出为其他格式 ][https://orgmode.org/manual/Exporting.html](html,markdown,pdf,latex etc) - -+ 使用 [ledger][https://github.com/ledger/ledger-mode] [追踪财务状况 ][https://orgmode.org/worg/org-tutorials/weaving-a-budget.html] +### 更多 Org 模式的功能 ++ 手机应用([Android](https://play.google.com/store/apps/details?id=com.orgzly&hl=en)、[ios](https://itunes.apple.com/app/id1238649962])) ++ [将 Org 模式文档导出为其他格式](https://orgmode.org/manual/Exporting.html)(html、markdown、pdf、latex 等) ++ 使用 [ledger](https://github.com/ledger/ledger-mode) [追踪财务状况](https://orgmode.org/worg/org-tutorials/weaving-a-budget.html) ### 总结 -本文我描述了 Org-mode 广泛功能中的一小部分,我每天都用它来提高工作效率,把时间花在重要的事情上。 +本文我描述了 Org 模式广泛功能中的一小部分,我每天都用它来提高工作效率,把时间花在重要的事情上。 -------------------------------------------------------------------------------- @@ -182,7 +176,7 @@ via: https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/ 作者:[Ayrat Badykov][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ab4f4f964609707f9aaae39b00ff4a47736f6e84 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Mar 2019 18:13:28 +0800 Subject: [PATCH 693/813] PUB:20180826 Be productive with Org-mode.md @lujun9972 https://linux.cn/article-10634-1.html --- .../20180826 Be productive with Org-mode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180826 Be productive with Org-mode.md (99%) diff --git a/translated/tech/20180826 Be productive with Org-mode.md b/published/20180826 Be productive with Org-mode.md similarity index 99% rename from translated/tech/20180826 Be productive with Org-mode.md rename to published/20180826 Be productive with Org-mode.md index 582d1fafc7..5eef4efd7b 100644 --- a/translated/tech/20180826 Be productive with Org-mode.md +++ b/published/20180826 Be productive with Org-mode.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10634-1.html) [#]: subject: (Be productive with Org-mode) [#]: via: (https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/) [#]: author: (Ayrat Badykov https://www.badykov.com) From 0018cb5e4b333dd171930ade2ae717a90534928d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Mar 2019 18:49:20 +0800 Subject: [PATCH 694/813] PRF:20190227 How To Find Available Network Interfaces On Linux.md @FSSlc --- ...d Available Network Interfaces On Linux.md | 95 +++++++++---------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md b/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md index 9c5b133bf2..408dd5c03f 100644 --- a/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md +++ b/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Find Available Network Interfaces On Linux) @@ -18,9 +18,9 @@ 我们可以使用下面的这些方法来找到可用的网络接口。 -**方法 1 —— 使用 `ifconfig` 命令:** +#### 方法 1 使用 ifconfig 命令 -使用 **`ifconfig`** 命令来查看网络接口仍然是最常使用的方法。我相信还有很多 Linux 用户仍然使用这个方法。 +使用 `ifconfig` 命令来查看网络接口仍然是最常使用的方法。我相信还有很多 Linux 用户仍然使用这个方法。 ``` $ ifconfig -a @@ -30,39 +30,39 @@ $ ifconfig -a ``` enp5s0: flags=4098 mtu 1500 -ether 24:b6:fd:37:8b:29 txqueuelen 1000 (Ethernet) -RX packets 0 bytes 0 (0.0 B) -RX errors 0 dropped 0 overruns 0 frame 0 -TX packets 0 bytes 0 (0.0 B) -TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + ether 24:b6:fd:37:8b:29 txqueuelen 1000 (Ethernet) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 -inet 127.0.0.1 netmask 255.0.0.0 -inet6 ::1 prefixlen 128 scopeid 0x10 -loop txqueuelen 1000 (Local Loopback) -RX packets 171420 bytes 303980988 (289.8 MiB) -RX errors 0 dropped 0 overruns 0 frame 0 -TX packets 171420 bytes 303980988 (289.8 MiB) -TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + inet 127.0.0.1 netmask 255.0.0.0 + inet6 ::1 prefixlen 128 scopeid 0x10 + loop txqueuelen 1000 (Local Loopback) + RX packets 171420 bytes 303980988 (289.8 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 171420 bytes 303980988 (289.8 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlp9s0: flags=4163 mtu 1500 -inet 192.168.225.37 netmask 255.255.255.0 broadcast 192.168.225.255 -inet6 2409:4072:6183:c604:c218:85ff:fe50:474f prefixlen 64 scopeid 0x0 -inet6 fe80::c218:85ff:fe50:474f prefixlen 64 scopeid 0x20 -ether c0:18:85:50:47:4f txqueuelen 1000 (Ethernet) -RX packets 564574 bytes 628671925 (599.5 MiB) -RX errors 0 dropped 0 overruns 0 frame 0 -TX packets 299706 bytes 60535732 (57.7 MiB) -TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + inet 192.168.225.37 netmask 255.255.255.0 broadcast 192.168.225.255 + inet6 2409:4072:6183:c604:c218:85ff:fe50:474f prefixlen 64 scopeid 0x0 + inet6 fe80::c218:85ff:fe50:474f prefixlen 64 scopeid 0x20 + ether c0:18:85:50:47:4f txqueuelen 1000 (Ethernet) + RX packets 564574 bytes 628671925 (599.5 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 299706 bytes 60535732 (57.7 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` -如上面的输出所示,在我的 Linux 机子上有两个网络接口,它们分别叫做 **enp5s0**(主板上的有线网卡)和 **wlp9s0**(无线网卡)。其中的 **lo** 是环回网卡,被用来访问本地的网络的服务,通常它的 IP 地址为 127.0.0.1。 +如上面的输出所示,在我的 Linux 机器上有两个网络接口,它们分别叫做 `enp5s0`(主板上的有线网卡)和 `wlp9s0`(无线网卡)。其中的 `lo` 是环回网卡,被用来访问本地的网络的服务,通常它的 IP 地址为 `127.0.0.1`。 -我们也可以在许多 UNIX 变种例如 **FreeBSD** 中使用相同的 `ifconfig` 来列出可用的网卡。 +我们也可以在许多 UNIX 变种例如 FreeBSD 中使用相同的 `ifconfig` 来列出可用的网卡。 -**方法 2 —— 使用 `ip` 命令:** +#### 方法 2 使用 ip 命令 -在最新的 Linux 版本中, `ifconfig` 命令已经被弃用了。你可以使用 **`ip`** 命令来罗列出网络接口,正如下面这样: +在最新的 Linux 版本中, `ifconfig` 命令已经被弃用了。你可以使用 `ip` 命令来罗列出网络接口,正如下面这样: ``` $ ip link show @@ -72,11 +72,11 @@ $ ip link show ``` 1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 - link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: enp5s0: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 - link/ether 24:b6:fd:37:8b:29 brd ff:ff:ff:ff:ff:ff + link/ether 24:b6:fd:37:8b:29 brd ff:ff:ff:ff:ff:ff 3: wlp9s0: mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000 - link/ether c0:18:85:50:47:4f brd ff:ff:ff:ff:ff:ff + link/ether c0:18:85:50:47:4f brd ff:ff:ff:ff:ff:ff ``` ![](https://www.ostechnix.com/wp-content/uploads/2019/02/ip-command.png) @@ -91,15 +91,15 @@ $ ip addr $ ip -s link ``` -你注意到了吗?这些命令同时还显示出了已经连接的网络接口的状态。假如你仔细查看上面的输出,你将注意到我的有线网卡并没有跟网络线缆连接(从上面输出中的 **DOWN** 可以看出)。另外,我的无线网卡已经连接了(从上面输出中的 **UP** 可以看出)。想知晓更多的细节,可以查看我们先前的指南 [**在 Linux 中查看网络接口的已连接状态**][1]。 +你注意到了吗?这些命令同时还显示出了已经连接的网络接口的状态。假如你仔细查看上面的输出,你将注意到我的有线网卡并没有跟网络线缆连接(从上面输出中的 `DOWN` 可以看出)。另外,我的无线网卡已经连接了(从上面输出中的 `UP` 可以看出)。想知晓更多的细节,可以查看我们先前的指南 [在 Linux 中查看网络接口的已连接状态][1]。 -这两个命令(ifconfig 和 ip)已经足够在你的 LInux 系统中查看可用的网卡了。 +这两个命令(`ifconfig` 和 `ip`)已经足够在你的 LInux 系统中查看可用的网卡了。 然而,仍然有其他方法来列出 Linux 中的网络接口,下面我们接着看。 -**方法 3:** +#### 方法 3 使用 /sys/class/net 目录 -Linux 内核将网络接口的详细信息保存在 **/sys/class/net** 目录中,你可以通过查看这个目录的内容来检验可用接口的列表是否和前面的结果相符。 +Linux 内核将网络接口的详细信息保存在 `/sys/class/net` 目录中,你可以通过查看这个目录的内容来检验可用接口的列表是否和前面的结果相符。 ``` $ ls /sys/class/net @@ -111,9 +111,9 @@ $ ls /sys/class/net enp5s0 lo wlp9s0 ``` -**方法 4:** +#### 方法 4 使用 /proc/net/dev 目录 -在 Linux 操作系统中,文件 **/proc/net/dev** 中包含有关网络接口的信息。 +在 Linux 操作系统中,文件 `/proc/net/dev` 中包含有关网络接口的信息。 要查看可用的网卡,只需使用下面的命令来查看上面文件的内容: @@ -131,9 +131,9 @@ enp5s0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 lo: 303980988 171420 0 0 0 0 0 0 303980988 171420 0 0 0 0 0 0 ``` -**方法 5 : 使用 `netstat` 命令* +#### 方法 5 使用 netstat 命令 -**netstat** 命令可以列出各种不同的信息,例如网络连接、路由表、接口统计信息、伪装连接和多播成员等。 +`netstat` 命令可以列出各种不同的信息,例如网络连接、路由表、接口统计信息、伪装连接和多播成员等。 ``` $ netstat -i @@ -150,11 +150,11 @@ wlp9s0 1500 565625 0 0 0 300543 0 0 0 BMRU 请注意 `netstat` 被弃用了, `netstat -i` 的替代命令是 `ip -s link`。另外需要注意的是这个方法将只列出激活的接口,而不是所有可用的接口。 -**方法 6: 使用 `nmcli` 命令** +#### 方法 6 使用 nmcli 命令 -`nmcli` 是一个用来控制 `NetworkManager` 和报告网络状态的命令行工具。它可以被用来创建、展示、编辑、删除、激活、停用网络连接和展示网络状态。 +`nmcli` 是一个用来控制 NetworkManager 和报告网络状态的命令行工具。它可以被用来创建、展示、编辑、删除、激活、停用网络连接和展示网络状态。 -假如你的 Linux 系统中安装了 `Network Manager`,你便可以使用下面的命令来使用 `nmcli` 列出可以的网络接口: +假如你的 Linux 系统中安装了 NetworkManager,你便可以使用下面的命令来使用 `nmcli` 列出可以的网络接口: ``` $ nmcli device status @@ -168,13 +168,10 @@ $ nmcli connection show 现在你知道了如何在 Linux 中找到可用网络接口的方法,接下来,请查看下面的指南来知晓如何在 Linux 中配置 IP 地址吧。 -[如何在 Linux 和 Unix 中配置静态 IP 地址][2] - -[如何在 Ubuntu 18.04 LTS 中配置 IP 地址][3] - -[如何在 Arch Linux 中配置静态和动态 IP 地址][4] - -[如何在 Linux 中为单个网卡分配多个 IP 地址][5] +- [如何在 Linux 和 Unix 中配置静态 IP 地址][2] +- [如何在 Ubuntu 18.04 LTS 中配置 IP 地址][3] +- [如何在 Arch Linux 中配置静态和动态 IP 地址][4] +- [如何在 Linux 中为单个网卡分配多个 IP 地址][5] 假如你知道其他快捷的方法来在 Linux 中找到可用的网络接口,请在下面的评论部分中分享出来,我将检查你们的评论并更新这篇指南。 @@ -189,7 +186,7 @@ via: https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux 作者:[SK][a] 选题:[lujun9972][b] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cd0d23bfa0755c5a5e637a9c143af9030747a21e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 19 Mar 2019 18:50:51 +0800 Subject: [PATCH 695/813] PUB:20190227 How To Find Available Network Interfaces On Linux.md @FSSlc https://linux.cn/article-10635-1.html --- ...90227 How To Find Available Network Interfaces On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190227 How To Find Available Network Interfaces On Linux.md (99%) diff --git a/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md b/published/20190227 How To Find Available Network Interfaces On Linux.md similarity index 99% rename from translated/tech/20190227 How To Find Available Network Interfaces On Linux.md rename to published/20190227 How To Find Available Network Interfaces On Linux.md index 408dd5c03f..6fa954bdfc 100644 --- a/translated/tech/20190227 How To Find Available Network Interfaces On Linux.md +++ b/published/20190227 How To Find Available Network Interfaces On Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10635-1.html) [#]: subject: (How To Find Available Network Interfaces On Linux) [#]: via: (https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From f631a2381c9ed8a612f3818295c9400f3d3c2334 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 19 Mar 2019 21:13:24 +0800 Subject: [PATCH 696/813] hankchow translating --- sources/tech/20180719 Building tiny container images.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180719 Building tiny container images.md b/sources/tech/20180719 Building tiny container images.md index bdaef5f08c..50fcac0951 100644 --- a/sources/tech/20180719 Building tiny container images.md +++ b/sources/tech/20180719 Building tiny container images.md @@ -1,3 +1,5 @@ +hankchow translating + Building tiny container images ====== From 86dbec9d687f302f60269d7dc3f42cc294e94435 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 19 Mar 2019 22:08:47 +0800 Subject: [PATCH 697/813] =?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 --- ...factor authentication for SSH on Fedora.md | 170 ------------------ ...actor authentic ation for SSH on Fedora.md | 157 ++++++++++++++++ 2 files changed, 157 insertions(+), 170 deletions(-) delete mode 100644 sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md create mode 100644 translated/tech/20190220 Set up two-factor authentic ation for SSH on Fedora.md diff --git a/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md deleted file mode 100644 index b54361dfd4..0000000000 --- a/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md +++ /dev/null @@ -1,170 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Set up two-factor authentication for SSH on Fedora) -[#]: via: (https://fedoramagazine.org/two-factor-authentication-ssh-fedora/) -[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) - -Set up two-factor authentication for SSH on Fedora -====== - -![](https://fedoramagazine.org/wp-content/uploads/2019/02/twofactor-auth-ssh-816x345.png) - -Every day there seems to be a security breach reported in the news where our data is at risk. Despite the fact that SSH is a secure way to connect remotely to a system, you can still make it even more secure. This article will show you how. - -That’s where two-factor authentication (2FA) comes in. Even if you disable passwords and only allow SSH connections using public and private keys, an unauthorized user could still gain access to your system if they steal your keys. - -With two-factor authentication, you can’t connect to a server with just your SSH keys. You also need to provide the randomly generated number displayed by an authenticator application on a mobile phone. - -The Time-based One-time Password algorithm (TOTP) is the method shown in this article. [Google Authenticator][1] is used as the server application. Google Authenticator is available by default in Fedora. - -For your mobile phone, you can use any two-way authentication application that is compatible with TOTP. There are numerous free applications for Android or IOS that work with TOTP and Google Authenticator. This article uses [FreeOTP][2] as an example. - -### Install and set up Google Authenticator - -First, install the Google Authenticator package on your server. - -``` -$ sudo dnf install -y google-authenticator -``` - -Run the application. - -``` -$ google-authenticator -``` - -The application presents you with a series of questions. The snippets below show you how to answer for a reasonably secure setup. - -``` -Do you want authentication tokens to be time-based (y/n) y -Do you want me to update your "/home/user/.google_authenticator" file (y/n)? y -``` - -The app provides you with a secret key, verification code, and recovery codes. Keep these in a secure, safe location. The recovery codes are the **only** way to access your server if you lose your mobile phone. - -### Set up mobile phone authentication - -Install the authenticator application (FreeOTP) on your mobile phone. You can find it in Google Play if you have an Android phone, or in the iTunes store for an Apple iPhone. - -A QR code is displayed on the screen. Open up the FreeOTP app on your mobile phone. To add a new account, select the QR code shaped tool at the top on the app, and then scan the QR code. After the setup is complete, you’ll have to provide the random number generated by the authenticator application every time you connect to your server remotely. - -### Finish configuration - -The application asks further questions. The example below shows you how to answer to set up a reasonably secure configuration. - -``` -Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it increases your chances to notice or even prevent man-in-the-middle attacks (y/n) y -By default, tokens are good for 30 seconds. In order to compensate for possible time-skew between the client and the server, we allow an extra token before and after the current time. If you experience problems with poor time synchronization, you can increase the window from its default size of +-1min (window size of 3) to about +-4min (window size of 17 acceptable tokens). -Do you want to do so? (y/n) n -If the computer that you are logging into isn't hardened against brute-force login attempts, you can enable rate-limiting for the authentication module. By default, this limits attackers to no more than 3 login attempts every 30s. -Do you want to enable rate-limiting (y/n) y -``` - -Now you have to set up SSH to take advantage of the new two-way authentication. - -### Configure SSH - -Before completing this step, **make sure you’ve already established a working SSH connection** using public SSH keys, since we’ll be disabling password connections. If there is a problem or mistake, having a connection will allow you to fix the problem. - -On your server, use [sudo][3] to edit the /etc/pam.d/sshd file. - -``` -$ sudo vi /etc/pam.d/ssh -``` - -Comment out the auth substack password-auth line: - -``` -#auth       substack     password-auth -``` - -Add the following line to the bottom of the file. - -``` -auth sufficient pam_google_authenticator.so -``` - -Save and close the file. Next, edit the /etc/ssh/sshd_config file. - -``` -$ sudo vi /etc/ssh/sshd_config -``` - -Look for the ChallengeResponseAuthentication line and change it to yes. - -``` -ChallengeResponseAuthentication yes -``` - -Look for the PasswordAuthentication line and change it to no. - -``` -PasswordAuthentication no -``` - -Add the following line to the bottom of the file. - -``` -AuthenticationMethods publickey,password publickey,keyboard-interactive -``` - -Save and close the file, and then restart SSH. - -``` -$ sudo systemctl restart sshd -``` - -### Testing your two-factor authentication - -When you attempt to connect to your server you’re now prompted for a verification code. - -``` -[user@client ~]$ ssh user@example.com -Verification code: -``` - -The verification code is randomly generated by your authenticator application on your mobile phone. Since this number changes every few seconds, you need to enter it before it changes. - -![][4] - -If you do not enter the verification code, you won’t be able to access the system, and you’ll get a permission denied error: - -``` -[user@client ~]$ ssh user@example.com - -Verification code: - -Verification code: - -Verification code: - -Permission denied (keyboard-interactive). - -[user@client ~]$ -``` - -### Conclusion - -By adding this simple two-way authentication, you’ve now made it much more difficult for an unauthorized user to gain access to your server. - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/two-factor-authentication-ssh-fedora/ - -作者:[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://en.wikipedia.org/wiki/Google_Authenticator -[2]: https://freeotp.github.io/ -[3]: https://fedoramagazine.org/howto-use-sudo/ -[4]: https://fedoramagazine.org/wp-content/uploads/2019/02/freeotp-1.png diff --git a/translated/tech/20190220 Set up two-factor authentic ation for SSH on Fedora.md b/translated/tech/20190220 Set up two-factor authentic ation for SSH on Fedora.md new file mode 100644 index 0000000000..c79f43b076 --- /dev/null +++ b/translated/tech/20190220 Set up two-factor authentic ation for SSH on Fedora.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up two-factor authentication for SSH on Fedora) +[#]: via: (https://fedoramagazine.org/two-factor-authentication-ssh-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +在 Fedora 上为 SSH 设置双因素验证 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2019/02/twofactor-auth-ssh-816x345.png) + +每天似乎都有一个安全漏洞的新闻报道,说我们的数据会因此而存在风险。尽管 SSH 是一种远程连接系统的安全方式,但你仍然可以使它更安全。本文将向你展示如何做到这一点。 + +此时双因素验证(2FA)就有用武之地了。即使你禁用密码并只允许使用公钥和私钥进行 SSH 连接,但如果未经授权的用户偷窃了你的密钥,他仍然可以借此访问系统。 + +使用双因素验证,你不能仅使用 SSH 密钥连接到服务器,你还需要提供手机上验证器应用程序随机生成的数字。 + +本文展示的方法是基于时间的一次性密码算法(TOTP)。[Google Authenticator][1] 用作服务器应用程序。默认情况下,Google Authenticator 在 Fedora 中是可用的。 + +至于手机,你可以使用与 TOTP 兼容的任何可以双向验证的应用程序。Andorid 或 IOS 有许多可以与 TOTP 和 Google Authenticator 配合使用的免费应用程序。本文与 [FreeOTP][2] 为例。 + +### 安装并设置 Google Authenticator + +首先,在你的服务器上安装 Google Authenticator。 +``` +$ sudo dnf install -y google-authenticator +``` + +运行应用程序: + +``` +$ google-authenticator +``` + +该应用程序提供了一系列问题。下面的片段展示了如何进行合理的安全设置: +``` +Do you want authentication tokens to be time-based (y/n) y +Do you want me to update your "/home/user/.google_authenticator" file (y/n)? y +``` + +这个应用程序为你提供一个密钥,验证码和恢复码。把它们放在安全的地方。如果你丢失了手机,恢复码是访问服务器的**唯一**方式。 + +### 设置手机验证 + +在你的手机上安装 authenticator 应用程序(FreeOTP)。如果你有一台安卓手机,那么你可以在 Google Play 中找到它,也可以在苹果 iPhone 的 iTunes 商店中找到它。 + +Google Authenticator 会在屏幕上显示一个二维码。打开手机上的 FreeOTP 应用程序,选择添加新账户,在应用程序顶部选择二维码形状工具,然后扫描二维码即可。设置完成后,在每次远程连接服务器时,你必须提供 authenticator 应用程序生成的随机数。 + +### 完成配置 + +应用程序会向你询问更多的问题。下面示例展示了如何设置合理的安全配置。 + +``` +Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it increases your chances to notice or even prevent man-in-the-middle attacks (y/n) y +By default, tokens are good for 30 seconds. In order to compensate for possible time-skew between the client and the server, we allow an extra token before and after the current time. If you experience problems with poor time synchronization, you can increase the window from its default size of +-1min (window size of 3) to about +-4min (window size of 17 acceptable tokens). +Do you want to do so? (y/n) n +If the computer that you are logging into isn't hardened against brute-force login attempts, you can enable rate-limiting for the authentication module. By default, this limits attackers to no more than 3 login attempts every 30s. +Do you want to enable rate-limiting (y/n) y +``` + +现在,你必须设置 SSH 来利用新的双向验证。 + +### 配置 SSH + +在完成此步骤之前,**确保你已使用公钥建立了一个可用的 SSH 连接**,因为我们将禁用密码连接。如果出现问题或错误,一个已经建立的连接将允许你修复问题。 + +在你的服务器上,使用 [sudo][3] 编辑 /etc/pam.d/sshd 文件。 +``` +$ sudo vi /etc/pam.d/ssh +``` + +注释掉 auth substack password-auth 这一行: +``` +#auth       substack     password-auth +``` + +将以下行添加到文件底部。 +``` +auth sufficient pam_google_authenticator.so +``` + +保存并关闭文件。然后编辑 /etc/ssh/sshd_config 文件。 +``` +$ sudo vi /etc/ssh/sshd_config +``` + +找到 ChallengeResponseAuthentication 这一行并将其更改为 yes。 +``` +ChallengeResponseAuthentication yes +``` + +找到 PasswordAuthentication 这一行并将其更改为 no。 +``` +PasswordAuthentication no +``` + +将以下行添加到文件底部。 +``` +AuthenticationMethods publickey,password publickey,keyboard-interactive +``` + +保存并关闭文件,然后重新启动 SSH。 +``` +$ sudo systemctl restart sshd +``` + +### 测试双因素验证 + +当你尝试连接到服务器时,系统会提示你输入验证码: +``` +[user@client ~]$ ssh user@example.com +Verification code: +``` + +验证码由你手机上的 authenticator 应用程序随机生成。由于这个数字每隔几秒就会发生变化,因此你需要在它变化之前输入它。 + +![][4] + +如果你不输入验证码,你将无法访问系统,你会收到一个权限被拒绝的错误: +``` +[user@client ~]$ ssh user@example.com + +Verification code: + +Verification code: + +Verification code: + +Permission denied (keyboard-interactive). + +[user@client ~]$ +``` + +### 结论 + +通过添加这种简单的双向验证,现在未经授权的用户访问你的服务器将变得更加困难。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/two-factor-authentication-ssh-fedora/ + +作者:[Curt Warfield][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://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Google_Authenticator +[2]: https://freeotp.github.io/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/02/freeotp-1.png From 04bee5ade15da64886d81c391307866fedc67c79 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Tue, 19 Mar 2019 22:27:56 +0800 Subject: [PATCH 698/813] f --- ...0190220 Set up two-factor authentication for SSH on Fedora.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{20190220 Set up two-factor authentic ation for SSH on Fedora.md => 20190220 Set up two-factor authentication for SSH on Fedora.md} (100%) diff --git a/translated/tech/20190220 Set up two-factor authentic ation for SSH on Fedora.md b/translated/tech/20190220 Set up two-factor authentication for SSH on Fedora.md similarity index 100% rename from translated/tech/20190220 Set up two-factor authentic ation for SSH on Fedora.md rename to translated/tech/20190220 Set up two-factor authentication for SSH on Fedora.md From 95894b45db0ce03e5579e7762f2e5af0d59dc571 Mon Sep 17 00:00:00 2001 From: ustblixin <48573576+ustblixin@users.noreply.github.com> Date: Tue, 19 Mar 2019 23:46:07 +0800 Subject: [PATCH 699/813] Translating by ustblixin --- ...stall Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md b/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md index 7ce1201c4f..13b441f85d 100644 --- a/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md +++ b/sources/tech/20190205 Install Apache, MySQL, PHP (LAMP) Stack On Ubuntu 18.04 LTS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (ustblixin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 19aba31228f6a9072f77e82039c31069d66151d2 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 19 Mar 2019 23:47:29 +0800 Subject: [PATCH 700/813] Update 20190215 4 Methods To Change The HostName In Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 准备翻译该篇。 --- .../20190215 4 Methods To Change The HostName In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190215 4 Methods To Change The HostName In Linux.md b/sources/tech/20190215 4 Methods To Change The HostName In Linux.md index ad95e05fae..a4ef658851 100644 --- a/sources/tech/20190215 4 Methods To Change The HostName In Linux.md +++ b/sources/tech/20190215 4 Methods To Change The HostName In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (FSSlc) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -211,7 +211,7 @@ via: https://www.2daygeek.com/four-methods-to-change-the-hostname-in-linux/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[FSSlc](https://github.com/FSSlc) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6974e9ac189b7d5afbb5312098b89701525a96e9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 Mar 2019 08:53:37 +0800 Subject: [PATCH 701/813] translated --- ...en source collaborative document editor.md | 58 ------------------- ...en source collaborative document editor.md | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md create mode 100644 translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md diff --git a/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md deleted file mode 100644 index 94e880cf41..0000000000 --- a/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get started with CryptPad, an open source collaborative document editor) -[#]: via: (https://opensource.com/article/19/1/productivity-tool-cryptpad) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) - -Get started with CryptPad, an open source collaborative document editor -====== -Securely share your notes, documents, kanban boards, and more with CryptPad, the fifth in our series on open source tools that will make you more productive in 2019. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) - -There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. - -Here's the fifth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. - -### CryptPad - -We already talked about [Joplin][1], which is good for keeping your own notes but—as you may have noticed—doesn't have any sharing or collaboration features. - -[CryptPad][2] is a secure, shareable note-taking app and document editor that allows for secure, collaborative editing. Unlike Joplin, it is a NodeJS app, which means you can run it on your desktop or a server elsewhere and access it with any modern web browser. Out of the box, it supports rich text, Markdown, polls, whiteboards, kanban, and presentations. - -![](https://opensource.com/sites/default/files/uploads/cryptpad-1.png) - -The different document types are robust and fully featured. The rich text editor covers all the bases you'd expect from a good editor and allows you to export files to HTML. The Markdown editor is on par with Joplin, and the kanban board, though not as full-featured as [Wekan][3], is really well done. The rest of the supported document types and editors are also very polished and have the features you'd expect from similar apps, although polls feel a little clunky. - -![](https://opensource.com/sites/default/files/uploads/cryptpad-2.png) - -CryptPad's real power, though, comes in its sharing and collaboration features. Sharing a document is as simple as getting the sharable URL from the "share" option, and CryptPad supports embedding documents in iFrame tags on other websites. Documents can be shared in Edit or View mode with a password and with links that expire. The built-in chat allows editors to talk to each other (note that people with View access can also see the chat but can't comment). - -![](https://opensource.com/sites/default/files/pictures/cryptpad-3.png) - -All files are stored encrypted with the user's password. Server administrators can't read the documents, which also means if you forget or lose your password, the files are unrecoverable. So make sure you keep the password in a secure place, like a [password vault][4]. - -![](https://opensource.com/sites/default/files/uploads/cryptpad-4.png) - -When it's run locally, CryptPad is a robust app for creating and editing documents. When run on a server, it becomes an excellent collaboration platform for multi-user document creation and editing. Installation took less than five minutes on my laptop, and it just worked out of the box. The developers also include instructions for running CryptPad in Docker, and there is a community-maintained Ansible role for ease of deployment. CryptPad does not support any third-party authentication methods, so users must create their own accounts. CryptPad also has a community-supported hosted version if you don't want to run your own server. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/productivity-tool-cryptpad - -作者:[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 (Kevin Sonney) -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/19/1/productivity-tool-joplin -[2]: https://cryptpad.fr/index.html -[3]: https://opensource.com/article/19/1/productivity-tool-wekan -[4]: https://opensource.com/article/18/4/3-password-managers-linux-command-line diff --git a/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md b/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md new file mode 100644 index 0000000000..c3e6d69bfe --- /dev/null +++ b/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with CryptPad, an open source collaborative document editor) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-cryptpad) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +开始使用 CryptPad,一个开源的协作文档编辑器 +====== +使用 CryptPad 安全地共享你的笔记、文档、看板等,这是我们在开源工具系列中的第 5 个工具,它将使你在 2019 年更高效。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 + +这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 5 个工具来帮助你在 2019 年更有效率。 + +### CryptPad + +我们已经介绍过 [Joplin][1],它能很好地保存自己的笔记,但是,你可能已经注意到,它没有任何共享或协作功能。 + +[CryptPad][2] 是一个安全、可共享的笔记应用和文档编辑器,它能够安全地协作编辑。与 Joplin 不同,它是一个 NodeJS 应用,这意味着你可以在桌面或其他服务器上运行它,并使用任何现代 Web 浏览器访问。它开箱即用,它支持富文本、Markdown、投票、白板,看板和 PPT。 + +![](https://opensource.com/sites/default/files/uploads/cryptpad-1.png) + +它支持不同的文档类型且功能齐全。它的富文本编辑器涵盖了你所期望的所有基础功能,并允许你将文件导出为 HTML。它的 Markdown 的编辑能与 Joplin 相提并论,它的看板虽然不像 [Wekan][3] 那样功能齐全,但也做得不错。其他支持的文档类型和编辑器也很不错,并且有你希望在类似应用中看到的功能,尽管投票功能显得有些粗糙。 + +![](https://opensource.com/sites/default/files/uploads/cryptpad-2.png) + +然而,CryptPad 的真正强大之处在于它的共享和协作功能。共享文档只需在“共享”选项中获取可共享 URL,CryptPad 支持使用 iframe 标签嵌入其他网站的文档。可以在“编辑”或“查看”模式下使用密码和会过期的链接共享文档。内置聊天能够让编辑者相互交谈(请注意,具有浏览权限的人也可以看到聊天但无法发表评论)。 + +![](https://opensource.com/sites/default/files/pictures/cryptpad-3.png) + +所有文件都使用用户密码加密存储。服务器管理员无法读取文档,这也意味着如果你忘记或丢失了密码,文件将无法恢复。因此,请确保将密码保存在安全的地方,例如放在[密码保险箱][4]中。 + +![](https://opensource.com/sites/default/files/uploads/cryptpad-4.png) + +当它在本地运行时,CryptPad 是一个用于创建和编辑文档的强大应用。当在服务器上运行时,它成为了用于多用户文档创建和编辑的出色协作平台。在我的笔记本电脑上安装它不到五分钟,并且开箱即用。开发者还加入了在 Docker 中运行 CryptPad 的说明,并且还有一个社区维护用于方便部署的 Ansible 角色。CryptPad 不支持任何第三方身份验证,因此用户必须创建自己的帐户。如果你不想运行自己的服务器,CryptPad 还有一个社区支持的托管版本。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-cryptpad + +作者:[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 (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-joplin +[2]: https://cryptpad.fr/index.html +[3]: https://opensource.com/article/19/1/productivity-tool-wekan +[4]: https://opensource.com/article/18/4/3-password-managers-linux-command-line From 6d7958319b49cde4f420dda620e5d91937c6720a Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 Mar 2019 08:56:43 +0800 Subject: [PATCH 702/813] translating --- ...0309 Emulators and Native Linux games on the Raspberry Pi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md b/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md index 91670b7015..c533054854 100644 --- a/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md +++ b/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9ff4b8a35caaa66f8a2349b3b1fcea6dc7a8436a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 11:41:52 +0800 Subject: [PATCH 703/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Emacs?= =?UTF-8?q?=20for=20(even=20more=20of)=20the=20win=20sources/tech/20190301?= =?UTF-8?q?=20Emacs=20for=20(even=20more=20of)=20the=20win.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190301 Emacs for (even more of) the win.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20190301 Emacs for (even more of) the win.md diff --git a/sources/tech/20190301 Emacs for (even more of) the win.md b/sources/tech/20190301 Emacs for (even more of) the win.md new file mode 100644 index 0000000000..c1697f3cae --- /dev/null +++ b/sources/tech/20190301 Emacs for (even more of) the win.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emacs for (even more of) the win) +[#]: via: (https://so.nwalsh.com/2019/03/01/emacs) +[#]: author: (Norman Walsh https://so.nwalsh.com) + +Emacs for (even more of) the win +====== + +I use Emacs every day. I rarely notice it. But when I do, it usually brings me joy. + +>If you are a professional writer…Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish. + +I’ve been using [Emacs][1] for well over twenty years. I use it for writing almost anything and everything (I edit Scala and Java in [IntelliJ][2]). I read my email in it. If it can be done in Emacs, that’s where I prefer to do it. + +Although I’ve used Emacs for literally decades, I realized around the new year that very little about my use of Emacs had changed in the past decade or more. New editing modes had come along, of course, I’d picked up a package or two, and I did adopt [Helm][3] a few years ago, but mostly it just did all the heavy lifting that I required of it, day in and day out without complaining or getting in my way. On the one hand, that’s a testament to how good it is. On the other hand, that’s an invitation to dig in and see what I’ve missed. + +At about the same time, I resolved to improve several aspects of my work life: + + * **Better meeting management.** I’m lead on a couple of projects at work and those projects have meetings, both regularly scheduled and ad hoc; some of them I run, some of them, I only attend. + +I realized I’d become sloppy about my participation in meetings. It’s all too easy sit in a room where there’s a meeting going on but actually read email and work on other items. (I strongly oppose the “no laptops” rule in meetings, but that’s a topic for another day.) + +There are a couple of problems with sloppy participation. First, it’s disrespectful to the person who convened the meeting and the other participants. That’s actually sufficient reason not to do it, but I think there’s another problem: it disguises the cost of meetings. + +If you’re in a meeting but also answering your email and maybe fixing a bug, then that meeting didn’t cost anything (or as much). If meetings are cheap, then there will be more of them. + +I want fewer, shorter meetings. I don’t want to disguise their cost, I want them to be perceived as damned expensive and to be avoided unless absolutely necessary. + +Sometimes, they are absolutely necessary. And I appreciate that a quick meeting can sometimes resolve an issue quickly. But if I have ten short meetings a day, let’s not pretend that I’m getting anything else productive accomplished. + +I resolved to take notes at all the meetings I attend. I’m not offering to take minutes, necessarily, but I am taking minutes of a sort. It keeps me focused on the meeting and not catching up on other things. + + * **Better time management.** There are lots and lots of things that I need or want to do, both professionally and personally. I’ve historically kept track off some of them in issue lists, some in saved email threads (in Emacs and [Gmail][4], for slightly different types of reminders), in my calendar, on “todo lists” of various sorts on my phone, and on little scraps of paper. And probably other places as well. + +I resolved to keep them all in one place. Not because I think there’s one place that’s uniformly best or better, but because I hope to accomplish two things. First, by having them all in one place, I hope to be able to develop a better and more holistic view of where I’m putting my energies. Second, because I want to develop a habitn. “A settled or regular tendency or practice, especially one that is hard to give up.” of recording, tracking, and preserving them. + + * **Better accountability.** If you work in certain science or engineering disciplines, you will have developed the habit of keeping a [lab notebook][5]. Alas, I did not. But I resolved to do so. + +I’m not interested in the legal aspects that encourage bound pages or scribing only in permanent marker. What I’m interested in is developing the habit of keeping a record. My goal is to have a place to jot down ideas and design sketches and the like. If I have sudden inspiration or if I think of an edge case that isn’t in the test suite, I want my instinct to be to write it in my journal instead of scribbling it on a scrap of paper or promising myself that I’ll remember it. + + + + +This confluence of resolutions led me quickly and more-or-less directly to [Org][6]. There is a large, active, and loyal community of Org users. I’ve played with it in the past (I even [wrote about it][7], at least in passing, a couple of years ago) and I tinkered long enough to [integrate MarkLogic][8] into it. (Boy has that paid off in the last week or two!) + +But I never used it. + +I am now using it. I take minutes in it, I record all of my todo items in it, and I keep a journal in it. I’m not sure there’s much value in me attempting to wax eloquent about it or enumerate all its features, you’ll find plenty of either with a quick web search. + +If you use Emacs, you should be using Org. If you don’t use Emacs, I’m confident you wouldn’t be the first person who started because of Org. It does a lot. It takes a little time to learn your way around and remember the shortcuts, but I think it’s worth it. (And if you carry an [iOS][9] device in your pocket, I recommend [beorg][10] for recording items while you’re on the go.) + +Naturally, I worked out how to [get XML out of it][11]⊕“Worked out” sure is a funny way to spell “hacked together in elisp.”. And from there, how to turn it back into the markup my weblog expects (and do so at the push of a button in Emacs, of course). So this is the first posting written in Org. It won’t be the last. + +P.S. Happy birthday [little weblog][12]. + +-------------------------------------------------------------------------------- + +via: https://so.nwalsh.com/2019/03/01/emacs + +作者:[Norman Walsh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://so.nwalsh.com +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Emacs +[2]: https://en.wikipedia.org/wiki/IntelliJ_IDEA +[3]: https://emacs-helm.github.io/helm/ +[4]: https://en.wikipedia.org/wiki/Gmail +[5]: https://en.wikipedia.org/wiki/Lab_notebook +[6]: https://en.wikipedia.org/wiki/Org-mode +[7]: https://www.balisage.net/Proceedings/vol17/html/Walsh01/BalisageVol17-Walsh01.html +[8]: https://github.com/ndw/ob-ml-marklogic/ +[9]: https://en.wikipedia.org/wiki/IOS +[10]: https://beorgapp.com/ +[11]: https://github.com/ndw/org-to-xml +[12]: https://so.nwalsh.com/2017/03/01/helloWorld From ddf88a6c945be4c440ace9d7e052ab4031a0f73a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 11:49:51 +0800 Subject: [PATCH 704/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20Five?= =?UTF-8?q?=20Commands=20To=20Use=20Calculator=20In=20Linux=20Command=20Li?= =?UTF-8?q?ne=3F=20sources/tech/20190319=20Five=20Commands=20To=20Use=20Ca?= =?UTF-8?q?lculator=20In=20Linux=20Command=20Line.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Use Calculator In Linux Command Line.md | 342 ++++++++++++++++++ 1 file changed, 342 insertions(+) create mode 100644 sources/tech/20190319 Five Commands To Use Calculator In Linux Command Line.md diff --git a/sources/tech/20190319 Five Commands To Use Calculator In Linux Command Line.md b/sources/tech/20190319 Five Commands To Use Calculator In Linux Command Line.md new file mode 100644 index 0000000000..c419d15268 --- /dev/null +++ b/sources/tech/20190319 Five Commands To Use Calculator In Linux Command Line.md @@ -0,0 +1,342 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Five Commands To Use Calculator In Linux Command Line?) +[#]: via: (https://www.2daygeek.com/linux-command-line-calculator-bc-calc-qalc-gcalccmd/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Five Commands To Use Calculator In Linux Command Line? +====== + +As a Linux administrator you may use the command line calculator many times in a day for some purpose. + +I had used this especially when LVM creation using the PE values. + +There are many commands available for this purpose and i’m going to list most used commands in this article. + +These command line calculators are allow us to perform all kind of actions such as scientific, financial, or even simple calculation. + +Also, we can use these commands in shell scripts for complex math. + +In this article, I’m listing the top five command line calculator commands. + +Those command line calculator commands are below. + + * **`bc:`** An arbitrary precision calculator language + * **`calc:`** arbitrary precision calculator + * **`expr:`** evaluate expressions + * **`gcalccmd:`** gnome-calculator – a desktop calculator + * **`qalc:`** + * **`Linux Shell:`** + + + +### How To Perform Calculation In Linux Using bc Command? + +bs stands for Basic Calculator. bc is a language that supports arbitrary precision numbers with interactive execution of statements. There are some similarities in the syntax to the C programming language. + +A standard math library is available by command line option. If requested, the math library is defined before processing any files. bc starts by processing code from all the files listed on the command line in the order listed. + +After all files have been processed, bc reads from the standard input. All code is executed as it is read. + +By default bc command has installed in all the Linux system. If not, use the following procedure to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install bc. + +``` +$ sudo dnf install bc +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install bc. + +``` +$ sudo apt install bc +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install bc. + +``` +$ sudo pacman -S bc +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install bc. + +``` +$ sudo yum install bc +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install bc. + +``` +$ sudo zypper install bc +``` + +### How To Use The bc Command To Perform Calculation In Linux? + +We can use the bc command to perform all kind of calculation right from the terminal. + +``` +$ bc +bc 1.07.1 +Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. +This is free software with ABSOLUTELY NO WARRANTY. +For details type `warranty'. + +1+2 +3 + +10-5 +5 + +2*5 +10 + +10/2 +5 + +(2+4)*5-5 +25 + +quit +``` + +Use `-l` flag to define the standard math library. + +``` +$ bc -l +bc 1.07.1 +Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. +This is free software with ABSOLUTELY NO WARRANTY. +For details type `warranty'. + +3/5 +.60000000000000000000 + +quit +``` + +### How To Perform Calculation In Linux Using calc Command? + +calc is an arbitrary precision calculator. It’s a simple calculator that allow us to perform all kind of calculation in Linux command line. + +For **`Fedora`** system, use **[DNF Command][1]** to install calc. + +``` +$ sudo dnf install calc +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install calc. + +``` +$ sudo apt install calc +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install calc. + +``` +$ sudo pacman -S calc +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install calc. + +``` +$ sudo yum install calc +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install calc. + +``` +$ sudo zypper install calc +``` + +### How To Use The calc Command To Perform Calculation In Linux? + +We can use the calc command to perform all kind of calculation right from the terminal. + +Intractive mode + +``` +$ calc +C-style arbitrary precision calculator (version 2.12.7.1) +Calc is open software. For license details type: help copyright +[Type "exit" to exit, or "help" for help.] + +; 5+1 + 6 +; 5-1 + 4 +; 5*2 + 10 +; 10/2 + 5 +; quit +``` + +Non-Intractive mode + +``` +$ calc 3/5 + 0.6 +``` + +### How To Perform Calculation In Linux Using expr Command? + +Print the value of EXPRESSION to standard output. A blank line below separates increasing precedence groups. It’s part of coreutils so, we no need to install it. + +### How To Use The expr Command To Perform Calculation In Linux? + +Use the following format for basic calculations. + +For addition + +``` +$ expr 5 + 1 +6 +``` + +For subtraction + +``` +$ expr 5 - 1 +4 +``` + +For division. + +``` +$ expr 10 / 2 +5 +``` + +### How To Perform Calculation In Linux Using gcalccmd Command? + +gnome-calculator is the official calculator of the GNOME desktop environment. gcalccmd is the console version of Gnome Calculator utility. By default it has installed in the GNOME desktop. + +### How To Use The gcalccmd Command To Perform Calculation In Linux? + +I have added few examples on this. + +``` +$ gcalccmd + +> 5+1 +6 + +> 5-1 +4 + +> 5*2 +10 + +> 10/2 +5 + +> sqrt(16) +4 + +> 3/5 +0.6 + +> quit +``` + +### How To Perform Calculation In Linux Using qalc Command? + +Qalculate is a multi-purpose cross-platform desktop calculator. It is simple to use but provides power and versatility normally reserved for complicated math packages, as well as useful tools for everyday needs (such as currency conversion and percent calculation). + +Features include a large library of customizable functions, unit calculations and conversion, symbolic calculations (including integrals and equations), arbitrary precision, uncertainty propagation, interval arithmetic, plotting, and a user-friendly interface (GTK+ and CLI). + +For **`Fedora`** system, use **[DNF Command][1]** to install qalc. + +``` +$ sudo dnf install libqalculate +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install qalc. + +``` +$ sudo apt install libqalculate +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install qalc. + +``` +$ sudo pacman -S libqalculate +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install qalc. + +``` +$ sudo yum install libqalculate +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install qalc. + +``` +$ sudo zypper install libqalculate +``` + +### How To Use The qalc Command To Perform Calculation In Linux? + +I have added few examples on this. + +``` +$ qalc +> 5+1 + + 5 + 1 = 6 + +> ans*2 + + ans * 2 = 12 + +> ans-2 + + ans - 2 = 10 + +> 1 USD to INR +It has been 36 day(s) since the exchange rates last were updated. +Do you wish to update the exchange rates now? y + + error: Failed to download exchange rates from coinbase.com: Resolving timed out after 15000 milliseconds. + 1 * dollar = approx. INR 69.638581 + +> 10 USD to INR + + 10 * dollar = approx. INR 696.38581 + +> quit +``` + +### How To Perform Calculation In Linux Using Linux Shell Command? + +We can use the shell commands such as echo, awk, etc to perform the calculation. + +For Addition using echo command. + +``` +$ echo $((5+5)) +10 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-line-calculator-bc-calc-qalc-gcalccmd/ + +作者:[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/dnf-command-examples-manage-packages-fedora-system/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From 00cec5a93631ffd5ed67667ac763a1f22cc42b1e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 11:51:36 +0800 Subject: [PATCH 705/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20How=20?= =?UTF-8?q?to=20set=20up=20a=20homelab=20from=20hardware=20to=20firewall?= =?UTF-8?q?=20sources/tech/20190319=20How=20to=20set=20up=20a=20homelab=20?= =?UTF-8?q?from=20hardware=20to=20firewall.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... up a homelab from hardware to firewall.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20190319 How to set up a homelab from hardware to firewall.md diff --git a/sources/tech/20190319 How to set up a homelab from hardware to firewall.md b/sources/tech/20190319 How to set up a homelab from hardware to firewall.md new file mode 100644 index 0000000000..28a50d8a43 --- /dev/null +++ b/sources/tech/20190319 How to set up a homelab from hardware to firewall.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up a homelab from hardware to firewall) +[#]: via: (https://opensource.com/article/19/3/home-lab) +[#]: author: (Michael Zamot (Red Hat) https://opensource.com/users/mzamot) + +How to set up a homelab from hardware to firewall +====== + +Take a look at hardware and software options for building your own homelab. + +![][1] + +Do you want to create a homelab? Maybe you want to experiment with different technologies, create development environments, or have your own private cloud. There are many reasons to have a homelab, and this guide aims to make it easier to get started. + +There are three categories to consider when planning a home lab: hardware, software, and maintenance. We'll look at the first two categories here and save maintaining your computer lab for a future article. + +### Hardware + +When thinking about your hardware needs, first consider how you plan to use your lab as well as your budget, noise, space, and power usage. + +If buying new hardware is too expensive, search local universities, ads, and websites like eBay or Craigslist for recycled servers. They are usually inexpensive, and server-grade hardware is built to last many years. You'll need three types of hardware: a virtualization server, storage, and a router/firewall. + +#### Virtualization servers + +A virtualization server allows you to run several virtual machines that share the physical box's resources while maximizing and isolating resources. If you break one virtual machine, you won't have to rebuild the entire server, just the virtual one. If you want to do a test or try something without the risk of breaking your entire system, just spin up a new virtual machine and you're ready to go. + +The two most important factors to consider in a virtualization server are the number and speed of its CPU cores and its memory. If there are not enough resources to share among all the virtual machines, they'll be overallocated and try to steal each other's CPU cycles and memory. + +So, consider a CPU platform with multiple cores. You want to ensure the CPU supports virtualization instructions (VT-x for Intel and AMD-V for AMD). Examples of good consumer-grade processors that can handle virtualization are Intel i5 or i7 and AMD Ryzen. If you are considering server-grade hardware, the Xeon class for Intel and EPYC for AMD are good options. Memory can be expensive, especially the latest DDR4 SDRAM. When estimating memory requirements, factor at least 2GB for the host operating system's memory consumption. + +If your electricity bill or noise is a concern, solutions like Intel's NUC devices provide a small form factor, low power usage, and reduced noise, but at the expense of expandability. + +#### Network-attached storage (NAS) + +If you want a machine loaded with hard drives to store all your personal data, movies, pictures, etc. and provide storage for the virtualization server, network-attached storage (NAS) is what you want. + +In most cases, you won't need a powerful CPU; in fact, many commercial NAS solutions use low-powered ARM CPUs. A motherboard that supports multiple SATA disks is a must. If your motherboard doesn't have enough ports, use a host bus adapter (HBA) SAS controller to add extras. + +Network performance is critical for a NAS, so select a gigabit network interface (or better). + +Memory requirements will differ based on your filesystem. ZFS is one of the most popular filesystems for NAS, and you'll need more memory to use features such as caching or deduplication. Error-correcting code (ECC) memory is your best bet to protect data from corruption (but make sure your motherboard supports it before you buy). Last, but not least, don't forget an uninterruptible power supply (UPS), because losing power can cause data corruption. + +#### Firewall and router + +Have you ever realized that a cheap router/firewall is usually the main thing protecting your home network from the exterior world? These routers rarely receive timely security updates, if they receive any at all. Scared now? Well, [you should be][2]! + +You usually don't need a powerful CPU or a great deal of memory to build your own router/firewall, unless you are handling a huge throughput or want to do CPU-intensive tasks, like a VPN server or traffic filtering. In such cases, you'll need a multicore CPU with AES-NI support. + +You may want to get at least two 1-gigabit or better Ethernet network interface cards (NICs), also, not needed, but recommended, a managed switch to connect your DIY-router to create VLANs to further isolate and secure your network. + +![Home computer lab PfSense][4] + +### Software + +After you've selected your virtualization server, NAS, and firewall/router, the next step is exploring the different operating systems and software to maximize their benefits. While you could use a regular Linux distribution like CentOS, Debian, or Ubuntu, they usually take more time to configure and administer than the following options. + +#### Virtualization software + +**[KVM][5]** (Kernel-based Virtual Machine) lets you turn Linux into a hypervisor so you can run multiple virtual machines in the same box. The best thing is that KVM is part of Linux, and it is the go-to option for many enterprises and home users. If you are comfortable, you can install **[libvirt][6]** and **[virt-manager][7]** to manage your virtualization platform. + +**[Proxmox VE][8]** is a robust, enterprise-grade solution and a full open source virtualization and container platform. It is based on Debian and uses KVM as its hypervisor and LXC for containers. Proxmox offers a powerful web interface, an API, and can scale out to many clustered nodes, which is helpful because you'll never know when you'll run out of capacity in your lab. + +**[oVirt][9] (RHV)** is another enterprise-grade solution that uses KVM as the hypervisor. Just because it's enterprise doesn't mean you can't use it at home. oVirt offers a powerful web interface and an API and can handle hundreds of nodes (if you are running that many servers, I don't want to be your neighbor!). The potential problem with oVirt for a home lab is that it requires a minimum set of nodes: You'll need one external storage, such as a NAS, and at least two additional virtualization nodes (you can run it just on one, but you'll run into problems in maintenance of your environment). + +#### NAS software + +**[FreeNAS][10]** is the most popular open source NAS distribution, and it's based on the rock-solid FreeBSD operating system. One of its most robust features is its use of the ZFS filesystem, which provides data-integrity checking, snapshots, replication, and multiple levels of redundancy (mirroring, striped mirrors, and striping). On top of that, everything is managed from the powerful and easy-to-use web interface. Before installing FreeNAS, check its hardware support, as it is not as wide as Linux-based distributions. + +Another popular alternative is the Linux-based **[OpenMediaVault][11]**. One of its main features is its modularity, with plugins that extend and add features. Among its included features are a web-based administration interface; protocols like CIFS, SFTP, NFS, iSCSI; and volume management, including software RAID, quotas, access control lists (ACLs), and share management. Because it is Linux-based, it has extensive hardware support. + +#### Firewall/router software + +**[pfSense][12]** is an open source, enterprise-grade FreeBSD-based router and firewall distribution. It can be installed directly on a server or even inside a virtual machine (to manage your virtual or physical networks and save space). It has many features and can be expanded using packages. It is managed entirely using the web interface, although it also has command-line access. It has all the features you would expect from a router and firewall, like DHCP and DNS, as well as more advanced features, such as intrusion detection (IDS) and intrusion prevention (IPS) systems. You can create multiple networks listening on different interfaces or using VLANs, and you can create a secure VPN server with a few clicks. pfSense uses pf, a stateful packet filter that was developed for the OpenBSD operating system using a syntax similar to IPFilter. Many companies and organizations use pfSense. + +* * * + +With all this information in mind, it's time for you to get your hands dirty and start building your lab. In a future article, I will get into the third category of running a home lab: using automation to deploy and maintain it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/home-lab + +作者:[Michael Zamot (Red Hat)][a] +选题:[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/mzamot +[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 +[2]: https://opensource.com/article/18/5/how-insecure-your-router +[3]: /file/427426 +[4]: https://opensource.com/sites/default/files/uploads/pfsense2.png (Home computer lab PfSense) +[5]: https://www.linux-kvm.org/page/Main_Page +[6]: https://libvirt.org/ +[7]: https://virt-manager.org/ +[8]: https://www.proxmox.com/en/proxmox-ve +[9]: https://ovirt.org/ +[10]: https://freenas.org/ +[11]: https://www.openmediavault.org/ +[12]: https://www.pfsense.org/ From dbba85a0b67689be5847bda77406b46f65eeb760 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 12:13:43 +0800 Subject: [PATCH 706/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20Blockc?= =?UTF-8?q?hain=202.0:=20Blockchain=20In=20Real=20Estate=20[Part=204]=20so?= =?UTF-8?q?urces/tech/20190319=20Blockchain=202.0-=20Blockchain=20In=20Rea?= =?UTF-8?q?l=20Estate=20-Part=204.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 2.0- Blockchain In Real Estate -Part 4.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md diff --git a/sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md b/sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md new file mode 100644 index 0000000000..9e85b82f2c --- /dev/null +++ b/sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md @@ -0,0 +1,50 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: Blockchain In Real Estate [Part 4]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-blockchain-in-real-estate/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: Blockchain In Real Estate [Part 4] +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/Blockchain-In-Real-Estate-720x340.png) + +### Blockchain 2.0: Smart‘er’ Real Estate + +The [**previous article**][1] of this series explored the features of blockchain which will enable institutions to transform and interlace **traditional banking** and **financing systems** with it. This part will explore – **Blockchain in real estate**. The real estate industry is ripe for a revolution. It’s among the most actively traded most significant asset classes known to man. However, filled with regulatory hurdles and numerous possibilities of fraud and deceit, it’s also one of the toughest to participate in. The distributed ledger capabilities of the blockchain utilizing an appropriate consensus algorithm are touted as the way forward for the industry which is traditionally regarded as conservative in its attitude to change. + +Real estate has always been a very conservative industry in terms of its myriad operations. Somewhat rightfully so as well. A major economic crisis such as the 2008 financial crisis or the great depression from the early half of the 20th century managed to destroy the industry and its participants. However, like most products of economic value, the real estate industry is resilient and this resilience is rooted in its conservative nature. + +The global real estate market comprises an asset class worth **$228 trillion dollars** [1]. Give or take. Other investment assets such as stocks, bonds, and shares combined are only worth **$170 trillion**. Obviously, any and all transactions implemented in such an industry is naturally carefully planned and meticulously executed, for the most part. For the most part, because real estate is also notorious for numerous instances of fraud and devastating loses which ensue them. The industry because of the very conservative nature of its operations is also tough to navigate. It’s heavily regulated with complex laws creating an intertwined web of nuances that are just too difficult for an average person to understand fully. This makes entry and participation near impossible for most people. If you’ve ever been involved in one such deal, you’ll know how heavy and long the paper trail was. + +This hard reality is now set to change, albeit a slow and gradual transformation. The very reasons the industry has stuck to its hardy tested roots all this while can finally give way to its modern-day counterpart. The backbone of the real estate industry has always been its paper records. Land deeds, titles, agreements, rental insurance, proofs, and declarations etc., are just the tip of the iceberg here. If you’ve noticed the pattern here, this should be obvious, the distributed ledger technology that is blockchain, fits in perfectly with the needs here. Forget paper records, conventional database systems are also points of major failure. They can be modified by multiple participants, is not tamper proof or un-hackable, has a complicated set of ever-changing regulatory parameters making auditing and verifying data a nightmare. The blockchain perfectly solves all of these issues and more. + +Starting with a trivial albeit an important example to show just how bad the current record management practices are in the real estate sector, consider the **Title Insurance business** [2], [3]. Title Insurance is used to hedge against the possibility of the land’s titles and ownership records being inadmissible and hence unenforceable. An insurance product such as this is also referred to as an indemnity cover. It is by law required in many cases that properties have title insurance, especially when dealing with property that has changed hands multiple times over the years. Mortgage firms might insist on the same as well when they back real estate deals. The fact that a product of this kind has existed since the 1850s and that it does business worth at least **$1.5 trillion a year in the US alone** is a testament to the statement at the start. A revolution in terms of how these records are maintained is imperative to have in this situation and the blockchain provides a sustainable solution. Title fraud averages around $100k per case on average as per the **American Land Title Association** and 25% of all titles involved in transactions have an issue regarding their documents[4]. The blockchain allows for setting up an immutable permanent database that will track the property itself, recording each and every transaction or investment that has gone into it. Such a ledger system will make life easier for everyone involved in the real estate industry including one-time home buyers and make financial products such as Title Insurance basically irrelevant. Converting a physical asset such as real estate to a digital asset like this is unconventional and is extant only in theory at the moment. However, such a change is imminent sooner rather than later[5]. + +Among the areas in which blockchain will have the most impact within real estate is as highlighted above in maintaining a transparent and secure title management system for properties. A blockchain based record of the property can contain information about the property, its location, history of ownership, and any related public record of the same[6]. This will permit closing real estate deals fast and obliviates the need for 3rd party monitoring and oversight. Tasks such as real estate appraisal and tax calculations become matters of tangible objective parameters rather than subjective measures and guesses because of reliable historical data which is publicly verifiable. **UBITQUITY** is one such platform that offers customized blockchain-based solutions to enterprise customers. The platform allows customers to keep track of all property details, payment records, mortgage records and even allows running smart contracts that’ll take care of taxation and leasing automatically[7]. + +This brings us to the second biggest opportunity and use case of blockchains in real estate. Since the sector is highly regulated by numerous 3rd parties apart from the counterparties involved in the trade, due-diligence and financial evaluations can be significantly time-consuming. These processes are predominantly carried out using offline channels and paperwork needs to travel for days before a final evaluation report comes out. This is especially true for corporate real estate deals and forms a bulk of the total billable hours charged by consultants. In case the transaction is backed by a mortgage, duplication of these processes is unavoidable. Once combined with digital identities for the people and institutions involved along with the property, the current inefficiencies can be avoided altogether and transactions can take place in a matter of seconds. The tenants, investors, institutions involved, consultants etc., could individually validate the data and arrive at a critical consensus thereby validating the property records for perpetuity[8]. This increases the accuracy of verification manifold. Real estate giant **RE/MAX** has recently announced a partnership with service provider **XYO Network Partners** for building a national database of real estate listings in Mexico. They hope to one day create one of the largest (as of yet) decentralized real estate title registry in the world[9]. + +However, another significant and arguably a very democratic change that the blockchain can bring about is with respect to investing in real estate. Unlike other investment asset classes where even small household investors can potentially participate, real estate often requires large hands-down payments to participate. Companies such as **ATLANT** and **BitOfProperty** tokenize the book value of a property and convert them into equivalents of a cryptocurrency. These tokens are then put for sale on their exchanges similar to how stocks and shares are traded. Any cash flow that the real estate property generates afterward is credited or debited to the token owners depending on their “share” in the property[4]. + +However, even with all of that said, Blockchain technology is still in very early stages of adoption in the real estate sector and current regulations are not exactly defined for it to be either[8]. Concepts such as distributed applications, distributed anonymous organizations, smart contracts etc., are unheard of in the legal domain in many countries. A complete overhaul of existing regulations and guidelines once all the stakeholders are well educated on the intricacies of the blockchain is the most pragmatic way forward. Again, it’ll be a slow and gradual change to go through, however a much-needed one nonetheless. The next article of the series will look at how **“Smart Contracts”** , such as those implemented by companies such as UBITQUITY and XYO are created and executed in the blockchain. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-blockchain-in-real-estate/ + +作者:[EDITOR][a] +选题:[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/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/blockchain-2-0-redefining-financial-services/ From bc44686ee83593ad9df305092bf22345784a1eeb Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 12:16:10 +0800 Subject: [PATCH 707/813] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20How=20?= =?UTF-8?q?To=20Set=20Up=20a=20Firewall=20with=20GUFW=20on=20Linux=20sourc?= =?UTF-8?q?es/tech/20190319=20How=20To=20Set=20Up=20a=20Firewall=20with=20?= =?UTF-8?q?GUFW=20on=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Set Up a Firewall with GUFW on Linux.md | 365 ++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md diff --git a/sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md b/sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md new file mode 100644 index 0000000000..26b9850109 --- /dev/null +++ b/sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md @@ -0,0 +1,365 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Set Up a Firewall with GUFW on Linux) +[#]: via: (https://itsfoss.com/set-up-firewall-gufw) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How To Set Up a Firewall with GUFW on Linux +====== + +**UFW (Uncomplicated Firewall)** is a simple to use firewall utility with plenty of options for most users. It is an interface for the **iptables** , which is the classic (and harder to get comfortable with) way to set up rules for your network. + +**Do you really need a firewall for desktop?** + +![][1] + +A **[firewall][2]** is a way to regulate the incoming and outgoing traffic on your network. A well-configured firewall is crucial for the security of servers. + +But what about normal, desktop users? Do you need a firewall on your Linux system? Most likely you are connected to internet via a router linked to your internet service provider (ISP). Some routers already have built-in firewall. On top of that, your actual system is hidden behind NAT. In other words, you probably have a security layer when you are on your home network. + +Now that you know you should be using a firewall on your system, let’s see how you can easily install and configure a firewall on Ubuntu or any other Linux distribution. + +### Setting Up A Firewall With GUFW + +**[GUFW][3]** is a graphical utility for managing [Uncomplicated Firewall][4] ( **UFW** ). In this guide, I’ll go over configuring a firewall using **GUFW** that suits your needs, going over the different modes and rules. + +But first, let’s see how to install GUFW. + +#### Installing GUFW on Ubuntu and other Linux + +GUFW is available in all major Linux distributions. I advise using your distribution’s package manager for installing GUFW. + +If you are using Ubuntu, make sure you have the Universe Repository enabled. To do that, open up a terminal (default hotkey**:** CTRL+ALT+T) and enter: + +``` +sudo add-apt-repository universe +sudo apt update -y +``` + +Now you can install GUFW with this command: + +``` +sudo apt install gufw -y +``` + +That’s it! If you prefer not touching the terminal, you can install it from the Software Center as well. + +Open Software Center and search for **gufw** and click on the search result. + +![Search for gufw in software center][5] + +Go ahead and click **Install**. + +![Install GUFW from the Software Center][6] + +To open **gufw** , go to your menu and search for it. + +![Start GUFW][7] + +This will open the firewall application and you’ll be greeted by a “ **Getting Started** ” section. + +![GUFW Interface and Welcome Screen][8] + +#### Turn on the firewall + +The first thing to notice about this menu is the **Status** toggle. Pressing this button will turn on/off the firewall ( **default:** off), applying your preferences (policies and rules). + +![Turn on the firewall][9] + +If turned on, the shield icon turn from grey to colored. The colors, as noted later in this article, reflect your policies. This will also make the firewall **automatically start** on system startup. + +**Note:** _**Home** will be turned **off** by default. The other profiles (see next section) will be turned **on.**_ + +#### Understanding GUFW and its profiles + +As you can see in the menu, you can select different **profiles**. Each profile comes with different **default policies**. What this means is that they offer different behaviors for incoming and outgoing traffic. + +The **default profiles** are: + + * Home + * Public + * Office + + + +You can select another profile by clicking on the current one ( **default: Home** ). + +![][10] + +Selecting one of them will modify the default behavior. Further down, you can change Incoming and Outgoing traffic preferences. + +By default, both in **Home** and in **Office** , these policies are **Deny Incoming** and **Allow Outgoing**. This enables you to use services such as http/https without letting anything get in ( **e.g.** ssh). + +For **Public** , they are **Reject Incoming** and **Allow Outgoing**. **Reject** , similar to **deny** , doesn’t let services in, but also sends feedback to the user/service that tried accessing your machine (instead of simply dropping/hanging the connection). + +Note + +If you are an average desktop user, you can stick with the default profiles. You’ll have to manually change the profiles if you change the network. + +So if you are travelling, set the firewall on public profile and the from here forwards, firewall will be set in public mode on each reboot. + +#### Configuring firewall rules and policies [for advanced users] + +All profiles use the same rules, only the policies the rules build upon will differ. Changing the behavior of a policy ( **Incoming/Outgoing** ) will apply the changes to the selected profile. + +Note that the policies can only be changed while the firewall is active (Status: ON). + +Profiles can easily be added, deleted and renamed from the **Preferences** menu. + +##### Preferences + +In the top bar, click on **Edit**. Select **Preferences**. + +![Open Preferences Menu in GUFW][11] + +This will open up the **Preferences** menu. + +![][12] + +Let’s go over the options you have here! + +**Logging** means exactly what you would think: how much information does the firewall write down in the log files. + +The options under **Gufw** are quite self-explanatory. + +In the section under **Profiles** is where we can add, delete and rename profiles. Double-clicking on a profile will allow you to **rename** it. Pressing **Enter** will complete this process and pressing **Esc** will cancel the rename. + +![][13] + +To **add** a new profile, click on the **+** under the list of profiles. This will add a new profile. However, it won’t notify you about it. You’ll also have to scroll down the list to see the profile you created (using the mouse wheel or the scroll bar on the right side of the list). + +**Note:** _The newly added profile will **Deny Incoming** and **Allow Outgoing** traffic._ + +![][14] + +Clicking a profile highlight that profile. Pressing the **–** button will **delete** the highlighted profile. + +![][15] + +**Note:** _You can’t rename/remove the currently selected profile_. + +You can now click on **Close**. Next, I’ll go into setting up different **rules**. + +##### Rules + +Back to the main menu, somewhere in the middle of the screen you can select different tabs ( **Home, Rules, Report, Logs)**. We already covered the **Home** tab (that’s the quick guide you see when you start the app). + +![][16] + +Go ahead and select **Rules**. + +![][17] + +This will be the bulk of your firewall configuration: networking rules. You need to understand the concepts UFW is based on. That is **allowing, denying, rejecting** and **limiting** traffic. + +**Note:** _In UFW, the rules apply from top to bottom (the top rules take effect first and on top of them are added the following ones)._ + +**Allow, Deny, Reject, Limit:**These are the available policies for the rules you’ll add to your firewall. + +Let’s see exactly what each of them means: + + * **Allow:** allows any entry traffic to a port + * **Deny:** denies any entry traffic to a port + * **Reject:** denies any entry traffic to a port and informs the requester about the rejection + * **Limit:** denies entry traffic if an IP address has attempted to initiate 6 or more connections in the last 30 seconds + + + +##### Adding Rules + +There are three ways to add rules in GUFW. I’ll present all three methods in the following section. + +**Note:** _After you added the rules, changing their order is a very tricky process and it’s easier to just delete them and add them in the right order._ + +But first, click on the **+** at the bottom of the **Rules** tab. + +![][18] + +This should open a pop-up menu ( **Add a Firewall Rule** ). + +![][19] + +At the top of this menu, you can see the three ways you can add rules. I’ll guide you through each method i.e. **Preconfigured, Simple, Advanced**. Click to expand each section. + +**Preconfigured Rules** + +This is the most beginner-friendly way to add rules. + +The first step is choosing a policy for the rule (from the ones detailed above). + +![][20] + +The next step is to choose the direction the rule will affect ( **Incoming, Outgoing, Both** ). + +![][21] + +The **Category** and **Subcategory** choices are plenty. These narrow down the **Applications** you can select + +Choosing an **Application** will set up a set of ports based on what is needed for that particular application. This is especially useful for apps that might operate on multiple ports, or if you don’t want to bother with manually creating rules for handwritten port numbers. + +If you wish to further customize the rule, you can click on the **orange arrow icon**. This will copy the current settings (Application with it’s ports etc.) and take you to the **Advanced** rule menu. I’ll cover that later in this article. + +For this example, I picked an **Office Database** app: **MySQL**. I’ll deny all incoming traffic to the ports used by this app. +To create the rule, click on **Add**. + +![][22] + +You can now **Close** the pop-up (if you don’t want to add any other rules). You can see that the rule has been successfully added. + +![][23] + +The ports have been added by GUFW, and the rules have been automatically numbered. You may wonder why are there two new rules instead of just one; the answer is that UFW automatically adds both a standard **IP** rule and an **IPv6** rule. + +**Simple Rules** + +Although setting up preconfigured rules is nice, there is another easy way to add a rule. Click on the **+** icon again and go to the **Simple** tab. + +![][24] + +The options here are straight forward. Enter a name for your rule and select the policy and the direction. I’ll add a rule for rejecting incoming SSH attempts. + +![][25] + +The **Protocols** you can choose are **TCP, UDP** or **Both**. + +You must now enter the **Port** for which you want to manage the traffic. You can enter a **port number** (e.g. 22 for ssh), a **port range** with inclusive ends separated by a **:** ( **colon** ) (e.g. 81:89) or a **service name** (e.g. ssh). I’ll use **ssh** and select **both TCP and UDP** for this example. As before, click on **Add** to completing the creation of your rule. You can click the **red arrow icon** to copy the settings to the **Advanced** rule creation menu. + +![][26] + +If you select **Close** , you can see that the new rule (along with the corresponding IPv6 rule) has been added. + +![][27] + +**Advanced Rules** + +I’ll now go into how to set up more advanced rules, to handle traffic from specific IP addresses and subnets and targeting different interfaces. + +Let’s open up the **Rules** menu again. Select the **Advanced** tab. + +![][28] + +By now, you should already be familiar with the basic options: **Name, Policy, Direction, Protocol, Port**. These are the same as before. + +![][29] + +**Note:** _You can choose both a receiving port and a requesting port._ + +What changes is that now you have additional options to further specialize our rules. + +I mentioned before that rules are automatically numbered by GUFW. With **Advanced** rules you specify the position of your rule by entering a number in the **Insert** option. + +**Note:** _Inputting **position 0** will add your rule after all existing rules._ + +**Interface** let’s you select any network interface available on your machine. By doing so, the rule will only have effect on traffic to and from that specific interface. + +**Log** changes exactly that: what will and what won’t be logged. + +You can also choose IPs for the requesting and for the receiving port/service ( **From** , **To** ). + +All you have to do is specify an **IP address** (e.g. 192.168.0.102) or an entire **subnet** (e.g. 192.168.0.0/24 for IPv4 addresses ranging from 192.168.0.0 to 192.168.0.255). + +In my example, I’ll set up a rule to allow all incoming TCP SSH requests from systems on my subnet to a specific network interface of the machine I’m currently running. I’ll add the rule after all my standard IP rules, so that it takes effect on top of the other rules I have set up. + +![][30] + +**Close** the menu. + +![][31] + +The rule has been successfully added after the other standard IP rules. + +##### Edit Rules + +Clicking a rule in the rules list will highlight it. Now, if you click on the **little cog icon** at the bottom, you can **edit** the highlighted rule. + +![][32] + +This will open up a menu looking something like the **Advanced** menu I explained in the last section. + +![][33] + +**Note:** _Editing any options of a rule will move it to the end of your list._ + +You can now ether select on **Apply** to modify your rule and move it to the end of the list, or hit **Cancel**. + +##### Delete Rules + +After selecting (highlighting) a rule, you can also click on the **–** icon. + +![][34] + +##### Reports + +Select the **Report** tab. Here you can see services that are currently running (along with information about them, such as Protocol, Port, Address and Application name). From here, you can **Pause Listening Report (Pause Icon)** or **Create a rule from a highlighted service from the listening report (+ Icon)**. + +![][35] + +##### Logs + +Select the **Logs** tab. Here is where you’ll have to check for any errors are suspicious rules. I’ve tried creating some invalid rules to show you what these might look like when you don’t know why you can’t add a certain rule. In the bottom section, there are two icons. Clicking the **first icon copies the logs** to your clipboard and clicking the **second icon** **clears the log**. + +![][36] + +### Wrapping Up + +Having a firewall that is properly configured can greatly contribute to your Ubuntu experience, making your machine safer to use and allowing you to have full control over incoming and outgoing traffic. + +I have covered the different uses and modes of **GUFW** , going into how to set up different rules and configure a firewall to your needs. I hope that this guide has been helpful to you. + +If you are a beginner, this should prove to be a comprehensive guide; even if you are more versed in the Linux world and maybe getting your feet wet into servers and networking, I hope you learned something new. + +Let us know in the comments if this article helped you and why did you decide a firewall would improve your system! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/set-up-firewall-gufw + +作者:[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://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/firewall-linux.png?resize=800%2C450&ssl=1 +[2]: https://en.wikipedia.org/wiki/Firewall_(computing) +[3]: http://gufw.org/ +[4]: https://en.wikipedia.org/wiki/Uncomplicated_Firewall +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu_software_gufw-1.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu_software_install_gufw.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/show_applications_gufw.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_toggle_status.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_select_profile-1.jpg?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_open_preferences.jpg?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preferences.png?fit=800%2C585&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_rename_profile.png?fit=800%2C551&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_profile.png?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_delete_profile.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_home_tab.png?ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_rules_tab.png?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_rule.png?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_rules_menu.png?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_rule_policy.png?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_rule_direction.png?ssl=1 +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_add_rule.png?ssl=1 +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_rule_added.png?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_simple_rules_menu.png?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_simple_rule_name_policy_direction.png?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_simple_rule.png?ssl=1 +[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_simple_rule_added.png?ssl=1 +[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_advanced_rules_menu.png?ssl=1 +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_advanced_rule_basic_options.png?ssl=1 +[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_advanced_rule.png?ssl=1 +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_advanced_rule_added.png?ssl=1 +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_edit_highlighted_rule.png?ssl=1 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_edit_rule_menu.png?ssl=1 +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_delete_rule.png?ssl=1 +[35]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_report_tab.png?ssl=1 +[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_log_tab-1.png?ssl=1 +[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/firewall-linux.png?fit=800%2C450&ssl=1 From d034ad6b01f3e2ba9303c542966d536fd5ff36e0 Mon Sep 17 00:00:00 2001 From: zhangxiangping Date: Wed, 20 Mar 2019 15:33:29 +0800 Subject: [PATCH 708/813] add translator --- ...ty Print JSON With Linux Commandline Tools.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md index 6cf53bdbca..16e9c70627 100644 --- a/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md +++ b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md @@ -1,11 +1,11 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Parse And Pretty Print JSON With Linux Commandline Tools) -[#]: via: (https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/) -[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) +[#]: collector: "lujun9972" +[#]: translator: "zhangxiangping " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How To Parse And Pretty Print JSON With Linux Commandline Tools" +[#]: via: "https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/" +[#]: author: "EDITOR https://www.ostechnix.com/author/editor/" How To Parse And Pretty Print JSON With Linux Commandline Tools ====== From 83c549786e7624f4407987ff35dc10f088fb0494 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 20 Mar 2019 22:23:17 +0800 Subject: [PATCH 709/813] PRF:20190117 Get started with CryptPad, an open source collaborative document editor.md @geekpi --- ...an open source collaborative document editor.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md b/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md index c3e6d69bfe..18a9d6a307 100644 --- a/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md +++ b/translated/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md @@ -1,18 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Get started with CryptPad, an open source collaborative document editor) [#]: via: (https://opensource.com/article/19/1/productivity-tool-cryptpad) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) -开始使用 CryptPad,一个开源的协作文档编辑器 +开始使用 CryptPad 吧,一个开源的协作文档编辑器 ====== -使用 CryptPad 安全地共享你的笔记、文档、看板等,这是我们在开源工具系列中的第 5 个工具,它将使你在 2019 年更高效。 + +> 使用 CryptPad 安全地共享你的笔记、文档、看板等,这是我们在开源工具系列中的第 5 个工具,它将使你在 2019 年更高效。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) -每年年初似乎都有疯狂的冲动,想方设法提高工作效率。新年的决议,开始一年的权利,当然,“与旧的,与新的”的态度都有助于实现这一目标。通常的一轮建议严重偏向封闭源和专有软件。它不一定是这样。 +每年年初似乎都有疯狂的冲动想提高工作效率。新年的决心,渴望开启新的一年,当然,“抛弃旧的,拥抱新的”的态度促成了这一切。通常这时的建议严重偏向闭源和专有软件,但事实上并不用这样。 这是我挑选出的 19 个新的(或者对你而言新的)开源工具中的第 5 个工具来帮助你在 2019 年更有效率。 @@ -28,7 +30,7 @@ ![](https://opensource.com/sites/default/files/uploads/cryptpad-2.png) -然而,CryptPad 的真正强大之处在于它的共享和协作功能。共享文档只需在“共享”选项中获取可共享 URL,CryptPad 支持使用 iframe 标签嵌入其他网站的文档。可以在“编辑”或“查看”模式下使用密码和会过期的链接共享文档。内置聊天能够让编辑者相互交谈(请注意,具有浏览权限的人也可以看到聊天但无法发表评论)。 +然而,CryptPad 的真正强大之处在于它的共享和协作功能。共享文档只需在“共享”选项中获取可共享 URL,CryptPad 支持使用 `